ccxt 4.2.29 → 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 (154) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +1709 -533
  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 +21 -21
  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 +896 -217
  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 +52 -62
  14. package/dist/cjs/src/bitget.js +8 -4
  15. package/dist/cjs/src/bitmart.js +3 -3
  16. package/dist/cjs/src/bitmex.js +4 -4
  17. package/dist/cjs/src/bitrue.js +1 -1
  18. package/dist/cjs/src/bitso.js +1 -1
  19. package/dist/cjs/src/bitteam.js +2 -2
  20. package/dist/cjs/src/btcalpha.js +1 -1
  21. package/dist/cjs/src/bybit.js +3 -3
  22. package/dist/cjs/src/coinbase.js +12 -5
  23. package/dist/cjs/src/coincheck.js +1 -1
  24. package/dist/cjs/src/coinex.js +2 -2
  25. package/dist/cjs/src/coinlist.js +1 -1
  26. package/dist/cjs/src/coinmate.js +1 -1
  27. package/dist/cjs/src/coinmetro.js +2 -2
  28. package/dist/cjs/src/coinsph.js +1 -1
  29. package/dist/cjs/src/cryptocom.js +3 -3
  30. package/dist/cjs/src/digifinex.js +6 -4
  31. package/dist/cjs/src/exmo.js +2 -2
  32. package/dist/cjs/src/gate.js +5 -5
  33. package/dist/cjs/src/gemini.js +3 -3
  34. package/dist/cjs/src/hitbtc.js +14 -20
  35. package/dist/cjs/src/hollaex.js +2 -2
  36. package/dist/cjs/src/htx.js +5 -5
  37. package/dist/cjs/src/huobijp.js +1 -1
  38. package/dist/cjs/src/krakenfutures.js +1 -1
  39. package/dist/cjs/src/kucoin.js +17 -17
  40. package/dist/cjs/src/kucoinfutures.js +3 -3
  41. package/dist/cjs/src/lbank.js +1 -1
  42. package/dist/cjs/src/mexc.js +7 -7
  43. package/dist/cjs/src/novadax.js +1 -1
  44. package/dist/cjs/src/okcoin.js +2 -2
  45. package/dist/cjs/src/okx.js +7 -6
  46. package/dist/cjs/src/p2b.js +1 -0
  47. package/dist/cjs/src/phemex.js +3 -3
  48. package/dist/cjs/src/poloniexfutures.js +3 -3
  49. package/dist/cjs/src/pro/alpaca.js +1 -1
  50. package/dist/cjs/src/pro/binance.js +4 -4
  51. package/dist/cjs/src/pro/bitget.js +1 -1
  52. package/dist/cjs/src/pro/bitmart.js +1 -1
  53. package/dist/cjs/src/pro/bitmex.js +49 -6
  54. package/dist/cjs/src/pro/bitvavo.js +1 -1
  55. package/dist/cjs/src/pro/bybit.js +2 -2
  56. package/dist/cjs/src/pro/cex.js +2 -2
  57. package/dist/cjs/src/pro/independentreserve.js +1 -1
  58. package/dist/cjs/src/pro/okx.js +1 -1
  59. package/dist/cjs/src/pro/onetrading.js +2 -2
  60. package/dist/cjs/src/pro/p2b.js +432 -0
  61. package/dist/cjs/src/pro/probit.js +5 -5
  62. package/dist/cjs/src/pro/whitebit.js +1 -1
  63. package/dist/cjs/src/probit.js +1 -1
  64. package/dist/cjs/src/timex.js +1 -1
  65. package/dist/cjs/src/tokocrypto.js +3 -3
  66. package/dist/cjs/src/wavesexchange.js +2 -2
  67. package/dist/cjs/src/whitebit.js +2 -2
  68. package/dist/cjs/src/woo.js +3 -3
  69. package/dist/cjs/src/yobit.js +1 -1
  70. package/dist/cjs/src/zaif.js +1 -1
  71. package/dist/cjs/src/zonda.js +3 -3
  72. package/js/ccxt.d.ts +4 -1
  73. package/js/ccxt.js +3 -1
  74. package/js/src/abstract/bybit.d.ts +2 -2
  75. package/js/src/ascendex.js +5 -5
  76. package/js/src/base/Exchange.d.ts +1 -1
  77. package/js/src/base/Exchange.js +21 -21
  78. package/js/src/base/errorHierarchy.d.ts +7 -6
  79. package/js/src/base/errorHierarchy.js +7 -6
  80. package/js/src/base/errors.d.ts +3 -3
  81. package/js/src/base/errors.js +3 -3
  82. package/js/src/base/functions/type.js +12 -0
  83. package/js/src/bigone.js +2 -2
  84. package/js/src/binance.d.ts +1 -0
  85. package/js/src/binance.js +897 -218
  86. package/js/src/bingx.js +1 -1
  87. package/js/src/bitfinex.js +1 -1
  88. package/js/src/bitfinex2.js +52 -62
  89. package/js/src/bitget.js +8 -4
  90. package/js/src/bitmart.js +3 -3
  91. package/js/src/bitmex.js +4 -4
  92. package/js/src/bitrue.js +1 -1
  93. package/js/src/bitso.d.ts +1 -1
  94. package/js/src/bitso.js +1 -1
  95. package/js/src/bitteam.js +2 -2
  96. package/js/src/btcalpha.js +1 -1
  97. package/js/src/bybit.js +3 -3
  98. package/js/src/coinbase.js +12 -5
  99. package/js/src/coincheck.js +1 -1
  100. package/js/src/coinex.js +2 -2
  101. package/js/src/coinlist.js +1 -1
  102. package/js/src/coinmate.js +1 -1
  103. package/js/src/coinmetro.d.ts +1 -1
  104. package/js/src/coinmetro.js +2 -2
  105. package/js/src/coinsph.js +1 -1
  106. package/js/src/cryptocom.js +3 -3
  107. package/js/src/digifinex.js +6 -4
  108. package/js/src/exmo.js +2 -2
  109. package/js/src/gate.js +5 -5
  110. package/js/src/gemini.d.ts +1 -1
  111. package/js/src/gemini.js +3 -3
  112. package/js/src/hitbtc.js +14 -20
  113. package/js/src/hollaex.js +2 -2
  114. package/js/src/htx.js +5 -5
  115. package/js/src/huobijp.js +1 -1
  116. package/js/src/krakenfutures.js +1 -1
  117. package/js/src/kucoin.js +17 -17
  118. package/js/src/kucoinfutures.js +3 -3
  119. package/js/src/lbank.js +1 -1
  120. package/js/src/mexc.js +7 -7
  121. package/js/src/novadax.js +1 -1
  122. package/js/src/okcoin.js +2 -2
  123. package/js/src/okx.js +7 -6
  124. package/js/src/p2b.js +1 -0
  125. package/js/src/phemex.js +3 -3
  126. package/js/src/poloniexfutures.js +3 -3
  127. package/js/src/pro/alpaca.js +1 -1
  128. package/js/src/pro/binance.js +4 -4
  129. package/js/src/pro/bitget.js +1 -1
  130. package/js/src/pro/bitmart.js +1 -1
  131. package/js/src/pro/bitmex.d.ts +2 -1
  132. package/js/src/pro/bitmex.js +49 -6
  133. package/js/src/pro/bitvavo.js +1 -1
  134. package/js/src/pro/bybit.js +2 -2
  135. package/js/src/pro/cex.js +2 -2
  136. package/js/src/pro/independentreserve.js +1 -1
  137. package/js/src/pro/okx.js +1 -1
  138. package/js/src/pro/onetrading.js +2 -2
  139. package/js/src/pro/p2b.d.ts +23 -0
  140. package/js/src/pro/p2b.js +433 -0
  141. package/js/src/pro/probit.js +5 -5
  142. package/js/src/pro/whitebit.js +1 -1
  143. package/js/src/probit.js +1 -1
  144. package/js/src/timex.js +1 -1
  145. package/js/src/tokocrypto.js +3 -3
  146. package/js/src/wavesexchange.js +2 -2
  147. package/js/src/whitebit.js +2 -2
  148. package/js/src/woo.js +3 -3
  149. package/js/src/yobit.js +1 -1
  150. package/js/src/zaif.js +1 -1
  151. package/js/src/zonda.d.ts +1 -1
  152. package/js/src/zonda.js +3 -3
  153. package/package.json +1 -1
  154. package/skip-tests.json +3 -10
