* 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)
| 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 | /** |
no test coverage detected