| 2595 | * @return {object} - the depth volume cache object |
| 2596 | */ |
| 2597 | const depthVolume = symbol => { |
| 2598 | let cache = getDepthCache(symbol), quantity, price; |
| 2599 | let bidbase = 0, askbase = 0, bidqty = 0, askqty = 0; |
| 2600 | for (price in cache.bids) { |
| 2601 | quantity = cache.bids[price]; |
| 2602 | bidbase += parseFloat((quantity * parseFloat(price)).toFixed(8)); |
| 2603 | bidqty += quantity; |
| 2604 | } |
| 2605 | for (price in cache.asks) { |
| 2606 | quantity = cache.asks[price]; |
| 2607 | askbase += parseFloat((quantity * parseFloat(price)).toFixed(8)); |
| 2608 | askqty += quantity; |
| 2609 | } |
| 2610 | return { bids: bidbase, asks: askbase, bidQty: bidqty, askQty: askqty }; |
| 2611 | }; |
| 2612 | |
| 2613 | /** |
| 2614 | * Checks whether or not an array contains any duplicate elements |