* Futures WebSocket aggregated trades * @param {array/string} symbols - an array or string of symbols to query * @param {function} callback - callback function * @return {string} the websocket endpoint
(symbols: string[] | string, callback: Callback)
| 5702 | * @return {string} the websocket endpoint |
| 5703 | */ |
| 5704 | futuresAggTradeStream(symbols: string[] | string, callback: Callback) { |
| 5705 | const reconnect = () => { |
| 5706 | if (this.Options.reconnect) this.futuresAggTradeStream(symbols, callback); |
| 5707 | }; |
| 5708 | let subscription; |
| 5709 | const cleanCallback = data => callback(this.fAggTradeConvertData(data)); |
| 5710 | if (Array.isArray(symbols)) { |
| 5711 | if (!this.isArrayUnique(symbols)) throw Error('futuresAggTradeStream: "symbols" cannot contain duplicate elements.'); |
| 5712 | const streams = symbols.map(symbol => symbol.toLowerCase() + '@aggTrade'); |
| 5713 | subscription = this.futuresSubscribe(streams, cleanCallback, { reconnect }); |
| 5714 | } else { |
| 5715 | const symbol = symbols as string; |
| 5716 | subscription = this.futuresSubscribeSingle(symbol.toLowerCase() + '@aggTrade', cleanCallback, { reconnect }); |
| 5717 | } |
| 5718 | return (subscription as any).url; |
| 5719 | } |
| 5720 | |
| 5721 | /** |
| 5722 | * Futures WebSocket mark price |
no test coverage detected