anchor.diff:    </div>
   
     <hr>
  -  
  +
     <div>
       $<%= btc_usd %> * <%= dash_btc %> = $<%= dash_usd %> USD / Dash<br>
       <small>Page last generated: <%= last_page_gen %></small>
  
positive.code: <body>
  
    <div>
      Bitstamp BTC/USD Price: <%= btc_usd %><br>
      latest update: <%= bits_ts %>
    </div>
  
    <hr>
  
negative.code:   </div>
  
  </body>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.1/moment.min.js" type="text/javascript"></script>
  <script src="http://js.pusher.com/2.2/pusher.min.js" type="text/javascript"></script>
  <script type="text/javascript">
  function init() {
    // var exampleSocket = new WebSocket("wss://api.poloniex.com", "ticker");
    // exampleSocket.onMessage = function (event) {
    //   console.log(event.data);
    // }
  
    var pusher = new Pusher('de504dc5763aeef9ff52');
    var channel = pusher.subscribe('live_trades');
    channel.bind('trade', function(data) {
      window.console.log('id:' + data.id + ' price: ' + data.price + ' amount: ' + data.amount);
      update_bitstamp(data.price);
    });
  
    return;
  }
  
  var getNow = function () {
    var formattedDate = moment().utc().format('YYYY-MM-DD HH:mm:ss UTC');
    return formattedDate;
  }
  
  function BitstampViewModel() {
    var self = this;
  
    // set initial price here, or just leave as-was...
    //self.price = ko.observable(0);
    var current_val = parseFloat(jQuery('#btc_usd_price').text());
    var current_bits_ts = jQuery('#bits_ts').text();
  
    self.price = ko.observable(current_val);
    self.bitsTs = ko.observable(getNow());
  
    self.newPrice = function(price) {
      self.price(price);
      self.bitsTs(getNow());
    };
  
    self.formattedPrice = ko.computed(function() {
        return self.price().toFixed(2);
    });
  
    // can use $.getJSON to grab 1st value... or pull from DB to initialize it.
  }
  
  $(document).ready(function() {
    var pusher = new Pusher('de504dc5763aeef9ff52');
    var channel = pusher.subscribe('live_trades');
    channel.bind('trade', function(data) {
      window.console.log('Bitstamp: ' + 'id:' + data.id + ' price: ' + data.price + ' amount: ' + data.amount);
      viewModel.newPrice(data.price);
    });
  
    ko.applyBindings(viewModel);
  });
  var viewModel = new BitstampViewModel();
  </script>
  
  </html>
  