From 022602002a8ebb01c63a73f080d16d3cf4822544 Mon Sep 17 00:00:00 2001 From: eazy Date: Sat, 24 Mar 2018 18:31:38 +0100 Subject: [PATCH] steam lesen und orderbook kopieren funktioniert --- app.js | 78 +++++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 42 deletions(-) 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