Closed bengrunfeld closed 6 years ago
I had found that managing the depth cache as an object was way more efficient in terms of speed. However if you prefer the array format you can still request it as such:
binance.websockets.depthCache(['BTCUSDT'], (symbol, depth) => {
const limit = 3;
let bids = binance.sortBids(depth.bids, limit);
let asks = binance.sortAsks(depth.asks, limit);
//console.log("best bid: "+binance.first(bids));
//console.log("best ask: "+binance.first(asks));
let output = {bids:binance.array(bids), asks:binance.array(asks)};
console.log(symbol, output);
// save information to json file
//file.writeFile("json/depth/"+symbol+".json", JSON.stringify(output, null, 4), (err)=>{});
});
Title
binance.depth
should return data as arrayShort Description:
binance.depth
returns an object, but it seems more like array data. Not to be finicky or anything. Just asking.Rather, depth data should be returned as an array. E.g.
Platform:
node version:
code
Thank you, supercoder!! ;)