ccxt 4.5.39 → 4.5.41

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 (138) 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 +211 -22
  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 +143 -0
  13. package/dist/cjs/src/bingx.js +150 -123
  14. package/dist/cjs/src/bitmart.js +20 -6
  15. package/dist/cjs/src/bitmex.js +436 -0
  16. package/dist/cjs/src/blofin.js +86 -1
  17. package/dist/cjs/src/bybit.js +135 -0
  18. package/dist/cjs/src/coinspot.js +7 -2
  19. package/dist/cjs/src/delta.js +367 -0
  20. package/dist/cjs/src/gate.js +11 -4
  21. package/dist/cjs/src/gemini.js +76 -1
  22. package/dist/cjs/src/htx.js +266 -3
  23. package/dist/cjs/src/hyperliquid.js +20 -7
  24. package/dist/cjs/src/independentreserve.js +7 -7
  25. package/dist/cjs/src/kraken.js +1 -1
  26. package/dist/cjs/src/krakenfutures.js +96 -5
  27. package/dist/cjs/src/kucoin.js +3 -3
  28. package/dist/cjs/src/kucoinfutures.js +121 -0
  29. package/dist/cjs/src/lighter.js +2931 -0
  30. package/dist/cjs/src/mexc.js +9 -2
  31. package/dist/cjs/src/phemex.js +359 -0
  32. package/dist/cjs/src/poloniex.js +5 -0
  33. package/dist/cjs/src/pro/binance.js +2 -2
  34. package/dist/cjs/src/pro/bingx.js +248 -35
  35. package/dist/cjs/src/pro/bitget.js +49 -90
  36. package/dist/cjs/src/pro/bitmart.js +68 -0
  37. package/dist/cjs/src/pro/blofin.js +52 -1
  38. package/dist/cjs/src/pro/coinbaseinternational.js +5 -2
  39. package/dist/cjs/src/pro/defx.js +1 -1
  40. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  41. package/dist/cjs/src/pro/lighter.js +787 -0
  42. package/dist/cjs/src/pro/mexc.js +73 -1
  43. package/dist/cjs/src/pro/okx.js +7 -4
  44. package/dist/cjs/src/pro/paradex.js +138 -1
  45. package/dist/cjs/src/pro/woo.js +43 -0
  46. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +1 -0
  47. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -0
  48. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +1 -0
  49. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  50. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  51. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  52. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  53. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  54. package/dist/cjs/src/static_dependencies/ethers/fragments.js +1 -0
  55. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -0
  56. package/dist/cjs/src/static_dependencies/ethers/interface.js +1 -0
  57. package/dist/cjs/src/static_dependencies/ethers/typed.js +1 -0
  58. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -0
  59. package/dist/cjs/src/whitebit.js +118 -16
  60. package/dist/cjs/src/woo.js +103 -3
  61. package/js/ccxt.d.ts +9 -3
  62. package/js/ccxt.js +6 -2
  63. package/js/src/abstract/gemini.d.ts +27 -0
  64. package/js/src/abstract/lighter.d.ts +53 -0
  65. package/js/src/abstract/lighter.js +5 -0
  66. package/js/src/ascendex.d.ts +12 -1
  67. package/js/src/ascendex.js +73 -1
  68. package/js/src/base/Exchange.d.ts +29 -14
  69. package/js/src/base/Exchange.js +216 -23
  70. package/js/src/base/functions/generic.js +1 -0
  71. package/js/src/base/functions/io.d.ts +32 -0
  72. package/js/src/base/functions/io.js +131 -0
  73. package/js/src/base/functions.d.ts +1 -0
  74. package/js/src/base/functions.js +1 -0
  75. package/js/src/base/types.d.ts +9 -0
  76. package/js/src/binance.d.ts +27 -1
  77. package/js/src/binance.js +143 -0
  78. package/js/src/bingx.d.ts +113 -108
  79. package/js/src/bingx.js +150 -123
  80. package/js/src/bitmart.js +20 -6
  81. package/js/src/bitmex.d.ts +50 -1
  82. package/js/src/bitmex.js +436 -0
  83. package/js/src/blofin.d.ts +12 -1
  84. package/js/src/blofin.js +86 -1
  85. package/js/src/bybit.d.ts +12 -1
  86. package/js/src/bybit.js +135 -0
  87. package/js/src/coinspot.js +7 -2
  88. package/js/src/delta.d.ts +12 -1
  89. package/js/src/delta.js +367 -0
  90. package/js/src/gate.d.ts +1 -0
  91. package/js/src/gate.js +11 -4
  92. package/js/src/gemini.d.ts +11 -0
  93. package/js/src/gemini.js +76 -1
  94. package/js/src/htx.d.ts +15 -1
  95. package/js/src/htx.js +266 -3
  96. package/js/src/hyperliquid.js +20 -7
  97. package/js/src/independentreserve.js +7 -7
  98. package/js/src/kraken.js +1 -1
  99. package/js/src/krakenfutures.d.ts +1 -1
  100. package/js/src/krakenfutures.js +96 -5
  101. package/js/src/kucoin.d.ts +3 -3
  102. package/js/src/kucoin.js +3 -3
  103. package/js/src/kucoinfutures.d.ts +12 -1
  104. package/js/src/kucoinfutures.js +121 -0
  105. package/js/src/lighter.d.ts +424 -0
  106. package/js/src/lighter.js +2924 -0
  107. package/js/src/mexc.js +9 -2
  108. package/js/src/phemex.d.ts +16 -1
  109. package/js/src/phemex.js +359 -0
  110. package/js/src/poloniex.js +5 -0
  111. package/js/src/pro/binance.js +2 -2
  112. package/js/src/pro/bingx.d.ts +50 -34
  113. package/js/src/pro/bingx.js +249 -36
  114. package/js/src/pro/bitget.d.ts +6 -6
  115. package/js/src/pro/bitget.js +49 -90
  116. package/js/src/pro/bitmart.d.ts +22 -1
  117. package/js/src/pro/bitmart.js +69 -1
  118. package/js/src/pro/blofin.d.ts +12 -1
  119. package/js/src/pro/blofin.js +52 -1
  120. package/js/src/pro/coinbaseinternational.d.ts +2 -2
  121. package/js/src/pro/coinbaseinternational.js +6 -3
  122. package/js/src/pro/defx.js +1 -1
  123. package/js/src/pro/kucoinfutures.js +1 -1
  124. package/js/src/pro/lighter.d.ts +161 -0
  125. package/js/src/pro/lighter.js +780 -0
  126. package/js/src/pro/mexc.d.ts +22 -1
  127. package/js/src/pro/mexc.js +73 -1
  128. package/js/src/pro/okx.d.ts +4 -4
  129. package/js/src/pro/okx.js +7 -4
  130. package/js/src/pro/paradex.d.ts +23 -1
  131. package/js/src/pro/paradex.js +138 -1
  132. package/js/src/pro/woo.d.ts +12 -1
  133. package/js/src/pro/woo.js +43 -0
  134. package/js/src/whitebit.d.ts +2 -1
  135. package/js/src/whitebit.js +118 -16
  136. package/js/src/woo.d.ts +12 -1
  137. package/js/src/woo.js +103 -3
  138. package/package.json +1 -1
