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

Method depthStream

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

* Websocket depth chart * @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

6412 * @return {string} the websocket endpoint
6413 */
6414 depthStream(symbols: string[] | string, callback: Callback) {
6415 const reconnect = () => {
6416 if (this.Options.reconnect) this.depthStream(symbols, callback);
6417 };
6418 let subscription;
6419 if (Array.isArray(symbols)) {
6420 if (!this.isArrayUnique(symbols)) throw Error('depth: "symbols" cannot contain duplicate elements.');
6421 const streams = symbols.map(function (symbol) {
6422 return symbol.toLowerCase() + '@depth@100ms';
6423 });
6424 subscription = this.subscribeCombined(streams, callback, reconnect);
6425 } else {
6426 const symbol = symbols;
6427 subscription = this.subscribe(symbol.toLowerCase() + '@depth@100ms', callback, reconnect);
6428 }
6429 return (subscription as any).url;
6430 }
6431
6432 async mapLimit(array, limit, asyncFn) {
6433 const results = [];

Callers 1

reconnectMethod · 0.95

Calls 3

isArrayUniqueMethod · 0.95
subscribeCombinedMethod · 0.95
subscribeMethod · 0.95

Tested by

no test coverage detected