ccxt 4.5.42 → 4.5.43

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 (82) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/aftermath.js +11 -0
  5. package/dist/cjs/src/aftermath.js +1324 -0
  6. package/dist/cjs/src/base/Exchange.js +2 -1
  7. package/dist/cjs/src/bigone.js +3 -0
  8. package/dist/cjs/src/bingx.js +1 -0
  9. package/dist/cjs/src/bitget.js +88 -37
  10. package/dist/cjs/src/bithumb.js +0 -8
  11. package/dist/cjs/src/bullish.js +109 -0
  12. package/dist/cjs/src/bybit.js +1 -0
  13. package/dist/cjs/src/coinbaseinternational.js +1 -0
  14. package/dist/cjs/src/coinex.js +1 -0
  15. package/dist/cjs/src/coinmetro.js +1 -1
  16. package/dist/cjs/src/gate.js +1 -0
  17. package/dist/cjs/src/gemini.js +1 -0
  18. package/dist/cjs/src/htx.js +2 -1
  19. package/dist/cjs/src/hyperliquid.js +40 -2
  20. package/dist/cjs/src/independentreserve.js +15 -4
  21. package/dist/cjs/src/krakenfutures.js +5 -2
  22. package/dist/cjs/src/kucoin.js +20 -3
  23. package/dist/cjs/src/lbank.js +1 -1
  24. package/dist/cjs/src/lighter.js +56 -6
  25. package/dist/cjs/src/luno.js +1 -0
  26. package/dist/cjs/src/okx.js +17 -2
  27. package/dist/cjs/src/pro/aftermath.js +375 -0
  28. package/dist/cjs/src/pro/bingx.js +5 -1
  29. package/dist/cjs/src/pro/cex.js +24 -28
  30. package/dist/cjs/src/pro/krakenfutures.js +9 -3
  31. package/dist/cjs/src/pro/lighter.js +127 -4
  32. package/dist/cjs/src/pro/mexc.js +7 -1
  33. package/dist/cjs/src/pro/paradex.js +3 -3
  34. package/dist/cjs/src/pro/woo.js +3 -8
  35. package/dist/cjs/src/toobit.js +1 -0
  36. package/js/ccxt.d.ts +8 -2
  37. package/js/ccxt.js +6 -2
  38. package/js/src/abstract/aftermath.d.ts +33 -0
  39. package/js/src/abstract/aftermath.js +11 -0
  40. package/js/src/aftermath.d.ts +291 -0
  41. package/js/src/aftermath.js +1322 -0
  42. package/js/src/base/Exchange.js +2 -1
  43. package/js/src/bigone.js +3 -0
  44. package/js/src/bingx.js +1 -0
  45. package/js/src/bitget.js +88 -37
  46. package/js/src/bithumb.js +0 -8
  47. package/js/src/bullish.d.ts +12 -1
  48. package/js/src/bullish.js +109 -0
  49. package/js/src/bybit.js +1 -0
  50. package/js/src/coinbaseinternational.js +2 -1
  51. package/js/src/coinex.js +1 -0
  52. package/js/src/coinmetro.js +1 -1
  53. package/js/src/gate.js +1 -0
  54. package/js/src/gemini.js +1 -0
  55. package/js/src/htx.js +2 -1
  56. package/js/src/hyperliquid.d.ts +11 -0
  57. package/js/src/hyperliquid.js +40 -2
  58. package/js/src/independentreserve.d.ts +1 -0
  59. package/js/src/independentreserve.js +15 -4
  60. package/js/src/krakenfutures.js +5 -2
  61. package/js/src/kucoin.d.ts +1 -0
  62. package/js/src/kucoin.js +20 -3
  63. package/js/src/lbank.js +1 -1
  64. package/js/src/lighter.d.ts +6 -1
  65. package/js/src/lighter.js +56 -6
  66. package/js/src/luno.js +1 -0
  67. package/js/src/okx.js +17 -2
  68. package/js/src/pro/aftermath.d.ts +55 -0
  69. package/js/src/pro/aftermath.js +374 -0
  70. package/js/src/pro/bingx.js +5 -1
  71. package/js/src/pro/cex.d.ts +1 -0
  72. package/js/src/pro/cex.js +24 -28
  73. package/js/src/pro/krakenfutures.js +9 -3
  74. package/js/src/pro/lighter.d.ts +23 -0
  75. package/js/src/pro/lighter.js +127 -4
  76. package/js/src/pro/mexc.js +7 -1
  77. package/js/src/pro/paradex.js +3 -3
  78. package/js/src/pro/woo.js +3 -8
  79. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  80. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  81. package/js/src/toobit.js +1 -0
  82. package/package.json +3 -2
