()
| 2530 | let symbol = depth.s, obj; |
| 2531 | let context = Binance.depthCacheContext[symbol]; |
| 2532 | let updateDepthCache = () => { |
| 2533 | Binance.depthCache[symbol].eventTime = depth.E; |
| 2534 | for (obj of depth.b) { //bids |
| 2535 | if (obj[1] == 0) { |
| 2536 | delete Binance.depthCache[symbol].bids[obj[0]]; |
| 2537 | } else { |
| 2538 | Binance.depthCache[symbol].bids[obj[0]] = parseFloat(obj[1]); |
| 2539 | } |
| 2540 | } |
| 2541 | for (obj of depth.a) { //asks |
| 2542 | if (obj[1] == 0) { |
| 2543 | delete Binance.depthCache[symbol].asks[obj[0]]; |
| 2544 | } else { |
| 2545 | Binance.depthCache[symbol].asks[obj[0]] = parseFloat(obj[1]); |
| 2546 | } |
| 2547 | } |
| 2548 | context.skipCount = 0; |
| 2549 | context.lastEventUpdateId = depth.u; |
| 2550 | context.lastEventUpdateTime = depth.E; |
| 2551 | }; |
| 2552 | |
| 2553 | // This now conforms 100% to the Binance docs constraints on managing a local order book |
| 2554 | if (context.lastEventUpdateId) { |
no outgoing calls
no test coverage detected