ccxt 4.5.40 → 4.5.42

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 (106) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +18 -18
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/lighter.js +11 -0
  5. package/dist/cjs/src/ascendex.js +73 -1
  6. package/dist/cjs/src/base/Exchange.js +149 -17
  7. package/dist/cjs/src/base/functions/generic.js +1 -0
  8. package/dist/cjs/src/base/functions/io.js +160 -0
  9. package/dist/cjs/src/base/functions.js +6 -0
  10. package/dist/cjs/src/base/ws/Client.js +1 -0
  11. package/dist/cjs/src/base/ws/WsClient.js +1 -0
  12. package/dist/cjs/src/binance.js +1 -0
  13. package/dist/cjs/src/bingx.js +13 -3
  14. package/dist/cjs/src/bitmex.js +20 -0
  15. package/dist/cjs/src/blofin.js +2 -2
  16. package/dist/cjs/src/bybit.js +1 -1
  17. package/dist/cjs/src/coinspot.js +7 -2
  18. package/dist/cjs/src/delta.js +1 -1
  19. package/dist/cjs/src/gate.js +11 -4
  20. package/dist/cjs/src/gemini.js +76 -1
  21. package/dist/cjs/src/htx.js +2 -2
  22. package/dist/cjs/src/hyperliquid.js +20 -7
  23. package/dist/cjs/src/independentreserve.js +7 -7
  24. package/dist/cjs/src/kraken.js +1 -1
  25. package/dist/cjs/src/krakenfutures.js +96 -5
  26. package/dist/cjs/src/kucoin.js +3 -3
  27. package/dist/cjs/src/kucoinfutures.js +1 -1
  28. package/dist/cjs/src/lighter.js +2931 -0
  29. package/dist/cjs/src/mexc.js +0 -1
  30. package/dist/cjs/src/phemex.js +1 -1
  31. package/dist/cjs/src/pro/binance.js +2 -2
  32. package/dist/cjs/src/pro/bingx.js +215 -2
  33. package/dist/cjs/src/pro/bitget.js +1 -0
  34. package/dist/cjs/src/pro/defx.js +1 -1
  35. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  36. package/dist/cjs/src/pro/lighter.js +787 -0
  37. package/dist/cjs/src/pro/mexc.js +1 -1
  38. package/dist/cjs/src/pro/paradex.js +1 -1
  39. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +1 -0
  40. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -0
  41. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +1 -0
  42. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  43. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  44. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  45. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  46. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  47. package/dist/cjs/src/static_dependencies/ethers/fragments.js +1 -0
  48. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -0
  49. package/dist/cjs/src/static_dependencies/ethers/interface.js +1 -0
  50. package/dist/cjs/src/static_dependencies/ethers/typed.js +1 -0
  51. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -0
  52. package/dist/cjs/src/whitebit.js +118 -16
  53. package/dist/cjs/src/woo.js +1 -1
  54. package/js/ccxt.d.ts +8 -2
  55. package/js/ccxt.js +6 -2
  56. package/js/src/abstract/gemini.d.ts +27 -0
  57. package/js/src/abstract/lighter.d.ts +53 -0
  58. package/js/src/abstract/lighter.js +11 -0
  59. package/js/src/ascendex.d.ts +12 -1
  60. package/js/src/ascendex.js +73 -1
  61. package/js/src/base/Exchange.d.ts +18 -6
  62. package/js/src/base/Exchange.js +154 -21
  63. package/js/src/base/functions/generic.js +1 -0
  64. package/js/src/base/functions/io.d.ts +32 -0
  65. package/js/src/base/functions/io.js +137 -0
  66. package/js/src/base/functions.d.ts +1 -0
  67. package/js/src/base/functions.js +1 -0
  68. package/js/src/binance.d.ts +1 -0
  69. package/js/src/binance.js +1 -0
  70. package/js/src/bingx.js +13 -3
  71. package/js/src/bitmex.js +20 -0
  72. package/js/src/blofin.js +2 -2
  73. package/js/src/bybit.js +1 -1
  74. package/js/src/coinspot.js +7 -2
  75. package/js/src/delta.js +1 -1
  76. package/js/src/gate.d.ts +1 -0
  77. package/js/src/gate.js +11 -4
  78. package/js/src/gemini.d.ts +11 -0
  79. package/js/src/gemini.js +76 -1
  80. package/js/src/htx.js +2 -2
  81. package/js/src/hyperliquid.js +20 -7
  82. package/js/src/independentreserve.js +7 -7
  83. package/js/src/kraken.js +1 -1
  84. package/js/src/krakenfutures.d.ts +1 -1
  85. package/js/src/krakenfutures.js +96 -5
  86. package/js/src/kucoin.d.ts +3 -3
  87. package/js/src/kucoin.js +3 -3
  88. package/js/src/kucoinfutures.js +1 -1
  89. package/js/src/lighter.d.ts +424 -0
  90. package/js/src/lighter.js +2930 -0
  91. package/js/src/mexc.js +0 -1
  92. package/js/src/phemex.js +1 -1
  93. package/js/src/pro/binance.js +2 -2
  94. package/js/src/pro/bingx.d.ts +17 -1
  95. package/js/src/pro/bingx.js +216 -3
  96. package/js/src/pro/bitget.js +1 -0
  97. package/js/src/pro/defx.js +1 -1
  98. package/js/src/pro/kucoinfutures.js +1 -1
  99. package/js/src/pro/lighter.d.ts +161 -0
  100. package/js/src/pro/lighter.js +786 -0
  101. package/js/src/pro/mexc.js +1 -1
  102. package/js/src/pro/paradex.js +1 -1
  103. package/js/src/whitebit.d.ts +2 -1
  104. package/js/src/whitebit.js +118 -16
  105. package/js/src/woo.js +1 -1
  106. package/package.json +1 -1
