MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / bookTickersStream

Method bookTickersStream

src/node-binance-api.ts:6780–6795  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 1

reconnectMethod · 0.95

Calls 3

subscribeCombinedMethod · 0.95
subscribeMethod · 0.95

Tested by

no test coverage detected