package/js/src/htx.js CHANGED
@@ -102,8 +102,10 @@ export default class htx extends Exchange {
102
102
  'fetchOrders': true,
103
103
  'fetchOrderTrades': true,
104
104
  'fetchPosition': true,
105
+ 'fetchPositionADLRank': true,
105
106
  'fetchPositionHistory': 'emulated',
106
107
  'fetchPositions': true,
108
+ 'fetchPositionsADLRank': true,
107
109
  'fetchPositionsHistory': false,
108
110
  'fetchPositionsRisk': false,
109
111
  'fetchPremiumIndexOHLCV': true,
@@ -4289,7 +4291,7 @@ export default class htx extends Exchange {
4289
4291
  // POST /linear-swap-api/v3/swap_hisorders linear isolated --------
4290
4292
  // POST /linear-swap-api/v3/swap_cross_hisorders linear cross -----
4291
4293
  'trade_type': 0,
4292
- '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;
4294
+ '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;
4293
4295
  };
4294
4296
  let response = undefined;
4295
4297
  const trigger = this.safeBool2(params, 'stop', 'trigger');
@@ -8783,9 +8785,9 @@ export default class htx extends Exchange {
8783
8785
  }
8784
8786
  const request = {};
8785
8787
  let subType = undefined;
8786
- [subType, params] = this.handleSubTypeAndParams('fetchPositions', market, params, 'linear');
8788
+ [subType, params] = this.handleSubTypeAndParams('fetchOpenInterests', market, params, 'linear');
8787
8789
  let marketType = undefined;
8788
- [marketType, params] = this.handleMarketTypeAndParams('fetchPositions', market, params);
8790
+ [marketType, params] = this.handleMarketTypeAndParams('fetchOpenInterests', market, params);
8789
8791
  let response = undefined;
8790
8792
  if (marketType === 'future') {
8791
8793
  response = await this.contractPublicGetApiV1ContractOpenInterest(this.extend(request, params));
@@ -9757,4 +9759,265 @@ export default class htx extends Exchange {
9757
9759
  }
9758
9760
  return response;
9759
9761
  }
9762
+ /**
9763
+ * @method
9764
+ * @name htx#fetchPositionsADLRank
9765
+ * @description fetches the auto deleveraging rank and risk percentage for a list of symbols
9766
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb81b5a-77b5-11ed-9966-0242ac110003
9767
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb81c49-77b5-11ed-9966-0242ac110003
9768
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c2f164-77ae-11ed-9966-0242ac110003
9769
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=5d518648-77b6-11ed-9966-0242ac110003
9770
+ * @param {string[]} [symbols] a list of unified market symbols
9771
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9772
+ * @returns {object[]} an array of [auto de leverage structures]{@link https://docs.ccxt.com/?id=auto-de-leverage-structure}
9773
+ */
9774
+ async fetchPositionsADLRank(symbols = undefined, params = {}) {
9775
+ await this.loadMarkets();
9776
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
9777
+ let market = undefined;
9778
+ if (symbols !== undefined) {
9779
+ const symbolsLength = symbols.length;
9780
+ if (symbolsLength > 0) {
9781
+ const first = this.safeString(symbols, 0);
9782
+ market = this.market(first);
9783
+ }
9784
+ }
9785
+ let marginMode = undefined;
9786
+ [marginMode, params] = this.handleMarginModeAndParams('fetchPositionsADLRank', params, 'cross');
9787
+ let subType = undefined;
9788
+ [subType, params] = this.handleSubTypeAndParams('fetchPositionsADLRank', market, params, 'linear');
9789
+ let marketType = undefined;
9790
+ [marketType, params] = this.handleMarketTypeAndParams('fetchPositionsADLRank', market, params);
9791
+ if (marketType === 'spot') {
9792
+ marketType = 'future';
9793
+ }
9794
+ let response = undefined;
9795
+ if (subType === 'linear') {
9796
+ if (marginMode === 'isolated') {
9797
+ response = await this.contractPrivatePostLinearSwapApiV1SwapPositionInfo(params);
9798
+ }
9799
+ else if (marginMode === 'cross') {
9800
+ response = await this.contractPrivatePostLinearSwapApiV1SwapCrossPositionInfo(params);
9801
+ }
9802
+ else {
9803
+ throw new NotSupported(this.id + ' fetchPositionsADLRank() not support this market type');
9804
+ }
9805
+ //
9806
+ // {
9807
+ // "status": "ok",
9808
+ // "data": [
9809
+ // {
9810
+ // "symbol": "BTC",
9811
+ // "contract_code": "BTC-USDT",
9812
+ // "volume": 1.000000000000000000,
9813
+ // "available": 1.000000000000000000,
9814
+ // "frozen": 0E-18,
9815
+ // "cost_open": 96039.700000000000000000,
9816
+ // "cost_hold": 96039.700000000000000000,
9817
+ // "profit_unreal": 0.000600000000000000,
9818
+ // "profit_rate": 0.000006247416432995,
9819
+ // "lever_rate": 1,
9820
+ // "position_margin": 96.040300000000000000,
9821
+ // "direction": "buy",
9822
+ // "profit": 0.000600000000000000,
9823
+ // "last_price": 96040.3,
9824
+ // "margin_asset": "USDT",
9825
+ // "margin_mode": "cross",
9826
+ // "margin_account": "USDT",
9827
+ // "contract_type": "swap",
9828
+ // "pair": "BTC-USDT",
9829
+ // "business_type": "swap",
9830
+ // "trade_partition":"USDT",
9831
+ // "position_mode": "single_side",
9832
+ // "store_time": "2023-10-08 20:05:06",
9833
+ // "liquidation_price": null,
9834
+ // "market_closing_slippage": null,
9835
+ // "risk_rate": 249.274066168760049797,
9836
+ // "new_risk_rate": 0.003995619743220614,
9837
+ // "risk_rate_percent": 0.003995619743220614,
9838
+ // "withdraw_available": null,
9839
+ // "open_adl": 1,
9840
+ // "adl_risk_percent": 3,
9841
+ // "tp_trigger_price": null,
9842
+ // "sl_trigger_price": null,
9843
+ // "tp_order_id": null,
9844
+ // "sl_order_id": null,
9845
+ // "tp_trigger_type": null,
9846
+ // "sl_trigger_type": null,
9847
+ // "adjust_value": null
9848
+ // }
9849
+ // ],
9850
+ // "ts": 1768489640285
9851
+ // }
9852
+ //
9853
+ }
9854
+ else {
9855
+ if (marketType === 'future') {
9856
+ response = await this.contractPrivatePostApiV1ContractPositionInfo(params);
9857
+ //
9858
+ // {
9859
+ // "status": "ok",
9860
+ // "data": [
9861
+ // {
9862
+ // "symbol": "BTC",
9863
+ // "contract_code": "BTC-USDT-260123",
9864
+ // "volume": 1.000000000000000000,
9865
+ // "available": 1.000000000000000000,
9866
+ // "frozen": 0E-18,
9867
+ // "cost_open": 96203.100000000000000000,
9868
+ // "cost_hold": 96203.100000000000000000,
9869
+ // "profit_unreal": -0.199400000000000000,
9870
+ // "profit_rate": -0.002072698281032524,
9871
+ // "lever_rate": 1,
9872
+ // "position_margin": 96.003700000000000000,
9873
+ // "direction": "buy",
9874
+ // "profit": -0.199400000000000000,
9875
+ // "last_price": 96003.7,
9876
+ // "margin_asset": "USDT",
9877
+ // "margin_mode": "cross",
9878
+ // "margin_account": "USDT",
9879
+ // "contract_type": "next_week",
9880
+ // "pair": "BTC-USDT",
9881
+ // "business_type": "futures",
9882
+ // "trade_partition": "USDT",
9883
+ // "position_mode": "single_side",
9884
+ // "store_time": "2026-01-15 23:45:21",
9885
+ // "liquidation_price": null,
9886
+ // "market_closing_slippage": null,
9887
+ // "risk_rate": 249.265098252125343196,
9888
+ // "new_risk_rate": 0.003995762920935011,
9889
+ // "risk_rate_percent": 0.003995762920935011,
9890
+ // "withdraw_available": null,
9891
+ // "open_adl": 1,
9892
+ // "adl_risk_percent": 2,
9893
+ // "tp_trigger_price": null,
9894
+ // "sl_trigger_price": null,
9895
+ // "tp_order_id": null,
9896
+ // "sl_order_id": null,
9897
+ // "tp_trigger_type": null,
9898
+ // "sl_trigger_type": null,
9899
+ // "adjust_value": null
9900
+ // }
9901
+ // ],
9902
+ // "ts": 1768491964551
9903
+ // }
9904
+ //
9905
+ }
9906
+ else if (marketType === 'swap') {
9907
+ response = await this.contractPrivatePostSwapApiV1SwapPositionInfo(params);
9908
+ //
9909
+ // {
9910
+ // "status": "ok"
9911
+ // "data": [
9912
+ // {
9913
+ // "symbol": "THETA"
9914
+ // "contract_code": "THETA-USD"
9915
+ // "volume": 20
9916
+ // "available": 20
9917
+ // "frozen": 0
9918
+ // "cost_open": 0.6048347107438017
9919
+ // "cost_hold": 0.65931
9920
+ // "profit_unreal": -10.5257562398811
9921
+ // "profit_rate": 1.0158596753357925
9922
+ // "lever_rate": 20
9923
+ // "position_margin": 15.693659761456372
9924
+ // "direction": "buy"
9925
+ // "profit": 16.795657677889032
9926
+ // "last_price": 0.6372
9927
+ // "adl_risk_percent": "3"
9928
+ // "liq_px": "112"
9929
+ // "new_risk_rate": ""
9930
+ // "trade_partition": ""
9931
+ // }
9932
+ // ]
9933
+ // "ts": 1603868312729
9934
+ // }
9935
+ //
9936
+ }
9937
+ else {
9938
+ throw new NotSupported(this.id + ' fetchPositionsADLRank() not support this market type');
9939
+ }
9940
+ }
9941
+ const data = this.safeList(response, 'data', []);
9942
+ return this.parseADLRanks(data, symbols);
9943
+ }
9944
+ parseADLRank(info, market = undefined) {
9945
+ //
9946
+ // fetchPositionADLRank linear swap and future
9947
+ //
9948
+ // {
9949
+ // "symbol": "BTC",
9950
+ // "contract_code": "BTC-USDT",
9951
+ // "volume": 1.000000000000000000,
9952
+ // "available": 1.000000000000000000,
9953
+ // "frozen": 0E-18,
9954
+ // "cost_open": 96039.700000000000000000,
9955
+ // "cost_hold": 96039.700000000000000000,
9956
+ // "profit_unreal": 0.000600000000000000,
9957
+ // "profit_rate": 0.000006247416432995,
9958
+ // "lever_rate": 1,
9959
+ // "position_margin": 96.040300000000000000,
9960
+ // "direction": "buy",
9961
+ // "profit": 0.000600000000000000,
9962
+ // "last_price": 96040.3,
9963
+ // "margin_asset": "USDT",
9964
+ // "margin_mode": "cross",
9965
+ // "margin_account": "USDT",
9966
+ // "contract_type": "swap",
9967
+ // "pair": "BTC-USDT",
9968
+ // "business_type": "swap",
9969
+ // "trade_partition":"USDT",
9970
+ // "position_mode": "single_side",
9971
+ // "store_time": "2023-10-08 20:05:06",
9972
+ // "liquidation_price": null,
9973
+ // "market_closing_slippage": null,
9974
+ // "risk_rate": 249.274066168760049797,
9975
+ // "new_risk_rate": 0.003995619743220614,
9976
+ // "risk_rate_percent": 0.003995619743220614,
9977
+ // "withdraw_available": null,
9978
+ // "open_adl": 1,
9979
+ // "adl_risk_percent": 3,
9980
+ // "tp_trigger_price": null,
9981
+ // "sl_trigger_price": null,
9982
+ // "tp_order_id": null,
9983
+ // "sl_order_id": null,
9984
+ // "tp_trigger_type": null,
9985
+ // "sl_trigger_type": null,
9986
+ // "adjust_value": null
9987
+ // }
9988
+ //
9989
+ // fetchPositionADLRank inverse
9990
+ //
9991
+ // {
9992
+ // "symbol": "THETA"
9993
+ // "contract_code": "THETA-USD"
9994
+ // "volume": 20
9995
+ // "available": 20
9996
+ // "frozen": 0
9997
+ // "cost_open": 0.6048347107438017
9998
+ // "cost_hold": 0.65931
9999
+ // "profit_unreal": -10.5257562398811
10000
+ // "profit_rate": 1.0158596753357925
10001
+ // "lever_rate": 20
10002
+ // "position_margin": 15.693659761456372
10003
+ // "direction": "buy"
10004
+ // "profit": 16.795657677889032
10005
+ // "last_price": 0.6372
10006
+ // "adl_risk_percent": "3"
10007
+ // "liq_px": "112"
10008
+ // "new_risk_rate": ""
10009
+ // "trade_partition": ""
10010
+ // }
10011
+ //
10012
+ const marketId = this.safeString(info, 'contract_code');
10013
+ return {
10014
+ 'info': info,
10015
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
10016
+ 'rank': this.safeInteger(info, 'adl_risk_percent'),
10017
+ 'rating': undefined,
10018
+ 'percentage': undefined,
10019
+ 'timestamp': undefined,
10020
+ 'datetime': undefined,
10021
+ };
10022
+ }
9760
10023
  }
