ccxt 4.3.94 → 4.3.96

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 (63) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +8 -8
  3. package/dist/cjs/ccxt.js +1 -7
  4. package/dist/cjs/src/ascendex.js +8 -6
  5. package/dist/cjs/src/base/Exchange.js +3 -7
  6. package/dist/cjs/src/bingx.js +2 -1
  7. package/dist/cjs/src/bitfinex.js +3 -2
  8. package/dist/cjs/src/bitfinex2.js +6 -5
  9. package/dist/cjs/src/blofin.js +0 -1
  10. package/dist/cjs/src/btcturk.js +2 -2
  11. package/dist/cjs/src/bybit.js +8 -2
  12. package/dist/cjs/src/gate.js +3 -2
  13. package/dist/cjs/src/gemini.js +3 -2
  14. package/dist/cjs/src/hyperliquid.js +337 -42
  15. package/dist/cjs/src/independentreserve.js +4 -3
  16. package/dist/cjs/src/indodax.js +3 -0
  17. package/dist/cjs/src/kucoin.js +12 -12
  18. package/dist/cjs/src/mexc.js +78 -154
  19. package/dist/cjs/src/okx.js +2 -1
  20. package/dist/cjs/src/p2b.js +0 -1
  21. package/dist/cjs/src/pro/binance.js +100 -2
  22. package/dist/cjs/src/pro/bybit.js +65 -4
  23. package/dist/cjs/src/pro/cryptocom.js +224 -0
  24. package/dist/cjs/src/pro/okx.js +264 -35
  25. package/dist/cjs/src/tradeogre.js +0 -1
  26. package/js/ccxt.d.ts +2 -8
  27. package/js/ccxt.js +2 -6
  28. package/js/src/abstract/okx.d.ts +2 -0
  29. package/js/src/ascendex.js +8 -6
  30. package/js/src/base/Exchange.d.ts +1 -3
  31. package/js/src/base/Exchange.js +3 -7
  32. package/js/src/bingx.js +2 -1
  33. package/js/src/bitfinex.js +3 -2
  34. package/js/src/bitfinex2.js +6 -5
  35. package/js/src/blofin.js +0 -1
  36. package/js/src/btcturk.d.ts +2 -2
  37. package/js/src/btcturk.js +2 -2
  38. package/js/src/bybit.js +8 -2
  39. package/js/src/gate.js +3 -2
  40. package/js/src/gemini.js +3 -2
  41. package/js/src/hyperliquid.d.ts +25 -0
  42. package/js/src/hyperliquid.js +337 -42
  43. package/js/src/independentreserve.js +4 -3
  44. package/js/src/indodax.js +3 -0
  45. package/js/src/kucoin.d.ts +1 -1
  46. package/js/src/kucoin.js +12 -12
  47. package/js/src/mexc.js +78 -154
  48. package/js/src/okx.js +2 -1
  49. package/js/src/p2b.js +0 -1
  50. package/js/src/pro/binance.d.ts +2 -0
  51. package/js/src/pro/binance.js +100 -2
  52. package/js/src/pro/bybit.d.ts +3 -1
  53. package/js/src/pro/bybit.js +65 -4
  54. package/js/src/pro/cryptocom.d.ts +10 -1
  55. package/js/src/pro/cryptocom.js +225 -1
  56. package/js/src/pro/okx.d.ts +10 -1
  57. package/js/src/pro/okx.js +264 -35
  58. package/js/src/tradeogre.js +0 -1
  59. package/package.json +1 -1
  60. package/js/src/abstract/bitbay.d.ts +0 -56
  61. package/js/src/abstract/bitbay.js +0 -11
  62. package/js/src/abstract/hitbtc3.d.ts +0 -118
  63. package/js/src/abstract/hitbtc3.js +0 -11
