ccxt 4.5.10 → 4.5.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 (113) hide show
  1. package/README.md +32 -33
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -6
  4. package/dist/cjs/src/apex.js +9 -0
  5. package/dist/cjs/src/base/Exchange.js +15 -3
  6. package/dist/cjs/src/base/functions/throttle.js +1 -1
  7. package/dist/cjs/src/binance.js +1 -1
  8. package/dist/cjs/src/bingx.js +1 -1
  9. package/dist/cjs/src/bitfinex.js +4 -2
  10. package/dist/cjs/src/bitget.js +20 -2
  11. package/dist/cjs/src/bitmart.js +2 -2
  12. package/dist/cjs/src/btcmarkets.js +4 -2
  13. package/dist/cjs/src/bybit.js +28 -7
  14. package/dist/cjs/src/coinbase.js +1 -0
  15. package/dist/cjs/src/coincatch.js +2 -1
  16. package/dist/cjs/src/deribit.js +21 -19
  17. package/dist/cjs/src/kraken.js +4 -0
  18. package/dist/cjs/src/krakenfutures.js +26 -5
  19. package/dist/cjs/src/kucoin.js +1 -1
  20. package/dist/cjs/src/latoken.js +1 -0
  21. package/dist/cjs/src/mexc.js +1 -0
  22. package/dist/cjs/src/okx.js +18 -9
  23. package/dist/cjs/src/onetrading.js +2 -1
  24. package/dist/cjs/src/phemex.js +1 -0
  25. package/dist/cjs/src/pro/alpaca.js +17 -1
  26. package/dist/cjs/src/pro/apex.js +17 -0
  27. package/dist/cjs/src/pro/binance.js +5 -5
  28. package/dist/cjs/src/pro/bitget.js +10 -3
  29. package/dist/cjs/src/pro/coinbase.js +8 -7
  30. package/dist/cjs/src/pro/htx.js +22 -3
  31. package/dist/cjs/src/pro/hyperliquid.js +4 -0
  32. package/dist/cjs/src/pro/kraken.js +282 -458
  33. package/dist/cjs/src/pro/mexc.js +16 -11
  34. package/dist/cjs/src/pro/woo.js +48 -4
  35. package/dist/cjs/src/probit.js +1 -1
  36. package/dist/cjs/src/woo.js +20 -2
  37. package/dist/cjs/src/xt.js +1 -1
  38. package/js/ccxt.d.ts +2 -8
  39. package/js/ccxt.js +2 -6
  40. package/js/src/abstract/coinbase.d.ts +1 -0
  41. package/js/src/abstract/coinbaseadvanced.d.ts +1 -0
  42. package/js/src/abstract/phemex.d.ts +1 -0
  43. package/js/src/abstract/xt.d.ts +1 -1
  44. package/js/src/apex.js +9 -0
  45. package/js/src/base/Exchange.d.ts +5 -2
  46. package/js/src/base/Exchange.js +15 -3
  47. package/js/src/base/functions/throttle.js +1 -1
  48. package/js/src/binance.js +1 -1
  49. package/js/src/bingx.js +1 -1
  50. package/js/src/bitfinex.d.ts +1 -1
  51. package/js/src/bitfinex.js +4 -2
  52. package/js/src/bitget.d.ts +15 -2
  53. package/js/src/bitget.js +20 -2
  54. package/js/src/bithumb.d.ts +1 -1
  55. package/js/src/bitmart.js +2 -2
  56. package/js/src/bitmex.d.ts +1 -1
  57. package/js/src/bitopro.d.ts +1 -1
  58. package/js/src/bitso.d.ts +1 -1
  59. package/js/src/bittrade.d.ts +1 -1
  60. package/js/src/blofin.d.ts +1 -1
  61. package/js/src/btcmarkets.d.ts +1 -1
  62. package/js/src/btcmarkets.js +4 -2
  63. package/js/src/bybit.d.ts +1 -1
  64. package/js/src/bybit.js +28 -7
  65. package/js/src/coinbase.d.ts +1 -1
  66. package/js/src/coinbase.js +1 -0
  67. package/js/src/coincatch.js +2 -1
  68. package/js/src/coinex.d.ts +1 -1
  69. package/js/src/cryptocom.d.ts +1 -1
  70. package/js/src/deribit.js +21 -19
  71. package/js/src/digifinex.d.ts +1 -1
  72. package/js/src/hibachi.d.ts +1 -1
  73. package/js/src/htx.d.ts +1 -1
  74. package/js/src/hyperliquid.d.ts +1 -1
  75. package/js/src/kraken.d.ts +1 -1
  76. package/js/src/kraken.js +4 -0
  77. package/js/src/krakenfutures.js +26 -5
  78. package/js/src/kucoin.js +1 -1
  79. package/js/src/kucoinfutures.d.ts +1 -1
  80. package/js/src/latoken.js +1 -0
  81. package/js/src/mexc.d.ts +1 -1
  82. package/js/src/mexc.js +1 -0
  83. package/js/src/oceanex.d.ts +1 -1
  84. package/js/src/okx.d.ts +1 -1
  85. package/js/src/okx.js +18 -9
  86. package/js/src/onetrading.d.ts +1 -1
  87. package/js/src/onetrading.js +2 -1
  88. package/js/src/phemex.js +1 -0
  89. package/js/src/pro/alpaca.js +17 -1
  90. package/js/src/pro/apex.d.ts +2 -0
  91. package/js/src/pro/apex.js +18 -1
  92. package/js/src/pro/binance.js +5 -5
  93. package/js/src/pro/bitget.d.ts +1 -0
  94. package/js/src/pro/bitget.js +10 -3
  95. package/js/src/pro/bitvavo.d.ts +2 -2
  96. package/js/src/pro/coinbase.js +8 -7
  97. package/js/src/pro/htx.js +22 -3
  98. package/js/src/pro/hyperliquid.js +4 -0
  99. package/js/src/pro/kraken.d.ts +7 -8
  100. package/js/src/pro/kraken.js +282 -458
  101. package/js/src/pro/mexc.js +16 -11
  102. package/js/src/pro/woo.js +48 -4
  103. package/js/src/probit.js +1 -1
  104. package/js/src/timex.d.ts +1 -1
  105. package/js/src/woo.js +20 -2
  106. package/js/src/xt.js +1 -1
  107. package/package.json +1 -1
  108. package/js/src/abstract/okcoin.d.ts +0 -77
  109. package/js/src/abstract/okcoin.js +0 -11
  110. package/js/src/okcoin.d.ts +0 -346
  111. package/js/src/okcoin.js +0 -3214
  112. package/js/src/pro/okcoin.d.ts +0 -91
  113. package/js/src/pro/okcoin.js +0 -763
