* Calculate Buy/Sell volume from DepthCache * @param {string} symbol - the symbol to fetch * @return {object} - the depth volume cache object
(symbol: string)
| 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 |
nothing calls this directly
no test coverage detected