diff --git a/app.js b/app.js index 7f9cbd6..53a74fe 100644 --- a/app.js +++ b/app.js @@ -2,10 +2,14 @@ var bs = require('binarysearch'); var Gdax = require('gdax'); -var orderBook = { - bids: {}, - asks: {} -}; +var orderBook = []; +orderBook['bids'] = []; +orderBook['bids']['price'] = []; +orderBook['bids']['size'] = []; +orderBook['asks'] = []; +orderBook['asks']['price'] = []; +orderBook['asks']['size'] = []; + var wsGdax = new Gdax.WebsocketClient( @@ -17,7 +21,7 @@ var wsGdax = new Gdax.WebsocketClient( function array_keys(input) { - var output = new Array(); + var output = []; var counter = 0; for (i in input) { output[counter++] = i; @@ -31,12 +35,21 @@ wsGdax.on('message', function(data) { // save snapshot on orderBook object for(var i=0; i