@@ -5132,7 +5132,8 @@ export default class Exchange {
5132
5132
  return await this.createOrder(symbol, type, side, amount, price, params);
5133
5133
  }
5134
5134
  async editOrderWithClientOrderId(clientOrderId, symbol, type, side, amount = undefined, price = undefined, params = {}) {
5135
- return await this.editOrder('', symbol, type, side, amount, price, this.extend({ 'clientOrderId': clientOrderId }, params));
5135
+ const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
5136
+ return await this.editOrder('', symbol, type, side, amount, price, extendedParams);
5136
5137
  }
5137
5138
  async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
5138
5139
  await this.cancelOrderWs(id, symbol);
package/js/src/bigone.js CHANGED
@@ -70,6 +70,9 @@ export default class bigone extends Exchange {
70
70
  'fetchMarkets': true,
71
71
  'fetchMyTrades': true,
72
72
  'fetchOHLCV': true,
73
+ 'fetchOpenInterest': false,
74
+ 'fetchOpenInterestHistory': false,
75
+ 'fetchOpenInterests': false,
73
76
  'fetchOpenOrders': true,
74
77
  'fetchOption': false,
75
78
  'fetchOptionChain': false,
package/js/src/bingx.js CHANGED
@@ -780,6 +780,7 @@ export default class bingx extends Exchange {
780
780
  },
781
781
  },
782
782
  },
783
+ 'rollingWindowSize': 2000.0, // Some endpoints have a 10s window, some have a 5s window, a more complicated rate limiter is needed to accomodate for this
783
784
  });
784
785
  }