@@ -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) {
@@ -3981,7 +3981,7 @@ class htx extends htx$1 {
3981
3981
  let response = undefined;
3982
3982
  const stop = this.safeValue(params, 'stop');
3983
3983
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
3984
- const trailing = this.safeValue(params, 'trailing', false);
3984
+ const trailing = this.safeBool(params, 'trailing', false);
3985
3985
  params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
3986
3986
  if (stop || stopLossTakeProfit || trailing) {
3987
3987
  if (limit !== undefined) {
@@ -4356,7 +4356,7 @@ class htx extends htx$1 {
4356
4356
  request['contract_code'] = market['id'];
4357
4357
  const stop = this.safeValue(params, 'stop');
4358
4358
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
4359
- const trailing = this.safeValue(params, 'trailing', false);
4359
+ const trailing = this.safeBool(params, 'trailing', false);
4360
4360
  params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
4361
4361
  if (market['linear']) {
4362
4362
  let marginMode = undefined;
@@ -5735,7 +5735,7 @@ class htx extends htx$1 {
5735
5735
  }
5736
5736
  const stop = this.safeValue(params, 'stop');
5737
5737
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
5738
- const trailing = this.safeValue(params, 'trailing', false);
5738
+ const trailing = this.safeBool(params, 'trailing', false);
5739
5739
  params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
5740
5740
  if (market['linear']) {
5741
5741
  let marginMode = undefined;
@@ -6060,7 +6060,7 @@ class htx extends htx$1 {
6060
6060
  request['contract_code'] = market['id'];
6061
6061
  const stop = this.safeValue(params, 'stop');
6062
6062
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
6063
- const trailing = this.safeValue(params, 'trailing', false);
6063
+ const trailing = this.safeBool(params, 'trailing', false);
6064
6064
  params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
6065
6065
  if (market['linear']) {
6066
6066
  let marginMode = undefined;
@@ -6526,7 +6526,7 @@ class htx extends htx$1 {
6526
6526
  }
6527
6527
  amount = parseFloat(this.currencyToPrecision(code, amount, networkCode));
6528
6528
  const withdrawOptions = this.safeValue(this.options, 'withdraw', {});
6529
- if (this.safeValue(withdrawOptions, 'includeFee', false)) {
6529
+ if (this.safeBool(withdrawOptions, 'includeFee', false)) {
6530
6530
  let fee = this.safeNumber(params, 'fee');
6531
6531
  if (fee === undefined) {
6532
6532
  const currencies = await this.fetchCurrencies();
@@ -1043,7 +1043,7 @@ class huobijp extends huobijp$1 {
1043
1043
  const depositEnabled = this.safeValue(currency, 'deposit-enabled');
1044
1044
  const withdrawEnabled = this.safeValue(currency, 'withdraw-enabled');
1045
1045
  const countryDisabled = this.safeValue(currency, 'country-disabled');
1046
- const visible = this.safeValue(currency, 'visible', false);
1046
+ const visible = this.safeBool(currency, 'visible', false);
1047
1047
  const state = this.safeString(currency, 'state');
1048
1048
  const active = visible && depositEnabled && withdrawEnabled && (state === 'online') && !countryDisabled;
1049
1049
  const name = this.safeString(currency, 'display-name');
@@ -545,7 +545,7 @@ class krakenfutures extends krakenfutures$1 {
545
545
  const volume = this.safeString(ticker, 'vol24h');
546
546
  let baseVolume = undefined;
547
547
  let quoteVolume = undefined;
548
- const isIndex = this.safeValue(market, 'index', false);
548
+ const isIndex = this.safeBool(market, 'index', false);
549
549
  if (!isIndex) {
550
550
  if (market['linear']) {
551
551
  baseVolume = volume;
@@ -940,7 +940,7 @@ class kucoin extends kucoin$1 {
940
940
  //
941
941
  const data = this.safeValue(response, 'data');
942
942
  const options = this.safeValue(this.options, 'fetchMarkets', {});
943
- const fetchTickersFees = this.safeValue(options, 'fetchTickersFees', true);
943
+ const fetchTickersFees = this.safeBool(options, 'fetchTickersFees', true);
944
944
  let tickersResponse = {};
945
945
  if (fetchTickersFees) {
946
946
  tickersResponse = await this.publicGetMarketAllTickers(params);
@@ -1148,14 +1148,14 @@ class kucoin extends kucoin$1 {
1148
1148
  const chain = chains[j];
1149
1149
  const chainId = this.safeString(chain, 'chainId');
1150
1150
  const networkCode = this.networkIdToCode(chainId);
1151
- const chainWithdrawEnabled = this.safeValue(chain, 'isWithdrawEnabled', false);
1151
+ const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false);
1152
1152
  if (isWithdrawEnabled === undefined) {
1153
1153
  isWithdrawEnabled = chainWithdrawEnabled;
1154
1154
  }
1155
1155
  else {
1156
1156
  isWithdrawEnabled = isWithdrawEnabled || chainWithdrawEnabled;
1157
1157
  }
1158
- const chainDepositEnabled = this.safeValue(chain, 'isDepositEnabled', false);
1158
+ const chainDepositEnabled = this.safeBool(chain, 'isDepositEnabled', false);
1159
1159
  if (isDepositEnabled === undefined) {
1160
1160
  isDepositEnabled = chainDepositEnabled;
1161
1161
  }
@@ -1913,9 +1913,9 @@ class kucoin extends kucoin$1 {
1913
1913
  */
1914
1914
  await this.loadMarkets();
1915
1915
  const market = this.market(symbol);
1916
- const testOrder = this.safeValue(params, 'test', false);
1916
+ const testOrder = this.safeBool(params, 'test', false);
1917
1917
  params = this.omit(params, 'test');
1918
- const isHf = this.safeValue(params, 'hf', false);
1918
+ const isHf = this.safeBool(params, 'hf', false);
1919
1919
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
1920
1920
  const tradeType = this.safeString(params, 'tradeType'); // keep it for backward compatibility
1921
1921
  const isTriggerOrder = (triggerPrice || stopLossPrice || takeProfitPrice);
@@ -2042,7 +2042,7 @@ class kucoin extends kucoin$1 {
2042
2042
  'symbol': market['id'],
2043
2043
  'orderList': ordersRequests,
2044
2044
  };
2045
- const hf = this.safeValue(params, 'hf', false);
2045
+ const hf = this.safeBool(params, 'hf', false);
2046
2046
  params = this.omit(params, 'hf');
2047
2047
  let response = undefined;
2048
2048
  if (hf) {
@@ -2224,7 +2224,7 @@ class kucoin extends kucoin$1 {
2224
2224
  const request = {};
2225
2225
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2226
2226
  const stop = this.safeValue2(params, 'stop', 'trigger', false);
2227
- const hf = this.safeValue(params, 'hf', false);
2227
+ const hf = this.safeBool(params, 'hf', false);
2228
2228
  if (hf) {
2229
2229
  if (symbol === undefined) {
2230
2230
  throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol parameter for hf orders');
@@ -2279,8 +2279,8 @@ class kucoin extends kucoin$1 {
2279
2279
  */
2280
2280
  await this.loadMarkets();
2281
2281
  const request = {};
2282
- const stop = this.safeValue(params, 'stop', false);
2283
- const hf = this.safeValue(params, 'hf', false);
2282
+ const stop = this.safeBool(params, 'stop', false);
2283
+ const hf = this.safeBool(params, 'hf', false);
2284
2284
  params = this.omit(params, ['stop', 'hf']);
2285
2285
  const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
2286
2286
  if (symbol !== undefined) {
@@ -2337,8 +2337,8 @@ class kucoin extends kucoin$1 {
2337
2337
  await this.loadMarkets();
2338
2338
  let lowercaseStatus = status.toLowerCase();
2339
2339
  const until = this.safeInteger2(params, 'until', 'till');
2340
- const stop = this.safeValue(params, 'stop', false);
2341
- const hf = this.safeValue(params, 'hf', false);
2340
+ const stop = this.safeBool(params, 'stop', false);
2341
+ const hf = this.safeBool(params, 'hf', false);
2342
2342
  params = this.omit(params, ['stop', 'hf', 'till', 'until']);
2343
2343
  const [marginMode, query] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
2344
2344
  if (lowercaseStatus === 'open') {
@@ -2512,8 +2512,8 @@ class kucoin extends kucoin$1 {
2512
2512
  await this.loadMarkets();
2513
2513
  const request = {};
2514
2514
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2515
- const stop = this.safeValue(params, 'stop', false);
2516
- const hf = this.safeValue(params, 'hf', false);
2515
+ const stop = this.safeBool(params, 'stop', false);
2516
+ const hf = this.safeBool(params, 'hf', false);
2517
2517
  let market = undefined;
2518
2518
  if (symbol !== undefined) {
2519
2519
  market = this.market(symbol);
@@ -2690,10 +2690,10 @@ class kucoin extends kucoin$1 {
2690
2690
  const marketId = this.safeString(order, 'symbol');
2691
2691
  const timestamp = this.safeInteger(order, 'createdAt');
2692
2692
  const feeCurrencyId = this.safeString(order, 'feeCurrency');
2693
- const cancelExist = this.safeValue(order, 'cancelExist', false);
2693
+ const cancelExist = this.safeBool(order, 'cancelExist', false);
2694
2694
  const responseStop = this.safeString(order, 'stop');
2695
2695
  const stop = responseStop !== undefined;
2696
- const stopTriggered = this.safeValue(order, 'stopTriggered', false);
2696
+ const stopTriggered = this.safeBool(order, 'stopTriggered', false);
2697
2697
  const isActive = this.safeValue2(order, 'isActive', 'active');
2698
2698
  const responseStatus = this.safeString(order, 'status');
2699
2699
  let status = undefined;
@@ -2790,7 +2790,7 @@ class kucoin extends kucoin$1 {
2790
2790
  return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
2791
2791
  }
2792
2792
  let request = {};
2793
- const hf = this.safeValue(params, 'hf', false);
2793
+ const hf = this.safeBool(params, 'hf', false);
2794
2794
  if (hf && symbol === undefined) {
2795
2795
  throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
2796
2796
  }
@@ -3469,7 +3469,7 @@ class kucoin extends kucoin$1 {
3469
3469
  const accountsByType = this.safeValue(this.options, 'accountsByType');
3470
3470
  let type = this.safeString(accountsByType, requestedType, requestedType);
3471
3471
  params = this.omit(params, 'type');
3472
- const isHf = this.safeValue(params, 'hf', false);
3472
+ const isHf = this.safeBool(params, 'hf', false);
3473
3473
  if (isHf) {
3474
3474
  type = 'trade_hf';
3475
3475
  }
@@ -1121,7 +1121,7 @@ class kucoinfutures extends kucoinfutures$1 {
1121
1121
  */
1122
1122
  await this.loadMarkets();
1123
1123
  const market = this.market(symbol);
1124
- const testOrder = this.safeValue(params, 'test', false);
1124
+ const testOrder = this.safeBool(params, 'test', false);
1125
1125
  params = this.omit(params, 'test');
1126
1126
  const orderRequest = this.createContractOrderRequest(symbol, type, side, amount, price, params);
1127
1127
  let response = undefined;
@@ -1784,7 +1784,7 @@ class kucoinfutures extends kucoinfutures$1 {
1784
1784
  // const average = Precise.stringDiv (cost, Precise.stringMul (filled, market['contractSize']));
1785
1785
  // bool
1786
1786
  const isActive = this.safeValue(order, 'isActive');
1787
- const cancelExist = this.safeValue(order, 'cancelExist', false);
1787
+ const cancelExist = this.safeBool(order, 'cancelExist', false);
1788
1788
  let status = undefined;
1789
1789
  if (isActive !== undefined) {
1790
1790
  status = isActive ? 'open' : 'closed';
@@ -2508,7 +2508,7 @@ class kucoinfutures extends kucoinfutures$1 {
2508
2508
  await this.loadMarkets();
2509
2509
  const market = this.market(symbol);
2510
2510
  let clientOrderId = this.safeString(params, 'clientOrderId');
2511
- const testOrder = this.safeValue(params, 'test', false);
2511
+ const testOrder = this.safeBool(params, 'test', false);
2512
2512
  params = this.omit(params, ['test', 'clientOrderId']);
2513
2513
  if (clientOrderId === undefined) {
2514
2514
  clientOrderId = this.numberToString(this.nonce());
@@ -1312,7 +1312,7 @@ class lbank extends lbank$1 {
1312
1312
  await this.loadMarkets();
1313
1313
  const market = this.market(symbol);
1314
1314
  const clientOrderId = this.safeString2(params, 'custom_id', 'clientOrderId');
1315
- const postOnly = this.safeValue(params, 'postOnly', false);
1315
+ const postOnly = this.safeBool(params, 'postOnly', false);
1316
1316
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
1317
1317
  params = this.omit(params, ['custom_id', 'clientOrderId', 'timeInForce', 'postOnly']);
1318
1318
  const request = {
@@ -955,8 +955,8 @@ class mexc extends mexc$1 {
955
955
  const chain = chains[j];
956
956
  const networkId = this.safeString(chain, 'network');
957
957
  const network = this.safeNetwork(networkId);
958
- const isDepositEnabled = this.safeValue(chain, 'depositEnable', false);
959
- const isWithdrawEnabled = this.safeValue(chain, 'withdrawEnable', false);
958
+ const isDepositEnabled = this.safeBool(chain, 'depositEnable', false);
959
+ const isWithdrawEnabled = this.safeBool(chain, 'withdrawEnable', false);
960
960
  const active = (isDepositEnabled && isWithdrawEnabled);
961
961
  currencyActive = active || currencyActive;
962
962
  const withdrawMin = this.safeString(chain, 'withdrawMin');
@@ -2215,7 +2215,7 @@ class mexc extends mexc$1 {
2215
2215
  await this.loadMarkets();
2216
2216
  const symbol = market['symbol'];
2217
2217
  const unavailableContracts = this.safeValue(this.options, 'unavailableContracts', {});
2218
- const isContractUnavaiable = this.safeValue(unavailableContracts, symbol, false);
2218
+ const isContractUnavaiable = this.safeBool(unavailableContracts, symbol, false);
2219
2219
  if (isContractUnavaiable) {
2220
2220
  throw new errors.NotSupported(this.id + ' createSwapOrder() does not support yet this symbol:' + symbol);
2221
2221
  }
@@ -2283,7 +2283,7 @@ class mexc extends mexc$1 {
2283
2283
  throw new errors.ArgumentsRequired(this.id + ' createSwapOrder() requires a leverage parameter for isolated margin orders');
2284
2284
  }
2285
2285
  }
2286
- const reduceOnly = this.safeValue(params, 'reduceOnly', false);
2286
+ const reduceOnly = this.safeBool(params, 'reduceOnly', false);
2287
2287
  if (reduceOnly) {
2288
2288
  request['side'] = (side === 'buy') ? 2 : 4;
2289
2289
  }
@@ -3618,7 +3618,7 @@ class mexc extends mexc$1 {
3618
3618
  const request = {};
3619
3619
  [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
3620
3620
  const marginMode = this.safeString(params, 'marginMode');
3621
- const isMargin = this.safeValue(params, 'margin', false);
3621
+ const isMargin = this.safeBool(params, 'margin', false);
3622
3622
  params = this.omit(params, ['margin', 'marginMode']);
3623
3623
  let response = undefined;
3624
3624
  if ((marginMode !== undefined) || (isMargin) || (marketType === 'margin')) {
@@ -5296,7 +5296,7 @@ class mexc extends mexc$1 {
5296
5296
  * @returns {Array} the marginMode in lowercase
5297
5297
  */
5298
5298
  const defaultType = this.safeString(this.options, 'defaultType');
5299
- const isMargin = this.safeValue(params, 'margin', false);
5299
+ const isMargin = this.safeBool(params, 'margin', false);
5300
5300
  let marginMode = undefined;
5301
5301
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
5302
5302
  if ((defaultType === 'margin') || (isMargin === true)) {
@@ -5388,7 +5388,7 @@ class mexc extends mexc$1 {
5388
5388
  // {"code":10216,"msg":"No available deposit address"}
5389
5389
  // {"success":true, "code":0, "data":1634095541710}
5390
5390
  //
5391
- const success = this.safeValue(response, 'success', false); // v1
5391
+ const success = this.safeBool(response, 'success', false); // v1
5392
5392
  if (success === true) {
5393
5393
  return undefined;
5394
5394
  }
@@ -1162,7 +1162,7 @@ class novadax extends novadax$1 {
1162
1162
  //
1163
1163
  const transfer = this.parseTransfer(response, currency);
1164
1164
  const transferOptions = this.safeValue(this.options, 'transfer', {});
1165
- const fillResponseFromRequest = this.safeValue(transferOptions, 'fillResponseFromRequest', true);
1165
+ const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
1166
1166
  if (fillResponseFromRequest) {
1167
1167
  transfer['fromAccount'] = fromAccount;
1168
1168
  transfer['toAccount'] = toAccount;
@@ -857,7 +857,7 @@ class okcoin extends okcoin$1 {
857
857
  const symbol = market['symbol'];
858
858
  const last = this.safeString(ticker, 'last');
859
859
  const open = this.safeString(ticker, 'open24h');
860
- const spot = this.safeValue(market, 'spot', false);
860
+ const spot = this.safeBool(market, 'spot', false);
861
861
  const quoteVolume = spot ? this.safeString(ticker, 'volCcy24h') : undefined;
862
862
  const baseVolume = this.safeString(ticker, 'vol24h');
863
863
  const high = this.safeString(ticker, 'high24h');
@@ -1401,7 +1401,7 @@ class okcoin extends okcoin$1 {
1401
1401
  }
1402
1402
  else {
1403
1403
  marginMode = defaultMarginMode;
1404
- margin = this.safeValue(params, 'margin', false);
1404
+ margin = this.safeBool(params, 'margin', false);
1405
1405
  }
1406
1406
  if (margin) {
1407
1407
  const defaultCurrency = (side === 'buy') ? market['quote'] : market['base'];
@@ -2138,7 +2138,8 @@ class okx extends okx$1 {
2138
2138
  if (since < historyBorder) {
2139
2139
  defaultType = 'HistoryCandles';
2140
2140
  }
2141
- request['before'] = since;
2141
+ const startTime = Math.max(since - 1, 0);
2142
+ request['before'] = startTime;
2142
2143
  request['after'] = this.sum(since, durationInMilliseconds * limit);
2143
2144
  }
2144
2145
  const until = this.safeInteger(params, 'until');
@@ -3103,7 +3104,7 @@ class okx extends okx$1 {
3103
3104
  throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
3104
3105
  }
3105
3106
  const stop = this.safeValue2(params, 'stop', 'trigger');
3106
- const trailing = this.safeValue(params, 'trailing', false);
3107
+ const trailing = this.safeBool(params, 'trailing', false);
3107
3108
  if (stop || trailing) {
3108
3109
  const orderInner = await this.cancelOrders([id], symbol, params);
3109
3110
  return this.safeValue(orderInner, 0);
@@ -3171,7 +3172,7 @@ class okx extends okx$1 {
3171
3172
  const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
3172
3173
  const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
3173
3174
  const stop = this.safeValue2(params, 'stop', 'trigger');
3174
- const trailing = this.safeValue(params, 'trailing', false);
3175
+ const trailing = this.safeBool(params, 'trailing', false);
3175
3176
  if (stop || trailing) {
3176
3177
  method = 'privatePostTradeCancelAlgos';
3177
3178
  }
@@ -3670,7 +3671,7 @@ class okx extends okx$1 {
3670
3671
  let method = this.safeString(params, 'method', defaultMethod);
3671
3672
  const ordType = this.safeString(params, 'ordType');
3672
3673
  const stop = this.safeValue2(params, 'stop', 'trigger');
3673
- const trailing = this.safeValue(params, 'trailing', false);
3674
+ const trailing = this.safeBool(params, 'trailing', false);
3674
3675
  if (trailing || stop || (ordType in algoOrderTypes)) {
3675
3676
  method = 'privateGetTradeOrdersAlgoPending';
3676
3677
  }
@@ -3839,7 +3840,7 @@ class okx extends okx$1 {
3839
3840
  let method = this.safeString(params, 'method', defaultMethod);
3840
3841
  const ordType = this.safeString(params, 'ordType');
3841
3842
  const stop = this.safeValue2(params, 'stop', 'trigger');
3842
- const trailing = this.safeValue(params, 'trailing', false);
3843
+ const trailing = this.safeBool(params, 'trailing', false);
3843
3844
  if (trailing) {
3844
3845
  method = 'privateGetTradeOrdersAlgoHistory';
3845
3846
  request['ordType'] = 'move_order_stop';
@@ -4033,7 +4034,7 @@ class okx extends okx$1 {
4033
4034
  let method = this.safeString(params, 'method', defaultMethod);
4034
4035
  const ordType = this.safeString(params, 'ordType');
4035
4036
  const stop = this.safeValue2(params, 'stop', 'trigger');
4036
- const trailing = this.safeValue(params, 'trailing', false);
4037
+ const trailing = this.safeBool(params, 'trailing', false);
4037
4038
  if (trailing || stop || (ordType in algoOrderTypes)) {
4038
4039
  method = 'privateGetTradeOrdersAlgoHistory';
4039
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';