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

Method futuresCandlesticksStream

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

* Websocket futures candlesticks * @param {array/string} symbols - an array or string of symbols to query * @param {string} interval - the time interval * @param {function} callback - callback function * @return {string} the websocket endpoint

(symbols: string[] | string, interval: Interval, callback: Callback)

Source from the content-addressed store, hash-verified

5867 * @return {string} the websocket endpoint
5868 */
5869 futuresCandlesticksStream(symbols: string[] | string, interval: Interval, callback: Callback) {
5870 const reconnect = () => {
5871 if (this.Options.reconnect) this.futuresCandlesticksStream(symbols, interval, callback);
5872 };
5873 let subscription;
5874 if (Array.isArray(symbols)) {
5875 if (!this.isArrayUnique(symbols)) throw Error('futuresCandlesticks: "symbols" array cannot contain duplicate elements.');
5876 const streams = symbols.map(symbol => symbol.toLowerCase() + '@kline_' + interval);
5877 subscription = this.futuresSubscribe(streams, callback, { reconnect });
5878 } else {
5879 const symbol = symbols.toLowerCase();
5880 subscription = this.futuresSubscribeSingle(symbol + '@kline_' + interval, callback, { reconnect });
5881 }
5882 return (subscription as any).url;
5883 }
5884
5885 // Delivery WebSocket Functions:
5886 /**

Callers 3

reconnectMethod · 0.95

Calls 3

isArrayUniqueMethod · 0.95
futuresSubscribeMethod · 0.95

Tested by

no test coverage detected