binance 3.4.4 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,7 +128,7 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
128
128
  /**
129
129
  * @returns The WS URL to connect to for this WS key
130
130
  */
131
- getWsUrl(wsKey: WsKey, connectionType?: 'market' | 'userData'): Promise<string>;
131
+ getWsUrl(wsKey: WsKey, connectionType?: 'public' | 'market' | 'private'): Promise<string>;
132
132
  private signMessage;
133
133
  /**
134
134
  * Handles request sign, if connection isn't authenticated yet.
@@ -230,7 +230,7 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
230
230
  *
231
231
  * Note: the wsKey parameter is optional, but can be used to connect to other environments for this product group.
232
232
  */
233
- subscribeUsdFuturesUserDataStream(wsKey?: WsKey, // usdm | usdmTestnet
233
+ subscribeUsdFuturesUserDataStream(wsKey?: WsKey, // usdm | usdmPrivate | usdmTestnet
234
234
  forceNewConnection?: boolean, miscState?: MiscUserDataConnectionState): Promise<WSConnectedResult | undefined>;
235
235
  unsubscribeUsdFuturesUserDataStream(wsKey?: WsKey): Promise<void>;
236
236
  /**
@@ -288,52 +288,52 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
288
288
  /**
289
289
  * Subscribe to aggregate trades for a symbol in a market category
290
290
  */
291
- subscribeAggregateTrades(symbol: string, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
291
+ subscribeAggregateTrades(symbol: string, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
292
292
  /**
293
293
  * Subscribe to trades for a symbol in a market category
294
294
  * IMPORTANT: This topic for usdm and coinm is not listed in the api docs and might stop working without warning
295
295
  */
296
- subscribeTrades(symbol: string, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
296
+ subscribeTrades(symbol: string, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
297
297
  /**
298
298
  * Subscribe to coin index for a symbol in COINM Futures markets
299
299
  */
300
- subscribeCoinIndexPrice(symbol: string, updateSpeedMs?: 1000 | 3000): Promise<unknown>;
300
+ subscribeCoinIndexPrice(symbol: string, updateSpeedMs?: 1000 | 3000, wsKeyOverride?: WsKey): Promise<unknown>;
301
301
  /**
302
302
  * Subscribe to mark price for a symbol in a market category
303
303
  */
304
- subscribeMarkPrice(symbol: string, market: 'usdm' | 'coinm', updateSpeedMs?: 1000 | 3000): Promise<unknown>;
304
+ subscribeMarkPrice(symbol: string, market: 'usdm' | 'coinm', updateSpeedMs?: 1000 | 3000, wsKeyOverride?: WsKey): Promise<unknown>;
305
305
  /**
306
306
  * Subscribe to mark price for all symbols in a market category
307
307
  */
308
- subscribeAllMarketMarkPrice(market: 'usdm' | 'coinm', updateSpeedMs?: 1000 | 3000): Promise<unknown>;
308
+ subscribeAllMarketMarkPrice(market: 'usdm' | 'coinm', updateSpeedMs?: 1000 | 3000, wsKeyOverride?: WsKey): Promise<unknown>;
309
309
  /**
310
310
  * Subscribe to klines(candles) for a symbol in a market category
311
311
  */
312
- subscribeKlines(symbol: string, interval: KlineInterval, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
312
+ subscribeKlines(symbol: string, interval: KlineInterval, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
313
313
  /**
314
314
  * Subscribe to continuous contract klines(candles) for a symbol futures
315
315
  */
316
- subscribeContinuousContractKlines(symbol: string, contractType: 'perpetual' | 'current_quarter' | 'next_quarter', interval: KlineInterval, market: 'usdm' | 'coinm'): Promise<unknown>;
316
+ subscribeContinuousContractKlines(symbol: string, contractType: 'perpetual' | 'current_quarter' | 'next_quarter', interval: KlineInterval, market: 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
317
317
  /**
318
318
  * Subscribe to index klines(candles) for a symbol in a coinm futures
319
319
  */
320
- subscribeIndexKlines(symbol: string, interval: KlineInterval): Promise<unknown>;
320
+ subscribeIndexKlines(symbol: string, interval: KlineInterval, wsKeyOverride?: WsKey): Promise<unknown>;
321
321
  /**
322
322
  * Subscribe to index klines(candles) for a symbol in a coinm futures
323
323
  */
324
- subscribeMarkPriceKlines(symbol: string, interval: KlineInterval): Promise<unknown>;
324
+ subscribeMarkPriceKlines(symbol: string, interval: KlineInterval, wsKeyOverride?: WsKey): Promise<unknown>;
325
325
  /**
326
326
  * Subscribe to mini 24hr ticker for a symbol in market category.
327
327
  */
328
- subscribeSymbolMini24hrTicker(symbol: string, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
328
+ subscribeSymbolMini24hrTicker(symbol: string, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
329
329
  /**
330
330
  * Subscribe to mini 24hr mini ticker in market category.
331
331
  */
332
- subscribeAllMini24hrTickers(market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
332
+ subscribeAllMini24hrTickers(market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
333
333
  /**
334
334
  * Subscribe to 24hr ticker for a symbol in any market.
335
335
  */
336
- subscribeSymbol24hrTicker(symbol: string, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
336
+ subscribeSymbol24hrTicker(symbol: string, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
337
337
  /**
338
338
  * Subscribe to Alpha Trading WebSocket Market Data streams.
339
339
  * Base URL: wss://nbstream.binance.com/w3w/wsa/stream
@@ -364,7 +364,7 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
364
364
  /**
365
365
  * Subscribe to 24hr ticker in any market.
366
366
  */
367
- subscribeAll24hrTickers(market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
367
+ subscribeAll24hrTickers(market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
368
368
  /**
369
369
  * Subscribe to rolling window ticker statistics for all market symbols,
370
370
  * computed over multiple windows. Note that only tickers that have
@@ -374,23 +374,23 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
374
374
  * - Supported window sizes: 1h,4h,1d.
375
375
  * - Supported markets: spot
376
376
  */
377
- subscribeAllRollingWindowTickers(market: 'spot', windowSize: '1h' | '4h' | '1d'): Promise<unknown>;
377
+ subscribeAllRollingWindowTickers(market: 'spot', windowSize: '1h' | '4h' | '1d', wsKeyOverride?: WsKey): Promise<unknown>;
378
378
  /**
379
379
  * Subscribe to best bid/ask for symbol in spot markets.
380
380
  */
381
- subscribeSymbolBookTicker(symbol: string, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
381
+ subscribeSymbolBookTicker(symbol: string, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
382
382
  /**
383
383
  * Subscribe to best bid/ask for all symbols in spot markets.
384
384
  */
385
- subscribeAllBookTickers(market: 'usdm' | 'coinm'): Promise<unknown>;
385
+ subscribeAllBookTickers(market: 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
386
386
  /**
387
387
  * Subscribe to best bid/ask for symbol in spot markets.
388
388
  */
389
- subscribeSymbolLiquidationOrders(symbol: string, market: 'usdm' | 'coinm'): Promise<unknown>;
389
+ subscribeSymbolLiquidationOrders(symbol: string, market: 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
390
390
  /**
391
391
  * Subscribe to best bid/ask for all symbols in spot markets.
392
392
  */
393
- subscribeAllLiquidationOrders(market: 'usdm' | 'coinm'): Promise<unknown>;
393
+ subscribeAllLiquidationOrders(market: 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
394
394
  /**
395
395
  * Subscribe to partial book depths (snapshots).
396
396
  *
@@ -398,7 +398,7 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
398
398
  * - spot only supports 1000ms or 100ms for updateMs
399
399
  * - futures only support 100, 250 or 500ms for updateMs
400
400
  */
401
- subscribePartialBookDepths(symbol: string, levels: 5 | 10 | 20, updateMs: 100 | 250 | 500 | 1000, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
401
+ subscribePartialBookDepths(symbol: string, levels: 5 | 10 | 20, updateMs: 100 | 250 | 500 | 1000, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
402
402
  /**
403
403
  * Subscribe to orderbook depth updates to locally manage an order book.
404
404
  *
@@ -407,11 +407,11 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
407
407
  * - Spot: https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
408
408
  * - USDM Futures: https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
409
409
  */
410
- subscribeDiffBookDepth(symbol: string, updateMs: 100 | 250 | 500 | 1000 | undefined, market: 'spot' | 'usdm' | 'coinm'): Promise<unknown>;
410
+ subscribeDiffBookDepth(symbol: string, updateMs: 100 | 250 | 500 | 1000 | undefined, market: 'spot' | 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
411
411
  /**
412
412
  * Subscribe to best bid/ask for all symbols in spot markets.
413
413
  */
414
- subscribeContractInfoStream(market: 'usdm' | 'coinm'): Promise<unknown>;
414
+ subscribeContractInfoStream(market: 'usdm' | 'coinm', wsKeyOverride?: WsKey): Promise<unknown>;
415
415
  /**
416
416
  * --------------------------
417
417
  * SPOT market websocket streams
@@ -420,41 +420,41 @@ export declare class WebsocketClient extends BaseWebsocketClient<WsKey, WsReques
420
420
  /**
421
421
  * Subscribe to aggregate trades for a symbol in spot markets.
422
422
  */
423
- subscribeSpotAggregateTrades(symbol: string): Promise<unknown>;
423
+ subscribeSpotAggregateTrades(symbol: string, wsKeyOverride?: WsKey): Promise<unknown>;
424
424
  /**
425
425
  * Subscribe to trades for a symbol in spot markets.
426
426
  */
427
- subscribeSpotTrades(symbol: string): Promise<unknown>;
427
+ subscribeSpotTrades(symbol: string, wsKeyOverride?: WsKey): Promise<unknown>;
428
428
  /**
429
429
  * Subscribe to candles for a symbol in spot markets.
430
430
  */
431
- subscribeSpotKline(symbol: string, interval: KlineInterval): Promise<unknown>;
431
+ subscribeSpotKline(symbol: string, interval: KlineInterval, wsKeyOverride?: WsKey): Promise<unknown>;
432
432
  /**
433
433
  * Subscribe to mini 24hr ticker for a symbol in spot markets.
434
434
  */
435
- subscribeSpotSymbolMini24hrTicker(symbol: string): Promise<unknown>;
435
+ subscribeSpotSymbolMini24hrTicker(symbol: string, wsKeyOverride?: WsKey): Promise<unknown>;
436
436
  /**
437
437
  * Subscribe to mini 24hr mini ticker in spot markets.
438
438
  */
439
- subscribeSpotAllMini24hrTickers(): Promise<unknown>;
439
+ subscribeSpotAllMini24hrTickers(wsKeyOverride?: WsKey): Promise<unknown>;
440
440
  /**
441
441
  * Subscribe to 24hr ticker for a symbol in spot markets.
442
442
  */
443
- subscribeSpotSymbol24hrTicker(symbol: string): Promise<unknown>;
443
+ subscribeSpotSymbol24hrTicker(symbol: string, wsKeyOverride?: WsKey): Promise<unknown>;
444
444
  /**
445
445
  * Subscribe to 24hr ticker in spot markets.
446
446
  */
447
- subscribeSpotAll24hrTickers(): Promise<unknown>;
447
+ subscribeSpotAll24hrTickers(wsKeyOverride?: WsKey): Promise<unknown>;
448
448
  /**
449
449
  * Subscribe to best bid/ask for symbol in spot markets.
450
450
  */
451
- subscribeSpotSymbolBookTicker(symbol: string): Promise<unknown>;
451
+ subscribeSpotSymbolBookTicker(symbol: string, wsKeyOverride?: WsKey): Promise<unknown>;
452
452
  /**
453
453
  * Subscribe to top bid/ask levels for symbol in spot markets.
454
454
  */
455
- subscribeSpotPartialBookDepth(symbol: string, levels: 5 | 10 | 20, updateMs?: 1000 | 100): Promise<unknown>;
455
+ subscribeSpotPartialBookDepth(symbol: string, levels: 5 | 10 | 20, updateMs?: 1000 | 100, wsKeyOverride?: WsKey): Promise<unknown>;
456
456
  /**
457
457
  * Subscribe to spot orderbook depth updates to locally manage an order book.
458
458
  */
459
- subscribeSpotDiffBookDepth(symbol: string, updateMs?: 1000 | 100): Promise<unknown>;
459
+ subscribeSpotDiffBookDepth(symbol: string, updateMs?: 1000 | 100, wsKeyOverride?: WsKey): Promise<unknown>;
460
460
  }
@@ -915,10 +915,11 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
915
915
  * Note: the wsKey parameter is optional, but can be used to connect to other environments for this product group.
916
916
  */
917
917
  subscribeUsdFuturesUserDataStream() {
918
- return __awaiter(this, arguments, void 0, function* (wsKey = 'usdm', // usdm | usdmTestnet
918
+ return __awaiter(this, arguments, void 0, function* (wsKey = websocket_util_1.WS_KEY_MAP.usdmPrivate, // usdm | usdmPrivate | usdmTestnet
919
919
  forceNewConnection, miscState) {
920
920
  try {
921
- const isTestnet = wsKey === websocket_util_1.WS_KEY_MAP.usdmTestnet;
921
+ const isTestnet = wsKey === websocket_util_1.WS_KEY_MAP.usdmTestnet ||
922
+ wsKey === websocket_util_1.WS_KEY_MAP.usdmTestnetPrivate;
922
923
  const restClient = this.restClientCache.getUSDMRestClient(this.getRestClientOptions(), this.options.requestOptions);
923
924
  const { listenKey } = yield restClient.getFuturesUserDataListenKey();
924
925
  const market = isTestnet ? 'usdmTestnet' : 'usdm';
@@ -931,7 +932,7 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
931
932
  }
932
933
  });
933
934
  }
934
- unsubscribeUsdFuturesUserDataStream(wsKey = 'usdm') {
935
+ unsubscribeUsdFuturesUserDataStream(wsKey = websocket_util_1.WS_KEY_MAP.usdmPrivate) {
935
936
  return this.closeUserDataStream(wsKey, 'usdm');
936
937
  }
937
938
  /**
@@ -1205,114 +1206,114 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
1205
1206
  /**
1206
1207
  * Subscribe to aggregate trades for a symbol in a market category
1207
1208
  */
1208
- subscribeAggregateTrades(symbol, market) {
1209
+ subscribeAggregateTrades(symbol, market, wsKeyOverride) {
1209
1210
  const lowerCaseSymbol = symbol.toLowerCase();
1210
1211
  const streamName = 'aggTrade';
1211
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1212
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1212
1213
  return this.subscribe(`${lowerCaseSymbol}@${streamName}`, wsKey);
1213
1214
  }
1214
1215
  /**
1215
1216
  * Subscribe to trades for a symbol in a market category
1216
1217
  * IMPORTANT: This topic for usdm and coinm is not listed in the api docs and might stop working without warning
1217
1218
  */
1218
- subscribeTrades(symbol, market) {
1219
+ subscribeTrades(symbol, market, wsKeyOverride) {
1219
1220
  const lowerCaseSymbol = symbol.toLowerCase();
1220
1221
  const streamName = 'trade';
1221
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1222
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1222
1223
  return this.subscribe(`${lowerCaseSymbol}@${streamName}`, wsKey);
1223
1224
  }
1224
1225
  /**
1225
1226
  * Subscribe to coin index for a symbol in COINM Futures markets
1226
1227
  */
1227
- subscribeCoinIndexPrice(symbol, updateSpeedMs = 3000) {
1228
+ subscribeCoinIndexPrice(symbol, updateSpeedMs = 3000, wsKeyOverride) {
1228
1229
  const lowerCaseSymbol = symbol.toLowerCase();
1229
1230
  const streamName = 'indexPrice';
1230
1231
  const speedSuffix = updateSpeedMs === 1000 ? '@1s' : '';
1231
1232
  const market = 'coinm';
1232
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1233
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1233
1234
  return this.subscribe(`${lowerCaseSymbol}@${streamName}${speedSuffix}`, wsKey);
1234
1235
  }
1235
1236
  /**
1236
1237
  * Subscribe to mark price for a symbol in a market category
1237
1238
  */
1238
- subscribeMarkPrice(symbol, market, updateSpeedMs = 3000) {
1239
+ subscribeMarkPrice(symbol, market, updateSpeedMs = 3000, wsKeyOverride) {
1239
1240
  const lowerCaseSymbol = symbol.toLowerCase();
1240
1241
  const streamName = 'markPrice';
1241
1242
  const speedSuffix = updateSpeedMs === 1000 ? '@1s' : '';
1242
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1243
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1243
1244
  return this.subscribe(`${lowerCaseSymbol}@${streamName}${speedSuffix}`, wsKey);
1244
1245
  }
1245
1246
  /**
1246
1247
  * Subscribe to mark price for all symbols in a market category
1247
1248
  */
1248
- subscribeAllMarketMarkPrice(market, updateSpeedMs = 3000) {
1249
+ subscribeAllMarketMarkPrice(market, updateSpeedMs = 3000, wsKeyOverride) {
1249
1250
  const streamName = '!markPrice@arr';
1250
1251
  const speedSuffix = updateSpeedMs === 1000 ? '@1s' : '';
1251
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1252
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1252
1253
  return this.subscribe(`${streamName}${speedSuffix}`, wsKey);
1253
1254
  }
1254
1255
  /**
1255
1256
  * Subscribe to klines(candles) for a symbol in a market category
1256
1257
  */
1257
- subscribeKlines(symbol, interval, market) {
1258
+ subscribeKlines(symbol, interval, market, wsKeyOverride) {
1258
1259
  const lowerCaseSymbol = symbol.toLowerCase();
1259
1260
  const streamName = 'kline';
1260
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1261
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1261
1262
  return this.subscribe(`${lowerCaseSymbol}@${streamName}_${interval}`, wsKey);
1262
1263
  }
1263
1264
  /**
1264
1265
  * Subscribe to continuous contract klines(candles) for a symbol futures
1265
1266
  */
1266
- subscribeContinuousContractKlines(symbol, contractType, interval, market) {
1267
+ subscribeContinuousContractKlines(symbol, contractType, interval, market, wsKeyOverride) {
1267
1268
  const lowerCaseSymbol = symbol.toLowerCase();
1268
1269
  const streamName = 'continuousKline';
1269
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1270
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1270
1271
  return this.subscribe(`${lowerCaseSymbol}_${contractType}@${streamName}_${interval}`, wsKey);
1271
1272
  }
1272
1273
  /**
1273
1274
  * Subscribe to index klines(candles) for a symbol in a coinm futures
1274
1275
  */
1275
- subscribeIndexKlines(symbol, interval) {
1276
+ subscribeIndexKlines(symbol, interval, wsKeyOverride) {
1276
1277
  const lowerCaseSymbol = symbol.toLowerCase();
1277
1278
  const streamName = 'indexPriceKline';
1278
1279
  const market = 'coinm';
1279
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1280
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1280
1281
  return this.subscribe(`${lowerCaseSymbol}@${streamName}_${interval}`, wsKey);
1281
1282
  }
1282
1283
  /**
1283
1284
  * Subscribe to index klines(candles) for a symbol in a coinm futures
1284
1285
  */
1285
- subscribeMarkPriceKlines(symbol, interval) {
1286
+ subscribeMarkPriceKlines(symbol, interval, wsKeyOverride) {
1286
1287
  const lowerCaseSymbol = symbol.toLowerCase();
1287
1288
  const streamName = 'markPriceKline';
1288
1289
  const market = 'coinm';
1289
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1290
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1290
1291
  return this.subscribe(`${lowerCaseSymbol}@${streamName}_${interval}`, wsKey);
1291
1292
  }
1292
1293
  /**
1293
1294
  * Subscribe to mini 24hr ticker for a symbol in market category.
1294
1295
  */
1295
- subscribeSymbolMini24hrTicker(symbol, market) {
1296
+ subscribeSymbolMini24hrTicker(symbol, market, wsKeyOverride) {
1296
1297
  const lowerCaseSymbol = symbol.toLowerCase();
1297
1298
  const streamName = 'miniTicker';
1298
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1299
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1299
1300
  return this.subscribe(`${lowerCaseSymbol}@${streamName}`, wsKey);
1300
1301
  }
1301
1302
  /**
1302
1303
  * Subscribe to mini 24hr mini ticker in market category.
1303
1304
  */
1304
- subscribeAllMini24hrTickers(market) {
1305
+ subscribeAllMini24hrTickers(market, wsKeyOverride) {
1305
1306
  const streamName = 'miniTicker';
1306
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1307
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1307
1308
  return this.subscribe(`!${streamName}@arr`, wsKey);
1308
1309
  }
1309
1310
  /**
1310
1311
  * Subscribe to 24hr ticker for a symbol in any market.
1311
1312
  */
1312
- subscribeSymbol24hrTicker(symbol, market) {
1313
+ subscribeSymbol24hrTicker(symbol, market, wsKeyOverride) {
1313
1314
  const lowerCaseSymbol = symbol.toLowerCase();
1314
1315
  const streamName = 'ticker';
1315
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1316
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1316
1317
  return this.subscribe(`${lowerCaseSymbol}@${streamName}`, wsKey);
1317
1318
  }
1318
1319
  /**
@@ -1358,9 +1359,9 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
1358
1359
  /**
1359
1360
  * Subscribe to 24hr ticker in any market.
1360
1361
  */
1361
- subscribeAll24hrTickers(market) {
1362
+ subscribeAll24hrTickers(market, wsKeyOverride) {
1362
1363
  const streamName = 'ticker';
1363
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1364
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1364
1365
  return this.subscribe(`!${streamName}@arr`, wsKey);
1365
1366
  }
1366
1367
  /**
@@ -1372,43 +1373,43 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
1372
1373
  * - Supported window sizes: 1h,4h,1d.
1373
1374
  * - Supported markets: spot
1374
1375
  */
1375
- subscribeAllRollingWindowTickers(market, windowSize) {
1376
+ subscribeAllRollingWindowTickers(market, windowSize, wsKeyOverride) {
1376
1377
  const streamName = 'ticker';
1377
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1378
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1378
1379
  return this.subscribe(`!${streamName}_${windowSize}@arr`, wsKey);
1379
1380
  }
1380
1381
  /**
1381
1382
  * Subscribe to best bid/ask for symbol in spot markets.
1382
1383
  */
1383
- subscribeSymbolBookTicker(symbol, market) {
1384
+ subscribeSymbolBookTicker(symbol, market, wsKeyOverride) {
1384
1385
  const lowerCaseSymbol = symbol.toLowerCase();
1385
1386
  const streamName = 'bookTicker';
1386
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1387
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1387
1388
  return this.subscribe(`${lowerCaseSymbol}@${streamName}`, wsKey);
1388
1389
  }
1389
1390
  /**
1390
1391
  * Subscribe to best bid/ask for all symbols in spot markets.
1391
1392
  */
1392
- subscribeAllBookTickers(market) {
1393
+ subscribeAllBookTickers(market, wsKeyOverride) {
1393
1394
  const streamName = 'bookTicker';
1394
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1395
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1395
1396
  return this.subscribe(`!${streamName}`, wsKey);
1396
1397
  }
1397
1398
  /**
1398
1399
  * Subscribe to best bid/ask for symbol in spot markets.
1399
1400
  */
1400
- subscribeSymbolLiquidationOrders(symbol, market) {
1401
+ subscribeSymbolLiquidationOrders(symbol, market, wsKeyOverride) {
1401
1402
  const lowerCaseSymbol = symbol.toLowerCase();
1402
1403
  const streamName = 'forceOrder';
1403
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1404
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1404
1405
  return this.subscribe(`${lowerCaseSymbol}@${streamName}`, wsKey);
1405
1406
  }
1406
1407
  /**
1407
1408
  * Subscribe to best bid/ask for all symbols in spot markets.
1408
1409
  */
1409
- subscribeAllLiquidationOrders(market) {
1410
+ subscribeAllLiquidationOrders(market, wsKeyOverride) {
1410
1411
  const streamName = 'forceOrder@arr';
1411
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1412
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1412
1413
  return this.subscribe(`!${streamName}`, wsKey);
1413
1414
  }
1414
1415
  /**
@@ -1418,10 +1419,10 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
1418
1419
  * - spot only supports 1000ms or 100ms for updateMs
1419
1420
  * - futures only support 100, 250 or 500ms for updateMs
1420
1421
  */
1421
- subscribePartialBookDepths(symbol, levels, updateMs, market) {
1422
+ subscribePartialBookDepths(symbol, levels, updateMs, market, wsKeyOverride) {
1422
1423
  const lowerCaseSymbol = symbol.toLowerCase();
1423
1424
  const streamName = 'depth';
1424
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1425
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1425
1426
  const updateMsSuffx = typeof updateMs === 'number' ? `@${updateMs}ms` : '';
1426
1427
  return this.subscribe(`${lowerCaseSymbol}@${streamName}${levels}${updateMsSuffx}`, wsKey);
1427
1428
  }
@@ -1433,19 +1434,19 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
1433
1434
  * - Spot: https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
1434
1435
  * - USDM Futures: https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
1435
1436
  */
1436
- subscribeDiffBookDepth(symbol, updateMs = 100, market) {
1437
+ subscribeDiffBookDepth(symbol, updateMs = 100, market, wsKeyOverride) {
1437
1438
  const lowerCaseSymbol = symbol.toLowerCase();
1438
1439
  const streamName = 'depth';
1439
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1440
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1440
1441
  const updateMsSuffx = typeof updateMs === 'number' ? `@${updateMs}ms` : '';
1441
1442
  return this.subscribe(`${lowerCaseSymbol}@${streamName}${updateMsSuffx}`, wsKey);
1442
1443
  }
1443
1444
  /**
1444
1445
  * Subscribe to best bid/ask for all symbols in spot markets.
1445
1446
  */
1446
- subscribeContractInfoStream(market) {
1447
+ subscribeContractInfoStream(market, wsKeyOverride) {
1447
1448
  const streamName = '!contractInfo';
1448
- const wsKey = (0, websocket_util_1.resolveWsKeyForLegacyMarket)(market);
1449
+ const wsKey = wsKeyOverride || (0, websocket_util_1.getWsKeyForProductGroup)(market, streamName);
1449
1450
  return this.subscribe(`${streamName}`, wsKey);
1450
1451
  }
1451
1452
  /**
@@ -1456,62 +1457,62 @@ class WebsocketClient extends BaseWSClient_1.BaseWebsocketClient {
1456
1457
  /**
1457
1458
  * Subscribe to aggregate trades for a symbol in spot markets.
1458
1459
  */
1459
- subscribeSpotAggregateTrades(symbol) {
1460
- return this.subscribeAggregateTrades(symbol, 'spot');
1460
+ subscribeSpotAggregateTrades(symbol, wsKeyOverride) {
1461
+ return this.subscribeAggregateTrades(symbol, 'spot', wsKeyOverride);
1461
1462
  }
1462
1463
  /**
1463
1464
  * Subscribe to trades for a symbol in spot markets.
1464
1465
  */
1465
- subscribeSpotTrades(symbol) {
1466
- return this.subscribeTrades(symbol, 'spot');
1466
+ subscribeSpotTrades(symbol, wsKeyOverride) {
1467
+ return this.subscribeTrades(symbol, 'spot', wsKeyOverride);
1467
1468
  }
1468
1469
  /**
1469
1470
  * Subscribe to candles for a symbol in spot markets.
1470
1471
  */
1471
- subscribeSpotKline(symbol, interval) {
1472
- return this.subscribeKlines(symbol, interval, 'spot');
1472
+ subscribeSpotKline(symbol, interval, wsKeyOverride) {
1473
+ return this.subscribeKlines(symbol, interval, 'spot', wsKeyOverride);
1473
1474
  }
1474
1475
  /**
1475
1476
  * Subscribe to mini 24hr ticker for a symbol in spot markets.
1476
1477
  */
1477
- subscribeSpotSymbolMini24hrTicker(symbol) {
1478
- return this.subscribeSymbolMini24hrTicker(symbol, 'spot');
1478
+ subscribeSpotSymbolMini24hrTicker(symbol, wsKeyOverride) {
1479
+ return this.subscribeSymbolMini24hrTicker(symbol, 'spot', wsKeyOverride);
1479
1480
  }
1480
1481
  /**
1481
1482
  * Subscribe to mini 24hr mini ticker in spot markets.
1482
1483
  */
1483
- subscribeSpotAllMini24hrTickers() {
1484
- return this.subscribeAllMini24hrTickers('spot');
1484
+ subscribeSpotAllMini24hrTickers(wsKeyOverride) {
1485
+ return this.subscribeAllMini24hrTickers('spot', wsKeyOverride);
1485
1486
  }
1486
1487
  /**
1487
1488
  * Subscribe to 24hr ticker for a symbol in spot markets.
1488
1489
  */
1489
- subscribeSpotSymbol24hrTicker(symbol) {
1490
- return this.subscribeSymbol24hrTicker(symbol, 'spot');
1490
+ subscribeSpotSymbol24hrTicker(symbol, wsKeyOverride) {
1491
+ return this.subscribeSymbol24hrTicker(symbol, 'spot', wsKeyOverride);
1491
1492
  }
1492
1493
  /**
1493
1494
  * Subscribe to 24hr ticker in spot markets.
1494
1495
  */
1495
- subscribeSpotAll24hrTickers() {
1496
- return this.subscribeAll24hrTickers('spot');
1496
+ subscribeSpotAll24hrTickers(wsKeyOverride) {
1497
+ return this.subscribeAll24hrTickers('spot', wsKeyOverride);
1497
1498
  }
1498
1499
  /**
1499
1500
  * Subscribe to best bid/ask for symbol in spot markets.
1500
1501
  */
1501
- subscribeSpotSymbolBookTicker(symbol) {
1502
- return this.subscribeSymbolBookTicker(symbol, 'spot');
1502
+ subscribeSpotSymbolBookTicker(symbol, wsKeyOverride) {
1503
+ return this.subscribeSymbolBookTicker(symbol, 'spot', wsKeyOverride);
1503
1504
  }
1504
1505
  /**
1505
1506
  * Subscribe to top bid/ask levels for symbol in spot markets.
1506
1507
  */
1507
- subscribeSpotPartialBookDepth(symbol, levels, updateMs = 1000) {
1508
- return this.subscribePartialBookDepths(symbol, levels, updateMs, 'spot');
1508
+ subscribeSpotPartialBookDepth(symbol, levels, updateMs = 1000, wsKeyOverride) {
1509
+ return this.subscribePartialBookDepths(symbol, levels, updateMs, 'spot', wsKeyOverride);
1509
1510
  }
1510
1511
  /**
1511
1512
  * Subscribe to spot orderbook depth updates to locally manage an order book.
1512
1513
  */
1513
- subscribeSpotDiffBookDepth(symbol, updateMs = 1000) {
1514
- return this.subscribeDiffBookDepth(symbol, updateMs, 'spot');
1514
+ subscribeSpotDiffBookDepth(symbol, updateMs = 1000, wsKeyOverride) {
1515
+ return this.subscribeDiffBookDepth(symbol, updateMs, 'spot', wsKeyOverride);
1515
1516
  }
1516
1517
  }
1517
1518
  exports.WebsocketClient = WebsocketClient;