ccxt 4.2.28 → 4.2.30

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 (158) hide show
  1. package/CONTRIBUTING.md +4 -1
  2. package/README.md +6 -6
  3. package/dist/ccxt.browser.js +1865 -558
  4. package/dist/ccxt.browser.min.js +7 -7
  5. package/dist/cjs/ccxt.js +3 -1
  6. package/dist/cjs/src/ascendex.js +5 -5
  7. package/dist/cjs/src/base/Exchange.js +114 -21
  8. package/dist/cjs/src/base/errors.js +3 -3
  9. package/dist/cjs/src/base/functions/type.js +12 -0
  10. package/dist/cjs/src/bigone.js +2 -2
  11. package/dist/cjs/src/binance.js +896 -217
  12. package/dist/cjs/src/bingx.js +1 -1
  13. package/dist/cjs/src/bitfinex.js +1 -1
  14. package/dist/cjs/src/bitfinex2.js +52 -62
  15. package/dist/cjs/src/bitget.js +8 -4
  16. package/dist/cjs/src/bitmart.js +3 -3
  17. package/dist/cjs/src/bitmex.js +9 -6
  18. package/dist/cjs/src/bitrue.js +1 -1
  19. package/dist/cjs/src/bitso.js +1 -1
  20. package/dist/cjs/src/bitteam.js +2 -2
  21. package/dist/cjs/src/btcalpha.js +1 -1
  22. package/dist/cjs/src/bybit.js +28 -12
  23. package/dist/cjs/src/coinbase.js +12 -5
  24. package/dist/cjs/src/coincheck.js +1 -1
  25. package/dist/cjs/src/coinex.js +2 -2
  26. package/dist/cjs/src/coinlist.js +1 -1
  27. package/dist/cjs/src/coinmate.js +1 -1
  28. package/dist/cjs/src/coinmetro.js +12 -6
  29. package/dist/cjs/src/coinsph.js +1 -1
  30. package/dist/cjs/src/cryptocom.js +3 -3
  31. package/dist/cjs/src/digifinex.js +6 -4
  32. package/dist/cjs/src/exmo.js +2 -2
  33. package/dist/cjs/src/gate.js +5 -5
  34. package/dist/cjs/src/gemini.js +3 -3
  35. package/dist/cjs/src/hitbtc.js +14 -20
  36. package/dist/cjs/src/hollaex.js +2 -2
  37. package/dist/cjs/src/htx.js +5 -5
  38. package/dist/cjs/src/huobijp.js +1 -1
  39. package/dist/cjs/src/krakenfutures.js +1 -1
  40. package/dist/cjs/src/kucoin.js +17 -17
  41. package/dist/cjs/src/kucoinfutures.js +3 -3
  42. package/dist/cjs/src/lbank.js +1 -1
  43. package/dist/cjs/src/mexc.js +7 -7
  44. package/dist/cjs/src/novadax.js +1 -1
  45. package/dist/cjs/src/okcoin.js +2 -2
  46. package/dist/cjs/src/okx.js +24 -10
  47. package/dist/cjs/src/p2b.js +1 -0
  48. package/dist/cjs/src/phemex.js +3 -3
  49. package/dist/cjs/src/poloniexfutures.js +3 -3
  50. package/dist/cjs/src/pro/alpaca.js +1 -1
  51. package/dist/cjs/src/pro/binance.js +4 -4
  52. package/dist/cjs/src/pro/bitget.js +1 -1
  53. package/dist/cjs/src/pro/bitmart.js +1 -1
  54. package/dist/cjs/src/pro/bitmex.js +49 -6
  55. package/dist/cjs/src/pro/bitvavo.js +1 -1
  56. package/dist/cjs/src/pro/bybit.js +2 -2
  57. package/dist/cjs/src/pro/cex.js +2 -2
  58. package/dist/cjs/src/pro/coinbase.js +1 -1
  59. package/dist/cjs/src/pro/independentreserve.js +1 -1
  60. package/dist/cjs/src/pro/okx.js +1 -1
  61. package/dist/cjs/src/pro/onetrading.js +2 -2
  62. package/dist/cjs/src/pro/p2b.js +432 -0
  63. package/dist/cjs/src/pro/probit.js +5 -5
  64. package/dist/cjs/src/pro/whitebit.js +1 -1
  65. package/dist/cjs/src/probit.js +1 -1
  66. package/dist/cjs/src/timex.js +1 -1
  67. package/dist/cjs/src/tokocrypto.js +3 -3
  68. package/dist/cjs/src/wavesexchange.js +2 -2
  69. package/dist/cjs/src/whitebit.js +2 -2
  70. package/dist/cjs/src/woo.js +3 -3
  71. package/dist/cjs/src/yobit.js +1 -1
  72. package/dist/cjs/src/zaif.js +1 -1
  73. package/dist/cjs/src/zonda.js +3 -3
  74. package/js/ccxt.d.ts +4 -1
  75. package/js/ccxt.js +3 -1
  76. package/js/src/abstract/bybit.d.ts +2 -2
  77. package/js/src/abstract/okx.d.ts +1 -0
  78. package/js/src/ascendex.js +5 -5
  79. package/js/src/base/Exchange.d.ts +10 -1
  80. package/js/src/base/Exchange.js +114 -21
  81. package/js/src/base/errorHierarchy.d.ts +7 -6
  82. package/js/src/base/errorHierarchy.js +7 -6
  83. package/js/src/base/errors.d.ts +3 -3
  84. package/js/src/base/errors.js +3 -3
  85. package/js/src/base/functions/type.js +12 -0
  86. package/js/src/bigone.js +2 -2
  87. package/js/src/binance.d.ts +1 -0
  88. package/js/src/binance.js +897 -218
  89. package/js/src/bingx.js +1 -1
  90. package/js/src/bitfinex.js +1 -1
  91. package/js/src/bitfinex2.js +52 -62
  92. package/js/src/bitget.js +8 -4
  93. package/js/src/bitmart.js +3 -3
  94. package/js/src/bitmex.js +9 -6
  95. package/js/src/bitrue.js +1 -1
  96. package/js/src/bitso.d.ts +1 -1
  97. package/js/src/bitso.js +1 -1
  98. package/js/src/bitteam.js +2 -2
  99. package/js/src/btcalpha.js +1 -1
  100. package/js/src/bybit.js +28 -12
  101. package/js/src/coinbase.js +12 -5
  102. package/js/src/coincheck.js +1 -1
  103. package/js/src/coinex.js +2 -2
  104. package/js/src/coinlist.js +1 -1
  105. package/js/src/coinmate.js +1 -1
  106. package/js/src/coinmetro.d.ts +1 -1
  107. package/js/src/coinmetro.js +12 -6
  108. package/js/src/coinsph.js +1 -1
  109. package/js/src/cryptocom.js +3 -3
  110. package/js/src/digifinex.js +6 -4
  111. package/js/src/exmo.js +2 -2
  112. package/js/src/gate.js +5 -5
  113. package/js/src/gemini.d.ts +1 -1
  114. package/js/src/gemini.js +3 -3
  115. package/js/src/hitbtc.js +14 -20
  116. package/js/src/hollaex.js +2 -2
  117. package/js/src/htx.js +5 -5
  118. package/js/src/huobijp.js +1 -1
  119. package/js/src/krakenfutures.js +1 -1
  120. package/js/src/kucoin.js +17 -17
  121. package/js/src/kucoinfutures.js +3 -3
  122. package/js/src/lbank.js +1 -1
  123. package/js/src/mexc.js +7 -7
  124. package/js/src/novadax.js +1 -1
  125. package/js/src/okcoin.js +2 -2
  126. package/js/src/okx.js +24 -10
  127. package/js/src/p2b.js +1 -0
  128. package/js/src/phemex.js +3 -3
  129. package/js/src/poloniexfutures.js +3 -3
  130. package/js/src/pro/alpaca.js +1 -1
  131. package/js/src/pro/binance.js +4 -4
  132. package/js/src/pro/bitget.js +1 -1
  133. package/js/src/pro/bitmart.js +1 -1
  134. package/js/src/pro/bitmex.d.ts +2 -1
  135. package/js/src/pro/bitmex.js +49 -6
  136. package/js/src/pro/bitvavo.js +1 -1
  137. package/js/src/pro/bybit.js +2 -2
  138. package/js/src/pro/cex.js +2 -2
  139. package/js/src/pro/coinbase.js +2 -2
  140. package/js/src/pro/independentreserve.js +1 -1
  141. package/js/src/pro/okx.js +1 -1
  142. package/js/src/pro/onetrading.js +2 -2
  143. package/js/src/pro/p2b.d.ts +23 -0
  144. package/js/src/pro/p2b.js +433 -0
  145. package/js/src/pro/probit.js +5 -5
  146. package/js/src/pro/whitebit.js +1 -1
  147. package/js/src/probit.js +1 -1
  148. package/js/src/timex.js +1 -1
  149. package/js/src/tokocrypto.js +3 -3
  150. package/js/src/wavesexchange.js +2 -2
  151. package/js/src/whitebit.js +2 -2
  152. package/js/src/woo.js +3 -3
  153. package/js/src/yobit.js +1 -1
  154. package/js/src/zaif.js +1 -1
  155. package/js/src/zonda.d.ts +1 -1
  156. package/js/src/zonda.js +3 -3
  157. package/package.json +1 -1
  158. package/skip-tests.json +3 -10
