ccxt 4.2.29 → 4.2.31

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 (164) hide show
  1. package/README.md +5 -6
  2. package/dist/ccxt.browser.js +2196 -601
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +3 -1
  5. package/dist/cjs/src/ascendex.js +5 -5
  6. package/dist/cjs/src/base/Exchange.js +33 -25
  7. package/dist/cjs/src/base/errors.js +3 -3
  8. package/dist/cjs/src/base/functions/type.js +12 -0
  9. package/dist/cjs/src/bigone.js +2 -2
  10. package/dist/cjs/src/binance.js +897 -218
  11. package/dist/cjs/src/bingx.js +1 -1
  12. package/dist/cjs/src/bitfinex.js +1 -1
  13. package/dist/cjs/src/bitfinex2.js +457 -93
  14. package/dist/cjs/src/bitforex.js +3 -0
  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 +4 -4
  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 +3 -3
  23. package/dist/cjs/src/coinbase.js +22 -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 +2 -2
  29. package/dist/cjs/src/coinsph.js +1 -1
  30. package/dist/cjs/src/cryptocom.js +3 -3
  31. package/dist/cjs/src/deribit.js +1 -0
  32. package/dist/cjs/src/digifinex.js +6 -4
  33. package/dist/cjs/src/exmo.js +2 -2
  34. package/dist/cjs/src/gate.js +5 -5
  35. package/dist/cjs/src/gemini.js +3 -3
  36. package/dist/cjs/src/hitbtc.js +14 -20
  37. package/dist/cjs/src/hollaex.js +2 -2
  38. package/dist/cjs/src/htx.js +6 -6
  39. package/dist/cjs/src/huobijp.js +1 -1
  40. package/dist/cjs/src/kraken.js +3 -1
  41. package/dist/cjs/src/krakenfutures.js +4 -1
  42. package/dist/cjs/src/kucoin.js +17 -17
  43. package/dist/cjs/src/kucoinfutures.js +3 -3
  44. package/dist/cjs/src/lbank.js +28 -27
  45. package/dist/cjs/src/mexc.js +7 -7
  46. package/dist/cjs/src/novadax.js +1 -1
  47. package/dist/cjs/src/okcoin.js +2 -2
  48. package/dist/cjs/src/okx.js +23 -8
  49. package/dist/cjs/src/p2b.js +1 -0
  50. package/dist/cjs/src/phemex.js +3 -3
  51. package/dist/cjs/src/poloniexfutures.js +6 -3
  52. package/dist/cjs/src/pro/alpaca.js +1 -1
  53. package/dist/cjs/src/pro/binance.js +4 -4
  54. package/dist/cjs/src/pro/bitget.js +1 -1
  55. package/dist/cjs/src/pro/bitmart.js +1 -1
  56. package/dist/cjs/src/pro/bitmex.js +49 -6
  57. package/dist/cjs/src/pro/bitvavo.js +1 -1
  58. package/dist/cjs/src/pro/bybit.js +2 -2
  59. package/dist/cjs/src/pro/cex.js +2 -2
  60. package/dist/cjs/src/pro/independentreserve.js +1 -1
  61. package/dist/cjs/src/pro/okx.js +1 -1
  62. package/dist/cjs/src/pro/onetrading.js +2 -2
  63. package/dist/cjs/src/pro/p2b.js +432 -0
  64. package/dist/cjs/src/pro/probit.js +5 -5
  65. package/dist/cjs/src/pro/whitebit.js +1 -1
  66. package/dist/cjs/src/probit.js +1 -1
  67. package/dist/cjs/src/timex.js +2 -2
  68. package/dist/cjs/src/tokocrypto.js +3 -3
  69. package/dist/cjs/src/wavesexchange.js +2 -2
  70. package/dist/cjs/src/whitebit.js +3 -3
  71. package/dist/cjs/src/woo.js +3 -3
  72. package/dist/cjs/src/yobit.js +1 -1
  73. package/dist/cjs/src/zaif.js +1 -1
  74. package/dist/cjs/src/zonda.js +3 -3
  75. package/js/ccxt.d.ts +4 -1
  76. package/js/ccxt.js +3 -1
  77. package/js/src/abstract/bybit.d.ts +2 -2
  78. package/js/src/abstract/coinbase.d.ts +10 -0
  79. package/js/src/abstract/okx.d.ts +12 -1
  80. package/js/src/ascendex.js +5 -5
  81. package/js/src/base/Exchange.d.ts +2 -2
  82. package/js/src/base/Exchange.js +33 -25
  83. package/js/src/base/errorHierarchy.d.ts +7 -6
  84. package/js/src/base/errorHierarchy.js +7 -6
  85. package/js/src/base/errors.d.ts +3 -3
  86. package/js/src/base/errors.js +3 -3
  87. package/js/src/base/functions/type.js +12 -0
  88. package/js/src/bigone.js +2 -2
  89. package/js/src/binance.d.ts +1 -0
  90. package/js/src/binance.js +898 -219
  91. package/js/src/bingx.js +1 -1
  92. package/js/src/bitfinex.js +1 -1
  93. package/js/src/bitfinex2.d.ts +6 -1
  94. package/js/src/bitfinex2.js +457 -93
  95. package/js/src/bitforex.js +3 -0
  96. package/js/src/bitget.js +8 -4
  97. package/js/src/bitmart.js +3 -3
  98. package/js/src/bitmex.js +4 -4
  99. package/js/src/bitrue.js +1 -1
  100. package/js/src/bitso.d.ts +1 -1
  101. package/js/src/bitso.js +1 -1
  102. package/js/src/bitteam.js +2 -2
  103. package/js/src/btcalpha.js +1 -1
  104. package/js/src/bybit.js +3 -3
  105. package/js/src/coinbase.js +22 -5
  106. package/js/src/coincheck.js +1 -1
  107. package/js/src/coinex.js +2 -2
  108. package/js/src/coinlist.js +1 -1
  109. package/js/src/coinmate.js +1 -1
  110. package/js/src/coinmetro.d.ts +1 -1
  111. package/js/src/coinmetro.js +2 -2
  112. package/js/src/coinsph.js +1 -1
  113. package/js/src/cryptocom.js +3 -3
  114. package/js/src/deribit.js +1 -0
  115. package/js/src/digifinex.js +6 -4
  116. package/js/src/exmo.js +2 -2
  117. package/js/src/gate.js +5 -5
  118. package/js/src/gemini.d.ts +1 -1
  119. package/js/src/gemini.js +3 -3
  120. package/js/src/hitbtc.js +14 -20
  121. package/js/src/hollaex.js +2 -2
  122. package/js/src/htx.js +6 -6
  123. package/js/src/huobijp.js +1 -1
  124. package/js/src/kraken.js +3 -1
  125. package/js/src/krakenfutures.js +4 -1
  126. package/js/src/kucoin.js +17 -17
  127. package/js/src/kucoinfutures.js +3 -3
  128. package/js/src/lbank.d.ts +1 -1
  129. package/js/src/lbank.js +28 -27
  130. package/js/src/mexc.js +7 -7
  131. package/js/src/novadax.js +1 -1
  132. package/js/src/okcoin.js +2 -2
  133. package/js/src/okx.js +23 -8
  134. package/js/src/p2b.js +1 -0
  135. package/js/src/phemex.js +3 -3
  136. package/js/src/poloniexfutures.js +6 -3
  137. package/js/src/pro/alpaca.js +1 -1
  138. package/js/src/pro/binance.js +4 -4
  139. package/js/src/pro/bitget.js +1 -1
  140. package/js/src/pro/bitmart.js +1 -1
  141. package/js/src/pro/bitmex.d.ts +2 -1
  142. package/js/src/pro/bitmex.js +49 -6
  143. package/js/src/pro/bitvavo.js +1 -1
  144. package/js/src/pro/bybit.js +2 -2
  145. package/js/src/pro/cex.js +2 -2
  146. package/js/src/pro/independentreserve.js +1 -1
  147. package/js/src/pro/okx.js +1 -1
  148. package/js/src/pro/onetrading.js +2 -2
  149. package/js/src/pro/p2b.d.ts +23 -0
  150. package/js/src/pro/p2b.js +433 -0
  151. package/js/src/pro/probit.js +5 -5
  152. package/js/src/pro/whitebit.js +1 -1
  153. package/js/src/probit.js +1 -1
  154. package/js/src/timex.js +2 -2
  155. package/js/src/tokocrypto.js +3 -3
  156. package/js/src/wavesexchange.js +2 -2
  157. package/js/src/whitebit.js +3 -3
  158. package/js/src/woo.js +3 -3
  159. package/js/src/yobit.js +1 -1
  160. package/js/src/zaif.js +1 -1
  161. package/js/src/zonda.d.ts +1 -1
  162. package/js/src/zonda.js +3 -3
  163. package/package.json +1 -1
  164. package/skip-tests.json +3 -10