@@ -622,7 +622,7 @@ export default class hyperliquid extends Exchange {
622
622
  // and we don't have the base/settle information and we can't assume it's USDC for hip3 markets
623
623
  for (let j = 0; j < universe.length; j++) {
624
624
  const data = this.extend(this.safeDict(universe, j, {}), this.safeDict(assetCtxs, j, {}));
625
- data['baseId'] = j + offset;
625
+ data['baseId'] = this.sum(j, offset);
626
626
  data['collateralToken'] = collateralToken;
627
627
  data['hip3'] = true;
628
628
  data['dex'] = dexName;
@@ -2194,7 +2194,7 @@ export default class hyperliquid extends Exchange {
2194
2194
  const symbol = market['symbol'];
2195
2195
  const type = this.safeStringUpper(rawOrder, 'type');
2196
2196
  const side = this.safeStringUpper(rawOrder, 'side');
2197
- const amount = this.safeString(rawOrder, 'amount');
2197
+ let amount = this.safeString(rawOrder, 'amount');
2198
2198
  const price = this.safeString(rawOrder, 'price');
2199
2199
  let orderParams = this.safeDict(rawOrder, 'params', {});
2200
2200
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
@@ -2205,17 +2205,27 @@ export default class hyperliquid extends Exchange {
2205
2205
  const hasTakeProfit = (takeProfit !== undefined);
2206
2206
  orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
2207
2207
  const mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams);
2208
- orderReq.push(mainOrderObj);
2209
2208
  if (hasStopLoss || hasTakeProfit) {
2210
2209
  // grouping opposed orders for sl/tp
2211
2210
  const stopLossOrderTriggerPrice = this.safeStringN(stopLoss, ['triggerPrice', 'stopPrice']);
2212
- const stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
2211
+ let stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
2213
2212
  const stopLossOrderLimitPrice = this.safeStringN(stopLoss, ['price', 'stopLossPrice'], stopLossOrderTriggerPrice);
2214
2213
  const takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, ['triggerPrice', 'stopPrice']);
2215
- const takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
2214
+ let takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
2216
2215
  const takeProfitOrderLimitPrice = this.safeStringN(takeProfit, ['price', 'takeProfitPrice'], takeProfitOrderTriggerPrice);
2217
- grouping = 'normalTpsl';
2218
- orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
2216
+ grouping = this.safeString(orderParams, 'grouping', 'normalTpsl');
2217
+ if (grouping === 'positionTpsl') {
2218
+ amount = '0';
2219
+ stopLossOrderType = 'market';
2220
+ takeProfitOrderType = 'market';
2221
+ }
2222
+ else if (grouping === 'normalTpsl') {
2223
+ orderReq.push(mainOrderObj);
2224
+ }
2225
+ else {
2226
+ throw new NotSupported(this.id + ' only support grouping normalTpsl and positionTpsl.');
2227
+ }
2228
+ orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit', 'grouping']);
2219
2229
  let triggerOrderSide = '';
2220
2230
  if (side === 'BUY') {
2221
2231
  triggerOrderSide = 'sell';
@@ -2238,6 +2248,9 @@ export default class hyperliquid extends Exchange {
2238
2248
  orderReq.push(orderObj);
2239
2249
  }
2240
2250
  }
2251
+ else {
2252
+ orderReq.push(mainOrderObj);
2253
+ }
2241
2254
  }
2242
2255
  let vaultAddress = undefined;
2243
2256
  [vaultAddress, params] = this.handleOptionAndParams(params, 'createOrder', 'vaultAddress');
@@ -674,7 +674,7 @@ export default class independentreserve extends Exchange {
674
674
  */
675
675
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
676
676
  await this.loadMarkets();
677
- const request = this.ordered({});
677
+ const request = {};
678
678
  let market = undefined;
679
679
  if (symbol !== undefined) {
680
680
  market = this.market(symbol);
@@ -702,7 +702,7 @@ export default class independentreserve extends Exchange {
702
702
  */
703
703
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
704
704
  await this.loadMarkets();
705
- const request = this.ordered({});
705
+ const request = {};
706
706
  let market = undefined;
707
707
  if (symbol !== undefined) {
708
708
  market = this.market(symbol);
@@ -734,10 +734,10 @@ export default class independentreserve extends Exchange {
734
734
  if (limit === undefined) {
735
735
  limit = 50;
736
736
  }
737
- const request = this.ordered({
737
+ const request = {
738
738
  'pageIndex': pageIndex,
739
739
  'pageSize': limit,
740
- });
740
+ };
741
741
  const response = await this.privatePostGetTrades(this.extend(request, params));
742
742
  let market = undefined;
743
743
  if (symbol !== undefined) {
@@ -870,11 +870,11 @@ export default class independentreserve extends Exchange {
870
870
  const market = this.market(symbol);
871
871
  let orderType = this.capitalize(type);
872
872
  orderType += (side === 'sell') ? 'Offer' : 'Bid';
873
- const request = this.ordered({
873
+ const request = {
874
874
  'primaryCurrencyCode': market['baseId'],
875
875
  'secondaryCurrencyCode': market['quoteId'],
876
876
  'orderType': orderType,
877
- });
877
+ };
878
878
  let response = undefined;
879
879
  request['volume'] = amount;
880
880
  if (type === 'limit') {
@@ -1094,7 +1094,7 @@ export default class independentreserve extends Exchange {
1094
1094
  }
1095
1095
  const message = auth.join(',');
1096
1096
  const signature = this.hmac(this.encode(message), this.encode(this.secret), sha256);
1097
- const query = this.ordered({});
1097
+ const query = {};
1098
1098
  query['apiKey'] = this.apiKey;
1099
1099
  query['nonce'] = nonce;
1100
1100
  query['signature'] = signature.toUpperCase();
package/js/src/kraken.js CHANGED
@@ -1674,7 +1674,7 @@ export default class kraken extends Exchange {
1674
1674
  const result = this.safeDict(response, 'result');
1675
1675
  result['usingCost'] = isUsingCost;
1676
1676
  // it's impossible to know if the order was created using cost or base currency
1677
- // becuase kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1677
+ // because kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1678
1678
  // this usingCost flag is used to help the parsing but omited from the order
1679
1679
  return this.parseOrder(result);
1680
1680
  }
@@ -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)
@@ -1040,6 +1040,15 @@ export default class krakenfutures extends Exchange {
1040
1040
  takerOrMaker = 'taker';
1041
1041
  }
1042
1042
  }
1043
+ let fee = undefined;
1044
+ if ((takerOrMaker !== undefined) && (cost !== undefined)) {
1045
+ const feeRate = this.safeString(market, takerOrMaker);
1046
+ fee = {
1047
+ 'cost': Precise.stringMul(cost, feeRate),
1048
+ 'currency': this.safeString(market, 'quote'),
1049
+ 'rate': feeRate,
1050
+ };
1051
+ }
1043
1052
  return this.safeTrade({
1044
1053
  'info': trade,
1045
1054
  'id': id,
@@ -1053,7 +1062,7 @@ export default class krakenfutures extends Exchange {
1053
1062
  'price': price,
1054
1063
  'amount': linear ? amount : undefined,
1055
1064
  'cost': cost,
1056
- 'fee': undefined,
1065
+ 'fee': fee,
1057
1066
  });
1058
1067
  }
1059
1068
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1176,6 +1185,41 @@ export default class krakenfutures extends Exchange {
1176
1185
  // "serverTime": "2022-02-28T19:32:17.122Z"
1177
1186
  // }
1178
1187
  //
1188
+ // MARKET
1189
+ //
1190
+ // {
1191
+ // "result": "success",
1192
+ // "serverTime": "2026-03-02T06:10:31.955Z",
1193
+ // "sendStatus": {
1194
+ // "status": "placed",
1195
+ // "order_id": "a133a4f9-254d-4806-8176-9acc936b6944",
1196
+ // "receivedTime": "2026-03-02T06:10:31.954Z",
1197
+ // "orderEvents": [
1198
+ // {
1199
+ // "type": "EXECUTION",
1200
+ // "executionId": "403bf49f-dbbe-448b-8de7-fd3cf38cc5dd",
1201
+ // "price": 66596.0,
1202
+ // "amount": 0.001,
1203
+ // "orderPriorEdit": null,
1204
+ // "orderPriorExecution": {
1205
+ // "orderId": "a133a4f9-254d-4806-8176-9acc936b6944",
1206
+ // "cliOrdId": null,
1207
+ // "type": "ioc",
1208
+ // "symbol": "PF_XBTUSD",
1209
+ // "side": "buy",
1210
+ // "quantity": 0.001,
1211
+ // "filled": 0,
1212
+ // "limitPrice": 67261.000,
1213
+ // "reduceOnly": false,
1214
+ // "timestamp": "2026-03-02T06:10:31.954Z",
1215
+ // "lastUpdateTimestamp": "2026-03-02T06:10:31.954Z"
1216
+ // },
1217
+ // "takerReducedQuantity": null
1218
+ // }
1219
+ // ]
1220
+ // }
1221
+ // }
1222
+ //
1179
1223
  const sendStatus = this.safeValue(response, 'sendStatus');
1180
1224
  const status = this.safeString(sendStatus, 'status');
1181
1225
  this.verifyOrderActionSuccess(status, 'createOrder', ['filled']);
@@ -1457,8 +1501,8 @@ export default class krakenfutures extends Exchange {
1457
1501
  /**
1458
1502
  * @method
1459
1503
  * @name krakenfutures#fetchOrders
1460
- * @see https://docs.kraken.com/api/docs/futures-api/trading/get-order-status/
1461
1504
  * @description Gets all orders for an account from the exchange api
1505
+ * @see https://docs.kraken.com/api/docs/futures-api/trading/get-order-status/
1462
1506
  * @param {string} symbol Unified market symbol
1463
1507
  * @param {int} [since] Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT)
1464
1508
  * @param {int} [limit] How many orders to return. (Not used by kraken api but filtered internally by CCXT)
@@ -1716,6 +1760,37 @@ export default class krakenfutures extends Exchange {
1716
1760
  // ]
1717
1761
  // }
1718
1762
  //
1763
+ // MARKET
1764
+ //
1765
+ // {
1766
+ // "status": "placed",
1767
+ // "order_id": "a133a4f9-254d-4806-8176-9acc936b6944",
1768
+ // "receivedTime": "2026-03-02T06:10:31.954Z",
1769
+ // "orderEvents": [
1770
+ // {
1771
+ // "type": "EXECUTION",
1772
+ // "executionId": "403bf49f-dbbe-448b-8de7-fd3cf38cc5dd",
1773
+ // "price": 66596.0,
1774
+ // "amount": 0.001,
1775
+ // "orderPriorEdit": null,
1776
+ // "orderPriorExecution": {
1777
+ // "orderId": "a133a4f9-254d-4806-8176-9acc936b6944",
1778
+ // "cliOrdId": null,
1779
+ // "type": "ioc",
1780
+ // "symbol": "PF_XBTUSD",
1781
+ // "side": "buy",
1782
+ // "quantity": 0.001,
1783
+ // "filled": 0,
1784
+ // "limitPrice": 67261.000,
1785
+ // "reduceOnly": false,
1786
+ // "timestamp": "2026-03-02T06:10:31.954Z",
1787
+ // "lastUpdateTimestamp": "2026-03-02T06:10:31.954Z"
1788
+ // },
1789
+ // "takerReducedQuantity": null
1790
+ // }
1791
+ // ]
1792
+ // }
1793
+ //
1719
1794
  // CONDITIONAL
1720
1795
  //
1721
1796
  // {
@@ -1959,6 +2034,10 @@ export default class krakenfutures extends Exchange {
1959
2034
  //
1960
2035
  const datetime = this.safeString(orderDictFromFetchOrder, 'timestamp');
1961
2036
  const innerStatus = this.safeString(order, 'status');
2037
+ let filledOrder = this.safeString(orderDictFromFetchOrder, 'filled', '0');
2038
+ if ((filledOrder === '0') || (filledOrder === '0.0')) {
2039
+ filledOrder = undefined;
2040
+ }
1962
2041
  return this.safeOrder({
1963
2042
  'info': order,
1964
2043
  'id': this.safeString(orderDictFromFetchOrder, 'orderId'),
@@ -1978,7 +2057,7 @@ export default class krakenfutures extends Exchange {
1978
2057
  'amount': this.safeString(orderDictFromFetchOrder, 'quantity'),
1979
2058
  'cost': undefined,
1980
2059
  'average': undefined,
1981
- 'filled': this.safeString(orderDictFromFetchOrder, 'filled'),
2060
+ 'filled': filledOrder,
1982
2061
  'remaining': undefined,
1983
2062
  'status': this.parseOrderStatus(innerStatus),
1984
2063
  'fee': undefined,
@@ -2015,9 +2094,15 @@ export default class krakenfutures extends Exchange {
2015
2094
  fixed = true;
2016
2095
  }
2017
2096
  else if (!fixed) {
2097
+ const executedPrice = this.safeString(item, 'price');
2018
2098
  const orderPriorExecution = this.safeValue(item, 'orderPriorExecution');
2019
2099
  details = this.safeValue2(item, 'orderPriorExecution', 'orderPriorEdit');
2020
- price = this.safeString(orderPriorExecution, 'limitPrice');
2100
+ if (executedPrice === undefined) {
2101
+ price = this.safeString(orderPriorExecution, 'limitPrice');
2102
+ }
2103
+ else {
2104
+ price = executedPrice;
2105
+ }
2021
2106
  if (details !== undefined) {
2022
2107
  isPrior = true;
2023
2108
  }
@@ -2112,6 +2197,11 @@ export default class krakenfutures extends Exchange {
2112
2197
  symbol = this.safeSymbol(this.safeString(details, 'tradeable'), market);
2113
2198
  }
2114
2199
  const ts = this.safeInteger(details, 'timestamp', timestamp);
2200
+ const priceTriggerOptions = this.safeDict(details, 'priceTriggerOptions', {});
2201
+ let triggerPrice = this.safeString2(details, 'triggerPrice', 'stopPrice');
2202
+ if (triggerPrice === undefined) {
2203
+ triggerPrice = this.safeString(priceTriggerOptions, 'triggerPrice');
2204
+ }
2115
2205
  return this.safeOrder({
2116
2206
  'info': order,
2117
2207
  'id': id,
@@ -2127,7 +2217,8 @@ export default class krakenfutures extends Exchange {
2127
2217
  'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
2128
2218
  'side': this.safeStringLower2(details, 'side', 'direction'),
2129
2219
  'price': price,
2130
- 'triggerPrice': this.safeString(details, 'triggerPrice'),
2220
+ 'triggerPrice': triggerPrice,
2221
+ 'stopPrice': triggerPrice,
2131
2222
  'amount': amount,
2132
2223
  'cost': cost,
2133
2224
  'average': average,
@@ -355,7 +355,7 @@ export default class kucoin extends Exchange {
355
355
  * @param {object} [params] extra parameters specific to the exchange API endpoint
356
356
  * @param {bool} [params.trigger] *invalid for isolated margin* true if cancelling all stop orders
357
357
  * @param {string} [params.marginMode] 'cross' or 'isolated'
358
- * @param {string} [params.orderIds] *stop orders only* Comma seperated order IDs
358
+ * @param {string} [params.orderIds] *stop orders only* Comma separated order IDs
359
359
  * @param {bool} [params.hf] false, // true for hf order
360
360
  * @returns Response from the exchange
361
361
  */
@@ -378,7 +378,7 @@ export default class kucoin extends Exchange {
378
378
  * @param {string} [params.type] limit, market, limit_stop or market_stop
379
379
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
380
380
  * @param {int} [params.currentPage] *trigger orders only* current page
381
- * @param {string} [params.orderIds] *trigger orders only* comma seperated order ID list
381
+ * @param {string} [params.orderIds] *trigger orders only* comma separated order ID list
382
382
  * @param {bool} [params.trigger] True if fetching a trigger order
383
383
  * @param {bool} [params.hf] false, // true for hf order
384
384
  * @returns An [array of order structures]{@link https://docs.ccxt.com/?id=order-structure}
@@ -424,7 +424,7 @@ export default class kucoin extends Exchange {
424
424
  * @param {string} [params.type] limit, market, limit_stop or market_stop
425
425
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
426
426
  * @param {int} [params.currentPage] *trigger orders only* current page
427
- * @param {string} [params.orderIds] *trigger orders only* comma seperated order ID list
427
+ * @param {string} [params.orderIds] *trigger orders only* comma separated order ID list
428
428
  * @param {bool} [params.hf] false, // true for hf order
429
429
  * @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)
430
430
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}