(client, message, subscription)
| 170 | } |
| 171 | } |
| 172 | async fetchOrderBookSnapshot(client, message, subscription) { |
| 173 | const symbol = this.safeString(message, 'symbol'); |
| 174 | const market = this.market(symbol); |
| 175 | const messageHash = market['id'] + '@orderbook'; |
| 176 | try { |
| 177 | const defaultLimit = this.safeInteger(this.options, 'watchOrderBookLimit', 1000); |
| 178 | const limit = this.safeInteger(subscription, 'limit', defaultLimit); |
| 179 | const params = this.safeDict(subscription, 'params'); |
| 180 | const snapshot = await this.fetchRestOrderBookSafe(symbol, limit, params); |
| 181 | if (this.safeValue(this.orderbooks, symbol) === undefined) { |
| 182 | // if the orderbook is dropped before the snapshot is received |
| 183 | return; |
| 184 | } |
| 185 | const orderbook = this.orderbooks[symbol]; |
| 186 | orderbook.reset(snapshot); |
| 187 | this.orderbooks[symbol] = orderbook; |
| 188 | client.resolve(orderbook, messageHash); |
| 189 | } |
| 190 | catch (e) { |
| 191 | delete client.subscriptions[messageHash]; |
| 192 | client.reject(e, messageHash); |
| 193 | } |
| 194 | } |
| 195 | handleOrderBookMessage(client, message, orderbook) { |
| 196 | this.handleDeltas(orderbook['asks'], this.safeValue(message, 'asks', [])); |
| 197 | this.handleDeltas(orderbook['bids'], this.safeValue(message, 'bids', [])); |
nothing calls this directly
no test coverage detected