* Used for /depth endpoint * @param {object} data - containing the bids and asks * @return {undefined}
(data: any)
| 3420 | * @return {undefined} |
| 3421 | */ |
| 3422 | depthData(data: any) { |
| 3423 | if (!data) return { bids: [], asks: [] }; |
| 3424 | const bids = {}, asks = {}; |
| 3425 | let obj; |
| 3426 | if (typeof data.bids !== 'undefined') { |
| 3427 | for (obj of data.bids) { |
| 3428 | bids[obj[0]] = parseFloat(obj[1]); |
| 3429 | } |
| 3430 | } |
| 3431 | if (typeof data.asks !== 'undefined') { |
| 3432 | for (obj of data.asks) { |
| 3433 | asks[obj[0]] = parseFloat(obj[1]); |
| 3434 | } |
| 3435 | } |
| 3436 | return { lastUpdateId: data.lastUpdateId, bids: bids, asks: asks }; |
| 3437 | } |
| 3438 | |
| 3439 | parseOrderBook(data, symbol: string): OrderBook { |
| 3440 | const { lastUpdateId, bids, asks } = data; |
no outgoing calls
no test coverage detected