785
786
  /**
package/js/src/bitget.js CHANGED
@@ -8869,9 +8869,14 @@ export default class bitget extends Exchange {
8869
8869
  if (symbol === undefined) {
8870
8870
  throw new ArgumentsRequired(this.id + ' fetchFundingHistory() requires a symbol argument');
8871
8871
  }
8872
+ let uta = undefined;
8873
+ [uta, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'uta', false);
8872
8874
  let paginate = false;
8873
8875
  [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
8874
8876
  if (paginate) {
8877
+ if (uta) {
8878
+ return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'cursor', 'cursor');
8879
+ }
8875
8880
  return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'endId', 'idLessThan');
8876
8881
  }
8877
8882
  const market = this.market(symbol);
@@ -8880,12 +8885,7 @@ export default class bitget extends Exchange {
8880
8885
  }
8881
8886
  let productType = undefined;
8882
8887
  [productType, params] = this.handleProductTypeAndParams(market, params);
8883
- let request = {
8884
- 'symbol': market['id'],
8885
- 'marginCoin': market['settleId'],
8886
- 'businessType': 'contract_settle_fee',
8887
- 'productType': productType,
8888
- };
8888
+ let request = {};
8889
8889
  [request, params] = this.handleUntilOption('endTime', request, params);
8890
8890
  if (since !== undefined) {
8891
8891
  request['startTime'] = since;
@@ -8893,32 +8893,70 @@ export default class bitget extends Exchange {
8893
8893
  if (limit !== undefined) {
8894
8894
  request['limit'] = limit;
8895
8895
  }
8896
- const response = await this.privateMixGetV2MixAccountBill(this.extend(request, params));
8897
- //
8898
- // {
8899
- // "code": "00000",
8900
- // "msg": "success",
8901
- // "requestTime": 1700795977890,
8902
- // "data": {
8903
- // "bills": [
8904
- // {
8905
- // "billId": "1111499428100472833",
8906
- // "symbol": "BTCUSDT",
8907
- // "amount": "-0.004992",
8908
- // "fee": "0",
8909
- // "feeByCoupon": "",
8910
- // "businessType": "contract_settle_fee",
8911
- // "coin": "USDT",
8912
- // "cTime": "1700728034996"
8913
- // },
8914
- // ],
8915
- // "endId": "1098396773329305606"
8916
- // }
8917
- // }
8918
- //
8896
+ let response = undefined;
8897
+ if (uta) {
8898
+ request['coin'] = market['settleId'];
8899
+ request['category'] = productType;
8900
+ response = await this.privateUtaGetV3AccountFinancialRecords(this.extend(request, params));
8901
+ //
8902
+ // {
8903
+ // "code": "00000",
8904
+ // "msg": "success",
8905
+ // "requestTime": 1750135478641,
8906
+ // "data": {
8907
+ // "list": [
8908
+ // {
8909
+ // "category": "Margin",
8910
+ // "id": "13111111111111111",
8911
+ // "symbol": "BTCUSDT",
8912
+ // "coin": "BTC",
8913
+ // "type": "ORDER_DEALT_IN",
8914
+ // "amount": "0.00531168",
8915
+ // "fee": "-0.00000531",
8916
+ // "balance": "55.10017801",
8917
+ // "ts": "1745853486185"
8918
+ // }
8919
+ // ],
8920
+ // "cursor": "122222222222222222"
8921
+ // }
8922
+ // }
8923
+ //
8924
+ }
8925
+ else {
8926
+ request['symbol'] = market['id'];
8927
+ request['marginCoin'] = market['settleId'];
8928
+ request['businessType'] = 'contract_settle_fee';
8929
+ request['productType'] = productType;
8930
+ response = await this.privateMixGetV2MixAccountBill(this.extend(request, params));
8931
+ //
8932
+ // {
8933
+ // "code": "00000",
8934
+ // "msg": "success",
8935
+ // "requestTime": 1700795977890,
8936
+ // "data": {
8937
+ // "bills": [
8938
+ // {
8939
+ // "billId": "1111499428100472833",
8940
+ // "symbol": "BTCUSDT",
8941
+ // "amount": "-0.004992",
8942
+ // "fee": "0",
8943
+ // "feeByCoupon": "",
8944
+ // "businessType": "contract_settle_fee",
8945
+ // "coin": "USDT",
8946
+ // "cTime": "1700728034996"
8947
+ // },
8948
+ // ],
8949
+ // "endId": "1098396773329305606"
8950
+ // }
8951
+ // }
8952
+ //
8953
+ }
8919
8954
  const data = this.safeValue(response, 'data', {});
8920
- const result = this.safeValue(data, 'bills', []);
8921
- return this.parseFundingHistories(result, market, since, limit);
8955
+ let bills = this.safeList2(data, 'bills', 'list', []);
8956
+ if (uta) {
8957
+ bills = this.filterByArray(bills, 'type', ['CONTRACT_MAIN_SETTLE_FEE_USER_IN', 'CONTRACT_MAIN_SETTLE_FEE_USER_OUT'], false);
8958
+ }
8959
+ return this.parseFundingHistories(bills, market, since, limit);
8922
8960
  }
8923
8961
  parseFundingHistory(contract, market = undefined) {
8924
8962
  //
@@ -8933,9 +8971,21 @@ export default class bitget extends Exchange {
8933
8971
  // "cTime": "1700728034996"
8934
8972
  // }
8935
8973
  //
8974
+ // {
8975
+ // "category": "Margin",
8976
+ // "id": "13111111111111111",
8977
+ // "symbol": "BTCUSDT",
8978
+ // "coin": "BTC",
8979
+ // "type": "ORDER_DEALT_IN",
8980
+ // "amount": "0.00531168",
8981
+ // "fee": "-0.00000531",
8982
+ // "balance": "55.10017801",
8983
+ // "ts": "1745853486185"
8984
+ // }
8985
+ //
8936
8986
  const marketId = this.safeString(contract, 'symbol');
8937
8987
  const currencyId = this.safeString(contract, 'coin');
8938
- const timestamp = this.safeInteger(contract, 'cTime');
8988
+ const timestamp = this.safeInteger2(contract, 'cTime', 'ts');
8939
8989
  return {
8940
8990
  'info': contract,
8941
8991
  'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
@@ -8943,17 +8993,18 @@ export default class bitget extends Exchange {
8943
8993
  'datetime': this.iso8601(timestamp),
8944
8994
  'code': this.safeCurrencyCode(currencyId),
8945
8995
  'amount': this.safeNumber(contract, 'amount'),
8946
- 'id': this.safeString(contract, 'billId'),
8996
+ 'id': this.safeString2(contract, 'billId', 'id'),
8947
8997
  };
8948
8998
  }
8949
8999
  parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
8950
9000
  const result = [];
8951
9001
  for (let i = 0; i < contracts.length; i++) {
8952
9002
  const contract = contracts[i];
8953
- const business = this.safeString(contract, 'businessType');
8954
- if (business !== 'contract_settle_fee') {
8955
- continue;
8956
- }
9003
+ // for non-uta, we've set bussinessType in request payload. Not sure why this existed.
9004
+ // const business = this.safeString (contract, 'businessType');
9005
+ // if (business !== 'contract_settle_fee') {
9006
+ // continue;
9007
+ // }
8957
9008
  result.push(this.parseFundingHistory(contract, market));
8958
9009
  }
8959
9010
  const sorted = this.sortBy(result, 'timestamp');
package/js/src/bithumb.js CHANGED
@@ -268,14 +268,6 @@ export default class bithumb extends Exchange {
268
268
  },
269
269
  },
270
270
  },
271
- 'USDT': {
272
- 'limits': {
273
- 'cost': {
274
- 'min': undefined,
275
- 'max': undefined,
276
- },
277
- },
278
- },
279
271
  },
280
272
  },
281
273
  'commonCurrencies': {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bullish.js';
2
- import { Account, Balances, Currencies, Currency, DepositAddress, Dict, Int, int, FundingRateHistory, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Trade, Transaction, TransferEntry } from './base/types.js';
2
+ import { Account, Balances, Currencies, Currency, DepositAddress, Dict, Int, int, FundingRateHistory, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Trade, Transaction, TransferEntry, OpenInterest } from './base/types.js';
3
3
  /**
4
4
  * @class bullish
5
5
  * @augments Exchange
@@ -426,6 +426,17 @@ export default class bullish extends Exchange {
426
426
  info: any;
427
427
  };
428
428
  getTimestamp(): number;
429
+ /**
430
+ * @method
431
+ * @name bullish#fetchOpenInterest
432
+ * @description fetches the open interest of a specific market
433
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/tick
434
+ * @param {string} symbol unified symbol of the market to fetch the open interest for
435
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
436
+ * @returns {object} an [open interest structure]{@link https://docs.ccxt.com/?id=ticker-structure}
437
+ */
438
+ fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
439
+ parseOpenInterest(interest: any, market?: Market): OpenInterest;
429
440
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
430
441
  url: string;