package/dist/cjs/ccxt.js CHANGED
@@ -89,7 +89,6 @@ var myokx = require('./src/myokx.js');
89
89
  var ndax = require('./src/ndax.js');
90
90
  var novadax = require('./src/novadax.js');
91
91
  var oceanex = require('./src/oceanex.js');
92
- var okcoin = require('./src/okcoin.js');
93
92
  var okx = require('./src/okx.js');
94
93
  var okxus = require('./src/okxus.js');
95
94
  var onetrading = require('./src/onetrading.js');
@@ -169,7 +168,6 @@ var mexc$1 = require('./src/pro/mexc.js');
169
168
  var modetrade$1 = require('./src/pro/modetrade.js');
170
169
  var myokx$1 = require('./src/pro/myokx.js');
171
170
  var ndax$1 = require('./src/pro/ndax.js');
172
- var okcoin$1 = require('./src/pro/okcoin.js');
173
171
  var okx$1 = require('./src/pro/okx.js');
174
172
  var okxus$1 = require('./src/pro/okxus.js');
175
173
  var onetrading$1 = require('./src/pro/onetrading.js');
@@ -189,7 +187,7 @@ var xt$1 = require('./src/pro/xt.js');
189
187
  // ----------------------------------------------------------------------------
190
188
  //-----------------------------------------------------------------------------
191
189
  // this is updated by vss.js when building
192
- const version = '4.5.10';
190
+ const version = '4.5.12';
193
191
  Exchange["default"].ccxtVersion = version;
