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
@@ -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;
@@ -5009,7 +5009,7 @@ class htx extends htx$1 {
5009
5009
  const marketId = this.safeString2(order, 'contract_code', 'symbol');
5010
5010
  market = this.safeMarket(marketId, market);
5011
5011
  const timestamp = this.safeIntegerN(order, ['created_at', 'created-at', 'create_date']);
5012
- const clientOrderId = this.safeString2(order, 'client_order_id', 'client-order-id');
5012
+ const clientOrderId = this.safeString2(order, 'client_order_id', 'client-or' + 'der-id'); // transpiler regex trick for php issue
5013
5013
  let cost = undefined;
5014
5014
  let amount = undefined;
5015
5015
  if ((type !== undefined) && (type.indexOf('market') >= 0)) {
@@ -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');
@@ -975,7 +975,9 @@ class kraken extends kraken$1 {
975
975
  request['interval'] = timeframe;
976
976
  }
977
977
  if (since !== undefined) {
978
- request['since'] = this.parseToInt((since - 1) / 1000);
978
+ // contrary to kraken's api documentation, the since parameter must be passed in nanoseconds
979
+ // the adding of '000000' is copied from the fetchTrades function
980
+ request['since'] = this.numberToString(since) + '000000'; // expected to be in nanoseconds
979
981
  }
980
982
  const response = await this.publicGetOHLC(this.extend(request, params));
981
983
  //
@@ -42,6 +42,9 @@ class krakenfutures extends krakenfutures$1 {
42
42
  'fetchClosedOrders': undefined,
43
43
  'fetchCrossBorrowRate': false,
44
44
  'fetchCrossBorrowRates': false,
45
+ 'fetchDepositAddress': false,
46
+ 'fetchDepositAddresses': false,
47
+ 'fetchDepositAddressesByNetwork': false,
45
48
  'fetchFundingHistory': undefined,
46
49
  'fetchFundingRate': 'emulated',
47
50
  'fetchFundingRateHistory': true,
@@ -545,7 +548,7 @@ class krakenfutures extends krakenfutures$1 {
545
548
  const volume = this.safeString(ticker, 'vol24h');
546
549
  let baseVolume = undefined;
547
550
  let quoteVolume = undefined;
548
- const isIndex = this.safeValue(market, 'index', false);
551
+ const isIndex = this.safeBool(market, 'index', false);
549
552
  if (!isIndex) {
550
553
  if (market['linear']) {
551
554
  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());
@@ -11,7 +11,7 @@ var rsa = require('./base/functions/rsa.js');
11
11
  // ---------------------------------------------------------------------------
12
12
  // ---------------------------------------------------------------------------
13
13
  /**
14
- * @class lbank2
14
+ * @class lbank
15
15
  * @augments Exchange
16
16
  */
17
17
  class lbank extends lbank$1 {
@@ -49,6 +49,7 @@ class lbank extends lbank$1 {
49
49
  'fetchClosedOrders': false,
50
50
  'fetchCrossBorrowRate': false,
51
51
  'fetchCrossBorrowRates': false,
52
+ 'fetchDepositAddress': true,
52
53
  'fetchDepositWithdrawFee': 'emulated',
53
54
  'fetchDepositWithdrawFees': true,
54
55
  'fetchFundingHistory': false,
@@ -297,7 +298,7 @@ class lbank extends lbank$1 {
297
298
  async fetchTime(params = {}) {
298
299
  /**
299
300
  * @method
300
- * @name lbank2#fetchTime
301
+ * @name lbank#fetchTime
301
302
  * @description fetches the current integer timestamp in milliseconds from the exchange server
302
303
  * @see https://www.lbank.com/en-US/docs/index.html#get-timestamp
303
304
  * @see https://www.lbank.com/en-US/docs/contract.html#get-the-current-time
@@ -338,8 +339,8 @@ class lbank extends lbank$1 {
338
339
  async fetchMarkets(params = {}) {
339
340
  /**
340
341
  * @method
341
- * @name lbank2#fetchMarkets
342
- * @description retrieves data on all markets for lbank2
342
+ * @name lbank#fetchMarkets
343
+ * @description retrieves data on all markets for lbank
343
344
  * @see https://www.lbank.com/en-US/docs/index.html#trading-pairs
344
345
  * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-information-list
345
346
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -592,7 +593,7 @@ class lbank extends lbank$1 {
592
593
  async fetchTicker(symbol, params = {}) {
593
594
  /**
594
595
  * @method
595
- * @name lbank2#fetchTicker
596
+ * @name lbank#fetchTicker
596
597
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
597
598
  * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
598
599
  * @param {string} symbol unified symbol of the market to fetch the ticker for
@@ -637,7 +638,7 @@ class lbank extends lbank$1 {
637
638
  async fetchTickers(symbols = undefined, params = {}) {
638
639
  /**
639
640
  * @method
640
- * @name lbank2#fetchTickers
641
+ * @name lbank#fetchTickers
641
642
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
642
643
  * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
643
644
  * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
@@ -717,7 +718,7 @@ class lbank extends lbank$1 {
717
718
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
718
719
  /**
719
720
  * @method
720
- * @name lbank2#fetchOrderBook
721
+ * @name lbank#fetchOrderBook
721
722
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
722
723
  * @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
723
724
  * @see https://www.lbank.com/en-US/docs/contract.html#get-handicap
@@ -906,7 +907,7 @@ class lbank extends lbank$1 {
906
907
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
907
908
  /**
908
909
  * @method
909
- * @name lbank2#fetchTrades
910
+ * @name lbank#fetchTrades
910
911
  * @description get the list of most recent trades for a particular symbol
911
912
  * @see https://www.lbank.com/en-US/docs/index.html#query-historical-transactions
912
913
  * @see https://www.lbank.com/en-US/docs/index.html#recent-transactions-list
@@ -983,7 +984,7 @@ class lbank extends lbank$1 {
983
984
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
984
985
  /**
985
986
  * @method
986
- * @name lbank2#fetchOHLCV
987
+ * @name lbank#fetchOHLCV
987
988
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
988
989
  * @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
989
990
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
@@ -1168,7 +1169,7 @@ class lbank extends lbank$1 {
1168
1169
  async fetchBalance(params = {}) {
1169
1170
  /**
1170
1171
  * @method
1171
- * @name lbank2#fetchBalance
1172
+ * @name lbank#fetchBalance
1172
1173
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1173
1174
  * @see https://www.lbank.com/en-US/docs/index.html#asset-information
1174
1175
  * @see https://www.lbank.com/en-US/docs/index.html#account-information
@@ -1242,7 +1243,7 @@ class lbank extends lbank$1 {
1242
1243
  async fetchTradingFee(symbol, params = {}) {
1243
1244
  /**
1244
1245
  * @method
1245
- * @name lbank2#fetchTradingFee
1246
+ * @name lbank#fetchTradingFee
1246
1247
  * @description fetch the trading fees for a market
1247
1248
  * @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
1248
1249
  * @param {string} symbol unified market symbol
@@ -1256,7 +1257,7 @@ class lbank extends lbank$1 {
1256
1257
  async fetchTradingFees(params = {}) {
1257
1258
  /**
1258
1259
  * @method
1259
- * @name lbank2#fetchTradingFees
1260
+ * @name lbank#fetchTradingFees
1260
1261
  * @description fetch the trading fees for multiple markets
1261
1262
  * @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
1262
1263
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1297,7 +1298,7 @@ class lbank extends lbank$1 {
1297
1298
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1298
1299
  /**
1299
1300
  * @method
1300
- * @name lbank2#createOrder
1301
+ * @name lbank#createOrder
1301
1302
  * @description create a trade order
1302
1303
  * @see https://www.lbank.com/en-US/docs/index.html#place-order
1303
1304
  * @see https://www.lbank.com/en-US/docs/index.html#place-an-order
@@ -1312,7 +1313,7 @@ class lbank extends lbank$1 {
1312
1313
  await this.loadMarkets();
1313
1314
  const market = this.market(symbol);
1314
1315
  const clientOrderId = this.safeString2(params, 'custom_id', 'clientOrderId');
1315
- const postOnly = this.safeValue(params, 'postOnly', false);
1316
+ const postOnly = this.safeBool(params, 'postOnly', false);
1316
1317
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
1317
1318
  params = this.omit(params, ['custom_id', 'clientOrderId', 'timeInForce', 'postOnly']);
1318
1319
  const request = {
@@ -1541,7 +1542,7 @@ class lbank extends lbank$1 {
1541
1542
  async fetchOrder(id, symbol = undefined, params = {}) {
1542
1543
  /**
1543
1544
  * @method
1544
- * @name lbank2#fetchOrder
1545
+ * @name lbank#fetchOrder
1545
1546
  * @description fetches information on an order made by the user
1546
1547
  * @see https://www.lbank.com/en-US/docs/index.html#query-order
1547
1548
  * @see https://www.lbank.com/en-US/docs/index.html#query-order-new
@@ -1645,7 +1646,7 @@ class lbank extends lbank$1 {
1645
1646
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1646
1647
  /**
1647
1648
  * @method
1648
- * @name lbank2#fetchMyTrades
1649
+ * @name lbank#fetchMyTrades
1649
1650
  * @description fetch all trades made by the user
1650
1651
  * @see https://www.lbank.com/en-US/docs/index.html#past-transaction-details
1651
1652
  * @param {string} symbol unified market symbol
@@ -1704,7 +1705,7 @@ class lbank extends lbank$1 {
1704
1705
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1705
1706
  /**
1706
1707
  * @method
1707
- * @name lbank2#fetchOrders
1708
+ * @name lbank#fetchOrders
1708
1709
  * @description fetches information on multiple orders made by the user
1709
1710
  * @see https://www.lbank.com/en-US/docs/index.html#query-all-orders
1710
1711
  * @param {string} symbol unified market symbol of the market orders were made in
@@ -1764,7 +1765,7 @@ class lbank extends lbank$1 {
1764
1765
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1765
1766
  /**
1766
1767
  * @method
1767
- * @name lbank2#fetchOpenOrders
1768
+ * @name lbank#fetchOpenOrders
1768
1769
  * @description fetch all unfilled currently open orders
1769
1770
  * @see https://www.lbank.com/en-US/docs/index.html#current-pending-order
1770
1771
  * @param {string} symbol unified market symbol
@@ -1821,7 +1822,7 @@ class lbank extends lbank$1 {
1821
1822
  async cancelOrder(id, symbol = undefined, params = {}) {
1822
1823
  /**
1823
1824
  * @method
1824
- * @name lbank2#cancelOrder
1825
+ * @name lbank#cancelOrder
1825
1826
  * @description cancels an open order
1826
1827
  * @see https://www.lbank.com/en-US/docs/index.html#cancel-order-new
1827
1828
  * @param {string} id order id
@@ -1863,7 +1864,7 @@ class lbank extends lbank$1 {
1863
1864
  async cancelAllOrders(symbol = undefined, params = {}) {
1864
1865
  /**
1865
1866
  * @method
1866
- * @name lbank2#cancelAllOrders
1867
+ * @name lbank#cancelAllOrders
1867
1868
  * @description cancel all open orders in a market
1868
1869
  * @see https://www.lbank.com/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair
1869
1870
  * @param {string} symbol unified market symbol of the market to cancel orders in
@@ -1910,7 +1911,7 @@ class lbank extends lbank$1 {
1910
1911
  async fetchDepositAddress(code, params = {}) {
1911
1912
  /**
1912
1913
  * @method
1913
- * @name lbank2#fetchDepositAddress
1914
+ * @name lbank#fetchDepositAddress
1914
1915
  * @description fetch the deposit address for a currency associated with this account
1915
1916
  * @see https://www.lbank.com/en-US/docs/index.html#get-deposit-address
1916
1917
  * @see https://www.lbank.com/en-US/docs/index.html#the-user-obtains-the-deposit-address
@@ -2014,7 +2015,7 @@ class lbank extends lbank$1 {
2014
2015
  async withdraw(code, amount, address, tag = undefined, params = {}) {
2015
2016
  /**
2016
2017
  * @method
2017
- * @name lbank2#withdraw
2018
+ * @name lbank#withdraw
2018
2019
  * @description make a withdrawal
2019
2020
  * @see https://www.lbank.com/en-US/docs/index.html#withdrawal
2020
2021
  * @param {string} code unified currency code
@@ -2180,7 +2181,7 @@ class lbank extends lbank$1 {
2180
2181
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2181
2182
  /**
2182
2183
  * @method
2183
- * @name lbank2#fetchDeposits
2184
+ * @name lbank#fetchDeposits
2184
2185
  * @description fetch all deposits made to an account
2185
2186
  * @see https://www.lbank.com/en-US/docs/index.html#get-recharge-history
2186
2187
  * @param {string} code unified currency code
@@ -2233,7 +2234,7 @@ class lbank extends lbank$1 {
2233
2234
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2234
2235
  /**
2235
2236
  * @method
2236
- * @name lbank2#fetchWithdrawals
2237
+ * @name lbank#fetchWithdrawals
2237
2238
  * @description fetch all withdrawals made from an account
2238
2239
  * @see https://www.lbank.com/en-US/docs/index.html#get-withdrawal-history
2239
2240
  * @param {string} code unified currency code
@@ -2290,10 +2291,10 @@ class lbank extends lbank$1 {
2290
2291
  async fetchTransactionFees(codes = undefined, params = {}) {
2291
2292
  /**
2292
2293
  * @method
2293
- * @name lbank2#fetchTransactionFees
2294
+ * @name lbank#fetchTransactionFees
2294
2295
  * @deprecated
2295
2296
  * @description please use fetchDepositWithdrawFees instead
2296
- * @param {string[]|undefined} codes not used by lbank2 fetchTransactionFees ()
2297
+ * @param {string[]|undefined} codes not used by lbank fetchTransactionFees ()
2297
2298
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2298
2299
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
2299
2300
  */
@@ -2439,7 +2440,7 @@ class lbank extends lbank$1 {
2439
2440
  async fetchDepositWithdrawFees(codes = undefined, params = {}) {
2440
2441
  /**
2441
2442
  * @method
2442
- * @name lbank2#fetchDepositWithdrawFees
2443
+ * @name lbank#fetchDepositWithdrawFees
2443
2444
  * @description when using private endpoint, only returns information for currencies with non-zero balance, use public method by specifying this.options['fetchDepositWithdrawFees']['method'] = 'fetchPublicDepositWithdrawFees'
2444
2445
  * @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
2445
2446
  * @see https://www.lbank.com/en-US/docs/index.html#withdrawal-configurations
@@ -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'];