ccxt 4.2.58 → 4.2.60

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +3 -3
  3. package/build.sh +1 -1
  4. package/cleanup.sh +3 -0
  5. package/dist/ccxt.browser.js +716 -382
  6. package/dist/ccxt.browser.min.js +3 -3
  7. package/dist/cjs/ccxt.js +1 -1
  8. package/dist/cjs/src/ascendex.js +10 -12
  9. package/dist/cjs/src/base/Exchange.js +2 -0
  10. package/dist/cjs/src/binance.js +2 -2
  11. package/dist/cjs/src/bingx.js +41 -3
  12. package/dist/cjs/src/bitfinex2.js +21 -4
  13. package/dist/cjs/src/bitget.js +10 -3
  14. package/dist/cjs/src/bitmart.js +41 -23
  15. package/dist/cjs/src/bitmex.js +1 -1
  16. package/dist/cjs/src/blofin.js +60 -2
  17. package/dist/cjs/src/coinbase.js +24 -14
  18. package/dist/cjs/src/hitbtc.js +1 -1
  19. package/dist/cjs/src/htx.js +4 -1
  20. package/dist/cjs/src/kraken.js +42 -39
  21. package/dist/cjs/src/kucoinfutures.js +1 -0
  22. package/dist/cjs/src/lbank.js +1 -1
  23. package/dist/cjs/src/mexc.js +1 -1
  24. package/dist/cjs/src/okx.js +1 -1
  25. package/dist/cjs/src/phemex.js +1 -1
  26. package/dist/cjs/src/pro/binance.js +17 -4
  27. package/dist/cjs/src/pro/bitfinex2.js +1 -1
  28. package/dist/cjs/src/pro/bitget.js +1 -1
  29. package/dist/cjs/src/pro/bitmart.js +51 -89
  30. package/dist/cjs/src/pro/bitvavo.js +1 -1
  31. package/dist/cjs/src/pro/bybit.js +1 -1
  32. package/dist/cjs/src/pro/coinex.js +1 -1
  33. package/dist/cjs/src/pro/cryptocom.js +1 -1
  34. package/dist/cjs/src/pro/deribit.js +201 -84
  35. package/dist/cjs/src/pro/gate.js +1 -1
  36. package/dist/cjs/src/pro/independentreserve.js +1 -1
  37. package/dist/cjs/src/pro/kraken.js +1 -1
  38. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  39. package/dist/cjs/src/pro/mexc.js +5 -3
  40. package/dist/cjs/src/pro/okx.js +1 -1
  41. package/dist/cjs/src/pro/woo.js +1 -1
  42. package/dist/cjs/src/wazirx.js +6 -1
  43. package/dist/cjs/src/woo.js +159 -79
  44. package/js/ccxt.d.ts +1 -1
  45. package/js/ccxt.js +1 -1
  46. package/js/src/abstract/blofin.d.ts +1 -0
  47. package/js/src/abstract/wazirx.d.ts +5 -0
  48. package/js/src/ascendex.d.ts +2 -2
  49. package/js/src/ascendex.js +10 -12
  50. package/js/src/base/Exchange.js +2 -0
  51. package/js/src/binance.js +2 -2
  52. package/js/src/bingx.d.ts +3 -1
  53. package/js/src/bingx.js +41 -3
  54. package/js/src/bitfinex2.js +21 -4
  55. package/js/src/bitget.js +10 -3
  56. package/js/src/bitmart.d.ts +9 -2
  57. package/js/src/bitmart.js +41 -23
  58. package/js/src/bitmex.js +1 -1
  59. package/js/src/blofin.d.ts +2 -1
  60. package/js/src/blofin.js +60 -2
  61. package/js/src/coinbase.js +24 -14
  62. package/js/src/hitbtc.js +1 -1
  63. package/js/src/htx.js +4 -1
  64. package/js/src/kraken.js +42 -39
  65. package/js/src/kucoinfutures.js +1 -0
  66. package/js/src/lbank.js +1 -1
  67. package/js/src/mexc.js +1 -1
  68. package/js/src/okx.js +1 -1
  69. package/js/src/phemex.js +1 -1
  70. package/js/src/pro/binance.js +17 -4
  71. package/js/src/pro/bitfinex2.js +1 -1
  72. package/js/src/pro/bitget.js +1 -1
  73. package/js/src/pro/bitmart.d.ts +2 -2
  74. package/js/src/pro/bitmart.js +51 -89
  75. package/js/src/pro/bitvavo.js +1 -1
  76. package/js/src/pro/bybit.js +1 -1
  77. package/js/src/pro/coinex.js +1 -1
  78. package/js/src/pro/cryptocom.js +1 -1
  79. package/js/src/pro/deribit.d.ts +5 -0
  80. package/js/src/pro/deribit.js +202 -85
  81. package/js/src/pro/gate.js +1 -1
  82. package/js/src/pro/independentreserve.js +1 -1
  83. package/js/src/pro/kraken.js +1 -1
  84. package/js/src/pro/kucoinfutures.js +1 -1
  85. package/js/src/pro/mexc.js +6 -4
  86. package/js/src/pro/okx.js +1 -1
  87. package/js/src/pro/woo.js +1 -1
  88. package/js/src/wazirx.js +6 -1
  89. package/js/src/woo.d.ts +8 -0
  90. package/js/src/woo.js +159 -79
  91. package/package.json +1 -1
  92. package/skip-tests.json +44 -18
