ccxt 4.3.11 → 4.3.12

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 (81) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/base/Exchange.js +15 -0
  4. package/dist/cjs/src/bigone.js +22 -22
  5. package/dist/cjs/src/binance.js +5 -5
  6. package/dist/cjs/src/bingx.js +2 -2
  7. package/dist/cjs/src/bitget.js +7 -4
  8. package/dist/cjs/src/bitmart.js +3 -8
  9. package/dist/cjs/src/bitmex.js +2 -2
  10. package/dist/cjs/src/bybit.js +81 -71
  11. package/dist/cjs/src/coinbase.js +8 -8
  12. package/dist/cjs/src/coinbaseinternational.js +2 -2
  13. package/dist/cjs/src/coinex.js +513 -449
  14. package/dist/cjs/src/coinlist.js +12 -12
  15. package/dist/cjs/src/coinmetro.js +2 -2
  16. package/dist/cjs/src/cryptocom.js +16 -16
  17. package/dist/cjs/src/gate.js +2 -2
  18. package/dist/cjs/src/hitbtc.js +3 -3
  19. package/dist/cjs/src/htx.js +3 -7
  20. package/dist/cjs/src/indodax.js +2 -2
  21. package/dist/cjs/src/kraken.js +3 -1
  22. package/dist/cjs/src/kucoin.js +4 -4
  23. package/dist/cjs/src/kucoinfutures.js +6 -6
  24. package/dist/cjs/src/mexc.js +5 -5
  25. package/dist/cjs/src/okx.js +6 -6
  26. package/dist/cjs/src/poloniexfutures.js +4 -4
  27. package/dist/cjs/src/pro/bitget.js +140 -89
  28. package/dist/cjs/src/pro/bybit.js +196 -11
  29. package/dist/cjs/src/pro/coinbase.js +107 -29
  30. package/dist/cjs/src/pro/mexc.js +21 -1
  31. package/dist/cjs/src/probit.js +2 -2
  32. package/dist/cjs/src/whitebit.js +76 -1
  33. package/dist/cjs/src/woo.js +2 -2
  34. package/js/ccxt.d.ts +1 -1
  35. package/js/ccxt.js +1 -1
  36. package/js/src/base/Exchange.d.ts +10 -6
  37. package/js/src/base/Exchange.js +15 -0
  38. package/js/src/base/types.d.ts +17 -2
  39. package/js/src/bigone.js +22 -22
  40. package/js/src/binance.d.ts +2 -9
  41. package/js/src/binance.js +5 -5
  42. package/js/src/bingx.js +2 -2
  43. package/js/src/bitget.d.ts +4 -31
  44. package/js/src/bitget.js +7 -4
  45. package/js/src/bitmart.d.ts +4 -24
  46. package/js/src/bitmart.js +3 -8
  47. package/js/src/bitmex.js +2 -2
  48. package/js/src/bybit.d.ts +7 -9
  49. package/js/src/bybit.js +81 -71
  50. package/js/src/coinbase.js +8 -8
  51. package/js/src/coinbaseinternational.js +2 -2
  52. package/js/src/coinex.d.ts +4 -24
  53. package/js/src/coinex.js +513 -449
  54. package/js/src/coinlist.js +12 -12
  55. package/js/src/coinmetro.js +2 -2
  56. package/js/src/cryptocom.js +16 -16
  57. package/js/src/digifinex.d.ts +3 -10
  58. package/js/src/gate.js +2 -2
  59. package/js/src/hitbtc.js +3 -3
  60. package/js/src/htx.d.ts +3 -13
  61. package/js/src/htx.js +3 -7
  62. package/js/src/indodax.js +2 -2
  63. package/js/src/kraken.js +3 -1
  64. package/js/src/kucoin.js +4 -4
  65. package/js/src/kucoinfutures.js +6 -6
  66. package/js/src/mexc.js +5 -5
  67. package/js/src/okx.d.ts +3 -10
  68. package/js/src/okx.js +6 -6
  69. package/js/src/poloniexfutures.js +4 -4
  70. package/js/src/pro/bitget.js +140 -89
  71. package/js/src/pro/bybit.d.ts +5 -1
  72. package/js/src/pro/bybit.js +196 -11
  73. package/js/src/pro/coinbase.d.ts +4 -0
  74. package/js/src/pro/coinbase.js +107 -29
  75. package/js/src/pro/mexc.js +21 -1
  76. package/js/src/probit.js +2 -2
  77. package/js/src/whitebit.d.ts +1 -0
  78. package/js/src/whitebit.js +76 -1
  79. package/js/src/woo.js +2 -2
  80. package/package.json +6 -5
  81. package/dist/cjs/src/flowbtc.js +0 -35