@@ -41,6 +41,9 @@ class bitforex extends bitforex$1 {
41
41
  'fetchClosedOrders': true,
42
42
  'fetchCrossBorrowRate': false,
43
43
  'fetchCrossBorrowRates': false,
44
+ 'fetchDepositAddress': false,
45
+ 'fetchDepositAddresses': false,
46
+ 'fetchDepositAddressesByNetwork': false,
44
47
  'fetchFundingHistory': false,
45
48
  'fetchFundingRate': false,
46
49
  'fetchFundingRateHistory': false,
@@ -66,6 +66,7 @@ class bitget extends bitget$1 {
66
66
  'fetchCrossBorrowRate': true,
67
67
  'fetchCrossBorrowRates': false,
68
68
  'fetchCurrencies': true,
69
+ 'fetchDeposit': false,
69
70
  'fetchDepositAddress': true,
70
71
  'fetchDepositAddresses': false,
71
72
  'fetchDeposits': true,
@@ -95,6 +96,7 @@ class bitget extends bitget$1 {
95
96
  'fetchOpenOrders': true,
96
97
  'fetchOrder': true,
97
98
  'fetchOrderBook': true,
99
+ 'fetchOrderBooks': false,
98
100
  'fetchOrders': false,
99
101
  'fetchOrderTrades': false,
100
102
  'fetchPosition': true,
@@ -102,6 +104,7 @@ class bitget extends bitget$1 {
102
104
  'fetchPositions': true,
103
105
  'fetchPositionsRisk': false,
104
106
  'fetchPremiumIndexOHLCV': false,
107
+ 'fetchStatus': false,
105
108
  'fetchTicker': true,
106
109
  'fetchTickers': true,
107
110
  'fetchTime': true,
@@ -118,6 +121,7 @@ class bitget extends bitget$1 {
118
121
  'repayCrossMargin': true,
119
122
  'repayIsolatedMargin': true,
120
123
  'setLeverage': true,
124
+ 'setMargin': false,
121
125
  'setMarginMode': true,
122
126
  'setPositionMode': true,
123
127
  'signIn': false,
@@ -2235,7 +2239,7 @@ class bitget extends bitget$1 {
2235
2239
  'fee': undefined,
2236
2240
  };
2237
2241
  const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
2238
- const fillResponseFromRequest = this.safeValue(withdrawOptions, 'fillResponseFromRequest', true);
2242
+ const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
2239
2243
  if (fillResponseFromRequest) {
2240
2244
  result['currency'] = code;
2241
2245
  result['timestamp'] = this.milliseconds();
@@ -3120,7 +3124,7 @@ class bitget extends bitget$1 {
3120
3124
  [marginMode, params] = this.handleMarginModeAndParams('fetchTradingFees', params);
3121
3125
  [marketType, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
3122
3126
  if (marketType === 'spot') {
3123
- const margin = this.safeValue(params, 'margin', false);
3127
+ const margin = this.safeBool(params, 'margin', false);
3124
3128
  params = this.omit(params, 'margin');
3125
3129
  if ((marginMode !== undefined) || margin) {
3126
3130
  response = await this.publicMarginGetV2MarginCurrencies(params);
@@ -4141,7 +4145,7 @@ class bitget extends bitget$1 {
4141
4145
  request['price'] = this.priceToPrecision(symbol, price);
4142
4146
  }
4143
4147
  const triggerType = this.safeString(params, 'triggerType', 'mark_price');
4144
- const reduceOnly = this.safeValue(params, 'reduceOnly', false);
4148
+ const reduceOnly = this.safeBool(params, 'reduceOnly', false);
4145
4149
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
4146
4150
  const exchangeSpecificTifParam = this.safeString2(params, 'force', 'timeInForce');
4147
4151
  let postOnly = undefined;
@@ -4237,7 +4241,7 @@ class bitget extends bitget$1 {
4237
4241
  }
4238
4242
  const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
4239
4243
  request['marginMode'] = marginModeRequest;
4240
- const oneWayMode = this.safeValue(params, 'oneWayMode', false);
4244
+ const oneWayMode = this.safeBool(params, 'oneWayMode', false);
4241
4245
  params = this.omit(params, 'oneWayMode');
4242
4246
  let requestSide = side;
4243
4247
  if (reduceOnly) {
@@ -1936,7 +1936,7 @@ class bitmart extends bitmart$1 {
1936
1936
  let marketType = undefined;
1937
1937
  [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1938
1938
  const marginMode = this.safeString(params, 'marginMode');
1939
- const isMargin = this.safeValue(params, 'margin', false);
1939
+ const isMargin = this.safeBool(params, 'margin', false);
1940
1940
  params = this.omit(params, ['margin', 'marginMode']);
1941
1941
  if (marginMode !== undefined || isMargin) {
1942
1942
  marketType = 'margin';
@@ -2810,7 +2810,7 @@ class bitmart extends bitmart$1 {
2810
2810
  response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
2811
2811
  }
2812
2812
  else {
2813
- const trailing = this.safeValue(params, 'trailing', false);
2813
+ const trailing = this.safeBool(params, 'trailing', false);
2814
2814
  let orderType = this.safeString(params, 'orderType');
2815
2815
  params = this.omit(params, ['orderType', 'trailing']);
2816
2816
  if (trailing) {
@@ -2990,7 +2990,7 @@ class bitmart extends bitmart$1 {
2990
2990
  if (symbol === undefined) {
2991
2991
  throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
2992
2992
  }
2993
- const trailing = this.safeValue(params, 'trailing', false);
2993
+ const trailing = this.safeBool(params, 'trailing', false);
2994
2994
  let orderType = this.safeString(params, 'orderType');
2995
2995
  params = this.omit(params, ['orderType', 'trailing']);
2996
2996
  if (trailing) {
@@ -339,8 +339,8 @@ class bitmex extends bitmex$1 {
339
339
  const network = this.networkIdToCode(networkId);
340
340
  const withdrawalFeeRaw = this.safeString(chain, 'withdrawalFee');
341
341
  const withdrawalFee = this.parseNumber(Precise["default"].stringMul(withdrawalFeeRaw, precisionString));
342
- const isDepositEnabled = this.safeValue(chain, 'depositEnabled', false);
343
- const isWithdrawEnabled = this.safeValue(chain, 'withdrawalEnabled', false);
342
+ const isDepositEnabled = this.safeBool(chain, 'depositEnabled', false);
343
+ const isWithdrawEnabled = this.safeBool(chain, 'withdrawalEnabled', false);
344
344
  const active = (isDepositEnabled && isWithdrawEnabled);
345
345
  if (isDepositEnabled) {
346
346
  depositEnabled = true;
@@ -1716,7 +1716,7 @@ class bitmex extends bitmex$1 {
1716
1716
  isInverse = (defaultSubType === 'inverse');
1717
1717
  }
1718
1718
  else {
1719
- isInverse = this.safeValue(market, 'inverse', false);
1719
+ isInverse = this.safeBool(market, 'inverse', false);
1720
1720
  }
1721
1721
  if (isInverse) {
1722
1722
  cost = this.convertFromRawQuantity(symbol, qty);
@@ -2423,7 +2423,7 @@ class bitmex extends bitmex$1 {
2423
2423
  const item = response[i];
2424
2424
  const marketId = this.safeString(item, 'symbol');
2425
2425
  const market = this.safeMarket(marketId);
2426
- const swap = this.safeValue(market, 'swap', false);
2426
+ const swap = this.safeBool(market, 'swap', false);
2427
2427
  if (swap) {
2428
2428
  filteredResponse.push(item);
2429
2429
  }
@@ -3188,7 +3188,7 @@ class bitrue extends bitrue$1 {
3188
3188
  }
3189
3189
  // check success value for wapi endpoints
3190
3190
  // response in format {'msg': 'The coin does not exist.', 'success': true/false}
3191
- const success = this.safeValue(response, 'success', true);
3191
+ const success = this.safeBool(response, 'success', true);
3192
3192
  if (!success) {
3193
3193
  const messageInner = this.safeString(response, 'msg');
3194
3194
  let parsedMessage = undefined;
@@ -1726,7 +1726,7 @@ class bitso extends bitso$1 {
1726
1726
  //
1727
1727
  // {"success":false,"error":{"code":104,"message":"Cannot perform request - nonce must be higher than 1520307203724237"}}
1728
1728
  //
1729
- let success = this.safeValue(response, 'success', false);
1729
+ let success = this.safeBool(response, 'success', false);
1730
1730
  if (typeof success === 'string') {
1731
1731
  if ((success === 'true') || (success === '1')) {
1732
1732
  success = true;
@@ -353,7 +353,7 @@ class bitteam extends bitteam$1 {
353
353
  const created = this.parse8601(timeStart);
354
354
  let minCost = undefined;
355
355
  const currenciesValuedInUsd = this.safeValue(this.options, 'currenciesValuedInUsd', {});
356
- const quoteInUsd = this.safeValue(currenciesValuedInUsd, quote, false);
356
+ const quoteInUsd = this.safeBool(currenciesValuedInUsd, quote, false);
357
357
  if (quoteInUsd) {
358
358
  const settings = this.safeValue(market, 'settings', {});
359
359
  minCost = this.safeNumber(settings, 'limit_usd');
@@ -540,7 +540,7 @@ class bitteam extends bitteam$1 {
540
540
  const id = this.safeString(currency, 'symbol');
541
541
  const numericId = this.safeInteger(currency, 'id');
542
542
  const code = this.safeCurrencyCode(id);
543
- const active = this.safeValue(currency, 'active', false);
543
+ const active = this.safeBool(currency, 'active', false);
544
544
  const precision = this.safeInteger(currency, 'precision');
545
545
  const txLimits = this.safeValue(currency, 'txLimits', {});
546
546
  const minWithdraw = this.safeString(txLimits, 'minWithdraw');
@@ -677,7 +677,7 @@ class btcalpha extends btcalpha$1 {
677
677
  const marketId = this.safeString(order, 'pair');
678
678
  market = this.safeMarket(marketId, market, '_');
679
679
  const symbol = market['symbol'];
680
- const success = this.safeValue(order, 'success', false);
680
+ const success = this.safeBool(order, 'success', false);
681
681
  let timestamp = undefined;
682
682
  if (success) {
683
683
  timestamp = this.safeTimestamp(order, 'date');
@@ -296,8 +296,6 @@ class bybit extends bybit$1 {
296
296
  // account
297
297
  'v5/account/wallet-balance': 1,
298
298
  'v5/account/borrow-history': 1,
299
- 'v5/account/set-collateral-switch': 5,
300
- 'v5/account/set-collateral-switch-batch': 5,
301
299
  'v5/account/collateral-info': 1,
302
300
  'v5/asset/coin-greeks': 1,
303
301
  'v5/account/fee-rate': 10,
@@ -490,6 +488,8 @@ class bybit extends bybit$1 {
490
488
  'v5/lending/purchase': 5,
491
489
  'v5/lending/redeem': 5,
492
490
  'v5/lending/redeem-cancel': 5,
491
+ 'v5/account/set-collateral-switch': 5,
492
+ 'v5/account/set-collateral-switch-batch': 5,
493
493
  },
494
494
  },
495
495
  },
@@ -3459,7 +3459,7 @@ class bybit extends bybit$1 {
3459
3459
  const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
3460
3460
  const length = result.length;
3461
3461
  if (length === 0) {
3462
- const isTrigger = this.safeValueN(params, ['trigger', 'stop'], false);
3462
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
3463
3463
  const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
3464
3464
  throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
3465
3465
  }
@@ -204,6 +204,13 @@ class coinbase extends coinbase$1 {
204
204
  'brokerage/best_bid_ask',
205
205
  'brokerage/convert/trade/{trade_id}',
206
206
  'brokerage/time',
207
+ 'brokerage/cfm/balance_summary',
208
+ 'brokerage/cfm/positions',
209
+ 'brokerage/cfm/positions/{product_id}',
210
+ 'brokerage/cfm/sweeps',
211
+ 'brokerage/intx/portfolio/{portfolio_uuid}',
212
+ 'brokerage/intx/positions/{portfolio_uuid}',
213
+ 'brokerage/intx/positions/{portfolio_uuid}/{symbol}',
207
214
  ],
208
215
  'post': [
209
216
  'brokerage/orders',
@@ -214,12 +221,15 @@ class coinbase extends coinbase$1 {
214
221
  'brokerage/portfolios/move_funds',
215
222
  'brokerage/convert/quote',
216
223
  'brokerage/convert/trade/{trade_id}',
224
+ 'brokerage/cfm/sweeps/schedule',
225
+ 'brokerage/intx/allocate',
217
226
  ],
218
227
  'put': [
219
228
  'brokerage/portfolios/{portfolio_uuid}',
220
229
  ],
221
230
  'delete': [
222
231
  'brokerage/portfolios/{portfolio_uuid}',
232
+ 'brokerage/cfm/sweeps',
223
233
  ],
224
234
  },
225
235
  },
@@ -1361,7 +1371,11 @@ class coinbase extends coinbase$1 {
1361
1371
  async fetchTickersV3(symbols = undefined, params = {}) {
1362
1372
  await this.loadMarkets();
1363
1373
  symbols = this.marketSymbols(symbols);
1364
- const response = await this.v3PrivateGetBrokerageProducts(params);
1374
+ const request = {};
1375
+ if (symbols !== undefined) {
1376
+ request['product_ids'] = this.marketIds(symbols);
1377
+ }
1378
+ const response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
1365
1379
  //
1366
1380
  // {
1367
1381
  // "products": [
@@ -1679,7 +1693,7 @@ class coinbase extends coinbase$1 {
1679
1693
  'limit': 250,
1680
1694
  };
1681
1695
  let response = undefined;
1682
- const isV3 = this.safeValue(params, 'v3', false);
1696
+ const isV3 = this.safeBool(params, 'v3', false);
1683
1697
  params = this.omit(params, 'v3');
1684
1698
  const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
1685
1699
  if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
@@ -3195,8 +3209,11 @@ class coinbase extends coinbase$1 {
3195
3209
  */
3196
3210
  await this.loadMarkets();
3197
3211
  symbols = this.marketSymbols(symbols);
3198
- // the 'product_ids' param isn't working properly and returns {"pricebooks":[]} when defined
3199
- const response = await this.v3PrivateGetBrokerageBestBidAsk(params);
3212
+ const request = {};
3213
+ if (symbols !== undefined) {
3214
+ request['product_ids'] = this.marketIds(symbols);
3215
+ }
3216
+ const response = await this.v3PrivateGetBrokerageBestBidAsk(this.extend(request, params));
3200
3217
  //
3201
3218
  // {
3202
3219
  // "pricebooks": [
@@ -3325,7 +3342,7 @@ class coinbase extends coinbase$1 {
3325
3342
  const savedPath = fullPath;
3326
3343
  if (method === 'GET') {
3327
3344
  if (Object.keys(query).length) {
3328
- fullPath += '?' + this.urlencode(query);
3345
+ fullPath += '?' + this.urlencodeWithArrayRepeat(query);
3329
3346
  }
3330
3347
  }
3331
3348
  const url = this.urls['api']['rest'] + fullPath;
@@ -829,7 +829,7 @@ class coincheck extends coincheck$1 {
829
829
  // {"success":false,"error":"disabled API Key"}'
830
830
  // {"success":false,"error":"invalid authentication"}
831
831
  //
832
- const success = this.safeValue(response, 'success', true);
832
+ const success = this.safeBool(response, 'success', true);
833
833
  if (!success) {
834
834
  const error = this.safeString(response, 'error');
835
835
  const feedback = this.id + ' ' + this.json(response);
@@ -3324,7 +3324,7 @@ class coinex extends coinex$1 {
3324
3324
  const data = this.safeValue(response, 'data', {});
3325
3325
  const depositAddress = this.parseDepositAddress(data, currency);
3326
3326
  const options = this.safeValue(this.options, 'fetchDepositAddress', {});
3327
- const fillResponseFromRequest = this.safeValue(options, 'fillResponseFromRequest', true);
3327
+ const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
3328
3328
  if (fillResponseFromRequest) {
3329
3329
  depositAddress['network'] = this.safeNetworkCode(network, currency);
3330
3330
  }
@@ -5351,7 +5351,7 @@ class coinex extends coinex$1 {
5351
5351
  * @returns {Array} the marginMode in lowercase
5352
5352
  */
5353
5353
  const defaultType = this.safeString(this.options, 'defaultType');
5354
- const isMargin = this.safeValue(params, 'margin', false);
5354
+ const isMargin = this.safeBool(params, 'margin', false);
5355
5355
  let marginMode = undefined;
5356
5356
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
5357
5357
  if (marginMode === undefined) {
@@ -361,7 +361,7 @@ class coinlist extends coinlist$1 {
361
361
  const currency = currencies[i];
362
362
  const id = this.safeString(currency, 'asset');
363
363
  const code = this.safeCurrencyCode(id);
364
- const isTransferable = this.safeValue(currency, 'is_transferable', false);
364
+ const isTransferable = this.safeBool(currency, 'is_transferable', false);
365
365
  const withdrawEnabled = isTransferable;
366
366
  const depositEnabled = isTransferable;
367
367
  const active = isTransferable;
@@ -541,7 +541,7 @@ class coinmate extends coinmate$1 {
541
541
  //
542
542
  const data = this.safeValue(response, 'data');
543
543
  const transaction = this.parseTransaction(data, currency);
544
- const fillResponseFromRequest = this.safeValue(withdrawOptions, 'fillResponseFromRequest', true);
544
+ const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
545
545
  if (fillResponseFromRequest) {
546
546
  transaction['amount'] = amount;
547
547
  transaction['currency'] = code;
@@ -377,7 +377,7 @@ class coinmetro extends coinmetro$1 {
377
377
  const quote = this.safeCurrencyCode(quoteId);
378
378
  const basePrecisionAndLimits = this.parseMarketPrecisionAndLimits(baseId);
379
379
  const quotePrecisionAndLimits = this.parseMarketPrecisionAndLimits(quoteId);
380
- const margin = this.safeValue(market, 'margin', false);
380
+ const margin = this.safeBool(market, 'margin', false);
381
381
  const tradingFees = this.safeValue(this.fees, 'trading', {});
382
382
  return this.safeMarketStructure({
383
383
  'id': id,
@@ -1336,7 +1336,7 @@ class coinmetro extends coinmetro$1 {
1336
1336
  };
1337
1337
  const marginMode = undefined;
1338
1338
  [params, params] = this.handleMarginModeAndParams('cancelOrder', params);
1339
- const isMargin = this.safeValue(params, 'margin', false);
1339
+ const isMargin = this.safeBool(params, 'margin', false);
1340
1340
  params = this.omit(params, 'margin');
1341
1341
  let response = undefined;
1342
1342
  if (isMargin || (marginMode !== undefined)) {
@@ -1559,7 +1559,7 @@ class coinsph extends coinsph$1 {
1559
1559
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1560
1560
  */
1561
1561
  const options = this.safeValue(this.options, 'withdraw');
1562
- const warning = this.safeValue(options, 'warning', true);
1562
+ const warning = this.safeBool(options, 'warning', true);
1563
1563
  if (warning) {
1564
1564
  throw new errors.InvalidAddress(this.id + " withdraw() makes a withdrawals only to coins_ph account, add .options['withdraw']['warning'] = false to make a withdrawal to your coins_ph account");
1565
1565
  }
@@ -1054,7 +1054,7 @@ class cryptocom extends cryptocom$1 {
1054
1054
  request['time_in_force'] = timeInForce;
1055
1055
  }
1056
1056
  }
1057
- const postOnly = this.safeValue(params, 'postOnly', false);
1057
+ const postOnly = this.safeBool(params, 'postOnly', false);
1058
1058
  if ((postOnly) || (timeInForce === 'PO')) {
1059
1059
  request['exec_inst'] = ['POST_ONLY'];
1060
1060
  request['time_in_force'] = 'GOOD_TILL_CANCEL';
@@ -1275,7 +1275,7 @@ class cryptocom extends cryptocom$1 {
1275
1275
  request['time_in_force'] = timeInForce;
1276
1276
  }
1277
1277
  }
1278
- const postOnly = this.safeValue(params, 'postOnly', false);
1278
+ const postOnly = this.safeBool(params, 'postOnly', false);
1279
1279
  if ((postOnly) || (timeInForce === 'PO')) {
1280
1280
  request['exec_inst'] = ['POST_ONLY'];
1281
1281
  request['time_in_force'] = 'GOOD_TILL_CANCEL';
@@ -2246,7 +2246,7 @@ class cryptocom extends cryptocom$1 {
2246
2246
  * @returns {Array} the marginMode in lowercase
2247
2247
  */
2248
2248
  const defaultType = this.safeString(this.options, 'defaultType');
2249
- const isMargin = this.safeValue(params, 'margin', false);
2249
+ const isMargin = this.safeBool(params, 'margin', false);
2250
2250
  params = this.omit(params, 'margin');
2251
2251
  let marginMode = undefined;
2252
2252
  [marginMode, params] = this.handleMarginModeAndParams(methodName, params);
@@ -1343,6 +1343,7 @@ class deribit extends deribit$1 {
1343
1343
  request['end_timestamp'] = now;
1344
1344
  }
1345
1345
  else {
1346
+ since = Math.max(since - 1, 0);
1346
1347
  request['start_timestamp'] = since;
1347
1348
  if (limit === undefined) {
1348
1349
  request['end_timestamp'] = now;
@@ -1159,9 +1159,11 @@ class digifinex extends digifinex$1 {
1159
1159
  // "timestamp": 1663221614998
1160
1160
  // }
1161
1161
  //
1162
+ const indexPrice = this.safeNumber(ticker, 'index_price');
1163
+ const marketType = (indexPrice !== undefined) ? 'contract' : 'spot';
1162
1164
  const marketId = this.safeStringUpper2(ticker, 'symbol', 'instrument_id');
1163
- const symbol = this.safeSymbol(marketId, market);
1164
- market = this.safeMarket(marketId);
1165
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
1166
+ market = this.safeMarket(marketId, market, undefined, marketType);
1165
1167
  let timestamp = this.safeTimestamp(ticker, 'date');
1166
1168
  if (market['swap']) {
1167
1169
  timestamp = this.safeInteger(ticker, 'timestamp');
@@ -1748,7 +1750,7 @@ class digifinex extends digifinex$1 {
1748
1750
  let postOnly = this.isPostOnly(isMarketOrder, false, params);
1749
1751
  let postOnlyParsed = undefined;
1750
1752
  if (swap) {
1751
- const reduceOnly = this.safeValue(params, 'reduceOnly', false);
1753
+ const reduceOnly = this.safeBool(params, 'reduceOnly', false);
1752
1754
  const timeInForce = this.safeString(params, 'timeInForce');
1753
1755
  let orderType = undefined;
1754
1756
  if (side === 'buy') {
@@ -3921,7 +3923,7 @@ class digifinex extends digifinex$1 {
3921
3923
  * @returns {Array} the marginMode in lowercase
3922
3924
  */
3923
3925
  const defaultType = this.safeString(this.options, 'defaultType');
3924
- const isMargin = this.safeValue(params, 'margin', false);
3926
+ const isMargin = this.safeBool(params, 'margin', false);
3925
3927
  let marginMode = undefined;
3926
3928
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
3927
3929
  if (marginMode !== undefined) {
@@ -249,7 +249,7 @@ class exmo extends exmo$1 {
249
249
  //
250
250
  const margin = this.parseMarginModification(response, market);
251
251
  const options = this.safeValue(this.options, 'margin', {});
252
- const fillResponseFromRequest = this.safeValue(options, 'fillResponseFromRequest', true);
252
+ const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
253
253
  if (fillResponseFromRequest) {
254
254
  margin['type'] = type;
255
255
  margin['amount'] = amount;
@@ -2613,7 +2613,7 @@ class exmo extends exmo$1 {
2613
2613
  // {"result":false,"error":"Error 50052: Insufficient funds"}
2614
2614
  // {"s":"error","errmsg":"strconv.ParseInt: parsing \"\": invalid syntax"}
2615
2615
  //
2616
- let success = this.safeValue(response, 'result', false);
2616
+ let success = this.safeBool(response, 'result', false);
2617
2617
  if (typeof success === 'string') {
2618
2618
  if ((success === 'true') || (success === '1')) {
2619
2619
  success = true;
@@ -1589,9 +1589,9 @@ class gate extends gate$1 {
1589
1589
  const networkId = this.safeString(entry, 'chain');
1590
1590
  const networkCode = this.networkIdToCode(networkId, code);
1591
1591
  const delisted = this.safeValue(entry, 'delisted');
1592
- const withdrawDisabled = this.safeValue(entry, 'withdraw_disabled', false);
1593
- const depositDisabled = this.safeValue(entry, 'deposit_disabled', false);
1594
- const tradeDisabled = this.safeValue(entry, 'trade_disabled', false);
1592
+ const withdrawDisabled = this.safeBool(entry, 'withdraw_disabled', false);
1593
+ const depositDisabled = this.safeBool(entry, 'deposit_disabled', false);
1594
+ const tradeDisabled = this.safeBool(entry, 'trade_disabled', false);
1595
1595
  const withdrawEnabled = !withdrawDisabled;
1596
1596
  const depositEnabled = !depositDisabled;
1597
1597
  const tradeEnabled = !tradeDisabled;
@@ -4048,7 +4048,7 @@ class gate extends gate$1 {
4048
4048
  }
4049
4049
  }
4050
4050
  let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
4051
- const textIsRequired = this.safeValue(params, 'textIsRequired', false);
4051
+ const textIsRequired = this.safeBool(params, 'textIsRequired', false);
4052
4052
  if (clientOrderId !== undefined) {
4053
4053
  // user-defined, must follow the rules if not empty
4054
4054
  // prefixed with t-
@@ -4420,7 +4420,7 @@ class gate extends gate$1 {
4420
4420
  // "message": "Not enough balance"
4421
4421
  // }
4422
4422
  //
4423
- const succeeded = this.safeValue(order, 'succeeded', true);
4423
+ const succeeded = this.safeBool(order, 'succeeded', true);
4424
4424
  if (!succeeded) {
4425
4425
  // cancelOrders response
4426
4426
  return this.safeOrder({
@@ -512,7 +512,7 @@ class gemini extends gemini$1 {
512
512
  'post_only': true,
513
513
  'limit_only': true,
514
514
  };
515
- return this.safeValue(statuses, status, true);
515
+ return this.safeBool(statuses, status, true);
516
516
  }
517
517
  async fetchUSDTMarkets(params = {}) {
518
518
  // these markets can't be scrapped and fetchMarketsFrom api does an extra call
@@ -551,7 +551,7 @@ class gemini extends gemini$1 {
551
551
  result[marketId] = this.parseMarket(market);
552
552
  }
553
553
  const options = this.safeValue(this.options, 'fetchMarketsFromAPI', {});
554
- const fetchDetailsForAllSymbols = this.safeValue(options, 'fetchDetailsForAllSymbols', false);
554
+ const fetchDetailsForAllSymbols = this.safeBool(options, 'fetchDetailsForAllSymbols', false);
555
555
  const fetchDetailsForMarketIds = this.safeValue(options, 'fetchDetailsForMarketIds', []);
556
556
  let promises = [];
557
557
  let marketIds = [];
@@ -1368,7 +1368,7 @@ class gemini extends gemini$1 {
1368
1368
  request['options'] = ['maker-or-cancel'];
1369
1369
  }
1370
1370
  }
1371
- const postOnly = this.safeValue(params, 'postOnly', false);
1371
+ const postOnly = this.safeBool(params, 'postOnly', false);
1372
1372
  params = this.omit(params, 'postOnly');
1373
1373
  if (postOnly) {
1374
1374
  request['options'] = ['maker-or-cancel'];
@@ -690,7 +690,7 @@ class hitbtc extends hitbtc$1 {
690
690
  const expiry = this.safeInteger(market, 'expiry');
691
691
  const contract = (marketType === 'futures');
692
692
  const spot = (marketType === 'spot');
693
- const marginTrading = this.safeValue(market, 'margin_trading', false);
693
+ const marginTrading = this.safeBool(market, 'margin_trading', false);
694
694
  const margin = spot && marginTrading;
695
695
  const future = (expiry !== undefined);
696
696
  const swap = (contract && !future);
@@ -825,9 +825,9 @@ class hitbtc extends hitbtc$1 {
825
825
  const entry = response[currencyId];
826
826
  const name = this.safeString(entry, 'full_name');
827
827
  const precision = this.safeNumber(entry, 'precision_transfer');
828
- const payinEnabled = this.safeValue(entry, 'payin_enabled', false);
829
- const payoutEnabled = this.safeValue(entry, 'payout_enabled', false);
830
- const transferEnabled = this.safeValue(entry, 'transfer_enabled', false);
828
+ const payinEnabled = this.safeBool(entry, 'payin_enabled', false);
829
+ const payoutEnabled = this.safeBool(entry, 'payout_enabled', false);
830
+ const transferEnabled = this.safeBool(entry, 'transfer_enabled', false);
831
831
  const active = payinEnabled && payoutEnabled && transferEnabled;
832
832
  const rawNetworks = this.safeValue(entry, 'networks', []);
833
833
  const networks = {};
@@ -840,8 +840,8 @@ class hitbtc extends hitbtc$1 {
840
840
  const network = this.safeNetwork(networkId);
841
841
  fee = this.safeNumber(rawNetwork, 'payout_fee');
842
842
  const networkPrecision = this.safeNumber(rawNetwork, 'precision_payout');
843
- const payinEnabledNetwork = this.safeValue(entry, 'payin_enabled', false);
844
- const payoutEnabledNetwork = this.safeValue(entry, 'payout_enabled', false);
843
+ const payinEnabledNetwork = this.safeBool(entry, 'payin_enabled', false);
844
+ const payoutEnabledNetwork = this.safeBool(entry, 'payout_enabled', false);
845
845
  const activeNetwork = payinEnabledNetwork && payoutEnabledNetwork;
846
846
  if (payinEnabledNetwork && !depositEnabled) {
847
847
  depositEnabled = true;
@@ -2705,7 +2705,7 @@ class hitbtc extends hitbtc$1 {
2705
2705
  params = this.omit(params, 'network');
2706
2706
  }
2707
2707
  const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
2708
- const includeFee = this.safeValue(withdrawOptions, 'includeFee', false);
2708
+ const includeFee = this.safeBool(withdrawOptions, 'includeFee', false);
2709
2709
  if (includeFee) {
2710
2710
  request['include_fee'] = true;
2711
2711
  }
@@ -3227,7 +3227,7 @@ class hitbtc extends hitbtc$1 {
3227
3227
  await this.loadMarkets();
3228
3228
  const market = this.market(symbol);
3229
3229
  const leverage = this.safeString(params, 'leverage');
3230
- if (market['type'] === 'swap') {
3230
+ if (market['swap']) {
3231
3231
  if (leverage === undefined) {
3232
3232
  throw new errors.ArgumentsRequired(this.id + ' modifyMarginHelper() requires a leverage parameter for swap markets');
3233
3233
  }
@@ -3251,21 +3251,15 @@ class hitbtc extends hitbtc$1 {
3251
3251
  let marginMode = undefined;
3252
3252
  [marketType, params] = this.handleMarketTypeAndParams('modifyMarginHelper', market, params);
3253
3253
  [marginMode, params] = this.handleMarginModeAndParams('modifyMarginHelper', params);
3254
- params = this.omit(params, ['marginMode', 'margin']);
3255
3254
  let response = undefined;
3256
- if (marginMode !== undefined) {
3255
+ if (marketType === 'swap') {
3256
+ response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
3257
+ }
3258
+ else if ((marketType === 'margin') || (marketType === 'spot') || (marginMode === 'isolated')) {
3257
3259
  response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
3258
3260
  }
3259
3261
  else {
3260
- if (marketType === 'swap') {
3261
- response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
3262
- }
3263
- else if (marketType === 'margin') {
3264
- response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
3265
- }
3266
- else {
3267
- throw new errors.NotSupported(this.id + ' modifyMarginHelper() not support this market type');
3268
- }
3262
+ throw new errors.NotSupported(this.id + ' modifyMarginHelper() not support this market type');
3269
3263
  }
3270
3264
  //
3271
3265
  // {
@@ -3577,7 +3571,7 @@ class hitbtc extends hitbtc$1 {
3577
3571
  * @returns {Array} the marginMode in lowercase
3578
3572
  */
3579
3573
  const defaultType = this.safeString(this.options, 'defaultType');
3580
- const isMargin = this.safeValue(params, 'margin', false);
3574
+ const isMargin = this.safeBool(params, 'margin', false);
3581
3575
  let marginMode = undefined;
3582
3576
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
3583
3577
  if (marginMode === undefined) {
@@ -1091,7 +1091,7 @@ class hollaex extends hollaex$1 {
1091
1091
  const filled = this.safeString(order, 'filled');
1092
1092
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
1093
1093
  const meta = this.safeValue(order, 'meta', {});
1094
- const postOnly = this.safeValue(meta, 'post_only', false);
1094
+ const postOnly = this.safeBool(meta, 'post_only', false);
1095
1095
  return this.safeOrder({
1096
1096
  'id': id,
1097
1097
  'clientOrderId': undefined,
@@ -1145,7 +1145,7 @@ class hollaex extends hollaex$1 {
1145
1145
  };
1146
1146
  const stopPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop']);
1147
1147
  const meta = this.safeValue(params, 'meta', {});
1148
- const exchangeSpecificParam = this.safeValue(meta, 'post_only', false);
1148
+ const exchangeSpecificParam = this.safeBool(meta, 'post_only', false);
1149
1149
  const isMarketOrder = type === 'market';
1150
1150
  const postOnly = this.isPostOnly(isMarketOrder, exchangeSpecificParam, params);
1151
1151
  if (!isMarketOrder) {