431
442
  method: string;
package/js/src/bullish.js CHANGED
@@ -84,7 +84,9 @@ export default class bullish extends Exchange {
84
84
  'fetchMarkOHLCV': false,
85
85
  'fetchMyTrades': true,
86
86
  'fetchOHLCV': true,
87
+ 'fetchOpenInterest': true,
87
88
  'fetchOpenInterestHistory': false,
89
+ 'fetchOpenInterests': false,
88
90
  'fetchOpenOrder': false,
89
91
  'fetchOpenOrders': true,
90
92
  'fetchOrder': true,
@@ -2790,6 +2792,113 @@ export default class bullish extends Exchange {
2790
2792
  getTimestamp() {
2791
2793
  return this.milliseconds() - this.options['timeDifference'];
2792
2794
  }
2795
+ /**
2796
+ * @method
2797
+ * @name bullish#fetchOpenInterest
2798
+ * @description fetches the open interest of a specific market
2799
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/tick
2800
+ * @param {string} symbol unified symbol of the market to fetch the open interest for
2801
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2802
+ * @returns {object} an [open interest structure]{@link https://docs.ccxt.com/?id=ticker-structure}
2803
+ */
2804
+ async fetchOpenInterest(symbol, params = {}) {
2805
+ await this.loadMarkets();
2806
+ const market = this.market(symbol);
2807
+ const request = {
2808
+ 'symbol': market['id'],
2809
+ };
2810
+ const response = await this.publicGetV1MarketsSymbolTick(this.extend(request, params));
2811
+ //
2812
+ // {
2813
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
2814
+ // "createdAtTimestamp": "1621490985000",
2815
+ // "high": "1.00000000",
2816
+ // "low": "1.00000000",
2817
+ // "bestBid": "1.00000000",
2818
+ // "bidVolume": "1.00000000",
2819
+ // "bestAsk": "1.00000000",
2820
+ // "askVolume": "1.00000000",
2821
+ // "vwap": "1.00000000",
2822
+ // "open": "1.00000000",
2823
+ // "close": "1.00000000",
2824
+ // "last": "1.00000000",
2825
+ // "change": "1.00000000",
2826
+ // "percentage": "1.00000000",
2827
+ // "average": "1.00000000",
2828
+ // "baseVolume": "1.00000000",
2829
+ // "quoteVolume": "1.00000000",
2830
+ // "bancorPrice": "1.00000000",
2831
+ // "markPrice": "19999.00",
2832
+ // "fundingRate": "0.01",
2833
+ // "openInterest": "100000.32452",
2834
+ // "lastTradeDatetime": "2021-05-20T01:01:01.000Z",
2835
+ // "lastTradeTimestamp": "1621490985000",
2836
+ // "lastTradeQuantity": "1.00000000",
2837
+ // "ammData": [
2838
+ // {
2839
+ // "feeTierId": "1",
2840
+ // "bidSpreadFee": "0.00040000",
2841
+ // "askSpreadFee": "0.00040000",
2842
+ // "baseReservesQuantity": "245.56257825",
2843
+ // "quoteReservesQuantity": "3424383.3629",
2844
+ // "currentPrice": "16856.0000"
2845
+ // }
2846
+ // ]
2847
+ // }
2848
+ //
2849
+ return this.parseOpenInterest(response, market);
2850
+ }
2851
+ parseOpenInterest(interest, market = undefined) {
2852
+ //
2853
+ // {
2854
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
2855
+ // "createdAtTimestamp": "1621490985000",
2856
+ // "high": "1.00000000",
2857
+ // "low": "1.00000000",
2858
+ // "bestBid": "1.00000000",
2859
+ // "bidVolume": "1.00000000",
2860
+ // "bestAsk": "1.00000000",
2861
+ // "askVolume": "1.00000000",
2862
+ // "vwap": "1.00000000",
2863
+ // "open": "1.00000000",
2864
+ // "close": "1.00000000",
2865
+ // "last": "1.00000000",
2866
+ // "change": "1.00000000",
2867
+ // "percentage": "1.00000000",
2868
+ // "average": "1.00000000",
2869
+ // "baseVolume": "1.00000000",
2870
+ // "quoteVolume": "1.00000000",
2871
+ // "bancorPrice": "1.00000000",
2872
+ // "markPrice": "19999.00",
2873
+ // "fundingRate": "0.01",
2874
+ // "openInterest": "100000.32452",
2875
+ // "lastTradeDatetime": "2021-05-20T01:01:01.000Z",
2876
+ // "lastTradeTimestamp": "1621490985000",
2877
+ // "lastTradeQuantity": "1.00000000",
2878
+ // "ammData": [
2879
+ // {
2880
+ // "feeTierId": "1",
2881
+ // "bidSpreadFee": "0.00040000",
2882
+ // "askSpreadFee": "0.00040000",
2883
+ // "baseReservesQuantity": "245.56257825",
2884
+ // "quoteReservesQuantity": "3424383.3629",
2885
+ // "currentPrice": "16856.0000"
2886
+ // }
2887
+ // ]
2888
+ // }
2889
+ //
2890
+ const openInterest = this.safeString(interest, 'openInterest');
2891
+ return this.safeOpenInterest({
2892
+ 'info': interest,
2893
+ 'symbol': this.safeString(market, 'symbol'),
2894
+ 'openInterestAmount': openInterest,
2895
+ 'openInterestValue': undefined,
2896
+ 'timestamp': this.safeString(interest, 'createdAtTimestamp'),
2897
+ 'datetime': this.safeString(interest, 'createdAtDatetime'),
2898
+ 'baseVolume': openInterest,
2899
+ 'quoteVolume': undefined,
2900
+ }, market);
2901
+ }
2793
2902
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2794
2903
  const request = this.omit(params, this.extractParams(path));
2795
2904
  const endpoint = '/' + this.implodeParams(path, params);
package/js/src/bybit.js CHANGED
@@ -1352,6 +1352,7 @@ export default class bybit extends Exchange {
1352
1352
  'deposit': {},
1353
1353
  },
1354
1354
  },
1355
+ 'rollingWindowSize': 5000.0, // According to the docs (https://bybit-exchange.github.io/docs/v5/rate-limit), tested with 90000.0 with no errors
1355
1356
  });