package/js/src/kraken.js CHANGED
@@ -24,7 +24,10 @@ export default class kraken extends Exchange {
24
24
  'name': 'Kraken',
25
25
  'countries': ['US'],
26
26
  'version': '0',
27
- 'rateLimit': 3000,
27
+ // rate-limits: https://support.kraken.com/hc/en-us/articles/206548367-What-are-the-API-rate-limits-#1
28
+ // for public: 1 req/s
29
+ // for private: every second 0.33 weight added to your allowed capacity (some private endpoints need 1 weight, some need 2)
30
+ 'rateLimit': 1000,
28
31
  'certified': false,
29
32
  'pro': true,
30
33
  'has': {
@@ -154,7 +157,7 @@ export default class kraken extends Exchange {
154
157
  },
155
158
  'public': {
156
159
  'get': {
157
- // public endpoint rate-limits are described in article: https://support.kraken.com/hc/en-us/articles/206548367-What-are-the-API-rate-limits-#1
160
+ // rate-limits explained in comment in the top of this file
158
161
  'Assets': 1,
159
162
  'AssetPairs': 1,
160
163
  'Depth': 1,
@@ -170,48 +173,48 @@ export default class kraken extends Exchange {
170
173
  'post': {
171
174
  'AddOrder': 0,
172
175
  'AddOrderBatch': 0,
173
- 'AddExport': 1,
174
- 'Balance': 1,
175
- 'CancelAll': 1,
176
- 'CancelAllOrdersAfter': 1,
176
+ 'AddExport': 3,
177
+ 'Balance': 3,
178
+ 'CancelAll': 3,
179
+ 'CancelAllOrdersAfter': 3,
177
180
  'CancelOrder': 0,
178
181
  'CancelOrderBatch': 0,
179
- 'ClosedOrders': 1,
180
- 'DepositAddresses': 1,
181
- 'DepositMethods': 1,
182
- 'DepositStatus': 1,
182
+ 'ClosedOrders': 3,
183
+ 'DepositAddresses': 3,
184
+ 'DepositMethods': 3,
185
+ 'DepositStatus': 3,
183
186
  'EditOrder': 0,
184
- 'ExportStatus': 1,
185
- 'GetWebSocketsToken': 1,
186
- 'Ledgers': 2,
187
- 'OpenOrders': 1,
188
- 'OpenPositions': 1,
189
- 'QueryLedgers': 1,
190
- 'QueryOrders': 1,
191
- 'QueryTrades': 1,
192
- 'RetrieveExport': 1,
193
- 'RemoveExport': 1,
194
- 'BalanceEx': 1,
195
- 'TradeBalance': 1,
196
- 'TradesHistory': 2,
197
- 'TradeVolume': 1,
198
- 'Withdraw': 1,
199
- 'WithdrawCancel': 1,
200
- 'WithdrawInfo': 1,
201
- 'WithdrawMethods': 1,
202
- 'WithdrawAddresses': 1,
203
- 'WithdrawStatus': 1,
204
- 'WalletTransfer': 1,
187
+ 'ExportStatus': 3,
188
+ 'GetWebSocketsToken': 3,
189
+ 'Ledgers': 6,
190
+ 'OpenOrders': 3,
191
+ 'OpenPositions': 3,
192
+ 'QueryLedgers': 3,
193
+ 'QueryOrders': 3,
194
+ 'QueryTrades': 3,
195
+ 'RetrieveExport': 3,
196
+ 'RemoveExport': 3,
197
+ 'BalanceEx': 3,
198
+ 'TradeBalance': 3,
199
+ 'TradesHistory': 6,
200
+ 'TradeVolume': 3,
201
+ 'Withdraw': 3,
202
+ 'WithdrawCancel': 3,
203
+ 'WithdrawInfo': 3,
204
+ 'WithdrawMethods': 3,
205
+ 'WithdrawAddresses': 3,
206
+ 'WithdrawStatus': 3,
207
+ 'WalletTransfer': 3,
205
208
  // sub accounts
206
- 'CreateSubaccount': 1,
207
- 'AccountTransfer': 1,
209
+ 'CreateSubaccount': 3,
210
+ 'AccountTransfer': 3,
208
211
  // earn
209
- 'Earn/Allocate': 1,
210
- 'Earn/Deallocate': 1,
211
- 'Earn/AllocateStatus': 1,
212
- 'Earn/DeallocateStatus': 1,
213
- 'Earn/Strategies': 1,
214
- 'Earn/Allocations': 1,
212
+ 'Earn/Allocate': 3,
213
+ 'Earn/Deallocate': 3,
214
+ 'Earn/AllocateStatus': 3,
215
+ 'Earn/DeallocateStatus': 3,
216
+ 'Earn/Strategies': 3,
217
+ 'Earn/Allocations': 3,
215
218
  },
216
219
  },
217
220
  },
@@ -36,6 +36,7 @@ export default class kucoinfutures extends kucoin {
36
36
  'addMargin': true,
37
37
  'cancelAllOrders': true,
38
38
  'cancelOrder': true,
39
+ 'closeAllPositions': false,
39
40
  'closePosition': true,
40
41
  'closePositions': false,
41
42
  'createDepositAddress': true,
package/js/src/lbank.js CHANGED
@@ -2694,7 +2694,7 @@ export default class lbank extends Exchange {
2694
2694
  const uppercaseHash = hash.toUpperCase();
2695
2695
  let sign = undefined;
2696
2696
  if (signatureMethod === 'RSA') {
2697
- const cacheSecretAsPem = this.safeValue(this.options, 'cacheSecretAsPem', true);
2697
+ const cacheSecretAsPem = this.safeBool(this.options, 'cacheSecretAsPem', true);
2698
2698
  let pem = undefined;
2699
2699
  if (cacheSecretAsPem) {
2700
2700
  pem = this.safeValue(this.options, 'pem');
package/js/src/mexc.js CHANGED
@@ -5500,7 +5500,7 @@ export default class mexc extends Exchange {
5500
5500
  'source': this.safeString(this.options, 'broker', 'CCXT'),
5501
5501
  };
5502
5502
  }
5503
- if ((method === 'POST') || (method === 'PUT')) {
5503
+ if ((method === 'POST') || (method === 'PUT') || (method === 'DELETE')) {
5504
5504
  headers['Content-Type'] = 'application/json';
5505
5505
  }
5506
5506
  }
package/js/src/okx.js CHANGED
@@ -1560,7 +1560,7 @@ export default class okx extends Exchange {
1560
1560
  // while fetchCurrencies is a public API method by design
1561
1561
  // therefore we check the keys here
1562
1562
  // and fallback to generating the currencies from the markets
1563
- const isSandboxMode = this.safeValue(this.options, 'sandboxMode', false);
1563
+ const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
1564
1564
  if (!this.checkRequiredCredentials(false) || isSandboxMode) {
1565
1565
  return undefined;
1566
1566
  }
package/js/src/phemex.js CHANGED
@@ -2422,7 +2422,7 @@ export default class phemex extends Exchange {
2422
2422
  }
2423
2423
  parseOrder(order, market = undefined) {
2424
2424
  const isSwap = this.safeBool(market, 'swap', false);
2425
- const hasPnl = ('closedPnl' in order);
2425
+ const hasPnl = ('closedPnl' in order) || ('closedPnlRv' in order) || ('totalPnlRv' in order);
2426
2426
  if (isSwap || hasPnl) {
2427
2427
  return this.parseSwapOrder(order, market);
2428
2428
  }
@@ -2468,7 +2468,7 @@ export default class binance extends binanceRest {
2468
2468
  this.setBalanceCache(client, type, isPortfolioMargin);
2469
2469
  this.setPositionsCache(client, type, symbols, isPortfolioMargin);
2470
2470
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
2471
- const awaitPositionsSnapshot = this.safeValue('watchPositions', 'awaitPositionsSnapshot', true);
2471
+ const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
2472
2472
  const cache = this.safeValue(this.positions, type);
2473
2473
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
2474
2474
  const snapshot = await client.future(type + ':fetchPositionsSnapshot');
@@ -2602,8 +2602,21 @@ export default class binance extends binanceRest {
2602
2602
  // }
2603
2603
  //
2604
2604
  const marketId = this.safeString(position, 's');
2605
- const positionSide = this.safeStringLower(position, 'ps');
2606
- const hedged = positionSide !== 'both';
2605
+ const contracts = this.safeString(position, 'pa');
2606
+ const contractsAbs = Precise.stringAbs(this.safeString(position, 'pa'));
2607
+ let positionSide = this.safeStringLower(position, 'ps');
2608
+ let hedged = true;
2609
+ if (positionSide === 'both') {
2610
+ hedged = false;
2611
+ if (!Precise.stringEq(contracts, '0')) {
2612
+ if (Precise.stringLt(contracts, '0')) {
2613
+ positionSide = 'short';
2614
+ }
2615
+ else {
2616
+ positionSide = 'long';
2617
+ }
2618
+ }
2619
+ }
2607
2620
  return this.safePosition({
2608
2621
  'info': position,
2609
2622
  'id': undefined,
@@ -2614,7 +2627,7 @@ export default class binance extends binanceRest {
2614
2627
  'entryPrice': this.safeNumber(position, 'ep'),
2615
2628
  'unrealizedPnl': this.safeNumber(position, 'up'),
2616
2629
  'percentage': undefined,
2617
- 'contracts': this.safeNumber(position, 'pa'),
2630
+ 'contracts': this.parseNumber(contractsAbs),
2618
2631
  'contractSize': undefined,
2619
2632
  'markPrice': undefined,
2620
2633
  'side': positionSide,
@@ -56,7 +56,7 @@ export default class bitfinex2 extends bitfinex2Rest {
56
56
  'symbol': marketId,
57
57
  };
58
58
  const result = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash, { 'checksum': false });
59
- const checksum = this.safeValue(this.options, 'checksum', true);
59
+ const checksum = this.safeBool(this.options, 'checksum', true);
60
60
  if (checksum && !client.subscriptions[messageHash]['checksum'] && (channel === 'book')) {
61
61
  client.subscriptions[messageHash]['checksum'] = true;
62
62
  await client.send({
@@ -539,7 +539,7 @@ export default class bitget extends bitgetRest {
539
539
  this.handleDeltas(storedOrderBook['bids'], bids);
540
540
  storedOrderBook['timestamp'] = timestamp;
541
541
  storedOrderBook['datetime'] = this.iso8601(timestamp);
542
- const checksum = this.safeValue(this.options, 'checksum', true);
542
+ const checksum = this.safeBool(this.options, 'checksum', true);
543
543
  const isSnapshot = this.safeString(message, 'action') === 'snapshot'; // snapshot does not have a checksum
544
544
  if (!isSnapshot && checksum) {
545
545
  const storedAsks = storedOrderBook['asks'];
@@ -4,7 +4,7 @@ import Client from '../base/ws/Client.js';
4
4
  export default class bitmart extends bitmartRest {
5
5
  describe(): any;
6
6
  subscribe(channel: any, symbol: any, type: any, params?: {}): Promise<any>;
7
- subscribeMultiple(channel: string, type: string, symbols: string[], params?: {}): Promise<any>;
7
+ subscribeMultiple(channel: string, type: string, symbols?: Strings, params?: {}): Promise<any>;
8
8
  watchBalance(params?: {}): Promise<Balances>;
9
9
  setBalanceCache(client: Client, type: any, subscribeHash: any): void;
10
10
  loadBalanceSnapshot(client: any, messageHash: any, type: any): Promise<void>;
@@ -23,9 +23,9 @@ export default class bitmart extends bitmartRest {
23
23
  handlePositions(client: Client, message: any): void;
24
24
  parseWsPosition(position: any, market?: Market): Position;
25
25
  handleTrade(client: Client, message: any): void;
26
+ handleTradeLoop(entry: any): string;
26
27
  parseWsTrade(trade: any, market?: Market): Trade;
27
28
  handleTicker(client: Client, message: any): void;
28
- resolveMessageHashesForSymbol(client: any, symbol: any, result: any, prexif: any): void;
29
29
  parseWsSwapTicker(ticker: any, market?: Market): Ticker;
30
30
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
31
31
  handleOHLCV(client: Client, message: any): void;
@@ -110,11 +110,12 @@ export default class bitmart extends bitmartRest {
110
110
  }
111
111
  return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
112
112
  }
113
- async subscribeMultiple(channel, type, symbols, params = {}) {
113
+ async subscribeMultiple(channel, type, symbols = undefined, params = {}) {
114
+ symbols = this.marketSymbols(symbols, type, false, true);
114
115
  const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
115
116
  const channelType = (type === 'spot') ? 'spot' : 'futures';
116
117
  const actionType = (type === 'spot') ? 'op' : 'action';
117
- const rawSubscriptions = [];
118
+ let rawSubscriptions = [];
118
119
  const messageHashes = [];
119
120
  for (let i = 0; i < symbols.length; i++) {
120
121
  const market = this.market(symbols[i]);
@@ -122,6 +123,10 @@ export default class bitmart extends bitmartRest {
122
123
  rawSubscriptions.push(message);
123
124
  messageHashes.push(channel + ':' + market['symbol']);
124
125
  }
126
+ // as an exclusion, futures "tickers" need one generic request for all symbols
127
+ if ((type !== 'spot') && (channel === 'ticker')) {
128
+ rawSubscriptions = [channelType + '/' + channel];
129
+ }
125
130
  const request = {
126
131
  'args': rawSubscriptions,
127
132
  };
@@ -324,13 +329,8 @@ export default class bitmart extends bitmartRest {
324
329
  */
325
330
  await this.loadMarkets();
326
331
  symbol = this.symbol(symbol);
327
- const market = this.market(symbol);
328
- let type = 'spot';
329
- [type, params] = this.handleMarketTypeAndParams('watchTicker', market, params);
330
- if (type === 'swap') {
331
- throw new NotSupported(this.id + ' watchTicker() does not support ' + type + ' markets. Use watchTickers() instead');
332
- }
333
- return await this.subscribe('ticker', symbol, type, params);
332
+ const tickers = await this.watchTickers([symbol], params);
333
+ return tickers[symbol];
334
334
  }
335
335
  async watchTickers(symbols = undefined, params = {}) {
336
336
  /**
@@ -344,40 +344,12 @@ export default class bitmart extends bitmartRest {
344
344
  */
345
345
  await this.loadMarkets();
346
346
  const market = this.getMarketFromSymbols(symbols);
347
- let type = 'spot';
348
- [type, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
349
- const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
350
- symbols = this.marketSymbols(symbols);
351
- let messageHash = 'tickers::' + type;
352
- if (symbols !== undefined) {
353
- messageHash += '::' + symbols.join(',');
354
- }
355
- let request = undefined;
356
- let tickers = undefined;
357
- const isSpot = (type === 'spot');
358
- if (isSpot) {
359
- if (symbols === undefined) {
360
- throw new ArgumentsRequired(this.id + ' watchTickers() for ' + type + ' market type requires symbols argument to be provided');
361
- }
362
- const marketIds = this.marketIds(symbols);
363
- const finalArray = [];
364
- for (let i = 0; i < marketIds.length; i++) {
365
- finalArray.push('spot/ticker:' + marketIds[i]);
366
- }
367
- request = {
368
- 'op': 'subscribe',
369
- 'args': finalArray,
370
- };
371
- tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
372
- }
373
- else {
374
- request = {
375
- 'action': 'subscribe',
376
- 'args': ['futures/ticker'],
377
- };
378
- tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
379
- }
347
+ let marketType = undefined;
348
+ [marketType, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
349
+ const ticker = await this.subscribeMultiple('ticker', marketType, symbols, params);
380
350
  if (this.newUpdates) {
351
+ const tickers = {};
352
+ tickers[ticker['symbol']] = ticker;
381
353
  return tickers;
382
354
  }
383
355
  return this.filterByArray(this.tickers, 'symbol', symbols);
@@ -853,21 +825,34 @@ export default class bitmart extends bitmartRest {
853
825
  if (data === undefined) {
854
826
  return;
855
827
  }
856
- let stored = undefined;
857
828
  let symbol = undefined;
858
- for (let i = 0; i < data.length; i++) {
859
- const trade = this.parseWsTrade(data[i]);
860
- symbol = trade['symbol'];
861
- const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
862
- stored = this.safeValue(this.trades, symbol);
863
- if (stored === undefined) {
864
- stored = new ArrayCache(tradesLimit);
865
- this.trades[symbol] = stored;
829
+ const length = data.length;
830
+ const isSwap = ('group' in message);
831
+ if (isSwap) {
832
+ // in swap, chronologically decreasing: 1709536849322, 1709536848954,
833
+ const maxLen = Math.max(length - 1, 0);
834
+ for (let i = maxLen; i >= 0; i--) {
835
+ symbol = this.handleTradeLoop(data[i]);
836
+ }
837
+ }
838
+ else {
839
+ // in spot, chronologically increasing: 1709536771200, 1709536771226,
840
+ for (let i = 0; i < length; i++) {
841
+ symbol = this.handleTradeLoop(data[i]);
866
842
  }
867
- stored.append(trade);
868
843
  }
869
- const messageHash = 'trade:' + symbol;
870
- client.resolve(stored, messageHash);
844
+ client.resolve(this.trades[symbol], 'trade:' + symbol);
845
+ }
846
+ handleTradeLoop(entry) {
847
+ const trade = this.parseWsTrade(entry);
848
+ const symbol = trade['symbol'];
849
+ const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
850
+ if (this.safeValue(this.trades, symbol) === undefined) {
851
+ this.trades[symbol] = new ArrayCache(tradesLimit);
852
+ }
853
+ const stored = this.trades[symbol];
854
+ stored.append(trade);
855
+ return symbol;
871
856
  }
872
857
  parseWsTrade(trade, market = undefined) {
873
858
  // spot
@@ -946,45 +931,22 @@ export default class bitmart extends bitmartRest {
946
931
  //
947
932
  const table = this.safeString(message, 'table');
948
933
  const isSpot = (table !== undefined);
949
- const data = this.safeValue(message, 'data');
950
- if (data === undefined) {
951
- return;
952
- }
934
+ let rawTickers = [];
953
935
  if (isSpot) {
954
- for (let i = 0; i < data.length; i++) {
955
- const ticker = this.parseTicker(data[i]);
956
- const symbol = ticker['symbol'];
957
- const marketId = this.safeString(ticker['info'], 'symbol');
958
- const messageHash = table + ':' + marketId;
959
- this.tickers[symbol] = ticker;
960
- client.resolve(ticker, messageHash);
961
- this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
962
- }
936
+ rawTickers = this.safeList(message, 'data', []);
963
937
  }
964
938
  else {
965
- // on each update for contract markets, single ticker is provided
966
- const ticker = this.parseWsSwapTicker(data);
967
- const symbol = this.safeString(ticker, 'symbol');
968
- this.tickers[symbol] = ticker;
969
- client.resolve(ticker, 'tickers::swap');
970
- this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
939
+ rawTickers = [this.safeValue(message, 'data', {})];
971
940
  }
972
- }
973
- resolveMessageHashesForSymbol(client, symbol, result, prexif) {
974
- const prefixSeparator = '::';
975
- const symbolsSeparator = ',';
976
- const messageHashes = this.findMessageHashes(client, prexif);
977
- for (let i = 0; i < messageHashes.length; i++) {
978
- const messageHash = messageHashes[i];
979
- const parts = messageHash.split(prefixSeparator);
980
- const length = parts.length;
981
- const symbolsString = parts[length - 1];
982
- const symbols = symbolsString.split(symbolsSeparator);
983
- if (this.inArray(symbol, symbols)) {
984
- const response = {};
985
- response[symbol] = result;
986
- client.resolve(response, messageHash);
987
- }
941
+ if (!rawTickers.length) {
942
+ return;
943
+ }
944
+ for (let i = 0; i < rawTickers.length; i++) {
945
+ const ticker = isSpot ? this.parseTicker(rawTickers[i]) : this.parseWsSwapTicker(rawTickers[i]);
946
+ const symbol = ticker['symbol'];
947
+ this.tickers[symbol] = ticker;
948
+ const messageHash = 'ticker:' + symbol;
949
+ client.resolve(ticker, messageHash);
988
950
  }
989
951
  }
990
952
  parseWsSwapTicker(ticker, market = undefined) {
@@ -1087,7 +1087,7 @@ export default class bitvavo extends bitvavoRest {
1087
1087
  return messageHash;
1088
1088
  }
1089
1089
  checkMessageHashDoesNotExist(messageHash) {
1090
- const supressMultipleWsRequestsError = this.safeValue(this.options, 'supressMultipleWsRequestsError', false);
1090
+ const supressMultipleWsRequestsError = this.safeBool(this.options, 'supressMultipleWsRequestsError', false);
1091
1091
  if (!supressMultipleWsRequestsError) {
1092
1092
  const client = this.safeValue(this.clients, this.urls['api']['ws']);
1093
1093
  if (client !== undefined) {
@@ -942,7 +942,7 @@ export default class bybit extends bybitRest {
942
942
  this.setPositionsCache(client, symbols);
943
943
  const cache = this.positions;
944
944
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
945
- const awaitPositionsSnapshot = this.safeValue('watchPositions', 'awaitPositionsSnapshot', true);
945
+ const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
946
946
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
947
947
  const snapshot = await client.future('fetchPositionsSnapshot');
948
948
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
@@ -549,7 +549,7 @@ export default class coinex extends coinexRest {
549
549
  }
550
550
  const url = this.urls['api']['ws'][type];
551
551
  const messageHash = 'ohlcv';
552
- const watchOHLCVWarning = this.safeValue(this.options, 'watchOHLCVWarning', true);
552
+ const watchOHLCVWarning = this.safeBool(this.options, 'watchOHLCVWarning', true);
553
553
  const client = this.safeValue(this.clients, url, {});
554
554
  const clientSub = this.safeValue(client, 'subscriptions', {});
555
555
  const existingSubscription = this.safeValue(clientSub, messageHash);
@@ -556,7 +556,7 @@ export default class cryptocom extends cryptocomRest {
556
556
  const client = this.client(url);
557
557
  this.setPositionsCache(client, symbols);
558
558
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
559
- const awaitPositionsSnapshot = this.safeValue('watchPositions', 'awaitPositionsSnapshot', true);
559
+ const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
560
560
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
561
561
  const snapshot = await client.future('fetchPositionsSnapshot');
562
562
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
@@ -9,10 +9,12 @@ export default class deribit extends deribitRest {
9
9
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
10
10
  handleTicker(client: Client, message: any): void;
11
11
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
12
+ watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
12
13
  handleTrades(client: Client, message: any): void;
13
14
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
14
15
  handleMyTrades(client: Client, message: any): void;
15
16
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
17
+ watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
16
18
  handleOrderBook(client: Client, message: any): void;
17
19
  cleanOrderBook(data: any): any;
18
20
  handleDelta(bookside: any, delta: any): void;
@@ -20,7 +22,10 @@ export default class deribit extends deribitRest {
20
22
  watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
21
23
  handleOrders(client: Client, message: any): void;
22
24
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
25
+ watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<OHLCV[]>>>;
23
26
  handleOHLCV(client: Client, message: any): void;
27
+ parseWsOHLCV(ohlcv: any, market?: any): OHLCV;
28
+ watchMultipleWrapper(channelName: string, channelDescriptor: Str, symbolsArray?: any, params?: {}): Promise<any>;
24
29
  handleMessage(client: Client, message: any): void;
25
30
  handleAuthenticationMessage(client: Client, message: any): any;
26
31
  authenticate(params?: {}): Promise<any>;