194
192
  const exchanges = {
195
193
  'alpaca': alpaca["default"],
@@ -275,7 +273,6 @@ const exchanges = {
275
273
  'ndax': ndax["default"],
276
274
  'novadax': novadax["default"],
277
275
  'oceanex': oceanex["default"],
278
- 'okcoin': okcoin["default"],
279
276
  'okx': okx["default"],
280
277
  'okxus': okxus["default"],
281
278
  'onetrading': onetrading["default"],
@@ -357,7 +354,6 @@ const pro = {
357
354
  'modetrade': modetrade$1["default"],
358
355
  'myokx': myokx$1["default"],
359
356
  'ndax': ndax$1["default"],
360
- 'okcoin': okcoin$1["default"],
361
357
  'okx': okx$1["default"],
362
358
  'okxus': okxus$1["default"],
363
359
  'onetrading': onetrading$1["default"],
@@ -508,7 +504,6 @@ exports.myokx = myokx["default"];
508
504
  exports.ndax = ndax["default"];
509
505
  exports.novadax = novadax["default"];
510
506
  exports.oceanex = oceanex["default"];
511
- exports.okcoin = okcoin["default"];
512
507
  exports.okx = okx["default"];
513
508
  exports.okxus = okxus["default"];
514
509
  exports.onetrading = onetrading["default"];
@@ -35,6 +35,7 @@ class apex extends apex$1["default"] {
35
35
  'addMargin': false,
36
36
  'borrowCrossMargin': false,
37
37
  'borrowIsolatedMargin': false,
38
+ 'borrowMargin': false,
38
39
  'cancelAllOrders': true,
39
40
  'cancelAllOrdersAfter': false,
40
41
  'cancelOrder': true,
@@ -53,10 +54,14 @@ class apex extends apex$1["default"] {
53
54
  'createTriggerOrder': true,
54
55
  'editOrder': false,
55
56
  'fetchAccounts': true,
57
+ 'fetchAllGreeks': false,
56
58
  'fetchBalance': true,
57
59
  'fetchBorrowInterest': false,
60
+ 'fetchBorrowRate': false,
58
61
  'fetchBorrowRateHistories': false,
59
62
  'fetchBorrowRateHistory': false,
63
+ 'fetchBorrowRates': false,
64
+ 'fetchBorrowRatesPerSymbol': false,
60
65
  'fetchCanceledAndClosedOrders': false,
61
66
  'fetchCanceledOrders': false,
62
67
  'fetchClosedOrders': false,
@@ -72,6 +77,7 @@ class apex extends apex$1["default"] {
72
77
  'fetchFundingRate': false,
73
78
  'fetchFundingRateHistory': true,
74
79
  'fetchFundingRates': false,
80
+ 'fetchGreeks': false,
75
81
  'fetchIndexOHLCV': false,
76
82
  'fetchIsolatedBorrowRate': false,
77
83
  'fetchIsolatedBorrowRates': false,
@@ -90,6 +96,8 @@ class apex extends apex$1["default"] {
90
96
  'fetchOpenInterestHistory': false,
91
97
  'fetchOpenInterests': false,
92
98
  'fetchOpenOrders': true,
99
+ 'fetchOption': false,
100
+ 'fetchOptionChain': false,
93
101
  'fetchOrder': true,
94
102
  'fetchOrderBook': true,
95
103
  'fetchOrders': true,
@@ -107,6 +115,7 @@ class apex extends apex$1["default"] {
107
115
  'fetchTradingFees': false,
108
116
  'fetchTransfer': true,
109
117
  'fetchTransfers': true,
118
+ 'fetchVolatilityHistory': false,
110
119
  'fetchWithdrawal': false,
111
120
  'fetchWithdrawals': false,
112
121
  'reduceMargin': false,
@@ -2263,6 +2263,12 @@ class Exchange {
2263
2263
  async unWatchTicker(symbol, params = {}) {
2264
2264
  throw new errors.NotSupported(this.id + ' unWatchTicker() is not supported yet');
2265
2265
  }
2266
+ async unWatchMarkPrice(symbol, params = {}) {
2267
+ throw new errors.NotSupported(this.id + ' unWatchMarkPrice() is not supported yet');
2268
+ }
2269
+ async unWatchMarkPrices(symbols = undefined, params = {}) {
2270
+ throw new errors.NotSupported(this.id + ' unWatchMarkPrices() is not supported yet');
2271
+ }
2266
2272
  async fetchDepositAddresses(codes = undefined, params = {}) {
2267
2273
  throw new errors.NotSupported(this.id + ' fetchDepositAddresses() is not supported yet');
2268
2274
  }
@@ -2550,7 +2556,7 @@ class Exchange {
2550
2556
  'delay': 0.001,
2551
2557
  'capacity': 1,
2552
2558
  'cost': 1,
2553
- 'maxCapacity': 1000,
2559
+ 'maxCapacity': this.safeInteger(this.options, 'maxRequestsQueue', 1000),
2554
2560
  'refillRate': refillRate,
2555
2561
  };
2556
2562
  const existingBucket = (this.tokenBucket === undefined) ? {} : this.tokenBucket;
@@ -2678,6 +2684,9 @@ class Exchange {
2678
2684
  if (this.features === undefined) {
2679
2685
  return defaultValue;
2680
2686
  }
2687
+ if (marketType === undefined) {
2688
+ return defaultValue; // marketType is required
2689
+ }
2681
2690
  // if marketType (e.g. 'option') does not exist in features
2682
2691
  if (!(marketType in this.features)) {
2683
2692
  return defaultValue; // unsupported marketType, check "exchange.features" for details
@@ -2704,7 +2713,7 @@ class Exchange {
2704
2713
  }
2705
2714
  // if user wanted only marketType and didn't provide methodName, eg: featureIsSupported('spot')
2706
2715
  if (methodName === undefined) {
2707
- return methodsContainer;
2716
+ return (defaultValue !== undefined) ? defaultValue : methodsContainer;
2708
2717
  }
2709
2718
  if (!(methodName in methodsContainer)) {
2710
2719
  return defaultValue; // unsupported method, check "exchange.features" for details');
@@ -2715,7 +2724,7 @@ class Exchange {
2715
2724
  }
2716
2725
  // if user wanted only method and didn't provide `paramName`, eg: featureIsSupported('swap', 'linear', 'createOrder')
2717
2726
  if (paramName === undefined) {
2718
- return methodDict;
2727
+ return (defaultValue !== undefined) ? defaultValue : methodDict;
2719
2728
  }
2720
2729
  const splited = paramName.split('.'); // can be only parent key (`stopLoss`) or with child (`stopLoss.triggerPrice`)
2721
2730
  const parentKey = splited[0];
@@ -5705,6 +5714,9 @@ class Exchange {
5705
5714
  async cancelOrderWs(id, symbol = undefined, params = {}) {
5706
5715
  throw new errors.NotSupported(this.id + ' cancelOrderWs() is not supported yet');
5707
5716
  }
5717
+ async cancelOrders(ids, symbol = undefined, params = {}) {
5718
+ throw new errors.NotSupported(this.id + ' cancelOrders() is not supported yet');
5719
+ }
5708
5720
  async cancelOrdersWs(ids, symbol = undefined, params = {}) {
5709
5721
  throw new errors.NotSupported(this.id + ' cancelOrdersWs() is not supported yet');
5710
5722
  }
@@ -50,7 +50,7 @@ class Throttler {
50
50
  resolver = resolve;
51
51
  });
52
52
  if (this.queue.length > this.config['maxCapacity']) {
53
- throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://github.com/ccxt/ccxt/issues/11645#issuecomment-1195695526');
53
+ throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://docs.ccxt.com/#/README?id=maximum-requests-capacity');
54
54
  }
55
55
  cost = (cost === undefined) ? this.config['cost'] : cost;
56
56
  this.queue.push({ resolver, cost });
@@ -246,7 +246,7 @@ class binance extends binance$1["default"] {
246
246
  },
247
247
  'www': 'https://www.binance.com',
248
248
  'referral': {
249
- 'url': 'https://accounts.binance.com/en/register?ref=D7YA7CLY',
249
+ 'url': 'https://accounts.binance.com/register?ref=CCXTCOM',
250
250
  'discount': 0.1,
251
251
  },
252
252
  'doc': [
@@ -5891,7 +5891,7 @@ class bingx extends bingx$1["default"] {
5891
5891
  this.checkAddress(address);
5892
5892
  await this.loadMarkets();
5893
5893
  const currency = this.currency(code);
5894
- const walletType = this.safeInteger(params, 'walletType', 1);
5894
+ const walletType = this.safeInteger(params, 'walletType', 15);
5895
5895
  const request = {
5896
5896
  'coin': currency['id'],
5897
5897
  'address': address,
@@ -1983,11 +1983,13 @@ class bitfinex extends bitfinex$1["default"] {
1983
1983
  */
1984
1984
  async cancelOrders(ids, symbol = undefined, params = {}) {
1985
1985
  await this.loadMarkets();
1986
+ const numericIds = [];
1986
1987
  for (let i = 0; i < ids.length; i++) {
1987
- ids[i] = this.parseToNumeric(ids[i]);
1988
+ // numericIds[i] = this.parseToNumeric (ids[i]);
1989
+ numericIds.push(this.parseToNumeric(ids[i]));
1988
1990
  }
1989
1991
  const request = {
1990
- 'id': ids,
1992
+ 'id': numericIds,
1991
1993
  };
1992
1994
  let market = undefined;
1993
1995
  if (symbol !== undefined) {
@@ -1778,9 +1778,24 @@ class bitget extends bitget$1["default"] {
1778
1778
  },
1779
1779
  });
1780
1780
  }
1781
+ /**
1782
+ * @method
1783
+ * @name bitget#setSandboxMode
1784
+ * @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
1785
+ * @param enabled
1786
+ */
1781
1787
  setSandboxMode(enabled) {
1782
1788
  this.options['sandboxMode'] = enabled;
1783
1789
  }
1790
+ /**
1791
+ * @method
1792
+ * @name bitget#enableDemoTrading
1793
+ * @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
1794
+ * @param enabled
1795
+ */
1796
+ enableDemoTrading(enabled) {
1797
+ this.setSandboxMode(enabled);
1798
+ }
1784
1799
  handleProductTypeAndParams(market = undefined, params = {}) {
1785
1800
  let subType = undefined;
1786
1801
  [subType, params] = this.handleSubTypeAndParams('handleProductTypeAndParams', undefined, params);
@@ -7980,7 +7995,10 @@ class bitget extends bitget$1["default"] {
7980
7995
  let market = undefined;
7981
7996
  if (symbols !== undefined) {
7982
7997
  const first = this.safeString(symbols, 0);
7983
- market = this.market(first);
7998
+ // symbols can be undefined or []
7999
+ if (first !== undefined) {
8000
+ market = this.market(first);
8001
+ }
7984
8002
  }
7985
8003
  let productType = undefined;
7986
8004
  [productType, params] = this.handleProductTypeAndParams(market, params);
@@ -7995,7 +8013,7 @@ class bitget extends bitget$1["default"] {
7995
8013
  }
7996
8014
  else if (method === 'privateMixGetV2MixPositionAllPosition') {
7997
8015
  let marginCoin = this.safeString(params, 'marginCoin', 'USDT');
7998
- if (symbols !== undefined) {
8016
+ if (market !== undefined) {
7999
8017
  marginCoin = market['settleId'];
8000
8018
  }
8001
8019
  else if (productType === 'USDT-FUTURES') {
@@ -1013,7 +1013,7 @@ class bitmart extends bitmart$1["default"] {
1013
1013
  'swap': false,
1014
1014
  'future': false,
1015
1015
  'option': false,
1016
- 'active': true,
1016
+ 'active': this.safeStringLower2(market, 'status', 'trade_status') === 'trading',
1017
1017
  'contract': false,
1018
1018
  'linear': undefined,
1019
1019
  'inverse': undefined,
@@ -1130,7 +1130,7 @@ class bitmart extends bitmart$1["default"] {
1130
1130
  'swap': isSwap,
1131
1131
  'future': isFutures,
1132
1132
  'option': false,
1133
- 'active': true,
1133
+ 'active': this.safeStringLower(market, 'status') === 'trading',
1134
1134
  'contract': true,
1135
1135
  'linear': true,
1136
1136
  'inverse': false,
@@ -1012,11 +1012,13 @@ class btcmarkets extends btcmarkets$1["default"] {
1012
1012
  */
1013
1013
  async cancelOrders(ids, symbol = undefined, params = {}) {
1014
1014
  await this.loadMarkets();
1015
+ const numericIds = [];
1015
1016
  for (let i = 0; i < ids.length; i++) {
1016
- ids[i] = parseInt(ids[i]);
1017
+ // numericIds[i] = parseInt (ids[i]);
1018
+ numericIds.push(parseInt(ids[i]));
1017
1019
  }
1018
1020
  const request = {
1019
- 'ids': ids,
1021
+ 'ids': numericIds,
1020
1022
  };
1021
1023
  const response = await this.privateDeleteBatchordersIds(this.extend(request, params));
1022
1024
  //
@@ -184,7 +184,7 @@ class bybit extends bybit$1["default"] {
184
184
  'https://github.com/bybit-exchange',
185
185
  ],
186
186
  'fees': 'https://help.bybit.com/hc/en-us/articles/360039261154',
187
- 'referral': 'https://www.bybit.com/register?affiliate_id=35953',
187
+ 'referral': 'https://www.bybit.com/invite?ref=XDK12WP',
188
188
  },
189
189
  'api': {
190
190
  'public': {
@@ -4107,7 +4107,7 @@ class bybit extends bybit$1["default"] {
4107
4107
  if (triggerPrice !== undefined) {
4108
4108
  request['orderFilter'] = 'StopOrder';
4109
4109
  }
4110
- else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
4110
+ else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
4111
4111
  request['orderFilter'] = 'tpslOrder';
4112
4112
  }
4113
4113
  }
@@ -4130,7 +4130,8 @@ class bybit extends bybit$1["default"] {
4130
4130
  params = this.omit(params, 'cost');
4131
4131
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
4132
4132
  const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
4133
- if (market['spot'] && (type === 'market') && isUTA && !isMarketBuyAndCostInferable) {
4133
+ const isMarketOrder = lowerCaseType === 'market';
4134
+ if (market['spot'] && isMarketOrder && isUTA && !isMarketBuyAndCostInferable) {
4134
4135
  // UTA account can specify the cost of the order on both sides
4135
4136
  if ((cost !== undefined) || (price !== undefined)) {
4136
4137
  request['marketUnit'] = 'quoteCoin';
@@ -4149,7 +4150,7 @@ class bybit extends bybit$1["default"] {
4149
4150
  request['qty'] = amountString;
4150
4151
  }
4151
4152
  }
4152
- else if (market['spot'] && (type === 'market') && (side === 'buy')) {
4153
+ else if (market['spot'] && isMarketOrder && (side === 'buy')) {
4153
4154
  // classic accounts
4154
4155
  // for market buy it requires the amount of quote currency to spend
4155
4156
  let createMarketBuyOrderRequiresPrice = true;
@@ -4225,6 +4226,16 @@ class bybit extends bybit$1["default"] {
4225
4226
  request['slOrderType'] = 'Limit';
4226
4227
  request['slLimitPrice'] = this.getPrice(symbol, slLimitPrice);
4227
4228
  }
4229
+ else {
4230
+ // for spot market, we need to add this
4231
+ if (market['spot']) {
4232
+ request['slOrderType'] = 'Market';
4233
+ }
4234
+ }
4235
+ // for spot market, we need to add this
4236
+ if (market['spot'] && isMarketOrder) {
4237
+ throw new errors.InvalidOrder(this.id + ' createOrder(): attached stopLoss is not supported for spot market orders');
4238
+ }
4228
4239
  }
4229
4240
  if (isTakeProfit) {
4230
4241
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
@@ -4235,6 +4246,16 @@ class bybit extends bybit$1["default"] {
4235
4246
  request['tpOrderType'] = 'Limit';
4236
4247
  request['tpLimitPrice'] = this.getPrice(symbol, tpLimitPrice);
4237
4248
  }
4249
+ else {
4250
+ // for spot market, we need to add this
4251
+ if (market['spot']) {
4252
+ request['tpOrderType'] = 'Market';
4253
+ }
4254
+ }
4255
+ // for spot market, we need to add this
4256
+ if (market['spot'] && isMarketOrder) {
4257
+ throw new errors.InvalidOrder(this.id + ' createOrder(): attached takeProfit is not supported for spot market orders');
4258
+ }
4238
4259
  }
4239
4260
  }
4240
4261
  if (!market['spot'] && hedged) {
@@ -6629,7 +6650,7 @@ class bybit extends bybit$1["default"] {
6629
6650
  }
6630
6651
  const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
6631
6652
  const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
6632
- let initialMarginString = this.safeStringN(position, ['positionIM', 'cumEntryValue']);
6653
+ let initialMarginString = this.safeString2(position, 'positionIM', 'cumEntryValue');
6633
6654
  let maintenanceMarginString = this.safeString(position, 'positionMM');
6634
6655
  const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
6635
6656
  let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
@@ -6666,7 +6687,7 @@ class bybit extends bybit$1["default"] {
6666
6687
  const maintenanceMarginPriceDifference = Precise["default"].stringAbs(Precise["default"].stringSub(liquidationPrice, bustPrice));
6667
6688
  maintenanceMarginString = Precise["default"].stringMul(maintenanceMarginPriceDifference, size);
6668
6689
  // Initial Margin = Contracts x Entry Price / Leverage
6669
- if (entryPrice !== undefined) {
6690
+ if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
6670
6691
  initialMarginString = Precise["default"].stringDiv(Precise["default"].stringMul(size, entryPrice), leverage);
6671
6692
  }
6672
6693
  }
@@ -6679,7 +6700,7 @@ class bybit extends bybit$1["default"] {
6679
6700
  const multiply = Precise["default"].stringMul(bustPrice, liquidationPrice);
6680
6701
  maintenanceMarginString = Precise["default"].stringDiv(Precise["default"].stringMul(size, difference), multiply);
6681
6702
  // Initial Margin = Leverage x Contracts / EntryPrice
6682
- if (entryPrice !== undefined) {
6703
+ if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
6683
6704
  initialMarginString = Precise["default"].stringDiv(size, Precise["default"].stringMul(entryPrice, leverage));
6684
6705
  }
6685
6706
  }
@@ -280,6 +280,7 @@ class coinbase extends coinbase$1["default"] {
280
280
  'brokerage/intx/positions/{portfolio_uuid}/{symbol}': 1,
281
281
  'brokerage/payment_methods': 1,
282
282
  'brokerage/payment_methods/{payment_method_id}': 1,
283
+ 'brokerage/key_permissions': 1,
283
284
  },
284
285
  'post': {
285
286
  'brokerage/orders': 1,
@@ -372,7 +372,8 @@ class coincatch extends coincatch$1["default"] {
372
372
  'StratisEVM': 'STRAT',
373
373
  'ChilizChain': 'ChilizChain',
374
374
  'StellarLumens': 'XLM',
375
- 'CronosChain': 'CRO', // todo check
375
+ 'CronosChain': 'CRO',
376
+ 'Optimism': 'Optimism',
376
377
  },
377
378
  },
378
379
  'features': {
@@ -616,24 +616,26 @@ class deribit extends deribit$1["default"] {
616
616
  const response = await this.publicGetGetCurrencies(params);
617
617
  //
618
618
  // {
619
- // "jsonrpc": "2.0",
620
- // "result": [
621
- // {
622
- // "withdrawal_priorities": [],
623
- // "withdrawal_fee": 0.01457324,
624
- // "min_withdrawal_fee": 0.000001,
625
- // "min_confirmations": 1,
626
- // "fee_precision": 8,
627
- // "currency_long": "Solana",
628
- // "currency": "SOL",
629
- // "coin_type": "SOL"
630
- // },
631
- // ...
632
- // ],
633
- // "usIn": 1688652701456124,
634
- // "usOut": 1688652701456390,
635
- // "usDiff": 266,
636
- // "testnet": true
619
+ // "jsonrpc": "2.0",
620
+ // "result": [
621
+ // {
622
+ // "currency": "XRP",
623
+ // "network_fee": "1.5e-5",
624
+ // "min_withdrawal_fee": "0.0001",
625
+ // "apr": "0.0",
626
+ // "withdrawal_fee": "0.0001",
627
+ // "network_currency": "XRP",
628
+ // "coin_type": "XRP",
629
+ // "withdrawal_priorities": [],
630
+ // "min_confirmations": "1",
631
+ // "currency_long": "XRP",
632
+ // "in_cross_collateral_pool": false
633
+ // },
634
+ // ],
635
+ // "usIn": "1760110326693923",
636
+ // "usOut": "1760110326944891",
637
+ // "usDiff": "250968",
638
+ // "testnet": false
637
639
  // }
638
640
  //
639
641
  const data = this.safeList(response, 'result', []);
@@ -652,7 +654,7 @@ class deribit extends deribit$1["default"] {
652
654
  'withdraw': undefined,
653
655
  'type': 'crypto',
654
656
  'fee': this.safeNumber(currency, 'withdrawal_fee'),
655
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'fee_precision'))),
657
+ 'precision': undefined,
656
658
  'limits': {
657
659
  'amount': {
658
660
  'min': undefined,
@@ -1728,6 +1728,10 @@ class kraken extends kraken$1["default"] {
1728
1728
  const statuses = {
1729
1729
  'pending': 'open',
1730
1730
  'open': 'open',
1731
+ 'pending_new': 'open',
1732
+ 'new': 'open',
1733
+ 'partially_filled': 'open',
1734
+ 'filled': 'closed',
1731
1735
  'closed': 'closed',
1732
1736
  'canceled': 'canceled',
1733
1737
  'expired': 'expired',
@@ -1840,6 +1840,22 @@ class krakenfutures extends krakenfutures$1["default"] {
1840
1840
  // }
1841
1841
  // }
1842
1842
  //
1843
+ // {
1844
+ // uid: '85805e01-9eed-4395-8360-ed1a228237c9',
1845
+ // accountUid: '406142dd-7c5c-4a8b-acbc-5f16eca30009',
1846
+ // tradeable: 'PF_LTCUSD',
1847
+ // direction: 'Buy',
1848
+ // quantity: '0',
1849
+ // filled: '0.1',
1850
+ // timestamp: '1707258274849',
1851
+ // limitPrice: '69.2200000000',
1852
+ // orderType: 'IoC',
1853
+ // clientId: '',
1854
+ // reduceOnly: false,
1855
+ // lastUpdateTimestamp: '1707258274849',
1856
+ // status: 'closed'
1857
+ // }
1858
+ //
1843
1859
  const orderEvents = this.safeValue(order, 'orderEvents', []);
1844
1860
  const errorStatus = this.safeString(order, 'status');
1845
1861
  const orderEventsLength = orderEvents.length;
@@ -1961,20 +1977,25 @@ class krakenfutures extends krakenfutures$1["default"] {
1961
1977
  if (type === 'ioc' || this.parseOrderType(type) === 'market') {
1962
1978
  timeInForce = 'ioc';
1963
1979
  }
1980
+ let symbol = this.safeString(market, 'symbol');
1981
+ if ('tradeable' in details) {
1982
+ symbol = this.safeSymbol(this.safeString(details, 'tradeable'), market);
1983
+ }
1984
+ const ts = this.safeInteger(details, 'timestamp', timestamp);
1964
1985
  return this.safeOrder({
1965
1986
  'info': order,
1966
1987
  'id': id,
1967
1988
  'clientOrderId': this.safeStringN(details, ['clientOrderId', 'clientId', 'cliOrdId']),
1968
- 'timestamp': timestamp,
1969
- 'datetime': this.iso8601(timestamp),
1989
+ 'timestamp': ts,
1990
+ 'datetime': this.iso8601(ts),
1970
1991
  'lastTradeTimestamp': undefined,
1971
- 'lastUpdateTimestamp': lastUpdateTimestamp,
1972
- 'symbol': this.safeString(market, 'symbol'),
1992
+ 'lastUpdateTimestamp': this.safeInteger(details, 'lastUpdateTimestamp', lastUpdateTimestamp),
1993
+ 'symbol': symbol,
1973
1994
  'type': this.parseOrderType(type),
1974
1995
  'timeInForce': timeInForce,
1975
1996
  'postOnly': type === 'post',
1976
1997
  'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
1977
- 'side': this.safeString(details, 'side'),
1998
+ 'side': this.safeStringLower2(details, 'side', 'direction'),
1978
1999
  'price': price,
1979
2000
  'triggerPrice': this.safeString(details, 'triggerPrice'),
1980
2001
  'amount': amount,
@@ -1608,7 +1608,7 @@ class kucoin extends kucoin$1["default"] {
1608
1608
  const networkCodeNew = this.networkIdToCode(this.safeString(chain, 'chainId'), this.safeString(currency, 'code'));
1609
1609
  resultNew['networks'][networkCodeNew] = {
1610
1610
  'withdraw': {
1611
- 'fee': this.safeNumber(chain, 'withdrawMinFee'),
1611
+ 'fee': this.safeNumber2(chain, 'withdrawalMinFee', 'withdrawMinFee'),
1612
1612
  'percentage': false,
1613
1613
  },
1614
1614
  'deposit': {
@@ -1606,6 +1606,7 @@ class latoken extends latoken$1["default"] {
1606
1606
  'TRANSACTION_STATUS_CHECKING': 'pending',
1607
1607
  'TRANSACTION_STATUS_CANCELLED': 'canceled',
1608
1608
  'TRANSACTION_STATUS_FAILED': 'failed',
1609
+ 'TRANSACTION_STATUS_REJECTED': 'rejected',
1609
1610
  };
1610
1611
  return this.safeString(statuses, status, status);
1611
1612
  }
@@ -3589,6 +3589,7 @@ class mexc extends mexc$1["default"] {
3589
3589
  'timestamp': timestamp,
3590
3590
  'datetime': this.iso8601(timestamp),
3591
3591
  'lastTradeTimestamp': undefined,
3592
+ 'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
3592
3593
  'status': this.parseOrderStatus(this.safeString2(order, 'status', 'state')),
3593
3594
  'symbol': market['symbol'],
3594
3595
  'type': this.parseOrderType(typeRaw),
@@ -184,7 +184,7 @@ class okx extends okx$1["default"] {
184
184
  'referral': {
185
185
  // old reflink 0% discount https://www.okx.com/join/1888677
186
186
  // new reflink 20% discount https://www.okx.com/join/CCXT2023
187
- 'url': 'https://www.okx.com/join/CCXT2023',
187
+ 'url': 'https://www.okx.com/join/CCXTCOM',
188
188
  'discount': 0.2,
189
189
  },
190
190
  'test': {
@@ -1302,7 +1302,8 @@ class okx extends okx$1["default"] {
1302
1302
  },
1303
1303
  'fetchOHLCV': {
1304
1304
  'limit': 300,
1305
- 'historical': 100,
1305
+ 'mark': 100,
1306
+ 'index': 100,
1306
1307
  },
1307
1308
  },
1308
1309
  'spot': {
@@ -1328,6 +1329,12 @@ class okx extends okx$1["default"] {
1328
1329
  },
1329
1330
  },
1330
1331
  },
1332
+ 'currencies': {
1333
+ 'USD': this.safeCurrencyStructure({ 'id': 'USD', 'code': 'USD', 'precision': this.parseNumber('0.0001') }),
1334
+ 'EUR': this.safeCurrencyStructure({ 'id': 'EUR', 'code': 'EUR', 'precision': this.parseNumber('0.0001') }),
1335
+ 'AED': this.safeCurrencyStructure({ 'id': 'AED', 'code': 'AED', 'precision': this.parseNumber('0.0001') }),
1336
+ 'GBP': this.safeCurrencyStructure({ 'id': 'GBP', 'code': 'GBP', 'precision': this.parseNumber('0.0001') }),
1337
+ },
1331
1338
  'commonCurrencies': {
1332
1339
  // the exchange refers to ERC20 version of Aeternity (AEToken)
1333
1340
  'AE': 'AET',
@@ -2470,16 +2477,18 @@ class okx extends okx$1["default"] {
2470
2477
  if (paginate) {
2471
2478
  return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
2472
2479
  }
2473
- const price = this.safeString(params, 'price');
2480
+ const priceType = this.safeString(params, 'price');
2481
+ const isMarkOrIndex = this.inArray(priceType, ['mark', 'index']);
2474
2482
  params = this.omit(params, 'price');
2475
2483
  const options = this.safeDict(this.options, 'fetchOHLCV', {});
2476
2484
  const timezone = this.safeString(options, 'timezone', 'UTC');
2477
2485
  const limitIsUndefined = (limit === undefined);
2478
2486
  if (limit === undefined) {
2479
- limit = 100; // default 100, max 100
2487
+ limit = 100; // default 100, max 300
2480
2488
  }
2481
2489
  else {
2482
- limit = Math.min(limit, 300); // max 100
2490
+ const maxLimit = isMarkOrIndex ? 100 : 300; // default 300, only 100 if 'mark' or 'index'
2491
+ limit = Math.min(limit, maxLimit);
2483
2492
  }
2484
2493
  const duration = this.parseTimeframe(timeframe);
2485
2494
  let bar = this.safeString(this.timeframes, timeframe, timeframe);
@@ -2499,8 +2508,8 @@ class okx extends okx$1["default"] {
2499
2508
  const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
2500
2509
  if (since < historyBorder) {
2501
2510
  defaultType = 'HistoryCandles';
2502
- const maxLimit = (price !== undefined) ? 100 : 300;
2503
- limit = Math.min(limit, maxLimit); // max 300 for historical endpoint
2511
+ const maxLimit = isMarkOrIndex ? 100 : 300;
2512
+ limit = Math.min(limit, maxLimit);
2504
2513
  }
2505
2514
  const startTime = Math.max(since - 1, 0);
2506
2515
  request['before'] = startTime;
@@ -2516,7 +2525,7 @@ class okx extends okx$1["default"] {
2516
2525
  params = this.omit(params, 'type');
2517
2526
  const isHistoryCandles = (type === 'HistoryCandles');
2518
2527
  let response = undefined;
2519
- if (price === 'mark') {
2528
+ if (priceType === 'mark') {
2520
2529
  if (isHistoryCandles) {
2521
2530
  response = await this.publicGetMarketHistoryMarkPriceCandles(this.extend(request, params));
2522
2531
  }
@@ -2524,7 +2533,7 @@ class okx extends okx$1["default"] {
2524
2533
  response = await this.publicGetMarketMarkPriceCandles(this.extend(request, params));
2525
2534
  }
2526
2535
  }
2527
- else if (price === 'index') {
2536
+ else if (priceType === 'index') {
2528
2537
  request['instId'] = market['info']['instFamily']; // okx index candles require instFamily instead of instId
2529
2538
  if (isHistoryCandles) {
2530
2539
  response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));