* 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)
| 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 = []; |
no test coverage detected