1356
1357
  }
1357
1358
  /**
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
8
  import Exchange from './abstract/coinbaseinternational.js';
9
- import { ExchangeError, ArgumentsRequired, BadRequest, InvalidOrder, PermissionDenied, DuplicateOrderId, AuthenticationError } from './base/errors.js';
9
+ import { ExchangeError, ArgumentsRequired, BadRequest, InvalidOrder, PermissionDenied, DuplicateOrderId, AuthenticationError, NotSupported } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { TICK_SIZE } from './base/functions/number.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
@@ -230,6 +230,7 @@ export default class coinbaseinternational extends Exchange {
230
230
  'is a required field': BadRequest,
231
231
  'Not Found': BadRequest,
232
232
  'ip not allowed': AuthenticationError,
233
+ 'cbe spot routing instrument not supported': NotSupported,
233
234
  },
234
235
  },
235
236
  'timeframes': {
package/js/src/coinex.js CHANGED
@@ -682,6 +682,7 @@ export default class coinex extends Exchange {
682
682
  'Service is not available during funding fee settlement': OperationFailed,
683
683
  },
684
684
  },
685
+ 'rollingWindowSize': 1000.0, // docs say 1000.0: https://docs.coinex.com/api/v2/rate-limit#ip-rate-limit, tested with 60000.0 and received no errors
685
686
  });
686
687
  }
687
688
  /**
@@ -382,7 +382,7 @@ export default class coinmetro extends Exchange {
382
382
  const code = this.safeCurrencyCode(id);
383
383
  const typeRaw = this.safeString(currency, 'type');
384
384
  let type = undefined;
385
- if (typeRaw === 'coin' || typeRaw === 'token' || typeRaw === 'erc20') {
385
+ if (typeRaw === 'coin' || typeRaw === 'token' || typeRaw === 'erc20' || typeRaw === 'crypto') {
386
386
  type = 'crypto';
387
387
  }
388
388
  else if (typeRaw === 'fiat') {
package/js/src/gate.js CHANGED
@@ -1163,6 +1163,7 @@ export default class gate extends Exchange {
1163
1163
  'Your order size': InvalidOrder, // {"label":"INVALID_PARAM_VALUE","message":"Your order size 0.003749448 USDT is too small. The minimum is 3 USDT"}
1164
1164
  },
1165
1165
  },
1166
+ 'rollingWindowSize': 5000.0,
1166
1167
  });
1167
1168
  }
1168
1169
  setSandboxMode(enable) {
package/js/src/gemini.js CHANGED
@@ -305,6 +305,7 @@ export default class gemini extends Exchange {
305
305
  'webApiRetries': 5,
306
306
  'webApiMuteFailure': true,
307
307
  },
308
+ // fetchticker should use v1, confirmed that v2 is buggy ( https://github.com/ccxt/ccxt/issues/28077 )
308
309
  'fetchTickerMethod': 'fetchTickerV1',
309
310
  'networks': {
310
311
  'BTC': 'bitcoin',
package/js/src/htx.js CHANGED
@@ -116,7 +116,7 @@ export default class htx extends Exchange {
116
116
  'fetchPositionsRisk': false,
117
117
  'fetchPremiumIndexOHLCV': true,
118
118
  'fetchSettlementHistory': true,
119
- 'fetchStatus': true,
119
+ 'fetchStatus': false,
120
120
  'fetchTicker': true,
121
121
  'fetchTickers': true,
122
122
  'fetchTime': true,
@@ -1401,6 +1401,7 @@ export default class htx extends Exchange {
1401
1401
  },
1402
1402
  },
1403
1403
  },
1404
+ 'rollingWindowSize': 2000.0,
1404
1405
  });
1405
1406
  }
1406
1407
  /**
@@ -101,6 +101,7 @@ export default class hyperliquid extends Exchange {
101
101
  * @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
102
102
  * @param {string} [params.dex] for hip3 markets, the dex name, eg: 'xyz'
103
103
  * @param {string} [params.subAccountAddress] sub account user address
104
+ * @param {boolean} [params.enableUnifiedMargin] enable unified margin, CCXT tries to auto-detects this value but you can override it
104
105
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
105
106
  */
