From 63f24562535d70ecc8a8d16e497d71c3083c6139 Mon Sep 17 00:00:00 2001 From: eazy Date: Sat, 24 Mar 2018 00:25:17 +0100 Subject: [PATCH] Dateien hochladen nach '' --- app.js | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 app.js diff --git a/app.js b/app.js new file mode 100644 index 0000000..680f62d --- /dev/null +++ b/app.js @@ -0,0 +1,108 @@ +var bs = require('binarysearch'); +var Gdax = require('gdax'); + + +var orderBook = { + bids: {}, + asks: {} +}; + + +var wsGdax = new Gdax.WebsocketClient( + ['BTC-EUR'], + 'wss://ws-feed.gdax.com', + null, + {channels: ['level2', 'heartbeat']} +); + + +function array_keys(input) { + var output = new Array(); + var counter = 0; + for (i in input) { + output[counter++] = i; + } + return output; +} + + +wsGdax.on('message', function(data) { + if(data.type === 'snapshot') { + // save snapshot on orderBook object + for(var i=0; i