@@ -38,6 +38,9 @@ class bitmex extends bitmex$1["default"] {
38
38
  'future': true,
39
39
  'option': false,
40
40
  'addMargin': undefined,
41
+ 'borrowCrossMargin': false,
42
+ 'borrowIsolatedMargin': false,
43
+ 'borrowMargin': false,
41
44
  'cancelAllOrders': true,
42
45
  'cancelAllOrdersAfter': true,
43
46
  'cancelOrder': true,
@@ -50,8 +53,17 @@ class bitmex extends bitmex$1["default"] {
50
53
  'createTrailingAmountOrder': true,
51
54
  'createTriggerOrder': true,
52
55
  'editOrder': true,
56
+ 'fetchAllGreeks': false,
53
57
  'fetchBalance': true,
58
+ 'fetchBorrowInterest': false,
59
+ 'fetchBorrowRate': false,
60
+ 'fetchBorrowRateHistories': false,
61
+ 'fetchBorrowRateHistory': false,
62
+ 'fetchBorrowRates': false,
63
+ 'fetchBorrowRatesPerSymbol': false,
54
64
  'fetchClosedOrders': true,
65
+ 'fetchCrossBorrowRate': false,
66
+ 'fetchCrossBorrowRates': false,
55
67
  'fetchCurrencies': true,
56
68
  'fetchDepositAddress': true,
57
69
  'fetchDepositAddresses': false,
@@ -63,7 +75,10 @@ class bitmex extends bitmex$1["default"] {
63
75
  'fetchFundingRate': 'emulated',
64
76
  'fetchFundingRateHistory': true,
65
77
  'fetchFundingRates': true,
78
+ 'fetchGreeks': false,
66
79
  'fetchIndexOHLCV': false,
80
+ 'fetchIsolatedBorrowRate': false,
81
+ 'fetchIsolatedBorrowRates': false,
67
82
  'fetchLedger': true,
68
83
  'fetchLeverage': 'emulated',
69
84
  'fetchLeverages': true,
@@ -79,6 +94,8 @@ class bitmex extends bitmex$1["default"] {
79
94
  'fetchOpenInterest': 'emulated',
80
95
  'fetchOpenInterests': true,
81
96
  'fetchOpenOrders': true,
97
+ 'fetchOption': false,
98
+ 'fetchOptionChain': false,
82
99
  'fetchOrder': true,
83
100
  'fetchOrderBook': true,
84
101
  'fetchOrders': true,
@@ -97,8 +114,11 @@ class bitmex extends bitmex$1["default"] {
97
114
  'fetchTransactions': 'emulated',
98
115
  'fetchTransfer': false,
99
116
  'fetchTransfers': false,
117
+ 'fetchVolatilityHistory': false,
100
118
  'index': true,
101
119
  'reduceMargin': undefined,
120
+ 'repayCrossMargin': false,
121
+ 'repayIsolatedMargin': false,
102
122
  'sandbox': true,
103
123
  'setLeverage': true,
104
124
  'setMargin': undefined,
@@ -105,9 +105,9 @@ class blofin extends blofin$1["default"] {
105
105
  'fetchOrderTrades': true,
106
106
  'fetchPosition': true,
107
107
  'fetchPositionADLRank': true,
108
- 'fetchPositionsADLRank': true,
109
108
  'fetchPositionMode': true,
110
109
  'fetchPositions': true,
110
+ 'fetchPositionsADLRank': true,
111
111
  'fetchPositionsForSymbol': false,
112
112
  'fetchPositionsRisk': false,
113
113
  'fetchPremiumIndexOHLCV': false,
@@ -1750,7 +1750,7 @@ class blofin extends blofin$1["default"] {
1750
1750
  // {
1751
1751
  // "currency": "USDT",
1752
1752
  // "chain": "TRC20",
1753
- // "address": "TGfJLtnsh3B9EqekFEBZ1nR14QanBUf5Bi",
1753
+ // "address": "TGfJLtnsh3B9EqekFEBZ1nR14QanBUf5Be",
1754
1754
  // "txId": "892f4e0c32268b29b2e541ef30d32a30bbf10f902adcc4b1428319ed7c3758fd",
1755
1755
  // "type": "0",
1756
1756
  // "amount": "86.975843",
@@ -117,9 +117,9 @@ class bybit extends bybit$1["default"] {
117
117
  'fetchOrderTrades': true,
118
118
  'fetchPosition': true,
119
119
  'fetchPositionADLRank': true,
120
- 'fetchPositionsADLRank': true,
121
120
  'fetchPositionHistory': 'emulated',
122
121
  'fetchPositions': true,
122
+ 'fetchPositionsADLRank': true,
123
123
  'fetchPositionsHistory': true,
124
124
  'fetchPremiumIndexOHLCV': true,
125
125
  'fetchSettlementHistory': true,
@@ -706,8 +706,13 @@ class coinspot extends coinspot$1["default"] {
706
706
  });
707
707
  }
708
708
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
709
- const url = this.urls['api'][api] + '/' + path;
710
- if (api === 'private') {
709
+ const isVersionedApi = Array.isArray(api);
710
+ const version = isVersionedApi ? api[0] : undefined;
711
+ const accessType = isVersionedApi ? api[1] : api;
712
+ const endpoint = '/' + this.implodeParams(path, params);
713
+ const fullPath = (version !== undefined) ? '/' + version + endpoint : endpoint;
714
+ const url = this.urls['api'][accessType] + fullPath;
715
+ if (accessType === 'private') {
711
716
  this.checkRequiredCredentials();
712
717
  const nonce = this.nonce();
713
718
  body = this.json(this.extend({ 'nonce': nonce }, params));
@@ -71,9 +71,9 @@ class delta extends delta$1["default"] {
71
71
  'fetchOrderBook': true,
72
72
  'fetchPosition': true,
73
73
  'fetchPositionADLRank': true,
74
- 'fetchPositionsADLRank': true,
75
74
  'fetchPositionMode': false,
76
75
  'fetchPositions': true,
76
+ 'fetchPositionsADLRank': true,
77
77
  'fetchPremiumIndexOHLCV': false,
78
78
  'fetchSettlementHistory': true,
79
79
  'fetchStatus': true,
@@ -4279,6 +4279,7 @@ class gate extends gate$1["default"] {
4279
4279
  * @param {int} [params.price_type] *contract only* 0 latest deal price, 1 mark price, 2 index price
4280
4280
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
4281
4281
  * @param {bool} [params.unifiedAccount] set to true for creating an order in the unified account
4282
+ * @param {string} [params.clientOrderId] the clientOrderId of the order
4282
4283
  * @returns {object|undefined} [An order structure]{@link https://docs.ccxt.com/?id=order-structure}
4283
4284
  */
4284
4285
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -4472,7 +4473,8 @@ class gate extends gate$1["default"] {
4472
4473
  }
4473
4474
  // we only omit the unified params here
4474
4475
  // this is because the other params will get extended into the request
4475
- params = this.omit(params, ['stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'reduceOnly', 'timeInForce', 'postOnly']);
4476
+ let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
4477
+ params = this.omit(params, ['stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'reduceOnly', 'timeInForce', 'postOnly', 'clientOrderId']);
4476
4478
  const isLimitOrder = (type === 'limit');
4477
4479
  const isMarketOrder = (type === 'market');
4478
4480
  if (isLimitOrder && price === undefined) {
@@ -4585,7 +4587,6 @@ class gate extends gate$1["default"] {
4585
4587
  request['time_in_force'] = timeInForce;
4586
4588
  }
4587
4589
  }
4588
- let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
4589
4590
  const textIsRequired = this.safeBool(params, 'textIsRequired', false);
4590
4591
  if (clientOrderId !== undefined) {
4591
4592
  // user-defined, must follow the rules if not empty
@@ -4595,7 +4596,7 @@ class gate extends gate$1["default"] {
4595
4596
  if (clientOrderId.length > 28) {
4596
4597
  throw new errors.BadRequest(this.id + ' createOrder () clientOrderId or text param must be up to 28 characters');
4597
4598
  }
4598
- params = this.omit(params, ['text', 'clientOrderId', 'textIsRequired']);
4599
+ params = this.omit(params, 'textIsRequired');
4599
4600
  if (clientOrderId[0] !== 't') {
4600
4601
  clientOrderId = 't-' + clientOrderId;
4601
4602
  }
@@ -4609,6 +4610,9 @@ class gate extends gate$1["default"] {
4609
4610
  }
4610
4611
  }
4611
4612
  else {
4613
+ if (clientOrderId !== undefined) {
4614
+ request['text'] = clientOrderId;
4615
+ }
4612
4616
  if (market['option']) {
4613
4617
  throw new errors.NotSupported(this.id + ' createOrder() conditional option orders are not supported');
4614
4618
  }
@@ -5135,6 +5139,9 @@ class gate extends gate$1["default"] {
5135
5139
  if (lastTradeTimestampStr !== undefined) {
5136
5140
  lastTradeTimestamp = this.parseToInt(lastTradeTimestampStr);
5137
5141
  }
5142
+ const initial = this.safeDict(order, 'initial', {});
5143
+ const reduceOnlyInitial = this.safeBool(initial, 'is_reduce_only');
5144
+ const reduceOnly = this.safeBool(order, 'is_reduce_only', reduceOnlyInitial);
5138
5145
  return this.safeOrder({
5139
5146
  'id': this.safeString(order, 'id'),
5140
5147
  'clientOrderId': this.safeString(order, 'text'),
@@ -5146,7 +5153,7 @@ class gate extends gate$1["default"] {
5146
5153
  'type': type,
5147
5154
  'timeInForce': timeInForce,
5148
5155
  'postOnly': postOnly,
5149
- 'reduceOnly': this.safeValue(order, 'is_reduce_only'),
5156
+ 'reduceOnly': reduceOnly,
5150
5157
  'side': side,
5151
5158
  'price': price,
5152
5159
  'triggerPrice': triggerPrice,
@@ -28,7 +28,7 @@ class gemini extends gemini$1["default"] {
28
28
  'has': {
29
29
  'CORS': undefined,
30
30
  'spot': true,
31
- 'margin': false,
31
+ 'margin': undefined,
32
32
  'swap': true,
33
33
  'future': false,
34
34
  'option': false,
@@ -134,19 +134,29 @@ class gemini extends gemini$1["default"] {
134
134
  'get': {
135
135
  'v1/symbols': 5,
136
136
  'v1/symbols/details/{symbol}': 5,
137
+ 'v1/network/{token}': 5,
137
138
  'v1/staking/rates': 5,
138
139
  'v1/pubticker/{symbol}': 5,
140
+ 'v1/feepromos': 5,
139
141
  'v2/ticker/{symbol}': 5,
140
142
  'v2/candles/{symbol}/{timeframe}': 5,
141
143
  'v1/trades/{symbol}': 5,
142
144
  'v1/auction/{symbol}': 5,
143
145
  'v1/auction/{symbol}/history': 5,
144
146
  'v1/pricefeed': 5,
147
+ 'v1/fundingamount/{symbol}': 5,
148
+ 'v1/fundingamountreport/records.xlsx': 5,
145
149
  'v1/book/{symbol}': 5,
146
150
  'v1/earn/rates': 5,
151
+ 'v2/derivatives/candles/{symbol}/{time_frame}': 5,
152
+ 'v2/fxrate/{symbol}/{timestamp}': 5,
153
+ 'v1/riskstats/{symbol}': 5,
147
154
  },
148
155
  },
149
156
  'private': {
157
+ 'get': {
158
+ 'v1/perpetuals/fundingpaymentreport/records.xlsx': 1,
159
+ },
150
160
  'post': {
151
161
  'v1/staking/unstake': 1,
152
162
  'v1/staking/stake': 1,
@@ -189,6 +199,25 @@ class gemini extends gemini$1["default"] {
189
199
  'v1/account/list': 1,
190
200
  'v1/heartbeat': 1,
191
201
  'v1/roles': 1,
202
+ 'v1/custodyaccountfees': 1,
203
+ 'v1/withdraw/{currencyCodeLowerCase}/feeEstimate': 1,
204
+ 'v1/payments/addbank/cad': 1,
205
+ 'v1/transactions': 1,
206
+ 'v1/margin/account': 1,
207
+ 'v1/margin/rates': 1,
208
+ 'v1/margin/order/preview': 1,
209
+ 'v1/clearing/list': 1,
210
+ 'v1/clearing/broker/list': 1,
211
+ 'v1/clearing/broker/new': 1,
212
+ 'v1/clearing/trades': 1,
213
+ 'v1/instant/quote': 1,
214
+ 'v1/instant/execute': 1,
215
+ 'v1/account/rename': 1,
216
+ 'v1/oauth/revokeByToken': 1,
217
+ 'v1/margin': 1,
218
+ 'v1/perpetuals/fundingPayment': 1,
219
+ 'v1/perpetuals/fundingpaymentreport/records.json': 1,
220
+ 'v1/positions': 1,
192
221
  },
193
222
  },
194
223
  },
@@ -2007,6 +2036,52 @@ class gemini extends gemini$1["default"] {
2007
2036
  //
2008
2037
  return this.parseOHLCVs(response, market, timeframe, since, limit);
2009
2038
  }
2039
+ /**
2040
+ * @method
2041
+ * @name gemini#fetchOpenInterest
2042
+ * @description retrieves the open interest of a contract trading pair
2043
+ * @see https://docs.gemini.com/rest/derivatives#get-risk-stats
2044
+ * @param {string} symbol unified CCXT market symbol
2045
+ * @param {object} [params] exchange specific parameters
2046
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/?id=open-interest-structure}
2047
+ */
2048
+ async fetchOpenInterest(symbol, params = {}) {
2049
+ await this.loadMarkets();
2050
+ const market = this.market(symbol);
2051
+ const request = {
2052
+ 'symbol': market['id'],
2053
+ };
2054
+ const response = await this.publicGetV1RiskstatsSymbol(this.extend(request, params));
2055
+ //
2056
+ // {
2057
+ // product_type: 'PerpetualSwapContract',
2058
+ // mark_price: '9.023',
2059
+ // index_price: '9.02072',
2060
+ // open_interest: '4681.9',
2061
+ // open_interest_notional: '42244.7837'
2062
+ // }
2063
+ //
2064
+ return this.parseOpenInterest(response, market);
2065
+ }
2066
+ parseOpenInterest(interest, market = undefined) {
2067
+ //
2068
+ // {
2069
+ // product_type: 'PerpetualSwapContract',
2070
+ // mark_price: '9.023',
2071
+ // index_price: '9.02072',
2072
+ // open_interest: '4681.9',
2073
+ // open_interest_notional: '42244.7837'
2074
+ // }
2075
+ //
2076
+ return this.safeOpenInterest({
2077
+ 'info': interest,
2078
+ 'symbol': this.safeString(market, 'symbol'),
2079
+ 'openInterestAmount': this.safeString(interest, 'open_interest'),
2080
+ 'openInterestValue': this.safeString(interest, 'open_interest_notional'),
2081
+ 'timestamp': undefined,
2082
+ 'datetime': undefined,
2083
+ }, market);
2084
+ }
2010
2085
  }
2011
2086
 
2012
2087
  exports["default"] = gemini;
@@ -108,9 +108,9 @@ class htx extends htx$1["default"] {
108
108
  'fetchOrderTrades': true,
109
109
  'fetchPosition': true,
110
110
  'fetchPositionADLRank': true,
111
- 'fetchPositionsADLRank': true,
112
111
  'fetchPositionHistory': 'emulated',
113
112
  'fetchPositions': true,
113
+ 'fetchPositionsADLRank': true,
114
114
  'fetchPositionsHistory': false,
115
115
  'fetchPositionsRisk': false,
116
116
  'fetchPremiumIndexOHLCV': true,
@@ -4296,7 +4296,7 @@ class htx extends htx$1["default"] {
4296
4296
  // POST /linear-swap-api/v3/swap_hisorders linear isolated --------
4297
4297
  // POST /linear-swap-api/v3/swap_cross_hisorders linear cross -----
4298
4298
  'trade_type': 0,
4299
- 'status': '0', // support multiple query seperated by ',',such as '3,4,5', 0: all. 3. Have sumbmitted the orders; 4. Orders partially matched; 5. Orders cancelled with partially matched; 6. Orders fully matched; 7. Orders cancelled;
4299
+ 'status': '0', // support multiple query separated by ',',such as '3,4,5', 0: all. 3. Have submitted the orders; 4. Orders partially matched; 5. Orders cancelled with partially matched; 6. Orders fully matched; 7. Orders cancelled;
4300
4300
  };
4301
4301
  let response = undefined;
4302
4302
  const trigger = this.safeBool2(params, 'stop', 'trigger');
@@ -627,7 +627,7 @@ class hyperliquid extends hyperliquid$1["default"] {
627
627
  // and we don't have the base/settle information and we can't assume it's USDC for hip3 markets
628
628
  for (let j = 0; j < universe.length; j++) {
629
629
  const data = this.extend(this.safeDict(universe, j, {}), this.safeDict(assetCtxs, j, {}));
630
- data['baseId'] = j + offset;
630
+ data['baseId'] = this.sum(j, offset);
631
631
  data['collateralToken'] = collateralToken;
632
632
  data['hip3'] = true;
633
633
  data['dex'] = dexName;
@@ -2199,7 +2199,7 @@ class hyperliquid extends hyperliquid$1["default"] {
2199
2199
  const symbol = market['symbol'];
2200
2200
  const type = this.safeStringUpper(rawOrder, 'type');
2201
2201
  const side = this.safeStringUpper(rawOrder, 'side');
2202
- const amount = this.safeString(rawOrder, 'amount');
2202
+ let amount = this.safeString(rawOrder, 'amount');
2203
2203
  const price = this.safeString(rawOrder, 'price');
2204
2204
  let orderParams = this.safeDict(rawOrder, 'params', {});
2205
2205
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
@@ -2210,17 +2210,27 @@ class hyperliquid extends hyperliquid$1["default"] {
2210
2210
  const hasTakeProfit = (takeProfit !== undefined);
2211
2211
  orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
2212
2212
  const mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams);
2213
- orderReq.push(mainOrderObj);
2214
2213
  if (hasStopLoss || hasTakeProfit) {
2215
2214
  // grouping opposed orders for sl/tp
2216
2215
  const stopLossOrderTriggerPrice = this.safeStringN(stopLoss, ['triggerPrice', 'stopPrice']);
2217
- const stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
2216
+ let stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
2218
2217
  const stopLossOrderLimitPrice = this.safeStringN(stopLoss, ['price', 'stopLossPrice'], stopLossOrderTriggerPrice);
2219
2218
  const takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, ['triggerPrice', 'stopPrice']);
2220
- const takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
2219
+ let takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
2221
2220
  const takeProfitOrderLimitPrice = this.safeStringN(takeProfit, ['price', 'takeProfitPrice'], takeProfitOrderTriggerPrice);
2222
- grouping = 'normalTpsl';
2223
- orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
2221
+ grouping = this.safeString(orderParams, 'grouping', 'normalTpsl');
2222
+ if (grouping === 'positionTpsl') {
2223
+ amount = '0';
2224
+ stopLossOrderType = 'market';
2225
+ takeProfitOrderType = 'market';
2226
+ }
2227
+ else if (grouping === 'normalTpsl') {
2228
+ orderReq.push(mainOrderObj);
2229
+ }
2230
+ else {
2231
+ throw new errors.NotSupported(this.id + ' only support grouping normalTpsl and positionTpsl.');
2232
+ }
2233
+ orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit', 'grouping']);
2224
2234
  let triggerOrderSide = '';
2225
2235
  if (side === 'BUY') {
2226
2236
  triggerOrderSide = 'sell';
@@ -2243,6 +2253,9 @@ class hyperliquid extends hyperliquid$1["default"] {
2243
2253
  orderReq.push(orderObj);
2244
2254
  }
2245
2255
  }
2256
+ else {
2257
+ orderReq.push(mainOrderObj);
2258
+ }
2246
2259
  }
2247
2260
  let vaultAddress = undefined;
2248
2261
  [vaultAddress, params] = this.handleOptionAndParams(params, 'createOrder', 'vaultAddress');
@@ -679,7 +679,7 @@ class independentreserve extends independentreserve$1["default"] {
679
679
  */
680
680
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
681
681
  await this.loadMarkets();
682
- const request = this.ordered({});
682
+ const request = {};
683
683
  let market = undefined;
684
684
  if (symbol !== undefined) {
685
685
  market = this.market(symbol);
@@ -707,7 +707,7 @@ class independentreserve extends independentreserve$1["default"] {
707
707
  */
708
708
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
709
709
  await this.loadMarkets();
710
- const request = this.ordered({});
710
+ const request = {};
711
711
  let market = undefined;
712
712
  if (symbol !== undefined) {
713
713
  market = this.market(symbol);
@@ -739,10 +739,10 @@ class independentreserve extends independentreserve$1["default"] {
739
739
  if (limit === undefined) {
740
740
  limit = 50;
741
741
  }
742
- const request = this.ordered({
742
+ const request = {
743
743
  'pageIndex': pageIndex,
744
744
  'pageSize': limit,
745
- });
745
+ };
746
746
  const response = await this.privatePostGetTrades(this.extend(request, params));
747
747
  let market = undefined;
748
748
  if (symbol !== undefined) {
@@ -875,11 +875,11 @@ class independentreserve extends independentreserve$1["default"] {
875
875
  const market = this.market(symbol);
876
876
  let orderType = this.capitalize(type);
877
877
  orderType += (side === 'sell') ? 'Offer' : 'Bid';
878
- const request = this.ordered({
878
+ const request = {
879
879
  'primaryCurrencyCode': market['baseId'],
880
880
  'secondaryCurrencyCode': market['quoteId'],
881
881
  'orderType': orderType,
882
- });
882
+ };
883
883
  let response = undefined;
884
884
  request['volume'] = amount;
885
885
  if (type === 'limit') {
@@ -1099,7 +1099,7 @@ class independentreserve extends independentreserve$1["default"] {
1099
1099
  }
1100
1100
  const message = auth.join(',');
1101
1101
  const signature = this.hmac(this.encode(message), this.encode(this.secret), sha256.sha256);
1102
- const query = this.ordered({});
1102
+ const query = {};
1103
1103
  query['apiKey'] = this.apiKey;
1104
1104
  query['nonce'] = nonce;
1105
1105
  query['signature'] = signature.toUpperCase();
@@ -1679,7 +1679,7 @@ class kraken extends kraken$1["default"] {
1679
1679
  const result = this.safeDict(response, 'result');
1680
1680
  result['usingCost'] = isUsingCost;
1681
1681
  // it's impossible to know if the order was created using cost or base currency
1682
- // becuase kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1682
+ // because kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1683
1683
  // this usingCost flag is used to help the parsing but omited from the order
1684
1684
  return this.parseOrder(result);
1685
1685
  }
@@ -1045,6 +1045,15 @@ class krakenfutures extends krakenfutures$1["default"] {
1045
1045
  takerOrMaker = 'taker';
1046
1046
  }
1047
1047
  }
1048
+ let fee = undefined;
1049
+ if ((takerOrMaker !== undefined) && (cost !== undefined)) {
1050
+ const feeRate = this.safeString(market, takerOrMaker);
1051
+ fee = {
1052
+ 'cost': Precise["default"].stringMul(cost, feeRate),
1053
+ 'currency': this.safeString(market, 'quote'),
1054
+ 'rate': feeRate,
1055
+ };
1056
+ }
1048
1057
  return this.safeTrade({
1049
1058
  'info': trade,
1050
1059
  'id': id,
@@ -1058,7 +1067,7 @@ class krakenfutures extends krakenfutures$1["default"] {
1058
1067
  'price': price,
1059
1068
  'amount': linear ? amount : undefined,
1060
1069
  'cost': cost,
1061
- 'fee': undefined,
1070
+ 'fee': fee,
1062
1071
  });
1063
1072
  }
1064
1073
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1181,6 +1190,41 @@ class krakenfutures extends krakenfutures$1["default"] {
1181
1190
  // "serverTime": "2022-02-28T19:32:17.122Z"
1182
1191
  // }
1183
1192
  //
1193
+ // MARKET
1194
+ //
1195
+ // {
1196
+ // "result": "success",
1197
+ // "serverTime": "2026-03-02T06:10:31.955Z",
1198
+ // "sendStatus": {
1199
+ // "status": "placed",
1200
+ // "order_id": "a133a4f9-254d-4806-8176-9acc936b6944",
1201
+ // "receivedTime": "2026-03-02T06:10:31.954Z",
1202
+ // "orderEvents": [
1203
+ // {
1204
+ // "type": "EXECUTION",
1205
+ // "executionId": "403bf49f-dbbe-448b-8de7-fd3cf38cc5dd",
1206
+ // "price": 66596.0,
1207
+ // "amount": 0.001,
1208
+ // "orderPriorEdit": null,
1209
+ // "orderPriorExecution": {
1210
+ // "orderId": "a133a4f9-254d-4806-8176-9acc936b6944",
1211
+ // "cliOrdId": null,
1212
+ // "type": "ioc",
1213
+ // "symbol": "PF_XBTUSD",
1214
+ // "side": "buy",
1215
+ // "quantity": 0.001,
1216
+ // "filled": 0,
1217
+ // "limitPrice": 67261.000,
1218
+ // "reduceOnly": false,
1219
+ // "timestamp": "2026-03-02T06:10:31.954Z",
1220
+ // "lastUpdateTimestamp": "2026-03-02T06:10:31.954Z"
1221
+ // },
1222
+ // "takerReducedQuantity": null
1223
+ // }
1224
+ // ]
1225
+ // }
1226
+ // }
1227
+ //
1184
1228
  const sendStatus = this.safeValue(response, 'sendStatus');
1185
1229
  const status = this.safeString(sendStatus, 'status');
1186
1230
  this.verifyOrderActionSuccess(status, 'createOrder', ['filled']);
@@ -1462,8 +1506,8 @@ class krakenfutures extends krakenfutures$1["default"] {
1462
1506
  /**
1463
1507
  * @method
1464
1508
  * @name krakenfutures#fetchOrders
1465
- * @see https://docs.kraken.com/api/docs/futures-api/trading/get-order-status/
1466
1509
  * @description Gets all orders for an account from the exchange api
1510
+ * @see https://docs.kraken.com/api/docs/futures-api/trading/get-order-status/
1467
1511
  * @param {string} symbol Unified market symbol
1468
1512
  * @param {int} [since] Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT)
1469
1513
  * @param {int} [limit] How many orders to return. (Not used by kraken api but filtered internally by CCXT)
@@ -1721,6 +1765,37 @@ class krakenfutures extends krakenfutures$1["default"] {
1721
1765
  // ]
1722
1766
  // }
1723
1767
  //
1768
+ // MARKET
1769
+ //
1770
+ // {
1771
+ // "status": "placed",
1772
+ // "order_id": "a133a4f9-254d-4806-8176-9acc936b6944",
1773
+ // "receivedTime": "2026-03-02T06:10:31.954Z",
1774
+ // "orderEvents": [
1775
+ // {
1776
+ // "type": "EXECUTION",
1777
+ // "executionId": "403bf49f-dbbe-448b-8de7-fd3cf38cc5dd",
1778
+ // "price": 66596.0,
1779
+ // "amount": 0.001,
1780
+ // "orderPriorEdit": null,
1781
+ // "orderPriorExecution": {
1782
+ // "orderId": "a133a4f9-254d-4806-8176-9acc936b6944",
1783
+ // "cliOrdId": null,
1784
+ // "type": "ioc",
1785
+ // "symbol": "PF_XBTUSD",
1786
+ // "side": "buy",
1787
+ // "quantity": 0.001,
1788
+ // "filled": 0,
1789
+ // "limitPrice": 67261.000,
1790
+ // "reduceOnly": false,
1791
+ // "timestamp": "2026-03-02T06:10:31.954Z",
1792
+ // "lastUpdateTimestamp": "2026-03-02T06:10:31.954Z"
1793
+ // },
1794
+ // "takerReducedQuantity": null
1795
+ // }
1796
+ // ]
1797
+ // }
1798
+ //
1724
1799
  // CONDITIONAL
1725
1800
  //
1726
1801
  // {
@@ -1964,6 +2039,10 @@ class krakenfutures extends krakenfutures$1["default"] {
1964
2039
  //
1965
2040
  const datetime = this.safeString(orderDictFromFetchOrder, 'timestamp');
1966
2041
  const innerStatus = this.safeString(order, 'status');
2042
+ let filledOrder = this.safeString(orderDictFromFetchOrder, 'filled', '0');
2043
+ if ((filledOrder === '0') || (filledOrder === '0.0')) {
2044
+ filledOrder = undefined;
2045
+ }
1967
2046
  return this.safeOrder({
1968
2047
  'info': order,
1969
2048
  'id': this.safeString(orderDictFromFetchOrder, 'orderId'),
@@ -1983,7 +2062,7 @@ class krakenfutures extends krakenfutures$1["default"] {
1983
2062
  'amount': this.safeString(orderDictFromFetchOrder, 'quantity'),
1984
2063
  'cost': undefined,
1985
2064
  'average': undefined,
1986
- 'filled': this.safeString(orderDictFromFetchOrder, 'filled'),
2065
+ 'filled': filledOrder,
1987
2066
  'remaining': undefined,
1988
2067
  'status': this.parseOrderStatus(innerStatus),
1989
2068
  'fee': undefined,
@@ -2020,9 +2099,15 @@ class krakenfutures extends krakenfutures$1["default"] {
2020
2099
  fixed = true;
2021
2100
  }
2022
2101
  else if (!fixed) {
2102
+ const executedPrice = this.safeString(item, 'price');
2023
2103
  const orderPriorExecution = this.safeValue(item, 'orderPriorExecution');
2024
2104
  details = this.safeValue2(item, 'orderPriorExecution', 'orderPriorEdit');
2025
- price = this.safeString(orderPriorExecution, 'limitPrice');
2105
+ if (executedPrice === undefined) {
2106
+ price = this.safeString(orderPriorExecution, 'limitPrice');
2107
+ }
2108
+ else {
2109
+ price = executedPrice;
2110
+ }
2026
2111
  if (details !== undefined) {
2027
2112
  isPrior = true;
2028
2113
  }
@@ -2117,6 +2202,11 @@ class krakenfutures extends krakenfutures$1["default"] {
2117
2202
  symbol = this.safeSymbol(this.safeString(details, 'tradeable'), market);
2118
2203
  }
2119
2204
  const ts = this.safeInteger(details, 'timestamp', timestamp);
2205
+ const priceTriggerOptions = this.safeDict(details, 'priceTriggerOptions', {});
2206
+ let triggerPrice = this.safeString2(details, 'triggerPrice', 'stopPrice');
2207
+ if (triggerPrice === undefined) {
2208
+ triggerPrice = this.safeString(priceTriggerOptions, 'triggerPrice');
2209
+ }
2120
2210
  return this.safeOrder({
2121
2211
  'info': order,
2122
2212
  'id': id,
@@ -2132,7 +2222,8 @@ class krakenfutures extends krakenfutures$1["default"] {
2132
2222
  'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
2133
2223
  'side': this.safeStringLower2(details, 'side', 'direction'),
2134
2224
  'price': price,
2135
- 'triggerPrice': this.safeString(details, 'triggerPrice'),
2225
+ 'triggerPrice': triggerPrice,
2226
+ 'stopPrice': triggerPrice,
2136
2227
  'amount': amount,
2137
2228
  'cost': cost,
2138
2229
  'average': average,
@@ -3204,7 +3204,7 @@ class kucoin extends kucoin$1["default"] {
3204
3204
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3205
3205
  * @param {bool} [params.trigger] *invalid for isolated margin* true if cancelling all stop orders
3206
3206
  * @param {string} [params.marginMode] 'cross' or 'isolated'
3207
- * @param {string} [params.orderIds] *stop orders only* Comma seperated order IDs
3207
+ * @param {string} [params.orderIds] *stop orders only* Comma separated order IDs
3208
3208
  * @param {bool} [params.hf] false, // true for hf order
3209
3209
  * @returns Response from the exchange
3210
3210
  */
@@ -3260,7 +3260,7 @@ class kucoin extends kucoin$1["default"] {
3260
3260
  * @param {string} [params.type] limit, market, limit_stop or market_stop
3261
3261
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
3262
3262
  * @param {int} [params.currentPage] *trigger orders only* current page
3263
- * @param {string} [params.orderIds] *trigger orders only* comma seperated order ID list
3263
+ * @param {string} [params.orderIds] *trigger orders only* comma separated order ID list
3264
3264
  * @param {bool} [params.trigger] True if fetching a trigger order
3265
3265
  * @param {bool} [params.hf] false, // true for hf order
3266
3266
  * @returns An [array of order structures]{@link https://docs.ccxt.com/?id=order-structure}
@@ -3415,7 +3415,7 @@ class kucoin extends kucoin$1["default"] {
3415
3415
  * @param {string} [params.type] limit, market, limit_stop or market_stop
3416
3416
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
3417
3417
  * @param {int} [params.currentPage] *trigger orders only* current page
3418
- * @param {string} [params.orderIds] *trigger orders only* comma seperated order ID list
3418
+ * @param {string} [params.orderIds] *trigger orders only* comma separated order ID list
3419
3419
  * @param {bool} [params.hf] false, // true for hf order
3420
3420
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3421
3421
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}