@@ -172,6 +172,7 @@ class okx extends okx$1 {
172
172
  'api': {
173
173
  'public': {
174
174
  'get': {
175
+ 'market/books-full': 2,
175
176
  'market/tickers': 1,
176
177
  'market/ticker': 1,
177
178
  'market/index-tickers': 1,
@@ -1670,6 +1671,7 @@ class okx extends okx$1 {
1670
1671
  * @param {string} symbol unified symbol of the market to fetch the order book for
1671
1672
  * @param {int} [limit] the maximum amount of order book entries to return
1672
1673
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1674
+ * @param {string} [params.method] 'publicGetMarketBooksFull' or 'publicGetMarketBooks' default is 'publicGetMarketBooks'
1673
1675
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1674
1676
  */
1675
1677
  await this.loadMarkets();
@@ -1677,11 +1679,22 @@ class okx extends okx$1 {
1677
1679
  const request = {
1678
1680
  'instId': market['id'],
1679
1681
  };
1680
- limit = (limit === undefined) ? 20 : limit;
1682
+ let method = undefined;
1683
+ [method, params] = this.handleOptionAndParams(params, 'fetchOrderBook', 'method', 'publicGetMarketBooks');
1684
+ if (method === 'publicGetMarketBooksFull' && limit === undefined) {
1685
+ limit = 5000;
1686
+ }
1687
+ limit = (limit === undefined) ? 100 : limit;
1681
1688
  if (limit !== undefined) {
1682
1689
  request['sz'] = limit; // max 400
1683
1690
  }
1684
- const response = await this.publicGetMarketBooks(this.extend(request, params));
1691
+ let response = undefined;
1692
+ if ((method === 'publicGetMarketBooksFull') || (limit > 400)) {
1693
+ response = await this.publicGetMarketBooksFull(this.extend(request, params));
1694
+ }
1695
+ else {
1696
+ response = await this.publicGetMarketBooks(this.extend(request, params));
1697
+ }
1685
1698
  //
1686
1699
  // {
1687
1700
  // "code": "0",
@@ -1735,7 +1748,7 @@ class okx extends okx$1 {
1735
1748
  const symbol = market['symbol'];
1736
1749
  const last = this.safeString(ticker, 'last');
1737
1750
  const open = this.safeString(ticker, 'open24h');
1738
- const spot = this.safeValue(market, 'spot', false);
1751
+ const spot = this.safeBool(market, 'spot', false);
1739
1752
  const quoteVolume = spot ? this.safeString(ticker, 'volCcy24h') : undefined;
1740
1753
  const baseVolume = this.safeString(ticker, 'vol24h');
1741
1754
  const high = this.safeString(ticker, 'high24h');
@@ -2125,7 +2138,8 @@ class okx extends okx$1 {
2125
2138
  if (since < historyBorder) {
2126
2139
  defaultType = 'HistoryCandles';
2127
2140
  }
2128
- request['before'] = since;
2141
+ const startTime = Math.max(since - 1, 0);
2142
+ request['before'] = startTime;
2129
2143
  request['after'] = this.sum(since, durationInMilliseconds * limit);
2130
2144
  }
2131
2145
  const until = this.safeInteger(params, 'until');
@@ -2591,7 +2605,7 @@ class okx extends okx$1 {
2591
2605
  }
2592
2606
  else {
2593
2607
  marginMode = defaultMarginMode;
2594
- margin = this.safeValue(params, 'margin', false);
2608
+ margin = this.safeBool(params, 'margin', false);
2595
2609
  }
2596
2610
  if (spot) {
2597
2611
  if (margin) {
@@ -3090,7 +3104,7 @@ class okx extends okx$1 {
3090
3104
  throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
3091
3105
  }
3092
3106
  const stop = this.safeValue2(params, 'stop', 'trigger');
3093
- const trailing = this.safeValue(params, 'trailing', false);
3107
+ const trailing = this.safeBool(params, 'trailing', false);
3094
3108
  if (stop || trailing) {
3095
3109
  const orderInner = await this.cancelOrders([id], symbol, params);
3096
3110
  return this.safeValue(orderInner, 0);
@@ -3158,7 +3172,7 @@ class okx extends okx$1 {
3158
3172
  const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
3159
3173
  const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
3160
3174
  const stop = this.safeValue2(params, 'stop', 'trigger');
3161
- const trailing = this.safeValue(params, 'trailing', false);
3175
+ const trailing = this.safeBool(params, 'trailing', false);
3162
3176
  if (stop || trailing) {
3163
3177
  method = 'privatePostTradeCancelAlgos';
3164
3178
  }
@@ -3657,7 +3671,7 @@ class okx extends okx$1 {
3657
3671
  let method = this.safeString(params, 'method', defaultMethod);
3658
3672
  const ordType = this.safeString(params, 'ordType');
3659
3673
  const stop = this.safeValue2(params, 'stop', 'trigger');
3660
- const trailing = this.safeValue(params, 'trailing', false);
3674
+ const trailing = this.safeBool(params, 'trailing', false);
3661
3675
  if (trailing || stop || (ordType in algoOrderTypes)) {
3662
3676
  method = 'privateGetTradeOrdersAlgoPending';
3663
3677
  }
@@ -3826,7 +3840,7 @@ class okx extends okx$1 {
3826
3840
  let method = this.safeString(params, 'method', defaultMethod);
3827
3841
  const ordType = this.safeString(params, 'ordType');
3828
3842
  const stop = this.safeValue2(params, 'stop', 'trigger');
3829
- const trailing = this.safeValue(params, 'trailing', false);
3843
+ const trailing = this.safeBool(params, 'trailing', false);
3830
3844
  if (trailing) {
3831
3845
  method = 'privateGetTradeOrdersAlgoHistory';
3832
3846
  request['ordType'] = 'move_order_stop';
@@ -4020,7 +4034,7 @@ class okx extends okx$1 {
4020
4034
  let method = this.safeString(params, 'method', defaultMethod);
4021
4035
  const ordType = this.safeString(params, 'ordType');
4022
4036
  const stop = this.safeValue2(params, 'stop', 'trigger');
4023
- const trailing = this.safeValue(params, 'trailing', false);
4037
+ const trailing = this.safeBool(params, 'trailing', false);
4024
4038
  if (trailing || stop || (ordType in algoOrderTypes)) {
4025
4039
  method = 'privateGetTradeOrdersAlgoHistory';
4026
4040
  request['state'] = 'effective';
@@ -19,6 +19,7 @@ class p2b extends p2b$1 {
19
19
  'countries': ['LT'],
20
20
  'rateLimit': 100,
21
21
  'version': 'v2',
22
+ 'pro': true,
22
23
  'has': {
23
24
  'CORS': undefined,
24
25
  'spot': true,
@@ -2417,7 +2417,7 @@ class phemex extends phemex$1 {
2417
2417
  });
2418
2418
  }
2419
2419
  parseOrder(order, market = undefined) {
2420
- const isSwap = this.safeValue(market, 'swap', false);
2420
+ const isSwap = this.safeBool(market, 'swap', false);
2421
2421
  const hasPnl = ('closedPnl' in order);
2422
2422
  if (isSwap || hasPnl) {
2423
2423
  return this.parseSwapOrder(order, market);
@@ -4329,7 +4329,7 @@ class phemex extends phemex$1 {
4329
4329
  throw new errors.BadRequest(this.id + ' setLeverage() leverage should be between -100 and 100');
4330
4330
  }
4331
4331
  await this.loadMarkets();
4332
- const isHedged = this.safeValue(params, 'hedged', false);
4332
+ const isHedged = this.safeBool(params, 'hedged', false);
4333
4333
  const longLeverageRr = this.safeInteger(params, 'longLeverageRr');
4334
4334
  const shortLeverageRr = this.safeInteger(params, 'shortLeverageRr');
4335
4335
  const market = this.market(symbol);
@@ -4425,7 +4425,7 @@ class phemex extends phemex$1 {
4425
4425
  transfer = this.parseTransfer(response);
4426
4426
  }
4427
4427
  const transferOptions = this.safeValue(this.options, 'transfer', {});
4428
- const fillResponseFromRequest = this.safeValue(transferOptions, 'fillResponseFromRequest', true);
4428
+ const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
4429
4429
  if (fillResponseFromRequest) {
4430
4430
  if (transfer['fromAccount'] === undefined) {
4431
4431
  transfer['fromAccount'] = fromAccount;
@@ -861,7 +861,7 @@ class poloniexfutures extends poloniexfutures$1 {
861
861
  request['timeInForce'] = timeInForce;
862
862
  }
863
863
  }
864
- const postOnly = this.safeValue(params, 'postOnly', false);
864
+ const postOnly = this.safeBool(params, 'postOnly', false);
865
865
  const hidden = this.safeValue(params, 'hidden');
866
866
  if (postOnly && (hidden !== undefined)) {
867
867
  throw new errors.BadRequest(this.id + ' createOrder() does not support the postOnly parameter together with a hidden parameter');
@@ -1552,8 +1552,8 @@ class poloniexfutures extends poloniexfutures$1 {
1552
1552
  // precision reported by their api is 8 d.p.
1553
1553
  // const average = Precise.stringDiv (rawCost, Precise.stringMul (filled, market['contractSize']));
1554
1554
  // bool
1555
- const isActive = this.safeValue(order, 'isActive', false);
1556
- const cancelExist = this.safeValue(order, 'cancelExist', false);
1555
+ const isActive = this.safeBool(order, 'isActive', false);
1556
+ const cancelExist = this.safeBool(order, 'cancelExist', false);
1557
1557
  const status = isActive ? 'open' : 'closed';
1558
1558
  let id = this.safeString(order, 'id');
1559
1559
  if ('cancelledOrderIds' in order) {
@@ -224,7 +224,7 @@ class alpaca extends alpaca$1 {
224
224
  const symbol = this.safeSymbol(marketId);
225
225
  const datetime = this.safeString(message, 't');
226
226
  const timestamp = this.parse8601(datetime);
227
- const isSnapshot = this.safeValue(message, 'r', false);
227
+ const isSnapshot = this.safeBool(message, 'r', false);
228
228
  let orderbook = this.safeValue(this.orderbooks, symbol);
229
229
  if (orderbook === undefined) {
230
230
  orderbook = this.orderBook();
@@ -1270,7 +1270,7 @@ class binance extends binance$1 {
1270
1270
  return undefined;
1271
1271
  }
1272
1272
  const options = this.safeValue(this.options, 'watchBalance');
1273
- const fetchBalanceSnapshot = this.safeValue(options, 'fetchBalanceSnapshot', false);
1273
+ const fetchBalanceSnapshot = this.safeBool(options, 'fetchBalanceSnapshot', false);
1274
1274
  if (fetchBalanceSnapshot) {
1275
1275
  const messageHash = type + ':fetchBalanceSnapshot';
1276
1276
  if (!(messageHash in client.futures)) {
@@ -1396,8 +1396,8 @@ class binance extends binance$1 {
1396
1396
  this.setBalanceCache(client, type);
1397
1397
  this.setPositionsCache(client, type);
1398
1398
  const options = this.safeValue(this.options, 'watchBalance');
1399
- const fetchBalanceSnapshot = this.safeValue(options, 'fetchBalanceSnapshot', false);
1400
- const awaitBalanceSnapshot = this.safeValue(options, 'awaitBalanceSnapshot', true);
1399
+ const fetchBalanceSnapshot = this.safeBool(options, 'fetchBalanceSnapshot', false);
1400
+ const awaitBalanceSnapshot = this.safeBool(options, 'awaitBalanceSnapshot', true);
1401
1401
  if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
1402
1402
  await client.future(type + ':fetchBalanceSnapshot');
1403
1403
  }
@@ -1558,7 +1558,7 @@ class binance extends binance$1 {
1558
1558
  let returnRateLimits = false;
1559
1559
  [returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
1560
1560
  payload['returnRateLimits'] = returnRateLimits;
1561
- const test = this.safeValue(params, 'test', false);
1561
+ const test = this.safeBool(params, 'test', false);
1562
1562
  params = this.omit(params, 'test');
1563
1563
  const message = {
1564
1564
  'id': messageHash,
@@ -892,7 +892,7 @@ class bitget extends bitget$1 {
892
892
  await this.loadMarkets();
893
893
  let market = undefined;
894
894
  let marketId = undefined;
895
- const isStop = this.safeValue(params, 'stop', false);
895
+ const isStop = this.safeBool(params, 'stop', false);
896
896
  params = this.omit(params, 'stop');
897
897
  let messageHash = (isStop) ? 'triggerOrder' : 'order';
898
898
  let subscriptionHash = 'order:trades';
@@ -143,7 +143,7 @@ class bitmart extends bitmart$1 {
143
143
  return;
144
144
  }
145
145
  const options = this.safeValue(this.options, 'watchBalance');
146
- const snapshot = this.safeValue(options, 'fetchBalanceSnapshot', true);
146
+ const snapshot = this.safeBool(options, 'fetchBalanceSnapshot', true);
147
147
  if (snapshot) {
148
148
  const messageHash = type + ':' + 'fetchBalanceSnapshot';
149
149
  if (!(messageHash in client.futures)) {
@@ -20,7 +20,7 @@ class bitmex extends bitmex$1 {
20
20
  'watchOrders': true,
21
21
  'watchPostions': true,
22
22
  'watchTicker': true,
23
- 'watchTickers': false,
23
+ 'watchTickers': true,
24
24
  'watchTrades': true,
25
25
  'watchTradesForSymbols': true,
26
26
  },
@@ -72,6 +72,46 @@ class bitmex extends bitmex$1 {
72
72
  };
73
73
  return await this.watch(url, messageHash, this.extend(request, params), messageHash);
74
74
  }
75
+ async watchTickers(symbols = undefined, params = {}) {
76
+ /**
77
+ * @method
78
+ * @name bitmex#watchTickers
79
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
80
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
81
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
82
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
83
+ */
84
+ await this.loadMarkets();
85
+ symbols = this.marketSymbols(symbols, undefined, true);
86
+ const name = 'instrument';
87
+ const url = this.urls['api']['ws'];
88
+ const messageHashes = [];
89
+ if (symbols !== undefined) {
90
+ for (let i = 0; i < symbols.length; i++) {
91
+ const symbol = symbols[i];
92
+ const market = this.market(symbol);
93
+ const hash = name + ':' + market['id'];
94
+ messageHashes.push(hash);
95
+ }
96
+ }
97
+ else {
98
+ messageHashes.push(name);
99
+ }
100
+ const request = {
101
+ 'op': 'subscribe',
102
+ 'args': messageHashes,
103
+ };
104
+ const ticker = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
105
+ if (this.newUpdates) {
106
+ if (symbols === undefined) {
107
+ return ticker;
108
+ }
109
+ const result = {};
110
+ result[ticker['symbol']] = ticker;
111
+ return result;
112
+ }
113
+ return this.filterByArray(this.tickers, 'symbol', symbols);
114
+ }
75
115
  handleTicker(client, message) {
76
116
  //
77
117
  // {
@@ -300,19 +340,22 @@ class bitmex extends bitmex$1 {
300
340
  // }
301
341
  //
302
342
  const table = this.safeString(message, 'table');
303
- const data = this.safeValue(message, 'data', []);
343
+ const data = this.safeList(message, 'data', []);
344
+ const tickers = {};
304
345
  for (let i = 0; i < data.length; i++) {
305
346
  const update = data[i];
306
- const marketId = this.safeValue(update, 'symbol');
347
+ const marketId = this.safeString(update, 'symbol');
307
348
  const market = this.safeMarket(marketId);
308
349
  const symbol = market['symbol'];
309
350
  const messageHash = table + ':' + marketId;
310
- let ticker = this.safeValue(this.tickers, symbol, {});
311
- const info = this.safeValue(ticker, 'info', {});
351
+ let ticker = this.safeDict(this.tickers, symbol, {});
352
+ const info = this.safeDict(ticker, 'info', {});
312
353
  ticker = this.parseTicker(this.extend(info, update), market);
354
+ tickers[symbol] = ticker;
313
355
  this.tickers[symbol] = ticker;
314
356
  client.resolve(ticker, messageHash);
315
357
  }
358
+ client.resolve(tickers, 'instrument');
316
359
  return message;
317
360
  }
318
361
  async watchBalance(params = {}) {
@@ -576,7 +619,7 @@ class bitmex extends bitmex$1 {
576
619
  return future;
577
620
  }
578
621
  handleAuthenticationMessage(client, message) {
579
- const authenticated = this.safeValue(message, 'success', false);
622
+ const authenticated = this.safeBool(message, 'success', false);
580
623
  const messageHash = 'authenticated';
581
624
  if (authenticated) {
582
625
  // we resolve the future here permanently so authentication only happens once
@@ -1225,7 +1225,7 @@ class bitvavo extends bitvavo$1 {
1225
1225
  // }
1226
1226
  //
1227
1227
  const messageHash = 'authenticated';
1228
- const authenticated = this.safeValue(message, 'authenticated', false);
1228
+ const authenticated = this.safeBool(message, 'authenticated', false);
1229
1229
  if (authenticated) {
1230
1230
  // we resolve the future here permanently so authentication only happens once
1231
1231
  client.resolve(message, messageHash);
@@ -1342,8 +1342,8 @@ class bybit extends bybit$1 {
1342
1342
  let subType = undefined;
1343
1343
  [subType, params] = this.handleSubTypeAndParams('watchBalance', undefined, params);
1344
1344
  const unified = await this.isUnifiedEnabled();
1345
- const isUnifiedMargin = this.safeValue(unified, 0, false);
1346
- const isUnifiedAccount = this.safeValue(unified, 1, false);
1345
+ const isUnifiedMargin = this.safeBool(unified, 0, false);
1346
+ const isUnifiedAccount = this.safeBool(unified, 1, false);
1347
1347
  const url = this.getUrlByMarketType(undefined, true, method, params);
1348
1348
  await this.authenticate(url);
1349
1349
  const topicByMarket = {
@@ -717,7 +717,7 @@ class cex extends cex$1 {
717
717
  order = this.parseWsOrderUpdate(data, market);
718
718
  }
719
719
  order['remaining'] = remains;
720
- const canceled = this.safeValue(data, 'cancel', false);
720
+ const canceled = this.safeBool(data, 'cancel', false);
721
721
  if (canceled) {
722
722
  order['status'] = 'canceled';
723
723
  }
@@ -806,7 +806,7 @@ class cex extends cex$1 {
806
806
  if (isTransaction) {
807
807
  timestamp = this.parse8601(time);
808
808
  }
809
- const canceled = this.safeValue(order, 'cancel', false);
809
+ const canceled = this.safeBool(order, 'cancel', false);
810
810
  let status = 'open';
811
811
  if (canceled) {
812
812
  status = 'canceled';
@@ -110,7 +110,7 @@ class coinbase extends coinbase$1 {
110
110
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
111
111
  */
112
112
  if (symbols === undefined) {
113
- throw new errors.ArgumentsRequired(this.id + ' watchTickers requires a symbols argument');
113
+ symbols = this.symbols;
114
114
  }
115
115
  const name = 'ticker_batch';
116
116
  const tickers = await this.subscribe(name, symbols, params);
@@ -176,7 +176,7 @@ class independentreserve extends independentreserve$1 {
176
176
  const orderBook = this.safeValue(message, 'Data', {});
177
177
  const messageHash = 'orderbook:' + symbol + ':' + depth;
178
178
  const subscription = this.safeValue(client.subscriptions, messageHash, {});
179
- const receivedSnapshot = this.safeValue(subscription, 'receivedSnapshot', false);
179
+ const receivedSnapshot = this.safeBool(subscription, 'receivedSnapshot', false);
180
180
  const timestamp = this.safeInteger(message, 'Time');
181
181
  let storedOrderBook = this.safeValue(this.orderbooks, symbol);
182
182
  if (storedOrderBook === undefined) {
@@ -864,7 +864,7 @@ class okx extends okx$1 {
864
864
  // By default, receive order updates from any instrument type
865
865
  let type = undefined;
866
866
  [type, params] = this.handleOptionAndParams(params, 'watchMyTrades', 'type', 'ANY');
867
- const isStop = this.safeValue(params, 'stop', false);
867
+ const isStop = this.safeBool(params, 'stop', false);
868
868
  params = this.omit(params, ['stop']);
869
869
  await this.loadMarkets();
870
870
  await this.authenticate({ 'access': isStop ? 'business' : 'private' });
@@ -1057,7 +1057,7 @@ class onetrading extends onetrading$1 {
1057
1057
  subscription = this.safeValue(client.subscriptions, subscriptionHash);
1058
1058
  if (subscription !== undefined) {
1059
1059
  const ohlcvMarket = this.safeValue(subscription, marketId, {});
1060
- const marketSubscribed = this.safeValue(ohlcvMarket, timeframe, false);
1060
+ const marketSubscribed = this.safeBool(ohlcvMarket, timeframe, false);
1061
1061
  if (!marketSubscribed) {
1062
1062
  type = 'UPDATE_SUBSCRIPTION';
1063
1063
  client.subscriptions[subscriptionHash] = undefined;
@@ -1298,7 +1298,7 @@ class onetrading extends onetrading$1 {
1298
1298
  if (subscription !== undefined) {
1299
1299
  for (let i = 0; i < marketIds.length; i++) {
1300
1300
  const marketId = marketIds[i];
1301
- const marketSubscribed = this.safeValue(subscription, marketId, false);
1301
+ const marketSubscribed = this.safeBool(subscription, marketId, false);
1302
1302
  if (!marketSubscribed) {
1303
1303
  type = 'UPDATE_SUBSCRIPTION';
1304
1304
  client.subscriptions[subscriptionHash] = undefined;