package/README.md CHANGED
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.11/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.11/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.12/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.12/dist/ccxt.browser.js
218
218
 
219
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.11/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.12/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.3.11';
185
+ const version = '4.3.12';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -443,6 +443,8 @@ class Exchange {
443
443
  'fetchClosedOrdersWs': undefined,
444
444
  'fetchConvertCurrencies': undefined,
445
445
  'fetchConvertQuote': undefined,
446
+ 'fetchConvertTrade': undefined,
447
+ 'fetchConvertTradeHistory': undefined,
446
448
  'fetchCrossBorrowRate': undefined,
447
449
  'fetchCrossBorrowRates': undefined,
448
450
  'fetchCurrencies': 'emulated',
@@ -2028,6 +2030,9 @@ class Exchange {
2028
2030
  parseBorrowInterest(info, market = undefined) {
2029
2031
  throw new errors.NotSupported(this.id + ' parseBorrowInterest() is not supported yet');
2030
2032
  }
2033
+ parseIsolatedBorrowRate(info, market = undefined) {
2034
+ throw new errors.NotSupported(this.id + ' parseIsolatedBorrowRate() is not supported yet');
2035
+ }
2031
2036
  parseWsTrade(trade, market = undefined) {
2032
2037
  throw new errors.NotSupported(this.id + ' parseWsTrade() is not supported yet');
2033
2038
  }
@@ -5291,6 +5296,16 @@ class Exchange {
5291
5296
  }
5292
5297
  return interests;
5293
5298
  }
5299
+ parseIsolatedBorrowRates(info) {
5300
+ const result = {};
5301
+ for (let i = 0; i < info.length; i++) {
5302
+ const item = info[i];
5303
+ const borrowRate = this.parseIsolatedBorrowRate(item);
5304
+ const symbol = this.safeString(borrowRate, 'symbol');
5305
+ result[symbol] = borrowRate;
5306
+ }
5307
+ return result;
5308
+ }
5294
5309
  parseFundingRateHistories(response, market = undefined, since = undefined, limit = undefined) {
5295
5310
  const rates = [];
5296
5311
  for (let i = 0; i < response.length; i++) {
@@ -437,16 +437,16 @@ class bigone extends bigone$1 {
437
437
  // ],
438
438
  // }
439
439
  //
440
- const currenciesData = this.safeValue(data, 'data', []);
440
+ const currenciesData = this.safeList(data, 'data', []);
441
441
  const result = {};
442
442
  for (let i = 0; i < currenciesData.length; i++) {
443
443
  const currency = currenciesData[i];
444
444
  const id = this.safeString(currency, 'symbol');
445
445
  const code = this.safeCurrencyCode(id);
446
446
  const name = this.safeString(currency, 'name');
447
- const type = this.safeValue(currency, 'is_fiat') ? 'fiat' : 'crypto';
447
+ const type = this.safeBool(currency, 'is_fiat') ? 'fiat' : 'crypto';
448
448
  const networks = {};
449
- const chains = this.safeValue(currency, 'binding_gateways', []);
449
+ const chains = this.safeList(currency, 'binding_gateways', []);
450
450
  let currencyMaxPrecision = this.parsePrecision(this.safeString2(currency, 'withdrawal_scale', 'scale'));
451
451
  let currencyDepositEnabled = undefined;
452
452
  let currencyWithdrawEnabled = undefined;
@@ -454,8 +454,8 @@ class bigone extends bigone$1 {
454
454
  const chain = chains[j];
455
455
  const networkId = this.safeString(chain, 'gateway_name');
456
456
  const networkCode = this.networkIdToCode(networkId);
457
- const deposit = this.safeValue(chain, 'is_deposit_enabled');
458
- const withdraw = this.safeValue(chain, 'is_withdrawal_enabled');
457
+ const deposit = this.safeBool(chain, 'is_deposit_enabled');
458
+ const withdraw = this.safeBool(chain, 'is_withdrawal_enabled');
459
459
  const isActive = (deposit && withdraw);
460
460
  const minDepositAmount = this.safeString(chain, 'min_deposit_amount');
461
461
  const minWithdrawalAmount = this.safeString(chain, 'min_withdrawal_amount');
@@ -578,12 +578,12 @@ class bigone extends bigone$1 {
578
578
  // ...
579
579
  // ]
580
580
  //
581
- const markets = this.safeValue(response, 'data', []);
581
+ const markets = this.safeList(response, 'data', []);
582
582
  const result = [];
583
583
  for (let i = 0; i < markets.length; i++) {
584
584
  const market = markets[i];
585
- const baseAsset = this.safeValue(market, 'base_asset', {});
586
- const quoteAsset = this.safeValue(market, 'quote_asset', {});
585
+ const baseAsset = this.safeDict(market, 'base_asset', {});
586
+ const quoteAsset = this.safeDict(market, 'quote_asset', {});
587
587
  const baseId = this.safeString(baseAsset, 'symbol');
588
588
  const quoteId = this.safeString(quoteAsset, 'symbol');
589
589
  const base = this.safeCurrencyCode(baseId);
@@ -648,7 +648,7 @@ class bigone extends bigone$1 {
648
648
  const base = this.safeCurrencyCode(baseId);
649
649
  const quote = this.safeCurrencyCode(quoteId);
650
650
  const settle = this.safeCurrencyCode(settleId);
651
- const inverse = this.safeValue(market, 'isInverse');
651
+ const inverse = this.safeBool(market, 'isInverse');
652
652
  result.push(this.safeMarketStructure({
653
653
  'id': marketId,
654
654
  'symbol': base + '/' + quote + ':' + settle,
@@ -664,7 +664,7 @@ class bigone extends bigone$1 {
664
664
  'swap': true,
665
665
  'future': false,
666
666
  'option': false,
667
- 'active': this.safeValue(market, 'enable'),
667
+ 'active': this.safeBool(market, 'enable'),
668
668
  'contract': true,
669
669
  'linear': !inverse,
670
670
  'inverse': inverse,
@@ -751,8 +751,8 @@ class bigone extends bigone$1 {
751
751
  const marketId = this.safeString2(ticker, 'asset_pair_name', 'symbol');
752
752
  const symbol = this.safeSymbol(marketId, market, '-', marketType);
753
753
  const close = this.safeString2(ticker, 'close', 'latestPrice');
754
- const bid = this.safeValue(ticker, 'bid', {});
755
- const ask = this.safeValue(ticker, 'ask', {});
754
+ const bid = this.safeDict(ticker, 'bid', {});
755
+ const ask = this.safeDict(ticker, 'ask', {});
756
756
  return this.safeTicker({
757
757
  'symbol': symbol,
758
758
  'timestamp': undefined,
@@ -874,7 +874,7 @@ class bigone extends bigone$1 {
874
874
  // ]
875
875
  // }
876
876
  //
877
- data = this.safeValue(response, 'data', []);
877
+ data = this.safeList(response, 'data', []);
878
878
  }
879
879
  else {
880
880
  data = await this.contractPublicGetInstruments(params);
@@ -924,7 +924,7 @@ class bigone extends bigone$1 {
924
924
  // }
925
925
  // }
926
926
  //
927
- const data = this.safeValue(response, 'data', {});
927
+ const data = this.safeDict(response, 'data', {});
928
928
  const timestamp = this.safeInteger(data, 'Timestamp');
929
929
  return this.parseToInt(timestamp / 1000000);
930
930
  }
@@ -1301,7 +1301,7 @@ class bigone extends bigone$1 {
1301
1301
  'timestamp': undefined,
1302
1302
  'datetime': undefined,
1303
1303
  };
1304
- const balances = this.safeValue(response, 'data', []);
1304
+ const balances = this.safeList(response, 'data', []);
1305
1305
  for (let i = 0; i < balances.length; i++) {
1306
1306
  const balance = balances[i];
1307
1307
  const symbol = this.safeString(balance, 'asset_symbol');
@@ -1389,7 +1389,7 @@ class bigone extends bigone$1 {
1389
1389
  if (Precise["default"].stringEq(triggerPrice, '0')) {
1390
1390
  triggerPrice = undefined;
1391
1391
  }
1392
- const immediateOrCancel = this.safeValue(order, 'immediate_or_cancel');
1392
+ const immediateOrCancel = this.safeBool(order, 'immediate_or_cancel');
1393
1393
  let timeInForce = undefined;
1394
1394
  if (immediateOrCancel) {
1395
1395
  timeInForce = 'IOC';
@@ -1416,7 +1416,7 @@ class bigone extends bigone$1 {
1416
1416
  'symbol': symbol,
1417
1417
  'type': type,
1418
1418
  'timeInForce': timeInForce,
1419
- 'postOnly': this.safeValue(order, 'post_only'),
1419
+ 'postOnly': this.safeBool(order, 'post_only'),
1420
1420
  'side': side,
1421
1421
  'price': price,
1422
1422
  'stopPrice': triggerPrice,
@@ -1866,14 +1866,14 @@ class bigone extends bigone$1 {
1866
1866
  // ]
1867
1867
  // }
1868
1868
  //
1869
- const data = this.safeValue(response, 'data', []);
1869
+ const data = this.safeList(response, 'data', []);
1870
1870
  const dataLength = data.length;
1871
1871
  if (dataLength < 1) {
1872
1872
  throw new errors.ExchangeError(this.id + ' fetchDepositAddress() returned empty address response');
1873
1873
  }
1874
1874
  const chainsIndexedById = this.indexBy(data, 'chain');
1875
1875
  const selectedNetworkId = this.selectNetworkIdFromRawNetworks(code, networkCode, chainsIndexedById);
1876
- const addressObject = this.safeValue(chainsIndexedById, selectedNetworkId, {});
1876
+ const addressObject = this.safeDict(chainsIndexedById, selectedNetworkId, {});
1877
1877
  const address = this.safeString(addressObject, 'value');
1878
1878
  const tag = this.safeString(addressObject, 'memo');
1879
1879
  this.checkAddress(address);
@@ -1959,7 +1959,7 @@ class bigone extends bigone$1 {
1959
1959
  const address = this.safeString(transaction, 'target_address');
1960
1960
  const tag = this.safeString(transaction, 'memo');
1961
1961
  const type = ('customer_id' in transaction) ? 'withdrawal' : 'deposit';
1962
- const internal = this.safeValue(transaction, 'is_internal');
1962
+ const internal = this.safeBool(transaction, 'is_internal');
1963
1963
  return {
1964
1964
  'info': transaction,
1965
1965
  'id': id,
@@ -2102,7 +2102,7 @@ class bigone extends bigone$1 {
2102
2102
  */
2103
2103
  await this.loadMarkets();
2104
2104
  const currency = this.currency(code);
2105
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
2105
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
2106
2106
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
2107
2107
  const toId = this.safeString(accountsByType, toAccount, toAccount);
2108
2108
  const guid = this.safeString(params, 'guid', this.uuid());
@@ -2123,7 +2123,7 @@ class bigone extends bigone$1 {
2123
2123
  // }
2124
2124
  //
2125
2125
  const transfer = this.parseTransfer(response, currency);
2126
- const transferOptions = this.safeValue(this.options, 'transfer', {});
2126
+ const transferOptions = this.safeDict(this.options, 'transfer', {});
2127
2127
  const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
2128
2128
  if (fillResponseFromRequest) {
2129
2129
  transfer['fromAccount'] = fromAccount;
@@ -1099,7 +1099,7 @@ class binance extends binance$1 {
1099
1099
  'feeSide': 'quote',
1100
1100
  'tierBased': true,
1101
1101
  'percentage': true,
1102
- 'taker': this.parseNumber('0.000400'),
1102
+ 'taker': this.parseNumber('0.000500'),
1103
1103
  'maker': this.parseNumber('0.000200'),
1104
1104
  'tiers': {
1105
1105
  'taker': [
@@ -9039,9 +9039,9 @@ class binance extends binance$1 {
9039
9039
  if (since !== undefined) {
9040
9040
  request['startTime'] = since;
9041
9041
  }
9042
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
9042
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
9043
9043
  const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
9044
- params = this.omit(params, ['endTime', 'till', 'until']);
9044
+ params = this.omit(params, ['endTime', 'until']);
9045
9045
  if (endTime !== undefined) {
9046
9046
  request['endTime'] = endTime;
9047
9047
  }
@@ -11794,9 +11794,9 @@ class binance extends binance$1 {
11794
11794
  if (since !== undefined) {
11795
11795
  request['startTime'] = since;
11796
11796
  }
11797
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
11797
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
11798
11798
  const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
11799
- params = this.omit(params, ['endTime', 'until', 'till']);
11799
+ params = this.omit(params, ['endTime', 'until']);
11800
11800
  if (endTime) {
11801
11801
  request['endTime'] = endTime;
11802
11802
  }
@@ -2921,9 +2921,9 @@ class bingx extends bingx$1 {
2921
2921
  if (since !== undefined) {
2922
2922
  request['startTime'] = since;
2923
2923
  }
2924
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
2924
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
2925
2925
  const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
2926
- params = this.omit(params, ['endTime', 'till', 'until']);
2926
+ params = this.omit(params, ['endTime', 'until']);
2927
2927
  if (endTime !== undefined) {
2928
2928
  request['endTime'] = endTime;
2929
2929
  }
@@ -3361,11 +3361,11 @@ class bitget extends bitget$1 {
3361
3361
  'symbol': market['id'],
3362
3362
  'granularity': this.safeString(timeframes, timeframe, timeframe),
3363
3363
  };
3364
- const until = this.safeInteger2(params, 'until', 'till');
3364
+ const until = this.safeInteger(params, 'until');
3365
3365
  const limitDefined = limit !== undefined;
3366
3366
  const sinceDefined = since !== undefined;
3367
3367
  const untilDefined = until !== undefined;
3368
- params = this.omit(params, ['until', 'till']);
3368
+ params = this.omit(params, ['until']);
3369
3369
  let response = undefined;
3370
3370
  const now = this.milliseconds();
3371
3371
  // retrievable periods listed here:
@@ -4611,6 +4611,9 @@ class bitget extends bitget$1 {
4611
4611
  params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'clientOrderId', 'trailingTriggerPrice', 'trailingPercent']);
4612
4612
  let response = undefined;
4613
4613
  if (market['spot']) {
4614
+ if (triggerPrice === undefined) {
4615
+ throw new errors.NotSupported(this.id + 'editOrder() only supports plan/trigger spot orders');
4616
+ }
4614
4617
  const editMarketBuyOrderRequiresPrice = this.safeBool(this.options, 'editMarketBuyOrderRequiresPrice', true);
4615
4618
  if (editMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
4616
4619
  if (price === undefined) {
@@ -5643,8 +5646,8 @@ class bitget extends bitget$1 {
5643
5646
  if (symbol === undefined) {
5644
5647
  throw new errors.ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
5645
5648
  }
5646
- const endTime = this.safeIntegerN(params, ['endTime', 'until', 'till']);
5647
- params = this.omit(params, ['until', 'till']);
5649
+ const endTime = this.safeIntegerN(params, ['endTime', 'until']);
5650
+ params = this.omit(params, ['until']);
5648
5651
  if (since === undefined) {
5649
5652
  since = now - 7776000000;
5650
5653
  request['startTime'] = since;
@@ -3710,12 +3710,7 @@ class bitmart extends bitmart$1 {
3710
3710
  //
3711
3711
  const data = this.safeValue(response, 'data', {});
3712
3712
  const symbols = this.safeValue(data, 'symbols', []);
3713
- const result = [];
3714
- for (let i = 0; i < symbols.length; i++) {
3715
- const symbol = this.safeValue(symbols, i);
3716
- result.push(this.parseIsolatedBorrowRate(symbol));
3717
- }
3718
- return result;
3713
+ return this.parseIsolatedBorrowRates(symbols);
3719
3714
  }
3720
3715
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
3721
3716
  /**
@@ -3891,9 +3886,9 @@ class bitmart extends bitmart$1 {
3891
3886
  if (limit !== undefined) {
3892
3887
  request['limit'] = limit;
3893
3888
  }
3894
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
3889
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
3895
3890
  const endTime = this.safeInteger(params, 'time_end', until); // exchange-specific in milliseconds
3896
- params = this.omit(params, ['till', 'until']);
3891
+ params = this.omit(params, ['until']);
3897
3892
  if (endTime !== undefined) {
3898
3893
  request['time_end'] = endTime;
3899
3894
  }
@@ -2569,8 +2569,8 @@ class bitmex extends bitmex$1 {
2569
2569
  if (limit !== undefined) {
2570
2570
  request['count'] = limit;
2571
2571
  }
2572
- const until = this.safeInteger2(params, 'until', 'till');
2573
- params = this.omit(params, ['until', 'till']);
2572
+ const until = this.safeInteger(params, 'until');
2573
+ params = this.omit(params, ['until']);
2574
2574
  if (until !== undefined) {
2575
2575
  request['endTime'] = this.iso8601(until);
2576
2576
  }
@@ -2507,9 +2507,9 @@ class bybit extends bybit$1 {
2507
2507
  if (since !== undefined) {
2508
2508
  request['startTime'] = since;
2509
2509
  }
2510
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
2510
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
2511
2511
  const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
2512
- params = this.omit(params, ['endTime', 'till', 'until']);
2512
+ params = this.omit(params, ['endTime', 'until']);
2513
2513
  if (endTime !== undefined) {
2514
2514
  request['endTime'] = endTime;
2515
2515
  }
@@ -4067,44 +4067,8 @@ class bybit extends bybit$1 {
4067
4067
  const result = this.safeDict(response, 'result', {});
4068
4068
  return this.parseOrder(result, market);
4069
4069
  }
4070
- async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4071
- /**
4072
- * @method
4073
- * @name bybit#editOrder
4074
- * @description edit a trade order
4075
- * @see https://bybit-exchange.github.io/docs/v5/order/amend-order
4076
- * @see https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
4077
- * @see https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
4078
- * @param {string} id cancel order id
4079
- * @param {string} symbol unified symbol of the market to create an order in
4080
- * @param {string} type 'market' or 'limit'
4081
- * @param {string} side 'buy' or 'sell'
4082
- * @param {float} amount how much of currency you want to trade in units of base currency
4083
- * @param {float} price the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
4084
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4085
- * @param {float} [params.triggerPrice] The price that a trigger order is triggered at
4086
- * @param {float} [params.stopLossPrice] The price that a stop loss order is triggered at
4087
- * @param {float} [params.takeProfitPrice] The price that a take profit order is triggered at
4088
- * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
4089
- * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
4090
- * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
4091
- * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
4092
- * @param {string} [params.triggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
4093
- * @param {string} [params.slTriggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
4094
- * @param {string} [params.tpTriggerby] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
4095
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4096
- */
4097
- if (symbol === undefined) {
4098
- throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a symbol argument');
4099
- }
4100
- await this.loadMarkets();
4070
+ editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4101
4071
  const market = this.market(symbol);
4102
- const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4103
- const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4104
- const isUsdcSettled = market['settle'] === 'USDC';
4105
- if (isUsdcSettled && !isUnifiedAccount) {
4106
- return await this.editUsdcOrder(id, symbol, type, side, amount, price, params);
4107
- }
4108
4072
  const request = {
4109
4073
  'symbol': market['id'],
4110
4074
  'orderId': id,
@@ -4178,6 +4142,47 @@ class bybit extends bybit$1 {
4178
4142
  request['orderLinkId'] = clientOrderId;
4179
4143
  }
4180
4144
  params = this.omit(params, ['stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'clientOrderId', 'stopLoss', 'takeProfit']);
4145
+ return request;
4146
+ }
4147
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4148
+ /**
4149
+ * @method
4150
+ * @name bybit#editOrder
4151
+ * @description edit a trade order
4152
+ * @see https://bybit-exchange.github.io/docs/v5/order/amend-order
4153
+ * @see https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
4154
+ * @see https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
4155
+ * @param {string} id cancel order id
4156
+ * @param {string} symbol unified symbol of the market to create an order in
4157
+ * @param {string} type 'market' or 'limit'
4158
+ * @param {string} side 'buy' or 'sell'
4159
+ * @param {float} amount how much of currency you want to trade in units of base currency
4160
+ * @param {float} price the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
4161
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4162
+ * @param {float} [params.triggerPrice] The price that a trigger order is triggered at
4163
+ * @param {float} [params.stopLossPrice] The price that a stop loss order is triggered at
4164
+ * @param {float} [params.takeProfitPrice] The price that a take profit order is triggered at
4165
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
4166
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
4167
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
4168
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
4169
+ * @param {string} [params.triggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
4170
+ * @param {string} [params.slTriggerBy] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
4171
+ * @param {string} [params.tpTriggerby] 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
4172
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4173
+ */
4174
+ await this.loadMarkets();
4175
+ if (symbol === undefined) {
4176
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a symbol argument');
4177
+ }
4178
+ const market = this.market(symbol);
4179
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4180
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4181
+ const isUsdcSettled = market['settle'] === 'USDC';
4182
+ if (isUsdcSettled && !isUnifiedAccount) {
4183
+ return await this.editUsdcOrder(id, symbol, type, side, amount, price, params);
4184
+ }
4185
+ const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
4181
4186
  const response = await this.privatePostV5OrderAmend(this.extend(request, params));
4182
4187
  //
4183
4188
  // {
@@ -4237,30 +4242,8 @@ class bybit extends bybit$1 {
4237
4242
  const result = this.safeDict(response, 'result', {});
4238
4243
  return this.parseOrder(result, market);
4239
4244
  }
4240
- async cancelOrder(id, symbol = undefined, params = {}) {
4241
- /**
4242
- * @method
4243
- * @name bybit#cancelOrder
4244
- * @description cancels an open order
4245
- * @see https://bybit-exchange.github.io/docs/v5/order/cancel-order
4246
- * @param {string} id order id
4247
- * @param {string} symbol unified symbol of the market the order was made in
4248
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4249
- * @param {boolean} [params.stop] *spot only* whether the order is a stop order
4250
- * @param {string} [params.orderFilter] *spot only* 'Order' or 'StopOrder' or 'tpslOrder'
4251
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4252
- */
4253
- if (symbol === undefined) {
4254
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
4255
- }
4256
- await this.loadMarkets();
4245
+ cancelOrderRequest(id, symbol = undefined, params = {}) {
4257
4246
  const market = this.market(symbol);
4258
- const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4259
- const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4260
- const isUsdcSettled = market['settle'] === 'USDC';
4261
- if (isUsdcSettled && !isUnifiedAccount) {
4262
- return await this.cancelUsdcOrder(id, symbol, params);
4263
- }
4264
4247
  const request = {
4265
4248
  'symbol': market['id'],
4266
4249
  // 'orderLinkId': 'string',
@@ -4270,7 +4253,7 @@ class bybit extends bybit$1 {
4270
4253
  };
4271
4254
  if (market['spot']) {
4272
4255
  // only works for spot market
4273
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
4256
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
4274
4257
  params = this.omit(params, ['stop', 'trigger']);
4275
4258
  request['orderFilter'] = isStop ? 'StopOrder' : 'Order';
4276
4259
  }
@@ -4289,7 +4272,34 @@ class bybit extends bybit$1 {
4289
4272
  else if (market['option']) {
4290
4273
  request['category'] = 'option';
4291
4274
  }
4292
- const response = await this.privatePostV5OrderCancel(this.extend(request, params));
4275
+ return this.extend(request, params);
4276
+ }
4277
+ async cancelOrder(id, symbol = undefined, params = {}) {
4278
+ /**
4279
+ * @method
4280
+ * @name bybit#cancelOrder
4281
+ * @description cancels an open order
4282
+ * @see https://bybit-exchange.github.io/docs/v5/order/cancel-order
4283
+ * @param {string} id order id
4284
+ * @param {string} symbol unified symbol of the market the order was made in
4285
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4286
+ * @param {boolean} [params.stop] *spot only* whether the order is a stop order
4287
+ * @param {string} [params.orderFilter] *spot only* 'Order' or 'StopOrder' or 'tpslOrder'
4288
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4289
+ */
4290
+ if (symbol === undefined) {
4291
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
4292
+ }
4293
+ await this.loadMarkets();
4294
+ const market = this.market(symbol);
4295
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4296
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4297
+ const isUsdcSettled = market['settle'] === 'USDC';
4298
+ if (isUsdcSettled && !isUnifiedAccount) {
4299
+ return await this.cancelUsdcOrder(id, symbol, params);
4300
+ }
4301
+ const requestExtended = this.cancelOrderRequest(id, symbol, params);
4302
+ const response = await this.privatePostV5OrderCancel(requestExtended);
4293
4303
  //
4294
4304
  // {
4295
4305
  // "retCode": 0,
@@ -4815,9 +4825,9 @@ class bybit extends bybit$1 {
4815
4825
  if (since !== undefined) {
4816
4826
  request['startTime'] = since;
4817
4827
  }
4818
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
4828
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
4819
4829
  const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
4820
- params = this.omit(params, ['endTime', 'till', 'until']);
4830
+ params = this.omit(params, ['endTime', 'until']);
4821
4831
  if (endTime !== undefined) {
4822
4832
  request['endTime'] = endTime;
4823
4833
  }
@@ -4990,9 +5000,9 @@ class bybit extends bybit$1 {
4990
5000
  if (since !== undefined) {
4991
5001
  request['startTime'] = since;
4992
5002
  }
4993
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
5003
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
4994
5004
  const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
4995
- params = this.omit(params, ['endTime', 'till', 'until']);
5005
+ params = this.omit(params, ['endTime', 'until']);
4996
5006
  if (endTime !== undefined) {
4997
5007
  request['endTime'] = endTime;
4998
5008
  }
@@ -5784,7 +5794,7 @@ class bybit extends bybit$1 {
5784
5794
  // 'coin': currency['id'],
5785
5795
  // 'currency': currency['id'], // alias
5786
5796
  // 'start_date': this.iso8601 (since),
5787
- // 'end_date': this.iso8601 (till),
5797
+ // 'end_date': this.iso8601 (until),
5788
5798
  // 'wallet_fund_type': 'Deposit', // Withdraw, RealisedPNL, Commission, Refund, Prize, ExchangeOrderWithdraw, ExchangeOrderDeposit
5789
5799
  // 'page': 1,
5790
5800
  // 'limit': 20, // max 50
@@ -6839,8 +6849,8 @@ class bybit extends bybit$1 {
6839
6849
  if (since !== undefined) {
6840
6850
  request['startTime'] = since;
6841
6851
  }
6842
- const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
6843
- params = this.omit(params, ['till', 'until']);
6852
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
6853
+ params = this.omit(params, ['until']);
6844
6854
  if (until !== undefined) {
6845
6855
  request['endTime'] = until;
6846
6856
  }
@@ -3274,9 +3274,9 @@ class coinbase extends coinbase$1 {
3274
3274
  if (since !== undefined) {
3275
3275
  request['start_date'] = this.iso8601(since);
3276
3276
  }
3277
- const until = this.safeIntegerN(params, ['until', 'till']);
3277
+ const until = this.safeIntegerN(params, ['until']);
3278
3278
  if (until !== undefined) {
3279
- params = this.omit(params, ['until', 'till']);
3279
+ params = this.omit(params, ['until']);
3280
3280
  request['end_date'] = this.iso8601(until);
3281
3281
  }
3282
3282
  const response = await this.v3PrivateGetBrokerageOrdersHistoricalBatch(this.extend(request, params));
@@ -3350,9 +3350,9 @@ class coinbase extends coinbase$1 {
3350
3350
  if (since !== undefined) {
3351
3351
  request['start_date'] = this.iso8601(since);
3352
3352
  }
3353
- const until = this.safeIntegerN(params, ['until', 'till']);
3353
+ const until = this.safeIntegerN(params, ['until']);
3354
3354
  if (until !== undefined) {
3355
- params = this.omit(params, ['until', 'till']);
3355
+ params = this.omit(params, ['until']);
3356
3356
  request['end_date'] = this.iso8601(until);
3357
3357
  }
3358
3358
  const response = await this.v3PrivateGetBrokerageOrdersHistoricalBatch(this.extend(request, params));
@@ -3493,8 +3493,8 @@ class coinbase extends coinbase$1 {
3493
3493
  'product_id': market['id'],
3494
3494
  'granularity': this.safeString(this.timeframes, timeframe, timeframe),
3495
3495
  };
3496
- const until = this.safeIntegerN(params, ['until', 'till', 'end']);
3497
- params = this.omit(params, ['until', 'till']);
3496
+ const until = this.safeIntegerN(params, ['until', 'end']);
3497
+ params = this.omit(params, ['until']);
3498
3498
  const duration = this.parseTimeframe(timeframe);
3499
3499
  const requestedDuration = limit * duration;
3500
3500
  let sinceString = undefined;
@@ -3638,9 +3638,9 @@ class coinbase extends coinbase$1 {
3638
3638
  if (since !== undefined) {
3639
3639
  request['start_sequence_timestamp'] = this.iso8601(since);
3640
3640
  }
3641
- const until = this.safeIntegerN(params, ['until', 'till']);
3641
+ const until = this.safeIntegerN(params, ['until']);
3642
3642
  if (until !== undefined) {
3643
- params = this.omit(params, ['until', 'till']);
3643
+ params = this.omit(params, ['until']);
3644
3644
  request['end_sequence_timestamp'] = this.iso8601(until);
3645
3645
  }
3646
3646
  const response = await this.v3PrivateGetBrokerageOrdersHistoricalFills(this.extend(request, params));
@@ -1833,9 +1833,9 @@ class coinbaseinternational extends coinbaseinternational$1 {
1833
1833
  if (since !== undefined) {
1834
1834
  request['time_from'] = this.iso8601(since);
1835
1835
  }
1836
- const until = this.safeStringN(params, ['until', 'till']);
1836
+ const until = this.safeStringN(params, ['until']);
1837
1837
  if (until !== undefined) {
1838
- params = this.omit(params, ['until', 'till']);
1838
+ params = this.omit(params, ['until']);
1839
1839
  request['ref_datetime'] = this.iso8601(until);
1840
1840
  }
1841
1841
  const response = await this.v1PrivateGetPortfoliosFills(this.extend(request, params));