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
@@ -44,6 +44,9 @@ export default class bitforex extends Exchange {
44
44
  'fetchClosedOrders': true,
45
45
  'fetchCrossBorrowRate': false,
46
46
  'fetchCrossBorrowRates': false,
47
+ 'fetchDepositAddress': false,
48
+ 'fetchDepositAddresses': false,
49
+ 'fetchDepositAddressesByNetwork': false,
47
50
  'fetchFundingHistory': false,
48
51
  'fetchFundingRate': false,
49
52
  'fetchFundingRateHistory': false,
package/js/src/bitget.js CHANGED
@@ -69,6 +69,7 @@ export default class bitget extends Exchange {
69
69
  'fetchCrossBorrowRate': true,
70
70
  'fetchCrossBorrowRates': false,
71
71
  'fetchCurrencies': true,
72
+ 'fetchDeposit': false,
72
73
  'fetchDepositAddress': true,
73
74
  'fetchDepositAddresses': false,
74
75
  'fetchDeposits': true,
@@ -98,6 +99,7 @@ export default class bitget extends Exchange {
98
99
  'fetchOpenOrders': true,
99
100
  'fetchOrder': true,
100
101
  'fetchOrderBook': true,
102
+ 'fetchOrderBooks': false,
101
103
  'fetchOrders': false,
102
104
  'fetchOrderTrades': false,
103
105
  'fetchPosition': true,
@@ -105,6 +107,7 @@ export default class bitget extends Exchange {
105
107
  'fetchPositions': true,
106
108
  'fetchPositionsRisk': false,
107
109
  'fetchPremiumIndexOHLCV': false,
110
+ 'fetchStatus': false,
108
111
  'fetchTicker': true,
109
112
  'fetchTickers': true,
110
113
  'fetchTime': true,
@@ -121,6 +124,7 @@ export default class bitget extends Exchange {
121
124
  'repayCrossMargin': true,
122
125
  'repayIsolatedMargin': true,
123
126
  'setLeverage': true,
127
+ 'setMargin': false,
124
128
  'setMarginMode': true,
125
129
  'setPositionMode': true,
126
130
  'signIn': false,
@@ -2238,7 +2242,7 @@ export default class bitget extends Exchange {
2238
2242
  'fee': undefined,
2239
2243
  };
2240
2244
  const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
2241
- const fillResponseFromRequest = this.safeValue(withdrawOptions, 'fillResponseFromRequest', true);
2245
+ const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
2242
2246
  if (fillResponseFromRequest) {
2243
2247
  result['currency'] = code;
2244
2248
  result['timestamp'] = this.milliseconds();
@@ -3123,7 +3127,7 @@ export default class bitget extends Exchange {
3123
3127
  [marginMode, params] = this.handleMarginModeAndParams('fetchTradingFees', params);
3124
3128
  [marketType, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
3125
3129
  if (marketType === 'spot') {
3126
- const margin = this.safeValue(params, 'margin', false);
3130
+ const margin = this.safeBool(params, 'margin', false);
3127
3131
  params = this.omit(params, 'margin');
3128
3132
  if ((marginMode !== undefined) || margin) {
3129
3133
  response = await this.publicMarginGetV2MarginCurrencies(params);
@@ -4144,7 +4148,7 @@ export default class bitget extends Exchange {
4144
4148
  request['price'] = this.priceToPrecision(symbol, price);
4145
4149
  }
4146
4150
  const triggerType = this.safeString(params, 'triggerType', 'mark_price');
4147
- const reduceOnly = this.safeValue(params, 'reduceOnly', false);
4151
+ const reduceOnly = this.safeBool(params, 'reduceOnly', false);
4148
4152
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
4149
4153
  const exchangeSpecificTifParam = this.safeString2(params, 'force', 'timeInForce');
4150
4154
  let postOnly = undefined;
@@ -4240,7 +4244,7 @@ export default class bitget extends Exchange {
4240
4244
  }
4241
4245
  const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
4242
4246
  request['marginMode'] = marginModeRequest;
4243
- const oneWayMode = this.safeValue(params, 'oneWayMode', false);
4247
+ const oneWayMode = this.safeBool(params, 'oneWayMode', false);
4244
4248
  params = this.omit(params, 'oneWayMode');
4245
4249
  let requestSide = side;
4246
4250
  if (reduceOnly) {
package/js/src/bitmart.js CHANGED
@@ -1939,7 +1939,7 @@ export default class bitmart extends Exchange {
1939
1939
  let marketType = undefined;
1940
1940
  [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1941
1941
  const marginMode = this.safeString(params, 'marginMode');
1942
- const isMargin = this.safeValue(params, 'margin', false);
1942
+ const isMargin = this.safeBool(params, 'margin', false);
1943
1943
  params = this.omit(params, ['margin', 'marginMode']);
1944
1944
  if (marginMode !== undefined || isMargin) {
1945
1945
  marketType = 'margin';
@@ -2813,7 +2813,7 @@ export default class bitmart extends Exchange {
2813
2813
  response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
2814
2814
  }
2815
2815
  else {
2816
- const trailing = this.safeValue(params, 'trailing', false);
2816
+ const trailing = this.safeBool(params, 'trailing', false);
2817
2817
  let orderType = this.safeString(params, 'orderType');
2818
2818
  params = this.omit(params, ['orderType', 'trailing']);
2819
2819
  if (trailing) {
@@ -2993,7 +2993,7 @@ export default class bitmart extends Exchange {
2993
2993
  if (symbol === undefined) {
2994
2994
  throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
2995
2995
  }
2996
- const trailing = this.safeValue(params, 'trailing', false);
2996
+ const trailing = this.safeBool(params, 'trailing', false);
2997
2997
  let orderType = this.safeString(params, 'orderType');
2998
2998
  params = this.omit(params, ['orderType', 'trailing']);
2999
2999
  if (trailing) {
package/js/src/bitmex.js CHANGED
@@ -342,8 +342,8 @@ export default class bitmex extends Exchange {
342
342
  const network = this.networkIdToCode(networkId);
343
343
  const withdrawalFeeRaw = this.safeString(chain, 'withdrawalFee');
344
344
  const withdrawalFee = this.parseNumber(Precise.stringMul(withdrawalFeeRaw, precisionString));
345
- const isDepositEnabled = this.safeValue(chain, 'depositEnabled', false);
346
- const isWithdrawEnabled = this.safeValue(chain, 'withdrawalEnabled', false);
345
+ const isDepositEnabled = this.safeBool(chain, 'depositEnabled', false);
346
+ const isWithdrawEnabled = this.safeBool(chain, 'withdrawalEnabled', false);
347
347
  const active = (isDepositEnabled && isWithdrawEnabled);
348
348
  if (isDepositEnabled) {
349
349
  depositEnabled = true;
@@ -1719,7 +1719,7 @@ export default class bitmex extends Exchange {
1719
1719
  isInverse = (defaultSubType === 'inverse');
1720
1720
  }
1721
1721
  else {
1722
- isInverse = this.safeValue(market, 'inverse', false);
1722
+ isInverse = this.safeBool(market, 'inverse', false);
1723
1723
  }
1724
1724
  if (isInverse) {
1725
1725
  cost = this.convertFromRawQuantity(symbol, qty);
@@ -2426,7 +2426,7 @@ export default class bitmex extends Exchange {
2426
2426
  const item = response[i];
2427
2427
  const marketId = this.safeString(item, 'symbol');
2428
2428
  const market = this.safeMarket(marketId);
2429
- const swap = this.safeValue(market, 'swap', false);
2429
+ const swap = this.safeBool(market, 'swap', false);
2430
2430
  if (swap) {
2431
2431
  filteredResponse.push(item);
2432
2432
  }
package/js/src/bitrue.js CHANGED
@@ -3191,7 +3191,7 @@ export default class bitrue extends Exchange {
3191
3191
  }
3192
3192
  // check success value for wapi endpoints
3193
3193
  // response in format {'msg': 'The coin does not exist.', 'success': true/false}
3194
- const success = this.safeValue(response, 'success', true);
3194
+ const success = this.safeBool(response, 'success', true);
3195
3195
  if (!success) {
3196
3196
  const messageInner = this.safeString(response, 'msg');
3197
3197
  let parsedMessage = undefined;
package/js/src/bitso.d.ts CHANGED
@@ -23,7 +23,7 @@ export default class bitso extends Exchange {
23
23
  after: number;
24
24
  status: string;
25
25
  fee: any;
26
- info: any;
26
+ info: import("./base/types.js").Dictionary<any>;
27
27
  };
28
28
  fetchMarkets(params?: {}): Promise<any[]>;
29
29
  parseBalance(response: any): Balances;
package/js/src/bitso.js CHANGED
@@ -1729,7 +1729,7 @@ export default class bitso extends Exchange {
1729
1729
  //
1730
1730
  // {"success":false,"error":{"code":104,"message":"Cannot perform request - nonce must be higher than 1520307203724237"}}
1731
1731
  //
1732
- let success = this.safeValue(response, 'success', false);
1732
+ let success = this.safeBool(response, 'success', false);
1733
1733
  if (typeof success === 'string') {
1734
1734
  if ((success === 'true') || (success === '1')) {
1735
1735
  success = true;
package/js/src/bitteam.js CHANGED
@@ -356,7 +356,7 @@ export default class bitteam extends Exchange {
356
356
  const created = this.parse8601(timeStart);
357
357
  let minCost = undefined;
358
358
  const currenciesValuedInUsd = this.safeValue(this.options, 'currenciesValuedInUsd', {});
359
- const quoteInUsd = this.safeValue(currenciesValuedInUsd, quote, false);
359
+ const quoteInUsd = this.safeBool(currenciesValuedInUsd, quote, false);
360
360
  if (quoteInUsd) {
361
361
  const settings = this.safeValue(market, 'settings', {});
362
362
  minCost = this.safeNumber(settings, 'limit_usd');
@@ -543,7 +543,7 @@ export default class bitteam extends Exchange {
543
543
  const id = this.safeString(currency, 'symbol');
544
544
  const numericId = this.safeInteger(currency, 'id');
545
545
  const code = this.safeCurrencyCode(id);
546
- const active = this.safeValue(currency, 'active', false);
546
+ const active = this.safeBool(currency, 'active', false);
547
547
  const precision = this.safeInteger(currency, 'precision');
548
548
  const txLimits = this.safeValue(currency, 'txLimits', {});
549
549
  const minWithdraw = this.safeString(txLimits, 'minWithdraw');
@@ -680,7 +680,7 @@ export default class btcalpha extends Exchange {
680
680
  const marketId = this.safeString(order, 'pair');
681
681
  market = this.safeMarket(marketId, market, '_');
682
682
  const symbol = market['symbol'];
683
- const success = this.safeValue(order, 'success', false);
683
+ const success = this.safeBool(order, 'success', false);
684
684
  let timestamp = undefined;
685
685
  if (success) {
686
686
  timestamp = this.safeTimestamp(order, 'date');
package/js/src/bybit.js CHANGED
@@ -299,8 +299,6 @@ export default class bybit extends Exchange {
299
299
  // account
300
300
  'v5/account/wallet-balance': 1,
301
301
  'v5/account/borrow-history': 1,
302
- 'v5/account/set-collateral-switch': 5,
303
- 'v5/account/set-collateral-switch-batch': 5,
304
302
  'v5/account/collateral-info': 1,
305
303
  'v5/asset/coin-greeks': 1,
306
304
  'v5/account/fee-rate': 10,
@@ -493,6 +491,8 @@ export default class bybit extends Exchange {
493
491
  'v5/lending/purchase': 5,
494
492
  'v5/lending/redeem': 5,
495
493
  'v5/lending/redeem-cancel': 5,
494
+ 'v5/account/set-collateral-switch': 5,
495
+ 'v5/account/set-collateral-switch-batch': 5,
496
496
  },
497
497
  },
498
498
  },
@@ -3462,7 +3462,7 @@ export default class bybit extends Exchange {
3462
3462
  const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
3463
3463
  const length = result.length;
3464
3464
  if (length === 0) {
3465
- const isTrigger = this.safeValueN(params, ['trigger', 'stop'], false);
3465
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
3466
3466
  const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
3467
3467
  throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
3468
3468
  }
@@ -207,6 +207,13 @@ export default class coinbase extends Exchange {
207
207
  'brokerage/best_bid_ask',
208
208
  'brokerage/convert/trade/{trade_id}',
209
209
  'brokerage/time',
210
+ 'brokerage/cfm/balance_summary',
211
+ 'brokerage/cfm/positions',
212
+ 'brokerage/cfm/positions/{product_id}',
213
+ 'brokerage/cfm/sweeps',
214
+ 'brokerage/intx/portfolio/{portfolio_uuid}',
215
+ 'brokerage/intx/positions/{portfolio_uuid}',
216
+ 'brokerage/intx/positions/{portfolio_uuid}/{symbol}',
210
217
  ],
211
218
  'post': [
212
219
  'brokerage/orders',
@@ -217,12 +224,15 @@ export default class coinbase extends Exchange {
217
224
  'brokerage/portfolios/move_funds',
218
225
  'brokerage/convert/quote',
219
226
  'brokerage/convert/trade/{trade_id}',
227
+ 'brokerage/cfm/sweeps/schedule',
228
+ 'brokerage/intx/allocate',
220
229
  ],
221
230
  'put': [
222
231
  'brokerage/portfolios/{portfolio_uuid}',
223
232
  ],
224
233
  'delete': [
225
234
  'brokerage/portfolios/{portfolio_uuid}',
235
+ 'brokerage/cfm/sweeps',
226
236
  ],
227
237
  },
228
238
  },
@@ -1364,7 +1374,11 @@ export default class coinbase extends Exchange {
1364
1374
  async fetchTickersV3(symbols = undefined, params = {}) {
1365
1375
  await this.loadMarkets();
1366
1376
  symbols = this.marketSymbols(symbols);
1367
- const response = await this.v3PrivateGetBrokerageProducts(params);
1377
+ const request = {};
1378
+ if (symbols !== undefined) {
1379
+ request['product_ids'] = this.marketIds(symbols);
1380
+ }
1381
+ const response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
1368
1382
  //
1369
1383
  // {
1370
1384
  // "products": [
@@ -1682,7 +1696,7 @@ export default class coinbase extends Exchange {
1682
1696
  'limit': 250,
1683
1697
  };
1684
1698
  let response = undefined;
1685
- const isV3 = this.safeValue(params, 'v3', false);
1699
+ const isV3 = this.safeBool(params, 'v3', false);
1686
1700
  params = this.omit(params, 'v3');
1687
1701
  const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
1688
1702
  if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
@@ -3198,8 +3212,11 @@ export default class coinbase extends Exchange {
3198
3212
  */
3199
3213
  await this.loadMarkets();
3200
3214
  symbols = this.marketSymbols(symbols);
3201
- // the 'product_ids' param isn't working properly and returns {"pricebooks":[]} when defined
3202
- const response = await this.v3PrivateGetBrokerageBestBidAsk(params);
3215
+ const request = {};
3216
+ if (symbols !== undefined) {
3217
+ request['product_ids'] = this.marketIds(symbols);
3218
+ }
3219
+ const response = await this.v3PrivateGetBrokerageBestBidAsk(this.extend(request, params));
3203
3220
  //
3204
3221
  // {
3205
3222
  // "pricebooks": [
@@ -3328,7 +3345,7 @@ export default class coinbase extends Exchange {
3328
3345
  const savedPath = fullPath;
3329
3346
  if (method === 'GET') {
3330
3347
  if (Object.keys(query).length) {
3331
- fullPath += '?' + this.urlencode(query);
3348
+ fullPath += '?' + this.urlencodeWithArrayRepeat(query);
3332
3349
  }
3333
3350
  }
3334
3351
  const url = this.urls['api']['rest'] + fullPath;
@@ -832,7 +832,7 @@ export default class coincheck extends Exchange {
832
832
  // {"success":false,"error":"disabled API Key"}'
833
833
  // {"success":false,"error":"invalid authentication"}
834
834
  //
835
- const success = this.safeValue(response, 'success', true);
835
+ const success = this.safeBool(response, 'success', true);
836
836
  if (!success) {
837
837
  const error = this.safeString(response, 'error');
838
838
  const feedback = this.id + ' ' + this.json(response);
package/js/src/coinex.js CHANGED
@@ -3327,7 +3327,7 @@ export default class coinex extends Exchange {
3327
3327
  const data = this.safeValue(response, 'data', {});
3328
3328
  const depositAddress = this.parseDepositAddress(data, currency);
3329
3329
  const options = this.safeValue(this.options, 'fetchDepositAddress', {});
3330
- const fillResponseFromRequest = this.safeValue(options, 'fillResponseFromRequest', true);
3330
+ const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
3331
3331
  if (fillResponseFromRequest) {
3332
3332
  depositAddress['network'] = this.safeNetworkCode(network, currency);
3333
3333
  }
@@ -5354,7 +5354,7 @@ export default class coinex extends Exchange {
5354
5354
  * @returns {Array} the marginMode in lowercase
5355
5355
  */
5356
5356
  const defaultType = this.safeString(this.options, 'defaultType');
5357
- const isMargin = this.safeValue(params, 'margin', false);
5357
+ const isMargin = this.safeBool(params, 'margin', false);
5358
5358
  let marginMode = undefined;
5359
5359
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
5360
5360
  if (marginMode === undefined) {
@@ -364,7 +364,7 @@ export default class coinlist extends Exchange {
364
364
  const currency = currencies[i];
365
365
  const id = this.safeString(currency, 'asset');
366
366
  const code = this.safeCurrencyCode(id);
367
- const isTransferable = this.safeValue(currency, 'is_transferable', false);
367
+ const isTransferable = this.safeBool(currency, 'is_transferable', false);
368
368
  const withdrawEnabled = isTransferable;
369
369
  const depositEnabled = isTransferable;
370
370
  const active = isTransferable;
@@ -544,7 +544,7 @@ export default class coinmate extends Exchange {
544
544
  //
545
545
  const data = this.safeValue(response, 'data');
546
546
  const transaction = this.parseTransaction(data, currency);
547
- const fillResponseFromRequest = this.safeValue(withdrawOptions, 'fillResponseFromRequest', true);
547
+ const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
548
548
  if (fillResponseFromRequest) {
549
549
  transaction['amount'] = amount;
550
550
  transaction['currency'] = code;
@@ -45,7 +45,7 @@ export default class coinmetro extends Exchange {
45
45
  after: number;
46
46
  status: string;
47
47
  fee: any;
48
- info: any;
48
+ info: import("./base/types.js").Dictionary<any>;
49
49
  };
50
50
  parseLedgerEntryDescription(description: any): any[];
51
51
  parseLedgerEntryType(type: any): string;
@@ -380,7 +380,7 @@ export default class coinmetro extends Exchange {
380
380
  const quote = this.safeCurrencyCode(quoteId);
381
381
  const basePrecisionAndLimits = this.parseMarketPrecisionAndLimits(baseId);
382
382
  const quotePrecisionAndLimits = this.parseMarketPrecisionAndLimits(quoteId);
383
- const margin = this.safeValue(market, 'margin', false);
383
+ const margin = this.safeBool(market, 'margin', false);
384
384
  const tradingFees = this.safeValue(this.fees, 'trading', {});
385
385
  return this.safeMarketStructure({
386
386
  'id': id,
@@ -1339,7 +1339,7 @@ export default class coinmetro extends Exchange {
1339
1339
  };
1340
1340
  const marginMode = undefined;
1341
1341
  [params, params] = this.handleMarginModeAndParams('cancelOrder', params);
1342
- const isMargin = this.safeValue(params, 'margin', false);
1342
+ const isMargin = this.safeBool(params, 'margin', false);
1343
1343
  params = this.omit(params, 'margin');
1344
1344
  let response = undefined;
1345
1345
  if (isMargin || (marginMode !== undefined)) {
package/js/src/coinsph.js CHANGED
@@ -1562,7 +1562,7 @@ export default class coinsph extends Exchange {
1562
1562
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1563
1563
  */
1564
1564
  const options = this.safeValue(this.options, 'withdraw');
1565
- const warning = this.safeValue(options, 'warning', true);
1565
+ const warning = this.safeBool(options, 'warning', true);
1566
1566
  if (warning) {
1567
1567
  throw new 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");
1568
1568
  }
@@ -1057,7 +1057,7 @@ export default class cryptocom extends Exchange {
1057
1057
  request['time_in_force'] = timeInForce;
1058
1058
  }
1059
1059
  }
1060
- const postOnly = this.safeValue(params, 'postOnly', false);
1060
+ const postOnly = this.safeBool(params, 'postOnly', false);
1061
1061
  if ((postOnly) || (timeInForce === 'PO')) {
1062
1062
  request['exec_inst'] = ['POST_ONLY'];
1063
1063
  request['time_in_force'] = 'GOOD_TILL_CANCEL';
@@ -1278,7 +1278,7 @@ export default class cryptocom extends Exchange {
1278
1278
  request['time_in_force'] = timeInForce;
1279
1279
  }
1280
1280
  }
1281
- const postOnly = this.safeValue(params, 'postOnly', false);
1281
+ const postOnly = this.safeBool(params, 'postOnly', false);
1282
1282
  if ((postOnly) || (timeInForce === 'PO')) {
1283
1283
  request['exec_inst'] = ['POST_ONLY'];
1284
1284
  request['time_in_force'] = 'GOOD_TILL_CANCEL';
@@ -2249,7 +2249,7 @@ export default class cryptocom extends Exchange {
2249
2249
  * @returns {Array} the marginMode in lowercase
2250
2250
  */
2251
2251
  const defaultType = this.safeString(this.options, 'defaultType');
2252
- const isMargin = this.safeValue(params, 'margin', false);
2252
+ const isMargin = this.safeBool(params, 'margin', false);
2253
2253
  params = this.omit(params, 'margin');
2254
2254
  let marginMode = undefined;
2255
2255
  [marginMode, params] = this.handleMarginModeAndParams(methodName, params);
package/js/src/deribit.js CHANGED
@@ -1346,6 +1346,7 @@ export default class deribit extends Exchange {
1346
1346
  request['end_timestamp'] = now;
1347
1347
  }
1348
1348
  else {
1349
+ since = Math.max(since - 1, 0);
1349
1350
  request['start_timestamp'] = since;
1350
1351
  if (limit === undefined) {
1351
1352
  request['end_timestamp'] = now;
@@ -1162,9 +1162,11 @@ export default class digifinex extends Exchange {
1162
1162
  // "timestamp": 1663221614998
1163
1163
  // }
1164
1164
  //
1165
+ const indexPrice = this.safeNumber(ticker, 'index_price');
1166
+ const marketType = (indexPrice !== undefined) ? 'contract' : 'spot';
1165
1167
  const marketId = this.safeStringUpper2(ticker, 'symbol', 'instrument_id');
1166
- const symbol = this.safeSymbol(marketId, market);
1167
- market = this.safeMarket(marketId);
1168
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
1169
+ market = this.safeMarket(marketId, market, undefined, marketType);
1168
1170
  let timestamp = this.safeTimestamp(ticker, 'date');
1169
1171
  if (market['swap']) {
1170
1172
  timestamp = this.safeInteger(ticker, 'timestamp');
@@ -1751,7 +1753,7 @@ export default class digifinex extends Exchange {
1751
1753
  let postOnly = this.isPostOnly(isMarketOrder, false, params);
1752
1754
  let postOnlyParsed = undefined;
1753
1755
  if (swap) {
1754
- const reduceOnly = this.safeValue(params, 'reduceOnly', false);
1756
+ const reduceOnly = this.safeBool(params, 'reduceOnly', false);
1755
1757
  const timeInForce = this.safeString(params, 'timeInForce');
1756
1758
  let orderType = undefined;
1757
1759
  if (side === 'buy') {
@@ -3951,7 +3953,7 @@ export default class digifinex extends Exchange {
3951
3953
  * @returns {Array} the marginMode in lowercase
3952
3954
  */
3953
3955
  const defaultType = this.safeString(this.options, 'defaultType');
3954
- const isMargin = this.safeValue(params, 'margin', false);
3956
+ const isMargin = this.safeBool(params, 'margin', false);
3955
3957
  let marginMode = undefined;
3956
3958
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
3957
3959
  if (marginMode !== undefined) {
package/js/src/exmo.js CHANGED
@@ -252,7 +252,7 @@ export default class exmo extends Exchange {
252
252
  //
253
253
  const margin = this.parseMarginModification(response, market);
254
254
  const options = this.safeValue(this.options, 'margin', {});
255
- const fillResponseFromRequest = this.safeValue(options, 'fillResponseFromRequest', true);
255
+ const fillResponseFromRequest = this.safeBool(options, 'fillResponseFromRequest', true);
256
256
  if (fillResponseFromRequest) {
257
257
  margin['type'] = type;
258
258
  margin['amount'] = amount;
@@ -2616,7 +2616,7 @@ export default class exmo extends Exchange {
2616
2616
  // {"result":false,"error":"Error 50052: Insufficient funds"}
2617
2617
  // {"s":"error","errmsg":"strconv.ParseInt: parsing \"\": invalid syntax"}
2618
2618
  //
2619
- let success = this.safeValue(response, 'result', false);
2619
+ let success = this.safeBool(response, 'result', false);
2620
2620
  if (typeof success === 'string') {
2621
2621
  if ((success === 'true') || (success === '1')) {
2622
2622
  success = true;
package/js/src/gate.js CHANGED
@@ -1592,9 +1592,9 @@ export default class gate extends Exchange {
1592
1592
  const networkId = this.safeString(entry, 'chain');
1593
1593
  const networkCode = this.networkIdToCode(networkId, code);
1594
1594
  const delisted = this.safeValue(entry, 'delisted');
1595
- const withdrawDisabled = this.safeValue(entry, 'withdraw_disabled', false);
1596
- const depositDisabled = this.safeValue(entry, 'deposit_disabled', false);
1597
- const tradeDisabled = this.safeValue(entry, 'trade_disabled', false);
1595
+ const withdrawDisabled = this.safeBool(entry, 'withdraw_disabled', false);
1596
+ const depositDisabled = this.safeBool(entry, 'deposit_disabled', false);
1597
+ const tradeDisabled = this.safeBool(entry, 'trade_disabled', false);
1598
1598
  const withdrawEnabled = !withdrawDisabled;
1599
1599
  const depositEnabled = !depositDisabled;
1600
1600
  const tradeEnabled = !tradeDisabled;
@@ -4051,7 +4051,7 @@ export default class gate extends Exchange {
4051
4051
  }
4052
4052
  }
4053
4053
  let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
4054
- const textIsRequired = this.safeValue(params, 'textIsRequired', false);
4054
+ const textIsRequired = this.safeBool(params, 'textIsRequired', false);
4055
4055
  if (clientOrderId !== undefined) {
4056
4056
  // user-defined, must follow the rules if not empty
4057
4057
  // prefixed with t-
@@ -4423,7 +4423,7 @@ export default class gate extends Exchange {
4423
4423
  // "message": "Not enough balance"
4424
4424
  // }
4425
4425
  //
4426
- const succeeded = this.safeValue(order, 'succeeded', true);
4426
+ const succeeded = this.safeBool(order, 'succeeded', true);
4427
4427
  if (!succeeded) {
4428
4428
  // cancelOrders response
4429
4429
  return this.safeOrder({
@@ -10,7 +10,7 @@ export default class gemini extends Exchange {
10
10
  fetchCurrenciesFromWeb(params?: {}): Promise<{}>;
11
11
  fetchMarkets(params?: {}): Promise<any>;
12
12
  fetchMarketsFromWeb(params?: {}): Promise<any[]>;
13
- parseMarketActive(status: any): any;
13
+ parseMarketActive(status: any): boolean;
14
14
  fetchUSDTMarkets(params?: {}): Promise<any[]>;
15
15
  fetchMarketsFromAPI(params?: {}): Promise<unknown[]>;
16
16
  parseMarket(response: any): Market;
package/js/src/gemini.js CHANGED
@@ -515,7 +515,7 @@ export default class gemini extends Exchange {
515
515
  'post_only': true,
516
516
  'limit_only': true,
517
517
  };
518
- return this.safeValue(statuses, status, true);
518
+ return this.safeBool(statuses, status, true);
519
519
  }
520
520
  async fetchUSDTMarkets(params = {}) {
521
521
  // these markets can't be scrapped and fetchMarketsFrom api does an extra call
@@ -554,7 +554,7 @@ export default class gemini extends Exchange {
554
554
  result[marketId] = this.parseMarket(market);
555
555
  }
556
556
  const options = this.safeValue(this.options, 'fetchMarketsFromAPI', {});
557
- const fetchDetailsForAllSymbols = this.safeValue(options, 'fetchDetailsForAllSymbols', false);
557
+ const fetchDetailsForAllSymbols = this.safeBool(options, 'fetchDetailsForAllSymbols', false);
558
558
  const fetchDetailsForMarketIds = this.safeValue(options, 'fetchDetailsForMarketIds', []);
559
559
  let promises = [];
560
560
  let marketIds = [];
@@ -1371,7 +1371,7 @@ export default class gemini extends Exchange {
1371
1371
  request['options'] = ['maker-or-cancel'];
1372
1372
  }
1373
1373
  }
1374
- const postOnly = this.safeValue(params, 'postOnly', false);
1374
+ const postOnly = this.safeBool(params, 'postOnly', false);
1375
1375
  params = this.omit(params, 'postOnly');
1376
1376
  if (postOnly) {
1377
1377
  request['options'] = ['maker-or-cancel'];
package/js/src/hitbtc.js CHANGED
@@ -693,7 +693,7 @@ export default class hitbtc extends Exchange {
693
693
  const expiry = this.safeInteger(market, 'expiry');
694
694
  const contract = (marketType === 'futures');
695
695
  const spot = (marketType === 'spot');
696
- const marginTrading = this.safeValue(market, 'margin_trading', false);
696
+ const marginTrading = this.safeBool(market, 'margin_trading', false);
697
697
  const margin = spot && marginTrading;
698
698
  const future = (expiry !== undefined);
699
699
  const swap = (contract && !future);
@@ -828,9 +828,9 @@ export default class hitbtc extends Exchange {
828
828
  const entry = response[currencyId];
829
829
  const name = this.safeString(entry, 'full_name');
830
830
  const precision = this.safeNumber(entry, 'precision_transfer');
831
- const payinEnabled = this.safeValue(entry, 'payin_enabled', false);
832
- const payoutEnabled = this.safeValue(entry, 'payout_enabled', false);
833
- const transferEnabled = this.safeValue(entry, 'transfer_enabled', false);
831
+ const payinEnabled = this.safeBool(entry, 'payin_enabled', false);
832
+ const payoutEnabled = this.safeBool(entry, 'payout_enabled', false);
833
+ const transferEnabled = this.safeBool(entry, 'transfer_enabled', false);
834
834
  const active = payinEnabled && payoutEnabled && transferEnabled;
835
835
  const rawNetworks = this.safeValue(entry, 'networks', []);
836
836
  const networks = {};
@@ -843,8 +843,8 @@ export default class hitbtc extends Exchange {
843
843
  const network = this.safeNetwork(networkId);
844
844
  fee = this.safeNumber(rawNetwork, 'payout_fee');
845
845
  const networkPrecision = this.safeNumber(rawNetwork, 'precision_payout');
846
- const payinEnabledNetwork = this.safeValue(entry, 'payin_enabled', false);
847
- const payoutEnabledNetwork = this.safeValue(entry, 'payout_enabled', false);
846
+ const payinEnabledNetwork = this.safeBool(entry, 'payin_enabled', false);
847
+ const payoutEnabledNetwork = this.safeBool(entry, 'payout_enabled', false);
848
848
  const activeNetwork = payinEnabledNetwork && payoutEnabledNetwork;
849
849
  if (payinEnabledNetwork && !depositEnabled) {
850
850
  depositEnabled = true;
@@ -2708,7 +2708,7 @@ export default class hitbtc extends Exchange {
2708
2708
  params = this.omit(params, 'network');
2709
2709
  }
2710
2710
  const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
2711
- const includeFee = this.safeValue(withdrawOptions, 'includeFee', false);
2711
+ const includeFee = this.safeBool(withdrawOptions, 'includeFee', false);
2712
2712
  if (includeFee) {
2713
2713
  request['include_fee'] = true;
2714
2714
  }
@@ -3230,7 +3230,7 @@ export default class hitbtc extends Exchange {
3230
3230
  await this.loadMarkets();
3231
3231
  const market = this.market(symbol);
3232
3232
  const leverage = this.safeString(params, 'leverage');
3233
- if (market['type'] === 'swap') {
3233
+ if (market['swap']) {
3234
3234
  if (leverage === undefined) {
3235
3235
  throw new ArgumentsRequired(this.id + ' modifyMarginHelper() requires a leverage parameter for swap markets');
3236
3236
  }
@@ -3254,21 +3254,15 @@ export default class hitbtc extends Exchange {
3254
3254
  let marginMode = undefined;
3255
3255
  [marketType, params] = this.handleMarketTypeAndParams('modifyMarginHelper', market, params);
3256
3256
  [marginMode, params] = this.handleMarginModeAndParams('modifyMarginHelper', params);
3257
- params = this.omit(params, ['marginMode', 'margin']);
3258
3257
  let response = undefined;
3259
- if (marginMode !== undefined) {
3258
+ if (marketType === 'swap') {
3259
+ response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
3260
+ }
3261
+ else if ((marketType === 'margin') || (marketType === 'spot') || (marginMode === 'isolated')) {
3260
3262
  response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
3261
3263
  }
3262
3264
  else {
3263
- if (marketType === 'swap') {
3264
- response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
3265
- }
3266
- else if (marketType === 'margin') {
3267
- response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
3268
- }
3269
- else {
3270
- throw new NotSupported(this.id + ' modifyMarginHelper() not support this market type');
3271
- }
3265
+ throw new NotSupported(this.id + ' modifyMarginHelper() not support this market type');
3272
3266
  }
3273
3267
  //
3274
3268
  // {
@@ -3580,7 +3574,7 @@ export default class hitbtc extends Exchange {
3580
3574
  * @returns {Array} the marginMode in lowercase
3581
3575
  */
3582
3576
  const defaultType = this.safeString(this.options, 'defaultType');
3583
- const isMargin = this.safeValue(params, 'margin', false);
3577
+ const isMargin = this.safeBool(params, 'margin', false);
3584
3578
  let marginMode = undefined;
3585
3579
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
3586
3580
  if (marginMode === undefined) {