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

Method depthVolume

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

* Calculate Buy/Sell volume from DepthCache * @param {string} symbol - the symbol to fetch * @return {object} - the depth volume cache object

(symbol: string)

Source from the content-addressed store, hash-verified

3525 * @return {object} - the depth volume cache object
3526 */
3527 depthVolume(symbol: string) {
3528 const cache = this.getDepthCache(symbol);
3529 let quantity, price;
3530 let bidbase = 0, askbase = 0, bidqty = 0, askqty = 0;
3531 for (price in cache.bids) {
3532 quantity = cache.bids[price];
3533 bidbase += parseFloat((quantity * parseFloat(price)).toFixed(8));
3534 bidqty += quantity;
3535 }
3536 for (price in cache.asks) {
3537 quantity = cache.asks[price];
3538 askbase += parseFloat((quantity * parseFloat(price)).toFixed(8));
3539 askqty += quantity;
3540 }
3541 return { bids: bidbase, asks: askbase, bidQty: bidqty, askQty: askqty };
3542 }
3543
3544 /**
3545 * Checks whether or not an array contains any duplicate elements

Callers

nothing calls this directly

Calls 1

getDepthCacheMethod · 0.95

Tested by

no test coverage detected