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
package/js/src/bitmex.js CHANGED
@@ -39,6 +39,9 @@ export default class bitmex extends Exchange {
39
39
  'future': true,
40
40
  'option': false,
41
41
  'addMargin': undefined,
42
+ 'borrowCrossMargin': false,
43
+ 'borrowIsolatedMargin': false,
44
+ 'borrowMargin': false,
42
45
  'cancelAllOrders': true,
43
46
  'cancelAllOrdersAfter': true,
44
47
  'cancelOrder': true,
@@ -51,8 +54,17 @@ export default class bitmex extends Exchange {
51
54
  'createTrailingAmountOrder': true,
52
55
  'createTriggerOrder': true,
53
56
  'editOrder': true,
57
+ 'fetchAllGreeks': false,
54
58
  'fetchBalance': true,
59
+ 'fetchBorrowInterest': false,
60
+ 'fetchBorrowRate': false,
61
+ 'fetchBorrowRateHistories': false,
62
+ 'fetchBorrowRateHistory': false,
63
+ 'fetchBorrowRates': false,
64
+ 'fetchBorrowRatesPerSymbol': false,
55
65
  'fetchClosedOrders': true,
66
+ 'fetchCrossBorrowRate': false,
67
+ 'fetchCrossBorrowRates': false,
56
68
  'fetchCurrencies': true,
57
69
  'fetchDepositAddress': true,
58
70
  'fetchDepositAddresses': false,
@@ -64,7 +76,10 @@ export default class bitmex extends Exchange {
64
76
  'fetchFundingRate': 'emulated',
65
77
  'fetchFundingRateHistory': true,
66
78
  'fetchFundingRates': true,
79
+ 'fetchGreeks': false,
67
80
  'fetchIndexOHLCV': false,
81
+ 'fetchIsolatedBorrowRate': false,
82
+ 'fetchIsolatedBorrowRates': false,
68
83
  'fetchLedger': true,
69
84
  'fetchLeverage': 'emulated',
70
85
  'fetchLeverages': true,
@@ -80,6 +95,8 @@ export default class bitmex extends Exchange {
80
95
  'fetchOpenInterest': 'emulated',
81
96
  'fetchOpenInterests': true,
82
97
  'fetchOpenOrders': true,
98
+ 'fetchOption': false,
99
+ 'fetchOptionChain': false,
83
100
  'fetchOrder': true,
84
101
  'fetchOrderBook': true,
85
102
  'fetchOrders': true,
@@ -98,8 +115,11 @@ export default class bitmex extends Exchange {
98
115
  'fetchTransactions': 'emulated',
99
116
  'fetchTransfer': false,
100
117
  'fetchTransfers': false,
118
+ 'fetchVolatilityHistory': false,
101
119
  'index': true,
102
120
  'reduceMargin': undefined,
121
+ 'repayCrossMargin': false,
122
+ 'repayIsolatedMargin': false,
103
123
  'sandbox': true,
104
124
  'setLeverage': true,
105
125
  'setMargin': undefined,
package/js/src/blofin.js CHANGED
@@ -106,9 +106,9 @@ export default class blofin extends Exchange {
106
106
  'fetchOrderTrades': true,
107
107
  'fetchPosition': true,
108
108
  'fetchPositionADLRank': true,
109
- 'fetchPositionsADLRank': true,
110
109
  'fetchPositionMode': true,
111
110
  'fetchPositions': true,
111
+ 'fetchPositionsADLRank': true,
112
112
  'fetchPositionsForSymbol': false,
113
113
  'fetchPositionsRisk': false,
114
114
  'fetchPremiumIndexOHLCV': false,
@@ -1751,7 +1751,7 @@ export default class blofin extends Exchange {
1751
1751
  // {
1752
1752
  // "currency": "USDT",
1753
1753
  // "chain": "TRC20",
1754
- // "address": "TGfJLtnsh3B9EqekFEBZ1nR14QanBUf5Bi",
1754
+ // "address": "TGfJLtnsh3B9EqekFEBZ1nR14QanBUf5Be",
1755
1755
  // "txId": "892f4e0c32268b29b2e541ef30d32a30bbf10f902adcc4b1428319ed7c3758fd",
1756
1756
  // "type": "0",
1757
1757
  // "amount": "86.975843",
package/js/src/bybit.js CHANGED
@@ -118,9 +118,9 @@ export default class bybit extends Exchange {
118
118
  'fetchOrderTrades': true,
119
119
  'fetchPosition': true,
120
120
  'fetchPositionADLRank': true,
121
- 'fetchPositionsADLRank': true,
122
121
  'fetchPositionHistory': 'emulated',
123
122
  'fetchPositions': true,
123
+ 'fetchPositionsADLRank': true,
124
124
  'fetchPositionsHistory': true,
125
125
  'fetchPremiumIndexOHLCV': true,
126
126
  'fetchSettlementHistory': true,
@@ -707,8 +707,13 @@ export default class coinspot extends Exchange {
707
707
  });
708
708
  }
709
709
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
710
- const url = this.urls['api'][api] + '/' + path;
711
- if (api === 'private') {
710
+ const isVersionedApi = Array.isArray(api);
711
+ const version = isVersionedApi ? api[0] : undefined;
712
+ const accessType = isVersionedApi ? api[1] : api;
713
+ const endpoint = '/' + this.implodeParams(path, params);
714
+ const fullPath = (version !== undefined) ? '/' + version + endpoint : endpoint;
715
+ const url = this.urls['api'][accessType] + fullPath;
716
+ if (accessType === 'private') {
712
717
  this.checkRequiredCredentials();
713
718
  const nonce = this.nonce();
714
719
  body = this.json(this.extend({ 'nonce': nonce }, params));
package/js/src/delta.js CHANGED
@@ -72,9 +72,9 @@ export default class delta extends Exchange {
72
72
  'fetchOrderBook': true,
73
73
  'fetchPosition': true,
74
74
  'fetchPositionADLRank': true,
75
- 'fetchPositionsADLRank': true,
76
75
  'fetchPositionMode': false,
77
76
  'fetchPositions': true,
77
+ 'fetchPositionsADLRank': true,
78
78
  'fetchPremiumIndexOHLCV': false,
79
79
  'fetchSettlementHistory': true,
80
80
  'fetchStatus': true,
package/js/src/gate.d.ts CHANGED
@@ -466,6 +466,7 @@ export default class gate extends Exchange {
466
466
  * @param {int} [params.price_type] *contract only* 0 latest deal price, 1 mark price, 2 index price
467
467
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
468
468
  * @param {bool} [params.unifiedAccount] set to true for creating an order in the unified account
469
+ * @param {string} [params.clientOrderId] the clientOrderId of the order
469
470
  * @returns {object|undefined} [An order structure]{@link https://docs.ccxt.com/?id=order-structure}
470
471
  */
471
472
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/gate.js CHANGED
@@ -4280,6 +4280,7 @@ export default class gate extends Exchange {
4280
4280
  * @param {int} [params.price_type] *contract only* 0 latest deal price, 1 mark price, 2 index price
4281
4281
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
4282
4282
  * @param {bool} [params.unifiedAccount] set to true for creating an order in the unified account
4283
+ * @param {string} [params.clientOrderId] the clientOrderId of the order
4283
4284
  * @returns {object|undefined} [An order structure]{@link https://docs.ccxt.com/?id=order-structure}
4284
4285
  */
4285
4286
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -4473,7 +4474,8 @@ export default class gate extends Exchange {
4473
4474
  }
4474
4475
  // we only omit the unified params here
4475
4476
  // this is because the other params will get extended into the request
4476
- params = this.omit(params, ['stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'reduceOnly', 'timeInForce', 'postOnly']);
4477
+ let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
4478
+ params = this.omit(params, ['stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'reduceOnly', 'timeInForce', 'postOnly', 'clientOrderId']);
4477
4479
  const isLimitOrder = (type === 'limit');
4478
4480
  const isMarketOrder = (type === 'market');
4479
4481
  if (isLimitOrder && price === undefined) {
@@ -4586,7 +4588,6 @@ export default class gate extends Exchange {
4586
4588
  request['time_in_force'] = timeInForce;
4587
4589
  }
4588
4590
  }
4589
- let clientOrderId = this.safeString2(params, 'text', 'clientOrderId');
4590
4591
  const textIsRequired = this.safeBool(params, 'textIsRequired', false);
4591
4592
  if (clientOrderId !== undefined) {
4592
4593
  // user-defined, must follow the rules if not empty
@@ -4596,7 +4597,7 @@ export default class gate extends Exchange {
4596
4597
  if (clientOrderId.length > 28) {
4597
4598
  throw new BadRequest(this.id + ' createOrder () clientOrderId or text param must be up to 28 characters');
4598
4599
  }
4599
- params = this.omit(params, ['text', 'clientOrderId', 'textIsRequired']);
4600
+ params = this.omit(params, 'textIsRequired');
4600
4601
  if (clientOrderId[0] !== 't') {
4601
4602
  clientOrderId = 't-' + clientOrderId;
4602
4603
  }
@@ -4610,6 +4611,9 @@ export default class gate extends Exchange {
4610
4611
  }
4611
4612
  }
4612
4613
  else {
4614
+ if (clientOrderId !== undefined) {
4615
+ request['text'] = clientOrderId;
4616
+ }
4613
4617
  if (market['option']) {
4614
4618
  throw new NotSupported(this.id + ' createOrder() conditional option orders are not supported');
4615
4619
  }
@@ -5136,6 +5140,9 @@ export default class gate extends Exchange {
5136
5140
  if (lastTradeTimestampStr !== undefined) {
5137
5141
  lastTradeTimestamp = this.parseToInt(lastTradeTimestampStr);
5138
5142
  }
5143
+ const initial = this.safeDict(order, 'initial', {});
5144
+ const reduceOnlyInitial = this.safeBool(initial, 'is_reduce_only');
5145
+ const reduceOnly = this.safeBool(order, 'is_reduce_only', reduceOnlyInitial);
5139
5146
  return this.safeOrder({
5140
5147
  'id': this.safeString(order, 'id'),
5141
5148
  'clientOrderId': this.safeString(order, 'text'),
@@ -5147,7 +5154,7 @@ export default class gate extends Exchange {
5147
5154
  'type': type,
5148
5155
  'timeInForce': timeInForce,
5149
5156
  'postOnly': postOnly,
5150
- 'reduceOnly': this.safeValue(order, 'is_reduce_only'),
5157
+ 'reduceOnly': reduceOnly,
5151
5158
  'side': side,
5152
5159
  'price': price,
5153
5160
  'triggerPrice': triggerPrice,
@@ -254,4 +254,15 @@ export default class gemini extends Exchange {
254
254
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
255
255
  */
256
256
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
257
+ /**
258
+ * @method
259
+ * @name gemini#fetchOpenInterest
260
+ * @description retrieves the open interest of a contract trading pair
261
+ * @see https://docs.gemini.com/rest/derivatives#get-risk-stats
262
+ * @param {string} symbol unified CCXT market symbol
263
+ * @param {object} [params] exchange specific parameters
264
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/?id=open-interest-structure}
265
+ */
266
+ fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
267
+ parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
257
268
  }
package/js/src/gemini.js CHANGED
@@ -29,7 +29,7 @@ export default class gemini extends Exchange {
29
29
  'has': {
30
30
  'CORS': undefined,
31
31
  'spot': true,
32
- 'margin': false,
32
+ 'margin': undefined,
33
33
  'swap': true,
34
34
  'future': false,
35
35
  'option': false,
@@ -135,19 +135,29 @@ export default class gemini extends Exchange {
135
135
  'get': {
136
136
  'v1/symbols': 5,
137
137
  'v1/symbols/details/{symbol}': 5,
138
+ 'v1/network/{token}': 5,
138
139
  'v1/staking/rates': 5,
139
140
  'v1/pubticker/{symbol}': 5,
141
+ 'v1/feepromos': 5,
140
142
  'v2/ticker/{symbol}': 5,
141
143
  'v2/candles/{symbol}/{timeframe}': 5,
142
144
  'v1/trades/{symbol}': 5,
143
145
  'v1/auction/{symbol}': 5,
144
146
  'v1/auction/{symbol}/history': 5,
145
147
  'v1/pricefeed': 5,
148
+ 'v1/fundingamount/{symbol}': 5,
149
+ 'v1/fundingamountreport/records.xlsx': 5,
146
150
  'v1/book/{symbol}': 5,
147
151
  'v1/earn/rates': 5,
152
+ 'v2/derivatives/candles/{symbol}/{time_frame}': 5,
153
+ 'v2/fxrate/{symbol}/{timestamp}': 5,
154
+ 'v1/riskstats/{symbol}': 5,
148
155
  },
149
156
  },
150
157
  'private': {
158
+ 'get': {
159
+ 'v1/perpetuals/fundingpaymentreport/records.xlsx': 1,
160
+ },
151
161
  'post': {
152
162
  'v1/staking/unstake': 1,
153
163
  'v1/staking/stake': 1,
@@ -190,6 +200,25 @@ export default class gemini extends Exchange {
190
200
  'v1/account/list': 1,
191
201
  'v1/heartbeat': 1,
192
202
  'v1/roles': 1,
203
+ 'v1/custodyaccountfees': 1,
204
+ 'v1/withdraw/{currencyCodeLowerCase}/feeEstimate': 1,
205
+ 'v1/payments/addbank/cad': 1,
206
+ 'v1/transactions': 1,
207
+ 'v1/margin/account': 1,
208
+ 'v1/margin/rates': 1,
209
+ 'v1/margin/order/preview': 1,
210
+ 'v1/clearing/list': 1,
211
+ 'v1/clearing/broker/list': 1,
212
+ 'v1/clearing/broker/new': 1,
213
+ 'v1/clearing/trades': 1,
214
+ 'v1/instant/quote': 1,
215
+ 'v1/instant/execute': 1,
216
+ 'v1/account/rename': 1,
217
+ 'v1/oauth/revokeByToken': 1,
218
+ 'v1/margin': 1,
219
+ 'v1/perpetuals/fundingPayment': 1,
220
+ 'v1/perpetuals/fundingpaymentreport/records.json': 1,
221
+ 'v1/positions': 1,
193
222
  },
194
223
  },
195
224
  },
@@ -2008,4 +2037,50 @@ export default class gemini extends Exchange {
2008
2037
  //
2009
2038
  return this.parseOHLCVs(response, market, timeframe, since, limit);
2010
2039
  }
2040
+ /**
2041
+ * @method
2042
+ * @name gemini#fetchOpenInterest
2043
+ * @description retrieves the open interest of a contract trading pair
2044
+ * @see https://docs.gemini.com/rest/derivatives#get-risk-stats
2045
+ * @param {string} symbol unified CCXT market symbol
2046
+ * @param {object} [params] exchange specific parameters
2047
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/?id=open-interest-structure}
2048
+ */
2049
+ async fetchOpenInterest(symbol, params = {}) {
2050
+ await this.loadMarkets();
2051
+ const market = this.market(symbol);
2052
+ const request = {
2053
+ 'symbol': market['id'],
2054
+ };
2055
+ const response = await this.publicGetV1RiskstatsSymbol(this.extend(request, params));
2056
+ //
2057
+ // {
2058
+ // product_type: 'PerpetualSwapContract',
2059
+ // mark_price: '9.023',
2060
+ // index_price: '9.02072',
2061
+ // open_interest: '4681.9',
2062
+ // open_interest_notional: '42244.7837'
2063
+ // }
2064
+ //
2065
+ return this.parseOpenInterest(response, market);
2066
+ }
2067
+ parseOpenInterest(interest, market = undefined) {
2068
+ //
2069
+ // {
2070
+ // product_type: 'PerpetualSwapContract',
2071
+ // mark_price: '9.023',
2072
+ // index_price: '9.02072',
2073
+ // open_interest: '4681.9',
2074
+ // open_interest_notional: '42244.7837'
2075
+ // }
2076
+ //
2077
+ return this.safeOpenInterest({
2078
+ 'info': interest,
2079
+ 'symbol': this.safeString(market, 'symbol'),
2080
+ 'openInterestAmount': this.safeString(interest, 'open_interest'),
2081
+ 'openInterestValue': this.safeString(interest, 'open_interest_notional'),
2082
+ 'timestamp': undefined,
2083
+ 'datetime': undefined,
2084
+ }, market);
2085
+ }
2011
2086
  }
package/js/src/htx.js CHANGED
@@ -109,9 +109,9 @@ export default class htx extends Exchange {
109
109
  'fetchOrderTrades': true,
110
110
  'fetchPosition': true,
111
111
  'fetchPositionADLRank': true,
112
- 'fetchPositionsADLRank': true,
113
112
  'fetchPositionHistory': 'emulated',
114
113
  'fetchPositions': true,
114
+ 'fetchPositionsADLRank': true,
115
115
  'fetchPositionsHistory': false,
116
116
  'fetchPositionsRisk': false,
117
117
  'fetchPremiumIndexOHLCV': true,
@@ -4297,7 +4297,7 @@ export default class htx extends Exchange {
4297
4297
  // POST /linear-swap-api/v3/swap_hisorders linear isolated --------
4298
4298
  // POST /linear-swap-api/v3/swap_cross_hisorders linear cross -----
4299
4299
  'trade_type': 0,
4300
- '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;
4300
+ '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;
4301
4301
  };
4302
4302
  let response = undefined;
4303
4303
  const trigger = this.safeBool2(params, 'stop', 'trigger');
@@ -628,7 +628,7 @@ export default class hyperliquid extends Exchange {
628
628
  // and we don't have the base/settle information and we can't assume it's USDC for hip3 markets
629
629
  for (let j = 0; j < universe.length; j++) {
630
630
  const data = this.extend(this.safeDict(universe, j, {}), this.safeDict(assetCtxs, j, {}));
631
- data['baseId'] = j + offset;
631
+ data['baseId'] = this.sum(j, offset);
632
632
  data['collateralToken'] = collateralToken;
633
633
  data['hip3'] = true;
634
634
  data['dex'] = dexName;
@@ -2200,7 +2200,7 @@ export default class hyperliquid extends Exchange {
2200
2200
  const symbol = market['symbol'];
2201
2201
  const type = this.safeStringUpper(rawOrder, 'type');
2202
2202
  const side = this.safeStringUpper(rawOrder, 'side');
2203
- const amount = this.safeString(rawOrder, 'amount');
2203
+ let amount = this.safeString(rawOrder, 'amount');
2204
2204
  const price = this.safeString(rawOrder, 'price');
2205
2205
  let orderParams = this.safeDict(rawOrder, 'params', {});
2206
2206
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
@@ -2211,17 +2211,27 @@ export default class hyperliquid extends Exchange {
2211
2211
  const hasTakeProfit = (takeProfit !== undefined);
2212
2212
  orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
2213
2213
  const mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams);
2214
- orderReq.push(mainOrderObj);
2215
2214
  if (hasStopLoss || hasTakeProfit) {
2216
2215
  // grouping opposed orders for sl/tp
2217
2216
  const stopLossOrderTriggerPrice = this.safeStringN(stopLoss, ['triggerPrice', 'stopPrice']);
2218
- const stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
2217
+ let stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
2219
2218
  const stopLossOrderLimitPrice = this.safeStringN(stopLoss, ['price', 'stopLossPrice'], stopLossOrderTriggerPrice);
2220
2219
  const takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, ['triggerPrice', 'stopPrice']);
2221
- const takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
2220
+ let takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
2222
2221
  const takeProfitOrderLimitPrice = this.safeStringN(takeProfit, ['price', 'takeProfitPrice'], takeProfitOrderTriggerPrice);
2223
- grouping = 'normalTpsl';
2224
- orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
2222
+ grouping = this.safeString(orderParams, 'grouping', 'normalTpsl');
2223
+ if (grouping === 'positionTpsl') {
2224
+ amount = '0';
2225
+ stopLossOrderType = 'market';
2226
+ takeProfitOrderType = 'market';
2227
+ }
2228
+ else if (grouping === 'normalTpsl') {
2229
+ orderReq.push(mainOrderObj);
2230
+ }
2231
+ else {
2232
+ throw new NotSupported(this.id + ' only support grouping normalTpsl and positionTpsl.');
2233
+ }
2234
+ orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit', 'grouping']);
2225
2235
  let triggerOrderSide = '';
2226
2236
  if (side === 'BUY') {
2227
2237
  triggerOrderSide = 'sell';
@@ -2244,6 +2254,9 @@ export default class hyperliquid extends Exchange {
2244
2254
  orderReq.push(orderObj);
2245
2255
  }
2246
2256
  }
2257
+ else {
2258
+ orderReq.push(mainOrderObj);
2259
+ }
2247
2260
  }
2248
2261
  let vaultAddress = undefined;
2249
2262
  [vaultAddress, params] = this.handleOptionAndParams(params, 'createOrder', 'vaultAddress');
@@ -680,7 +680,7 @@ export default class independentreserve extends Exchange {
680
680
  */
681
681
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
682
682
  await this.loadMarkets();
683
- const request = this.ordered({});
683
+ const request = {};
684
684
  let market = undefined;
685
685
  if (symbol !== undefined) {
686
686
  market = this.market(symbol);
@@ -708,7 +708,7 @@ export default class independentreserve extends Exchange {
708
708
  */
709
709
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
710
710
  await this.loadMarkets();
711
- const request = this.ordered({});
711
+ const request = {};
712
712
  let market = undefined;
713
713
  if (symbol !== undefined) {
714
714
  market = this.market(symbol);
@@ -740,10 +740,10 @@ export default class independentreserve extends Exchange {
740
740
  if (limit === undefined) {
741
741
  limit = 50;
742
742
  }
743
- const request = this.ordered({
743
+ const request = {
744
744
  'pageIndex': pageIndex,
745
745
  'pageSize': limit,
746
- });
746
+ };
747
747
  const response = await this.privatePostGetTrades(this.extend(request, params));
748
748
  let market = undefined;
749
749
  if (symbol !== undefined) {
@@ -876,11 +876,11 @@ export default class independentreserve extends Exchange {
876
876
  const market = this.market(symbol);
877
877
  let orderType = this.capitalize(type);
878
878
  orderType += (side === 'sell') ? 'Offer' : 'Bid';
879
- const request = this.ordered({
879
+ const request = {
880
880
  'primaryCurrencyCode': market['baseId'],
881
881
  'secondaryCurrencyCode': market['quoteId'],
882
882
  'orderType': orderType,
883
- });
883
+ };
884
884
  let response = undefined;
885
885
  request['volume'] = amount;
886
886
  if (type === 'limit') {
@@ -1100,7 +1100,7 @@ export default class independentreserve extends Exchange {
1100
1100
  }
1101
1101
  const message = auth.join(',');
1102
1102
  const signature = this.hmac(this.encode(message), this.encode(this.secret), sha256);
1103
- const query = this.ordered({});
1103
+ const query = {};
1104
1104
  query['apiKey'] = this.apiKey;
1105
1105
  query['nonce'] = nonce;
1106
1106
  query['signature'] = signature.toUpperCase();
package/js/src/kraken.js CHANGED
@@ -1680,7 +1680,7 @@ export default class kraken extends Exchange {
1680
1680
  const result = this.safeDict(response, 'result');
1681
1681
  result['usingCost'] = isUsingCost;
1682
1682
  // it's impossible to know if the order was created using cost or base currency
1683
- // becuase kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1683
+ // because kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1684
1684
  // this usingCost flag is used to help the parsing but omited from the order
1685
1685
  return this.parseOrder(result);
1686
1686
  }
@@ -176,8 +176,8 @@ export default class krakenfutures extends Exchange {
176
176
  /**
177
177
  * @method
178
178
  * @name krakenfutures#fetchOrders
179
- * @see https://docs.kraken.com/api/docs/futures-api/trading/get-order-status/
180
179
  * @description Gets all orders for an account from the exchange api
180
+ * @see https://docs.kraken.com/api/docs/futures-api/trading/get-order-status/
181
181
  * @param {string} symbol Unified market symbol
182
182
  * @param {int} [since] Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT)
183
183
  * @param {int} [limit] How many orders to return. (Not used by kraken api but filtered internally by CCXT)