* Spot WebSocket bookTicker (bid/ask quotes including price & amount) * @param {string | string[]} symbol symbol or array of symbols * @param {function} callback - callback function * @return {string} the websocket endpoint
(symbol: string | string[], callback = console.log)
| 6778 | * @return {string} the websocket endpoint |
| 6779 | */ |
| 6780 | bookTickersStream(symbol: string | string[], callback = console.log) { |
| 6781 | const reconnect = () => { |
| 6782 | if (this.Options.reconnect) this.bookTickersStream(symbol, callback); |
| 6783 | }; |
| 6784 | let subscription: any; |
| 6785 | if (Array.isArray(symbol)) { |
| 6786 | const streams = symbol.map(function (symbol) { |
| 6787 | return symbol.toLowerCase() + '@bookTicker'; |
| 6788 | }); |
| 6789 | subscription = this.subscribeCombined(streams, data => callback(this.fBookTickerConvertData(data)), reconnect); |
| 6790 | } else { |
| 6791 | const endpoint = `${(symbol as string).toLowerCase()}@bookTicker`; |
| 6792 | subscription = this.subscribe(endpoint, data => callback(this.fBookTickerConvertData(data)), reconnect); |
| 6793 | } |
| 6794 | return (subscription as any).url; |
| 6795 | } |
| 6796 | |
| 6797 | /** |
| 6798 | * Websocket prevday percentage |
no test coverage detected