Skip to content

Converting Depth Data to Array

Jon Eyrick edited this page Nov 11, 2017 · 2 revisions

Often times depth data is required to be in array format. For example, when drawing charts: https://bfxdata.com/mobileSite/mobileGraphMarketDepthBTCUSD.php Data format: https://bfxdata.com/json/marketDepthBidsBTCUSD.json

For this reason I have added an array function to convert an object into an array:

binance.depth("BNBBTC", function(depth, symbol) {
	console.log(symbol+" bids", binance.array(depth.bids));
	console.log(symbol+" asks", binance.array(depth.asks));
});
Clone this wiki locally