MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / depthData

Method depthData

src/node-binance-api.ts:3422–3437  ·  view source on GitHub ↗

* Used for /depth endpoint * @param {object} data - containing the bids and asks * @return {undefined}

(data: any)

Source from the content-addressed store, hash-verified

3420 * @return {undefined}
3421 */
3422 depthData(data: any) {
3423 if (!data) return { bids: [], asks: [] };
3424 const bids = {}, asks = {};
3425 let obj;
3426 if (typeof data.bids !== 'undefined') {
3427 for (obj of data.bids) {
3428 bids[obj[0]] = parseFloat(obj[1]);
3429 }
3430 }
3431 if (typeof data.asks !== 'undefined') {
3432 for (obj of data.asks) {
3433 asks[obj[0]] = parseFloat(obj[1]);
3434 }
3435 }
3436 return { lastUpdateId: data.lastUpdateId, bids: bids, asks: asks };
3437 }
3438
3439 parseOrderBook(data, symbol: string): OrderBook {
3440 const { lastUpdateId, bids, asks } = data;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected