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

Method aggTradesStream

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

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

Source from the content-addressed store, hash-verified

6598 * @return {string} the websocket endpoint
6599 */
6600 aggTradesStream(symbols: string[] | string, callback: Callback) {
6601 const reconnect = () => {
6602 if (this.Options.reconnect) this.aggTradesStream(symbols, callback);
6603 };
6604 let subscription;
6605 if (Array.isArray(symbols)) {
6606 if (!this.isArrayUnique(symbols)) throw Error('trades: "symbols" cannot contain duplicate elements.');
6607 const streams = symbols.map(function (symbol) {
6608 return symbol.toLowerCase() + '@aggTrade';
6609 });
6610 subscription = this.subscribeCombined(streams, callback, reconnect);
6611 } else {
6612 const symbol = symbols;
6613 subscription = this.subscribe(symbol.toLowerCase() + '@aggTrade', callback, reconnect);
6614 }
6615 return (subscription as any).url;
6616 }
6617
6618 /**
6619 * Websocket raw trades

Callers 1

reconnectMethod · 0.95

Calls 3

isArrayUniqueMethod · 0.95
subscribeCombinedMethod · 0.95
subscribeMethod · 0.95

Tested by

no test coverage detected