106
107
  fetchBalance(params?: {}): Promise<Balances>;
@@ -230,6 +231,16 @@ export default class hyperliquid extends Exchange {
230
231
  approveBuilderFee(builder: string, maxFeeRate: string): Promise<any>;
231
232
  initializeClient(): Promise<boolean>;
232
233
  handleBuilderFeeApproval(): Promise<boolean>;
234
+ /**
235
+ * @method
236
+ * @name hyperliquid#isUnifiedEnabled
237
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-abstraction-state
238
+ * @description returns enableUnifiedMargin so the user can check if unified account is enabled
239
+ * @param {string} method the method for which we want to check if unified margin is enabled, this is used to check options for specific methods (e.g. fetchBalance can have a specific option to enable unified margin)
240
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
241
+ * @returns {bool} enableUnifiedMargin
242
+ */
243
+ isUnifiedEnabled(method: string, params?: {}): Promise<any[]>;
233
244
  /**
234
245
  * @method
235
246
  * @name hyperliquid#setUserAbstraction
@@ -1085,6 +1085,7 @@ export default class hyperliquid extends Exchange {
1085
1085
  * @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
1086
1086
  * @param {string} [params.dex] for hip3 markets, the dex name, eg: 'xyz'
1087
1087
  * @param {string} [params.subAccountAddress] sub account user address
1088
+ * @param {boolean} [params.enableUnifiedMargin] enable unified margin, CCXT tries to auto-detects this value but you can override it
1088
1089
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
1089
1090
  */
1090
1091
  async fetchBalance(params = {}) {
@@ -1094,7 +1095,10 @@ export default class hyperliquid extends Exchange {
1094
1095
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1095
1096
  let marginMode = undefined;
1096
1097
  [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
1097
- const isSpot = (type === 'spot');
1098
+ let isUnifiedEnabled = undefined;
1099
+ [isUnifiedEnabled, params] = await this.isUnifiedEnabled('fetchBalance', params);
1100
+ const dex = this.safeString(params, 'dex');
1101
+ const isSpot = ((type === 'spot') || isUnifiedEnabled) && (dex === undefined);
1098
1102
  const request = {
1099
1103
  'type': (isSpot) ? 'spotClearinghouseState' : 'clearinghouseState',
1100
1104
  'user': userAddress,
@@ -1796,7 +1800,7 @@ export default class hyperliquid extends Exchange {
1796
1800
  }
1797
1801
  async initializeClient() {
1798
1802
  try {
1799
- await Promise.all([this.handleBuilderFeeApproval(), this.setRef()]);
1803
+ await Promise.all([this.handleBuilderFeeApproval(), this.setRef(), this.isUnifiedEnabled('fetchBalance', {})]); // for now only fetchBalance requires the unified knowledge, but we can extend this to other methods as needed
1800
1804
  }
1801
1805
  catch (e) {
1802
1806
  return false;
@@ -1823,6 +1827,40 @@ export default class hyperliquid extends Exchange {
1823
1827
  }
1824
1828
  return true;
1825
1829
  }
1830
+ /**
1831
+ * @method
1832
+ * @name hyperliquid#isUnifiedEnabled
1833
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-abstraction-state
1834
+ * @description returns enableUnifiedMargin so the user can check if unified account is enabled
1835
+ * @param {string} method the method for which we want to check if unified margin is enabled, this is used to check options for specific methods (e.g. fetchBalance can have a specific option to enable unified margin)
1836
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1837
+ * @returns {bool} enableUnifiedMargin
1838
+ */
1839
+ async isUnifiedEnabled(method, params = {}) {
1840
+ let userAddress = undefined;
1841
+ [userAddress, params] = this.handlePublicAddress('isUnifiedEnabled', params);
1842
+ let enableUnifiedMargin = undefined;
1843
+ [enableUnifiedMargin, params] = this.handleOptionAndParams(params, method, 'enableUnifiedMargin');
1844
+ if (enableUnifiedMargin === undefined) {
1845
+ const request = {
1846
+ 'type': 'userAbstraction',
1847
+ 'user': userAddress,
1848
+ };
1849
+ let response = undefined;
1850
+ try {
1851
+ response = await this.publicPostInfo(this.extend(request, params));
1852
+ }
1853
+ catch (e) {
1854
+ response = undefined; // ignore this error and assume unified margin is not enabled
1855
+ }
1856
+ //
1857
+ // "unifiedAccount" | "portfolioMargin" | "disabled" | "default" | "dexAbstraction"
1858
+ //
1859
+ enableUnifiedMargin = response === '"unifiedAccount"';
1860
+ this.options['enableUnifiedMargin'] = enableUnifiedMargin; // cache this for future calls
1861
+ }
1862
+ return [enableUnifiedMargin, params];
1863
+ }
1826
1864
  /**
1827
1865
  * @method
1828
1866
  * @name hyperliquid#setUserAbstraction
@@ -45,6 +45,7 @@ export default class independentreserve extends Exchange {
45
45
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
46
46
  parseOrder(order: Dict, market?: Market): Order;
47
47
  parseOrderStatus(status: Str): string;
48
+ parseTimeInForce(timeInForce: Str): string;
48
49
  /**
49
50
  * @method
50
51
  * @name independentreserve#fetchOrder
@@ -197,9 +197,10 @@ export default class independentreserve extends Exchange {
197
197
  'takeProfitPrice': false,
198
198
  'attachedStopLossTakeProfit': undefined,
199
199
  'timeInForce': {
200
- 'IOC': false,
201
- 'FOK': false,
202
- 'PO': false,
200
+ 'GTC': true,
201
+ 'IOC': true,
202
+ 'FOK': true,
203
+ 'PO': true,
203
204
  'GTD': false,
204
205
  },
205
206
  'hedged': false,
@@ -617,7 +618,7 @@ export default class independentreserve extends Exchange {
617
618
  'lastTradeTimestamp': undefined,
618
619
  'symbol': symbol,
619
620
  'type': orderType,
620
- 'timeInForce': undefined,
621
+ 'timeInForce': this.parseTimeInForce(this.safeString(order, 'TimeInForce')),
621
622
  'postOnly': undefined,
622
623
  'side': side,
623
624
  'price': this.safeString(order, 'Price'),
@@ -645,9 +646,19 @@ export default class independentreserve extends Exchange {
645
646
  'Cancelled': 'canceled',
646
647
  'PartiallyFilledAndExpired': 'canceled',
647
648
  'Expired': 'canceled',
649
+ 'Failed': 'canceled',
648
650
  };
649
651
  return this.safeString(statuses, status, status);
650
652
  }
653
+ parseTimeInForce(timeInForce) {
654
+ const timeInForces = {
655
+ 'Gtc': 'GTC',
656
+ 'Moc': 'PO',
657
+ 'Fok': 'FOK',
658
+ 'Ioc': 'IOC',
659
+ };
660
+ return this.safeString(timeInForces, timeInForce, timeInForce);
661
+ }
651
662
  /**
652
663
  * @method
653
664
  * @name independentreserve#fetchOrder
@@ -2044,6 +2044,8 @@ export default class krakenfutures extends Exchange {
2044
2044
  if ((filledOrder === '0') || (filledOrder === '0.0')) {
2045
2045
  filledOrder = undefined;
2046
2046
  }
2047
+ const fetchOrderPriceTriggerOptions = this.safeDict(orderDictFromFetchOrder, 'priceTriggerOptions', {});
2048
+ const fetchOrderTriggerPrice = this.safeString(fetchOrderPriceTriggerOptions, 'triggerPrice');
2047
2049
  return this.safeOrder({
2048
2050
  'info': order,
2049
2051
  'id': this.safeString(orderDictFromFetchOrder, 'orderId'),
@@ -2058,8 +2060,9 @@ export default class krakenfutures extends Exchange {
2058
2060
  'postOnly': undefined,
2059
2061
  'reduceOnly': this.safeBool(orderDictFromFetchOrder, 'reduceOnly'),
2060
2062
  'side': this.safeString(orderDictFromFetchOrder, 'side'),
2061
- 'price': this.safeString(orderDictFromFetchOrder, 'limitPrice'),
2062
- 'triggerPrice': undefined,
2063
+ 'price': undefined,
2064
+ 'triggerPrice': fetchOrderTriggerPrice,
2065
+ 'stopPrice': fetchOrderTriggerPrice,
2063
2066
  'amount': this.safeString(orderDictFromFetchOrder, 'quantity'),
2064
2067
  'cost': undefined,
2065
2068
  'average': undefined,
@@ -341,6 +341,7 @@ export default class kucoin extends Exchange {
341
341
  * @param {bool} [params.trigger] True if cancelling a stop order
342
342
  * @param {bool} [params.hf] false, // true for hf order
343
343
  * @param {bool} [params.sync] false, // true to use the hf sync call
344
+ * @param {string} [params.marginMode] 'cross', // cross (cross mode) and isolated (isolated mode), set to cross by default, the isolated mode will be released soon, stay tuned
344
345
  * @returns Response from the exchange
345
346
  */
346
347
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;