@@ -57,14 +57,15 @@ export default class hyperliquid extends Exchange {
57
57
  'fetchBorrowInterest': false,
58
58
  'fetchBorrowRateHistories': false,
59
59
  'fetchBorrowRateHistory': false,
60
- 'fetchCanceledOrders': false,
60
+ 'fetchCanceledAndClosedOrders': true,
61
+ 'fetchCanceledOrders': true,
61
62
  'fetchClosedOrders': true,
62
63
  'fetchCrossBorrowRate': false,
63
64
  'fetchCrossBorrowRates': false,
64
65
  'fetchCurrencies': true,
65
66
  'fetchDepositAddress': false,
66
67
  'fetchDepositAddresses': false,
67
- 'fetchDeposits': false,
68
+ 'fetchDeposits': true,
68
69
  'fetchDepositWithdrawFee': 'emulated',
69
70
  'fetchDepositWithdrawFees': false,
70
71
  'fetchFundingHistory': false,
@@ -74,7 +75,7 @@ export default class hyperliquid extends Exchange {
74
75
  'fetchIndexOHLCV': false,
75
76
  'fetchIsolatedBorrowRate': false,
76
77
  'fetchIsolatedBorrowRates': false,
77
- 'fetchLedger': false,
78
+ 'fetchLedger': true,
78
79
  'fetchLeverage': false,
79
80
  'fetchLeverageTiers': false,
80
81
  'fetchLiquidations': false,
@@ -90,7 +91,7 @@ export default class hyperliquid extends Exchange {
90
91
  'fetchOpenOrders': true,
91
92
  'fetchOrder': true,
92
93
  'fetchOrderBook': true,
93
- 'fetchOrders': false,
94
+ 'fetchOrders': true,
94
95
  'fetchOrderTrades': false,
95
96
  'fetchPosition': true,
96
97
  'fetchPositionMode': false,
@@ -106,7 +107,7 @@ export default class hyperliquid extends Exchange {
106
107
  'fetchTransfer': false,
107
108
  'fetchTransfers': false,
108
109
  'fetchWithdrawal': false,
109
- 'fetchWithdrawals': false,
110
+ 'fetchWithdrawals': true,
110
111
  'reduceMargin': true,
111
112
  'repayCrossMargin': false,
112
113
  'repayIsolatedMargin': false,
@@ -829,6 +830,7 @@ export default class hyperliquid extends Exchange {
829
830
  await this.loadMarkets();
830
831
  const market = this.market(symbol);
831
832
  const until = this.safeInteger(params, 'until', this.milliseconds());
833
+ const useTail = (since === undefined);
832
834
  if (since === undefined) {
833
835
  since = 0;
834
836
  }
@@ -859,7 +861,7 @@ export default class hyperliquid extends Exchange {
859
861
  // }
860
862
  // ]
861
863
  //
862
- return this.parseOHLCVs(response, market, timeframe, since, limit);
864
+ return this.parseOHLCVs(response, market, timeframe, since, limit, useTail);
863
865
  }
864
866
  parseOHLCV(ohlcv, market = undefined) {
865
867
  //
@@ -1734,7 +1736,16 @@ export default class hyperliquid extends Exchange {
1734
1736
  // }
1735
1737
  // ]
1736
1738
  //
1737
- return this.parseOrders(response, market, since, limit);
1739
+ const orderWithStatus = [];
1740
+ for (let i = 0; i < response.length; i++) {
1741
+ const order = response[i];
1742
+ const extendOrder = {};
1743
+ if (this.safeString(order, 'status') === undefined) {
1744
+ extendOrder['ccxtStatus'] = 'open';
1745
+ }
1746
+ orderWithStatus.push(this.extend(order, extendOrder));
1747
+ }
1748
+ return this.parseOrders(orderWithStatus, market, since, limit);
1738
1749
  }
1739
1750
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1740
1751
  /**
@@ -1748,8 +1759,59 @@ export default class hyperliquid extends Exchange {
1748
1759
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1749
1760
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1750
1761
  */
1762
+ await this.loadMarkets();
1763
+ const orders = await this.fetchOrders(symbol, undefined, undefined, params); // don't filter here because we don't want to catch open orders
1764
+ const closedOrders = this.filterByArray(orders, 'status', ['closed'], false);
1765
+ return this.filterBySymbolSinceLimit(closedOrders, symbol, since, limit);
1766
+ }
1767
+ async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1768
+ /**
1769
+ * @method
1770
+ * @name hyperliquid#fetchCanceledOrders
1771
+ * @description fetch all canceled orders
1772
+ * @param {string} symbol unified market symbol
1773
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1774
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1775
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1776
+ * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1777
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1778
+ */
1779
+ await this.loadMarkets();
1780
+ const orders = await this.fetchOrders(symbol, undefined, undefined, params); // don't filter here because we don't want to catch open orders
1781
+ const closedOrders = this.filterByArray(orders, 'status', ['canceled'], false);
1782
+ return this.filterBySymbolSinceLimit(closedOrders, symbol, since, limit);
1783
+ }
1784
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1785
+ /**
1786
+ * @method
1787
+ * @name hyperliquid#fetchCanceledAndClosedOrders
1788
+ * @description fetch all closed and canceled orders
1789
+ * @param {string} symbol unified market symbol
1790
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1791
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1792
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1793
+ * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1794
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1795
+ */
1796
+ await this.loadMarkets();
1797
+ const orders = await this.fetchOrders(symbol, undefined, undefined, params); // don't filter here because we don't want to catch open orders
1798
+ const closedOrders = this.filterByArray(orders, 'status', ['canceled', 'closed', 'rejected'], false);
1799
+ return this.filterBySymbolSinceLimit(closedOrders, symbol, since, limit);
1800
+ }
1801
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1802
+ /**
1803
+ * @method
1804
+ * @name hyperliquid#fetchOrders
1805
+ * @description fetch all orders
1806
+ * @param {string} symbol unified market symbol
1807
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1808
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1809
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1810
+ * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1811
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1812
+ */
1751
1813
  let userAddress = undefined;
1752
- [userAddress, params] = this.handlePublicAddress('fetchClosedOrders', params);
1814
+ [userAddress, params] = this.handlePublicAddress('fetchOrders', params);
1753
1815
  await this.loadMarkets();
1754
1816
  const market = this.safeMarket(symbol);
1755
1817
  const request = {
@@ -1923,12 +1985,7 @@ export default class hyperliquid extends Exchange {
1923
1985
  const coin = this.safeString(entry, 'coin');
1924
1986
  let marketId = undefined;
1925
1987
  if (coin !== undefined) {
1926
- if (coin.indexOf('/') > -1) {
1927
- marketId = coin;
1928
- }
1929
- else {
1930
- marketId = coin + '/USDC:USDC';
1931
- }
1988
+ marketId = this.coinToMarketId(coin);
1932
1989
  }
1933
1990
  if (this.safeString(entry, 'id') === undefined) {
1934
1991
  market = this.safeMarket(marketId, undefined);
@@ -1938,11 +1995,14 @@ export default class hyperliquid extends Exchange {
1938
1995
  }
1939
1996
  const symbol = market['symbol'];
1940
1997
  const timestamp = this.safeInteger2(order, 'timestamp', 'statusTimestamp');
1941
- const status = this.safeString(order, 'status');
1998
+ const status = this.safeString2(order, 'status', 'ccxtStatus');
1999
+ order = this.omit(order, ['ccxtStatus']);
1942
2000
  let side = this.safeString(entry, 'side');
1943
2001
  if (side !== undefined) {
1944
2002
  side = (side === 'A') ? 'sell' : 'buy';
1945
2003
  }
2004
+ const totalAmount = this.safeString2(entry, 'origSz', 'totalSz');
2005
+ const remaining = this.safeString(entry, 'sz');
1946
2006
  return this.safeOrder({
1947
2007
  'info': order,
1948
2008
  'id': this.safeString(entry, 'oid'),
@@ -1957,13 +2017,13 @@ export default class hyperliquid extends Exchange {
1957
2017
  'postOnly': undefined,
1958
2018
  'reduceOnly': this.safeBool(entry, 'reduceOnly'),
1959
2019
  'side': side,
1960
- 'price': this.safeNumber(entry, 'limitPx'),
2020
+ 'price': this.safeString(entry, 'limitPx'),
1961
2021
  'triggerPrice': this.safeBool(entry, 'isTrigger') ? this.safeNumber(entry, 'triggerPx') : undefined,
1962
- 'amount': this.safeNumber2(entry, 'sz', 'totalSz'),
2022
+ 'amount': totalAmount,
1963
2023
  'cost': undefined,
1964
- 'average': this.safeNumber(entry, 'avgPx'),
1965
- 'filled': undefined,
1966
- 'remaining': undefined,
2024
+ 'average': this.safeString(entry, 'avgPx'),
2025
+ 'filled': Precise.stringSub(totalAmount, remaining),
2026
+ 'remaining': remaining,
1967
2027
  'status': this.parseOrderStatus(status),
1968
2028
  'fee': undefined,
1969
2029
  'trades': undefined,
@@ -2062,7 +2122,7 @@ export default class hyperliquid extends Exchange {
2062
2122
  const price = this.safeString(trade, 'px');
2063
2123
  const amount = this.safeString(trade, 'sz');
2064
2124
  const coin = this.safeString(trade, 'coin');
2065
- const marketId = coin + '/USDC:USDC';
2125
+ const marketId = this.coinToMarketId(coin);
2066
2126
  market = this.safeMarket(marketId, undefined);
2067
2127
  const symbol = market['symbol'];
2068
2128
  const id = this.safeString(trade, 'tid');
@@ -2202,7 +2262,7 @@ export default class hyperliquid extends Exchange {
2202
2262
  //
2203
2263
  const entry = this.safeDict(position, 'position', {});
2204
2264
  const coin = this.safeString(entry, 'coin');
2205
- const marketId = coin + '/USDC:USDC';
2265
+ const marketId = this.coinToMarketId(coin);
2206
2266
  market = this.safeMarket(marketId, undefined);
2207
2267
  const symbol = market['symbol'];
2208
2268
  const leverage = this.safeDict(entry, 'leverage', {});
@@ -2515,11 +2575,13 @@ export default class hyperliquid extends Exchange {
2515
2575
  * @name hyperliquid#withdraw
2516
2576
  * @description make a withdrawal (only support USDC)
2517
2577
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
2578
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
2518
2579
  * @param {string} code unified currency code
2519
2580
  * @param {float} amount the amount to withdraw
2520
2581
  * @param {string} address the address to withdraw to
2521
2582
  * @param {string} tag
2522
2583
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2584
+ * @param {string} [params.vaultAddress] vault address withdraw from
2523
2585
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2524
2586
  */
2525
2587
  this.checkRequiredCredentials();
@@ -2531,24 +2593,40 @@ export default class hyperliquid extends Exchange {
2531
2593
  throw new NotSupported(this.id + 'withdraw() only support USDC');
2532
2594
  }
2533
2595
  }
2534
- const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2596
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
2597
+ params = this.omit(params, 'vaultAddress');
2535
2598
  const nonce = this.milliseconds();
2536
- const payload = {
2537
- 'hyperliquidChain': isSandboxMode ? 'Testnet' : 'Mainnet',
2538
- 'destination': address,
2539
- 'amount': amount.toString(),
2540
- 'time': nonce,
2541
- };
2542
- const sig = this.buildWithdrawSig(payload);
2543
- const request = {
2544
- 'action': {
2599
+ let action = {};
2600
+ let sig = undefined;
2601
+ if (vaultAddress !== undefined) {
2602
+ action = {
2603
+ 'type': 'vaultTransfer',
2604
+ 'vaultAddress': '0x' + vaultAddress,
2605
+ 'isDeposit': false,
2606
+ 'usd': amount,
2607
+ };
2608
+ sig = this.signL1Action(action, nonce);
2609
+ }
2610
+ else {
2611
+ const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2612
+ const payload = {
2613
+ 'hyperliquidChain': isSandboxMode ? 'Testnet' : 'Mainnet',
2614
+ 'destination': address,
2615
+ 'amount': amount.toString(),
2616
+ 'time': nonce,
2617
+ };
2618
+ sig = this.buildWithdrawSig(payload);
2619
+ action = {
2545
2620
  'hyperliquidChain': payload['hyperliquidChain'],
2546
2621
  'signatureChainId': '0x66eee',
2547
2622
  'destination': address,
2548
2623
  'amount': amount.toString(),
2549
2624
  'time': nonce,
2550
2625
  'type': 'withdraw3',
2551
- },
2626
+ };
2627
+ }
2628
+ const request = {
2629
+ 'action': action,
2552
2630
  'nonce': nonce,
2553
2631
  'signature': sig,
2554
2632
  };
@@ -2559,27 +2637,53 @@ export default class hyperliquid extends Exchange {
2559
2637
  //
2560
2638
  // { status: 'ok', response: { type: 'default' } }
2561
2639
  //
2640
+ // fetchDeposits / fetchWithdrawals
2641
+ // {
2642
+ // "time":1724762307531,
2643
+ // "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
2644
+ // "delta":{
2645
+ // "type":"accountClassTransfer",
2646
+ // "usdc":"50.0",
2647
+ // "toPerp":false
2648
+ // }
2649
+ // }
2650
+ //
2651
+ const timestamp = this.safeInteger(transaction, 'time');
2652
+ const delta = this.safeDict(transaction, 'delta', {});
2653
+ let fee = undefined;
2654
+ const feeCost = this.safeInteger(delta, 'fee');
2655
+ if (feeCost !== undefined) {
2656
+ fee = {
2657
+ 'currency': 'USDC',
2658
+ 'cost': feeCost,
2659
+ };
2660
+ }
2661
+ let internal = undefined;
2662
+ const type = this.safeString(delta, 'type');
2663
+ if (type !== undefined) {
2664
+ internal = (type === 'internalTransfer');
2665
+ }
2562
2666
  return {
2563
2667
  'info': transaction,
2564
2668
  'id': undefined,
2565
- 'txid': undefined,
2566
- 'timestamp': undefined,
2567
- 'datetime': undefined,
2669
+ 'txid': this.safeString(transaction, 'hash'),
2670
+ 'timestamp': timestamp,
2671
+ 'datetime': this.iso8601(timestamp),
2568
2672
  'network': undefined,
2569
2673
  'address': undefined,
2570
- 'addressTo': undefined,
2571
- 'addressFrom': undefined,
2674
+ 'addressTo': this.safeString(delta, 'destination'),
2675
+ 'addressFrom': this.safeString(delta, 'user'),
2572
2676
  'tag': undefined,
2573
2677
  'tagTo': undefined,
2574
2678
  'tagFrom': undefined,
2575
2679
  'type': undefined,
2576
- 'amount': undefined,
2680
+ 'amount': this.safeInteger(delta, 'usdc'),
2577
2681
  'currency': undefined,
2578
2682
  'status': this.safeString(transaction, 'status'),
2579
2683
  'updated': undefined,
2580
2684
  'comment': undefined,
2581
- 'internal': undefined,
2582
- 'fee': undefined,
2685
+ 'internal': internal,
2686
+ 'fee': fee,
2583
2687
  };
2584
2688
  }
2585
2689
  async fetchTradingFee(symbol, params = {}) {
@@ -2688,6 +2792,197 @@ export default class hyperliquid extends Exchange {
2688
2792
  'tierBased': undefined,
2689
2793
  };
2690
2794
  }
2795
+ async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2796
+ /**
2797
+ * @method
2798
+ * @name hyperliquid#fetchLedger
2799
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2800
+ * @param {string} code unified currency code
2801
+ * @param {int} [since] timestamp in ms of the earliest ledger entry
2802
+ * @param {int} [limit] max number of ledger entrys to return
2803
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2804
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
2805
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2806
+ */
2807
+ await this.loadMarkets();
2808
+ let userAddress = undefined;
2809
+ [userAddress, params] = this.handlePublicAddress('fetchLedger', params);
2810
+ const request = {
2811
+ 'type': 'userNonFundingLedgerUpdates',
2812
+ 'user': userAddress,
2813
+ };
2814
+ if (since !== undefined) {
2815
+ request['startTime'] = since;
2816
+ }
2817
+ const until = this.safeInteger(params, 'until');
2818
+ if (until !== undefined) {
2819
+ request['endTime'] = until;
2820
+ params = this.omit(params, ['until']);
2821
+ }
2822
+ const response = await this.publicPostInfo(this.extend(request, params));
2823
+ //
2824
+ // [
2825
+ // {
2826
+ // "time":1724762307531,
2827
+ // "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
2828
+ // "delta":{
2829
+ // "type":"accountClassTransfer",
2830
+ // "usdc":"50.0",
2831
+ // "toPerp":false
2832
+ // }
2833
+ // }
2834
+ // ]
2835
+ //
2836
+ return this.parseLedger(response, undefined, since, limit);
2837
+ }
2838
+ parseLedgerEntry(item, currency = undefined) {
2839
+ //
2840
+ // {
2841
+ // "time":1724762307531,
2842
+ // "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
2843
+ // "delta":{
2844
+ // "type":"accountClassTransfer",
2845
+ // "usdc":"50.0",
2846
+ // "toPerp":false
2847
+ // }
2848
+ // }
2849
+ //
2850
+ const timestamp = this.safeInteger(item, 'time');
2851
+ const delta = this.safeDict(item, 'delta', {});
2852
+ let fee = undefined;
2853
+ const feeCost = this.safeInteger(delta, 'fee');
2854
+ if (feeCost !== undefined) {
2855
+ fee = {
2856
+ 'currency': 'USDC',
2857
+ 'cost': feeCost,
2858
+ };
2859
+ }
2860
+ const type = this.safeString(delta, 'type');
2861
+ const amount = this.safeString(delta, 'usdc');
2862
+ return {
2863
+ 'id': this.safeString(item, 'hash'),
2864
+ 'direction': undefined,
2865
+ 'account': undefined,
2866
+ 'referenceAccount': this.safeString(delta, 'user'),
2867
+ 'referenceId': this.safeString(item, 'hash'),
2868
+ 'type': this.parseLedgerEntryType(type),
2869
+ 'currency': undefined,
2870
+ 'amount': this.parseNumber(amount),
2871
+ 'timestamp': timestamp,
2872
+ 'datetime': this.iso8601(timestamp),
2873
+ 'before': undefined,
2874
+ 'after': undefined,
2875
+ 'status': undefined,
2876
+ 'fee': fee,
2877
+ 'info': item,
2878
+ };
2879
+ }
2880
+ parseLedgerEntryType(type) {
2881
+ const ledgerType = {
2882
+ 'internalTransfer': 'transfer',
2883
+ 'accountClassTransfer': 'transfer',
2884
+ };
2885
+ return this.safeString(ledgerType, type, type);
2886
+ }
2887
+ async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2888
+ /**
2889
+ * @method
2890
+ * @name hyperliquid#fetchDeposits
2891
+ * @description fetch all deposits made to an account
2892
+ * @param {string} code unified currency code
2893
+ * @param {int} [since] the earliest time in ms to fetch deposits for
2894
+ * @param {int} [limit] the maximum number of deposits structures to retrieve
2895
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2896
+ * @param {int} [params.until] the latest time in ms to fetch withdrawals for
2897
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2898
+ */
2899
+ await this.loadMarkets();
2900
+ let userAddress = undefined;
2901
+ [userAddress, params] = this.handlePublicAddress('fetchDepositsWithdrawals', params);
2902
+ const request = {
2903
+ 'type': 'userNonFundingLedgerUpdates',
2904
+ 'user': userAddress,
2905
+ };
2906
+ if (since !== undefined) {
2907
+ request['startTime'] = since;
2908
+ }
2909
+ const until = this.safeInteger(params, 'until');
2910
+ if (until !== undefined) {
2911
+ request['endTime'] = until;
2912
+ params = this.omit(params, ['until']);
2913
+ }
2914
+ const response = await this.publicPostInfo(this.extend(request, params));
2915
+ //
2916
+ // [
2917
+ // {
2918
+ // "time":1724762307531,
2919
+ // "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
2920
+ // "delta":{
2921
+ // "type":"accountClassTransfer",
2922
+ // "usdc":"50.0",
2923
+ // "toPerp":false
2924
+ // }
2925
+ // }
2926
+ // ]
2927
+ //
2928
+ const records = this.extractTypeFromDelta(response);
2929
+ const deposits = this.filterByArray(records, 'type', ['deposit'], false);
2930
+ return this.parseTransactions(deposits, undefined, since, limit);
2931
+ }
2932
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2933
+ /**
2934
+ * @method
2935
+ * @name hyperliquid#fetchWithdrawals
2936
+ * @description fetch all withdrawals made from an account
2937
+ * @param {string} code unified currency code
2938
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
2939
+ * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2940
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2941
+ * @param {int} [params.until] the latest time in ms to fetch withdrawals for
2942
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2943
+ */
2944
+ await this.loadMarkets();
2945
+ let userAddress = undefined;
2946
+ [userAddress, params] = this.handlePublicAddress('fetchDepositsWithdrawals', params);
2947
+ const request = {
2948
+ 'type': 'userNonFundingLedgerUpdates',
2949
+ 'user': userAddress,
2950
+ };
2951
+ if (since !== undefined) {
2952
+ request['startTime'] = since;
2953
+ }
2954
+ const until = this.safeInteger(params, 'until');
2955
+ if (until !== undefined) {
2956
+ request['endTime'] = until;
2957
+ params = this.omit(params, ['until']);
2958
+ }
2959
+ const response = await this.publicPostInfo(this.extend(request, params));
2960
+ //
2961
+ // [
2962
+ // {
2963
+ // "time":1724762307531,
2964
+ // "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
2965
+ // "delta":{
2966
+ // "type":"accountClassTransfer",
2967
+ // "usdc":"50.0",
2968
+ // "toPerp":false
2969
+ // }
2970
+ // }
2971
+ // ]
2972
+ //
2973
+ const records = this.extractTypeFromDelta(response);
2974
+ const withdrawals = this.filterByArray(records, 'type', ['withdraw'], false);
2975
+ return this.parseTransactions(withdrawals, undefined, since, limit);
2976
+ }
2977
+ extractTypeFromDelta(data = []) {
2978
+ const records = [];
2979
+ for (let i = 0; i < data.length; i++) {
2980
+ const record = data[i];
2981
+ record['type'] = record['delta']['type'];
2982
+ records.push(record);
2983
+ }
2984
+ return records;
2985
+ }
2691
2986
  formatVaultAddress(address = undefined) {
2692
2987
  if (address === undefined) {
2693
2988
  return undefined;
@@ -2711,7 +3006,7 @@ export default class hyperliquid extends Exchange {
2711
3006
  throw new ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
2712
3007
  }
2713
3008
  coinToMarketId(coin) {
2714
- if (coin.indexOf('/') > -1) {
3009
+ if (coin.indexOf('/') > -1 || coin.indexOf('@') > -1) {
2715
3010
  return coin; // spot
2716
3011
  }
2717
3012
  return coin + '/USDC:USDC';
@@ -157,11 +157,12 @@ export default class independentreserve extends Exchange {
157
157
  * @param {object} [params] extra parameters specific to the exchange API endpoint
158
158
  * @returns {object[]} an array of objects representing market data
159
159
  */
160
- const baseCurrencies = await this.publicGetGetValidPrimaryCurrencyCodes(params);
160
+ const baseCurrenciesPromise = this.publicGetGetValidPrimaryCurrencyCodes(params);
161
161
  // ['Xbt', 'Eth', 'Usdt', ...]
162
- const quoteCurrencies = await this.publicGetGetValidSecondaryCurrencyCodes(params);
162
+ const quoteCurrenciesPromise = this.publicGetGetValidSecondaryCurrencyCodes(params);
163
163
  // ['Aud', 'Usd', 'Nzd', 'Sgd']
164
- const limits = await this.publicGetGetOrderMinimumVolumes(params);
164
+ const limitsPromise = this.publicGetGetOrderMinimumVolumes(params);
165
+ const [baseCurrencies, quoteCurrencies, limits] = await Promise.all([baseCurrenciesPromise, quoteCurrenciesPromise, limitsPromise]);
165
166
  //
166
167
  // {
167
168
  // "Xbt": 0.0001,
package/js/src/indodax.js CHANGED
@@ -871,6 +871,9 @@ export default class indodax extends Exchange {
871
871
  else if (type === 'limit') {
872
872
  priceIsRequired = true;
873
873
  quantityIsRequired = true;
874
+ if (side === 'buy') {
875
+ request[market['quoteId']] = this.parseToNumeric(Precise.stringMul(this.numberToString(amount), this.numberToString(price)));
876
+ }
874
877
  }
875
878
  if (priceIsRequired) {
876
879
  if (price === undefined) {
@@ -17,7 +17,7 @@ export default class kucoin extends Exchange {
17
17
  }>;
18
18
  fetchMarkets(params?: {}): Promise<Market[]>;
19
19
  loadMigrationStatus(force?: boolean): Promise<void>;
20
- handleHfAndParams(params?: {}): Promise<{}[]>;
20
+ handleHfAndParams(params?: {}): {}[];
21
21
  fetchCurrencies(params?: {}): Promise<Currencies>;
22
22
  fetchAccounts(params?: {}): Promise<Account[]>;
23
23
  fetchTransactionFee(code: string, params?: {}): Promise<{