ccxt 4.3.94__py2.py3-none-any.whl → 4.3.96__py2.py3-none-any.whl
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.
- ccxt/__init__.py +1 -5
- ccxt/abstract/okx.py +2 -0
- ccxt/ascendex.py +8 -6
- ccxt/async_support/__init__.py +1 -5
- ccxt/async_support/ascendex.py +9 -6
- ccxt/async_support/base/exchange.py +1 -4
- ccxt/async_support/bingx.py +1 -0
- ccxt/async_support/bitfinex.py +4 -2
- ccxt/async_support/bitfinex2.py +7 -5
- ccxt/async_support/blofin.py +0 -1
- ccxt/async_support/btcturk.py +3 -3
- ccxt/async_support/bybit.py +7 -2
- ccxt/async_support/gate.py +3 -2
- ccxt/async_support/gemini.py +3 -2
- ccxt/async_support/hyperliquid.py +311 -40
- ccxt/async_support/independentreserve.py +5 -3
- ccxt/async_support/indodax.py +2 -0
- ccxt/async_support/kucoin.py +12 -12
- ccxt/async_support/mexc.py +78 -154
- ccxt/async_support/okx.py +2 -1
- ccxt/async_support/p2b.py +0 -1
- ccxt/async_support/tradeogre.py +0 -1
- ccxt/base/exchange.py +4 -8
- ccxt/bingx.py +1 -0
- ccxt/bitfinex.py +3 -2
- ccxt/bitfinex2.py +6 -5
- ccxt/blofin.py +0 -1
- ccxt/btcturk.py +3 -3
- ccxt/bybit.py +7 -2
- ccxt/gate.py +3 -2
- ccxt/gemini.py +3 -2
- ccxt/hyperliquid.py +311 -40
- ccxt/independentreserve.py +4 -3
- ccxt/indodax.py +2 -0
- ccxt/kucoin.py +2 -2
- ccxt/mexc.py +78 -154
- ccxt/okx.py +2 -1
- ccxt/p2b.py +0 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +90 -2
- ccxt/pro/bybit.py +58 -4
- ccxt/pro/cryptocom.py +195 -0
- ccxt/pro/okx.py +238 -31
- ccxt/test/tests_async.py +3 -0
- ccxt/test/tests_sync.py +3 -0
- ccxt/tradeogre.py +0 -1
- {ccxt-4.3.94.dist-info → ccxt-4.3.96.dist-info}/METADATA +5 -5
- {ccxt-4.3.94.dist-info → ccxt-4.3.96.dist-info}/RECORD +51 -53
- ccxt/abstract/bitbay.py +0 -53
- ccxt/abstract/hitbtc3.py +0 -115
- {ccxt-4.3.94.dist-info → ccxt-4.3.96.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.94.dist-info → ccxt-4.3.96.dist-info}/WHEEL +0 -0
- {ccxt-4.3.94.dist-info → ccxt-4.3.96.dist-info}/top_level.txt +0 -0
ccxt/hyperliquid.py
CHANGED
@@ -61,14 +61,15 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
61
61
|
'fetchBorrowInterest': False,
|
62
62
|
'fetchBorrowRateHistories': False,
|
63
63
|
'fetchBorrowRateHistory': False,
|
64
|
-
'
|
64
|
+
'fetchCanceledAndClosedOrders': True,
|
65
|
+
'fetchCanceledOrders': True,
|
65
66
|
'fetchClosedOrders': True,
|
66
67
|
'fetchCrossBorrowRate': False,
|
67
68
|
'fetchCrossBorrowRates': False,
|
68
69
|
'fetchCurrencies': True,
|
69
70
|
'fetchDepositAddress': False,
|
70
71
|
'fetchDepositAddresses': False,
|
71
|
-
'fetchDeposits':
|
72
|
+
'fetchDeposits': True,
|
72
73
|
'fetchDepositWithdrawFee': 'emulated',
|
73
74
|
'fetchDepositWithdrawFees': False,
|
74
75
|
'fetchFundingHistory': False,
|
@@ -78,7 +79,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
78
79
|
'fetchIndexOHLCV': False,
|
79
80
|
'fetchIsolatedBorrowRate': False,
|
80
81
|
'fetchIsolatedBorrowRates': False,
|
81
|
-
'fetchLedger':
|
82
|
+
'fetchLedger': True,
|
82
83
|
'fetchLeverage': False,
|
83
84
|
'fetchLeverageTiers': False,
|
84
85
|
'fetchLiquidations': False,
|
@@ -94,7 +95,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
94
95
|
'fetchOpenOrders': True,
|
95
96
|
'fetchOrder': True,
|
96
97
|
'fetchOrderBook': True,
|
97
|
-
'fetchOrders':
|
98
|
+
'fetchOrders': True,
|
98
99
|
'fetchOrderTrades': False,
|
99
100
|
'fetchPosition': True,
|
100
101
|
'fetchPositionMode': False,
|
@@ -110,7 +111,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
110
111
|
'fetchTransfer': False,
|
111
112
|
'fetchTransfers': False,
|
112
113
|
'fetchWithdrawal': False,
|
113
|
-
'fetchWithdrawals':
|
114
|
+
'fetchWithdrawals': True,
|
114
115
|
'reduceMargin': True,
|
115
116
|
'repayCrossMargin': False,
|
116
117
|
'repayIsolatedMargin': False,
|
@@ -814,6 +815,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
814
815
|
self.load_markets()
|
815
816
|
market = self.market(symbol)
|
816
817
|
until = self.safe_integer(params, 'until', self.milliseconds())
|
818
|
+
useTail = (since is None)
|
817
819
|
if since is None:
|
818
820
|
since = 0
|
819
821
|
params = self.omit(params, ['until'])
|
@@ -843,7 +845,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
843
845
|
# }
|
844
846
|
# ]
|
845
847
|
#
|
846
|
-
return self.parse_ohlcvs(response, market, timeframe, since, limit)
|
848
|
+
return self.parse_ohlcvs(response, market, timeframe, since, limit, useTail)
|
847
849
|
|
848
850
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
849
851
|
#
|
@@ -1644,7 +1646,14 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1644
1646
|
# }
|
1645
1647
|
# ]
|
1646
1648
|
#
|
1647
|
-
|
1649
|
+
orderWithStatus = []
|
1650
|
+
for i in range(0, len(response)):
|
1651
|
+
order = response[i]
|
1652
|
+
extendOrder = {}
|
1653
|
+
if self.safe_string(order, 'status') is None:
|
1654
|
+
extendOrder['ccxtStatus'] = 'open'
|
1655
|
+
orderWithStatus.append(self.extend(order, extendOrder))
|
1656
|
+
return self.parse_orders(orderWithStatus, market, since, limit)
|
1648
1657
|
|
1649
1658
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1650
1659
|
"""
|
@@ -1656,8 +1665,53 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1656
1665
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
1657
1666
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1658
1667
|
"""
|
1668
|
+
self.load_markets()
|
1669
|
+
orders = self.fetch_orders(symbol, None, None, params) # don't filter here because we don't want to catch open orders
|
1670
|
+
closedOrders = self.filter_by_array(orders, 'status', ['closed'], False)
|
1671
|
+
return self.filter_by_symbol_since_limit(closedOrders, symbol, since, limit)
|
1672
|
+
|
1673
|
+
def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1674
|
+
"""
|
1675
|
+
fetch all canceled orders
|
1676
|
+
:param str symbol: unified market symbol
|
1677
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
1678
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
1679
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1680
|
+
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
1681
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1682
|
+
"""
|
1683
|
+
self.load_markets()
|
1684
|
+
orders = self.fetch_orders(symbol, None, None, params) # don't filter here because we don't want to catch open orders
|
1685
|
+
closedOrders = self.filter_by_array(orders, 'status', ['canceled'], False)
|
1686
|
+
return self.filter_by_symbol_since_limit(closedOrders, symbol, since, limit)
|
1687
|
+
|
1688
|
+
def fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1689
|
+
"""
|
1690
|
+
fetch all closed and canceled orders
|
1691
|
+
:param str symbol: unified market symbol
|
1692
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
1693
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
1694
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1695
|
+
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
1696
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1697
|
+
"""
|
1698
|
+
self.load_markets()
|
1699
|
+
orders = self.fetch_orders(symbol, None, None, params) # don't filter here because we don't want to catch open orders
|
1700
|
+
closedOrders = self.filter_by_array(orders, 'status', ['canceled', 'closed', 'rejected'], False)
|
1701
|
+
return self.filter_by_symbol_since_limit(closedOrders, symbol, since, limit)
|
1702
|
+
|
1703
|
+
def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1704
|
+
"""
|
1705
|
+
fetch all orders
|
1706
|
+
:param str symbol: unified market symbol
|
1707
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
1708
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
1709
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1710
|
+
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
1711
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1712
|
+
"""
|
1659
1713
|
userAddress = None
|
1660
|
-
userAddress, params = self.handle_public_address('
|
1714
|
+
userAddress, params = self.handle_public_address('fetchOrders', params)
|
1661
1715
|
self.load_markets()
|
1662
1716
|
market = self.safe_market(symbol)
|
1663
1717
|
request: dict = {
|
@@ -1828,20 +1882,20 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1828
1882
|
coin = self.safe_string(entry, 'coin')
|
1829
1883
|
marketId = None
|
1830
1884
|
if coin is not None:
|
1831
|
-
|
1832
|
-
marketId = coin
|
1833
|
-
else:
|
1834
|
-
marketId = coin + '/USDC:USDC'
|
1885
|
+
marketId = self.coin_to_market_id(coin)
|
1835
1886
|
if self.safe_string(entry, 'id') is None:
|
1836
1887
|
market = self.safe_market(marketId, None)
|
1837
1888
|
else:
|
1838
1889
|
market = self.safe_market(marketId, market)
|
1839
1890
|
symbol = market['symbol']
|
1840
1891
|
timestamp = self.safe_integer_2(order, 'timestamp', 'statusTimestamp')
|
1841
|
-
status = self.
|
1892
|
+
status = self.safe_string_2(order, 'status', 'ccxtStatus')
|
1893
|
+
order = self.omit(order, ['ccxtStatus'])
|
1842
1894
|
side = self.safe_string(entry, 'side')
|
1843
1895
|
if side is not None:
|
1844
1896
|
side = 'sell' if (side == 'A') else 'buy'
|
1897
|
+
totalAmount = self.safe_string_2(entry, 'origSz', 'totalSz')
|
1898
|
+
remaining = self.safe_string(entry, 'sz')
|
1845
1899
|
return self.safe_order({
|
1846
1900
|
'info': order,
|
1847
1901
|
'id': self.safe_string(entry, 'oid'),
|
@@ -1856,13 +1910,13 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1856
1910
|
'postOnly': None,
|
1857
1911
|
'reduceOnly': self.safe_bool(entry, 'reduceOnly'),
|
1858
1912
|
'side': side,
|
1859
|
-
'price': self.
|
1913
|
+
'price': self.safe_string(entry, 'limitPx'),
|
1860
1914
|
'triggerPrice': self.safe_number(entry, 'triggerPx') if self.safe_bool(entry, 'isTrigger') else None,
|
1861
|
-
'amount':
|
1915
|
+
'amount': totalAmount,
|
1862
1916
|
'cost': None,
|
1863
|
-
'average': self.
|
1864
|
-
'filled':
|
1865
|
-
'remaining':
|
1917
|
+
'average': self.safe_string(entry, 'avgPx'),
|
1918
|
+
'filled': Precise.string_sub(totalAmount, remaining),
|
1919
|
+
'remaining': remaining,
|
1866
1920
|
'status': self.parse_order_status(status),
|
1867
1921
|
'fee': None,
|
1868
1922
|
'trades': None,
|
@@ -1956,7 +2010,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1956
2010
|
price = self.safe_string(trade, 'px')
|
1957
2011
|
amount = self.safe_string(trade, 'sz')
|
1958
2012
|
coin = self.safe_string(trade, 'coin')
|
1959
|
-
marketId = coin
|
2013
|
+
marketId = self.coin_to_market_id(coin)
|
1960
2014
|
market = self.safe_market(marketId, None)
|
1961
2015
|
symbol = market['symbol']
|
1962
2016
|
id = self.safe_string(trade, 'tid')
|
@@ -2090,7 +2144,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2090
2144
|
#
|
2091
2145
|
entry = self.safe_dict(position, 'position', {})
|
2092
2146
|
coin = self.safe_string(entry, 'coin')
|
2093
|
-
marketId = coin
|
2147
|
+
marketId = self.coin_to_market_id(coin)
|
2094
2148
|
market = self.safe_market(marketId, None)
|
2095
2149
|
symbol = market['symbol']
|
2096
2150
|
leverage = self.safe_dict(entry, 'leverage', {})
|
@@ -2376,11 +2430,13 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2376
2430
|
"""
|
2377
2431
|
make a withdrawal(only support USDC)
|
2378
2432
|
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
2433
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
2379
2434
|
:param str code: unified currency code
|
2380
2435
|
:param float amount: the amount to withdraw
|
2381
2436
|
:param str address: the address to withdraw to
|
2382
2437
|
:param str tag:
|
2383
2438
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2439
|
+
:param str [params.vaultAddress]: vault address withdraw from
|
2384
2440
|
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2385
2441
|
"""
|
2386
2442
|
self.check_required_credentials()
|
@@ -2390,24 +2446,38 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2390
2446
|
code = code.upper()
|
2391
2447
|
if code != 'USDC':
|
2392
2448
|
raise NotSupported(self.id + 'withdraw() only support USDC')
|
2393
|
-
|
2449
|
+
vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
|
2450
|
+
params = self.omit(params, 'vaultAddress')
|
2394
2451
|
nonce = self.milliseconds()
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2452
|
+
action: dict = {}
|
2453
|
+
sig = None
|
2454
|
+
if vaultAddress is not None:
|
2455
|
+
action = {
|
2456
|
+
'type': 'vaultTransfer',
|
2457
|
+
'vaultAddress': '0x' + vaultAddress,
|
2458
|
+
'isDeposit': False,
|
2459
|
+
'usd': amount,
|
2460
|
+
}
|
2461
|
+
sig = self.sign_l1_action(action, nonce)
|
2462
|
+
else:
|
2463
|
+
isSandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
2464
|
+
payload: dict = {
|
2465
|
+
'hyperliquidChain': 'Testnet' if isSandboxMode else 'Mainnet',
|
2466
|
+
'destination': address,
|
2467
|
+
'amount': str(amount),
|
2468
|
+
'time': nonce,
|
2469
|
+
}
|
2470
|
+
sig = self.build_withdraw_sig(payload)
|
2471
|
+
action = {
|
2404
2472
|
'hyperliquidChain': payload['hyperliquidChain'],
|
2405
2473
|
'signatureChainId': '0x66eee', # check self out
|
2406
2474
|
'destination': address,
|
2407
2475
|
'amount': str(amount),
|
2408
2476
|
'time': nonce,
|
2409
2477
|
'type': 'withdraw3',
|
2410
|
-
}
|
2478
|
+
}
|
2479
|
+
request: dict = {
|
2480
|
+
'action': action,
|
2411
2481
|
'nonce': nonce,
|
2412
2482
|
'signature': sig,
|
2413
2483
|
}
|
@@ -2418,27 +2488,51 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2418
2488
|
#
|
2419
2489
|
# {status: 'ok', response: {type: 'default'}}
|
2420
2490
|
#
|
2491
|
+
# fetchDeposits / fetchWithdrawals
|
2492
|
+
# {
|
2493
|
+
# "time":1724762307531,
|
2494
|
+
# "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
2495
|
+
# "delta":{
|
2496
|
+
# "type":"accountClassTransfer",
|
2497
|
+
# "usdc":"50.0",
|
2498
|
+
# "toPerp":false
|
2499
|
+
# }
|
2500
|
+
# }
|
2501
|
+
#
|
2502
|
+
timestamp = self.safe_integer(transaction, 'time')
|
2503
|
+
delta = self.safe_dict(transaction, 'delta', {})
|
2504
|
+
fee = None
|
2505
|
+
feeCost = self.safe_integer(delta, 'fee')
|
2506
|
+
if feeCost is not None:
|
2507
|
+
fee = {
|
2508
|
+
'currency': 'USDC',
|
2509
|
+
'cost': feeCost,
|
2510
|
+
}
|
2511
|
+
internal = None
|
2512
|
+
type = self.safe_string(delta, 'type')
|
2513
|
+
if type is not None:
|
2514
|
+
internal = (type == 'internalTransfer')
|
2421
2515
|
return {
|
2422
2516
|
'info': transaction,
|
2423
2517
|
'id': None,
|
2424
|
-
'txid':
|
2425
|
-
'timestamp':
|
2426
|
-
'datetime':
|
2518
|
+
'txid': self.safe_string(transaction, 'hash'),
|
2519
|
+
'timestamp': timestamp,
|
2520
|
+
'datetime': self.iso8601(timestamp),
|
2427
2521
|
'network': None,
|
2428
2522
|
'address': None,
|
2429
|
-
'addressTo':
|
2430
|
-
'addressFrom':
|
2523
|
+
'addressTo': self.safe_string(delta, 'destination'),
|
2524
|
+
'addressFrom': self.safe_string(delta, 'user'),
|
2431
2525
|
'tag': None,
|
2432
2526
|
'tagTo': None,
|
2433
2527
|
'tagFrom': None,
|
2434
2528
|
'type': None,
|
2435
|
-
'amount':
|
2529
|
+
'amount': self.safe_integer(delta, 'usdc'),
|
2436
2530
|
'currency': None,
|
2437
2531
|
'status': self.safe_string(transaction, 'status'),
|
2438
2532
|
'updated': None,
|
2439
2533
|
'comment': None,
|
2440
|
-
'internal':
|
2441
|
-
'fee':
|
2534
|
+
'internal': internal,
|
2535
|
+
'fee': fee,
|
2442
2536
|
}
|
2443
2537
|
|
2444
2538
|
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
@@ -2545,6 +2639,183 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2545
2639
|
'tierBased': None,
|
2546
2640
|
}
|
2547
2641
|
|
2642
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2643
|
+
"""
|
2644
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2645
|
+
:param str code: unified currency code
|
2646
|
+
:param int [since]: timestamp in ms of the earliest ledger entry
|
2647
|
+
:param int [limit]: max number of ledger entrys to return
|
2648
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2649
|
+
:param int [params.until]: timestamp in ms of the latest ledger entry
|
2650
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
2651
|
+
"""
|
2652
|
+
self.load_markets()
|
2653
|
+
userAddress = None
|
2654
|
+
userAddress, params = self.handle_public_address('fetchLedger', params)
|
2655
|
+
request: dict = {
|
2656
|
+
'type': 'userNonFundingLedgerUpdates',
|
2657
|
+
'user': userAddress,
|
2658
|
+
}
|
2659
|
+
if since is not None:
|
2660
|
+
request['startTime'] = since
|
2661
|
+
until = self.safe_integer(params, 'until')
|
2662
|
+
if until is not None:
|
2663
|
+
request['endTime'] = until
|
2664
|
+
params = self.omit(params, ['until'])
|
2665
|
+
response = self.publicPostInfo(self.extend(request, params))
|
2666
|
+
#
|
2667
|
+
# [
|
2668
|
+
# {
|
2669
|
+
# "time":1724762307531,
|
2670
|
+
# "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
2671
|
+
# "delta":{
|
2672
|
+
# "type":"accountClassTransfer",
|
2673
|
+
# "usdc":"50.0",
|
2674
|
+
# "toPerp":false
|
2675
|
+
# }
|
2676
|
+
# }
|
2677
|
+
# ]
|
2678
|
+
#
|
2679
|
+
return self.parse_ledger(response, None, since, limit)
|
2680
|
+
|
2681
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2682
|
+
#
|
2683
|
+
# {
|
2684
|
+
# "time":1724762307531,
|
2685
|
+
# "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
2686
|
+
# "delta":{
|
2687
|
+
# "type":"accountClassTransfer",
|
2688
|
+
# "usdc":"50.0",
|
2689
|
+
# "toPerp":false
|
2690
|
+
# }
|
2691
|
+
# }
|
2692
|
+
#
|
2693
|
+
timestamp = self.safe_integer(item, 'time')
|
2694
|
+
delta = self.safe_dict(item, 'delta', {})
|
2695
|
+
fee = None
|
2696
|
+
feeCost = self.safe_integer(delta, 'fee')
|
2697
|
+
if feeCost is not None:
|
2698
|
+
fee = {
|
2699
|
+
'currency': 'USDC',
|
2700
|
+
'cost': feeCost,
|
2701
|
+
}
|
2702
|
+
type = self.safe_string(delta, 'type')
|
2703
|
+
amount = self.safe_string(delta, 'usdc')
|
2704
|
+
return {
|
2705
|
+
'id': self.safe_string(item, 'hash'),
|
2706
|
+
'direction': None,
|
2707
|
+
'account': None,
|
2708
|
+
'referenceAccount': self.safe_string(delta, 'user'),
|
2709
|
+
'referenceId': self.safe_string(item, 'hash'),
|
2710
|
+
'type': self.parse_ledger_entry_type(type),
|
2711
|
+
'currency': None,
|
2712
|
+
'amount': self.parse_number(amount),
|
2713
|
+
'timestamp': timestamp,
|
2714
|
+
'datetime': self.iso8601(timestamp),
|
2715
|
+
'before': None,
|
2716
|
+
'after': None,
|
2717
|
+
'status': None,
|
2718
|
+
'fee': fee,
|
2719
|
+
'info': item,
|
2720
|
+
}
|
2721
|
+
|
2722
|
+
def parse_ledger_entry_type(self, type):
|
2723
|
+
ledgerType: dict = {
|
2724
|
+
'internalTransfer': 'transfer',
|
2725
|
+
'accountClassTransfer': 'transfer',
|
2726
|
+
}
|
2727
|
+
return self.safe_string(ledgerType, type, type)
|
2728
|
+
|
2729
|
+
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2730
|
+
"""
|
2731
|
+
fetch all deposits made to an account
|
2732
|
+
:param str code: unified currency code
|
2733
|
+
:param int [since]: the earliest time in ms to fetch deposits for
|
2734
|
+
:param int [limit]: the maximum number of deposits structures to retrieve
|
2735
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2736
|
+
:param int [params.until]: the latest time in ms to fetch withdrawals for
|
2737
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2738
|
+
"""
|
2739
|
+
self.load_markets()
|
2740
|
+
userAddress = None
|
2741
|
+
userAddress, params = self.handle_public_address('fetchDepositsWithdrawals', params)
|
2742
|
+
request: dict = {
|
2743
|
+
'type': 'userNonFundingLedgerUpdates',
|
2744
|
+
'user': userAddress,
|
2745
|
+
}
|
2746
|
+
if since is not None:
|
2747
|
+
request['startTime'] = since
|
2748
|
+
until = self.safe_integer(params, 'until')
|
2749
|
+
if until is not None:
|
2750
|
+
request['endTime'] = until
|
2751
|
+
params = self.omit(params, ['until'])
|
2752
|
+
response = self.publicPostInfo(self.extend(request, params))
|
2753
|
+
#
|
2754
|
+
# [
|
2755
|
+
# {
|
2756
|
+
# "time":1724762307531,
|
2757
|
+
# "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
2758
|
+
# "delta":{
|
2759
|
+
# "type":"accountClassTransfer",
|
2760
|
+
# "usdc":"50.0",
|
2761
|
+
# "toPerp":false
|
2762
|
+
# }
|
2763
|
+
# }
|
2764
|
+
# ]
|
2765
|
+
#
|
2766
|
+
records = self.extract_type_from_delta(response)
|
2767
|
+
deposits = self.filter_by_array(records, 'type', ['deposit'], False)
|
2768
|
+
return self.parse_transactions(deposits, None, since, limit)
|
2769
|
+
|
2770
|
+
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
2771
|
+
"""
|
2772
|
+
fetch all withdrawals made from an account
|
2773
|
+
:param str code: unified currency code
|
2774
|
+
:param int [since]: the earliest time in ms to fetch withdrawals for
|
2775
|
+
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
2776
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2777
|
+
:param int [params.until]: the latest time in ms to fetch withdrawals for
|
2778
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2779
|
+
"""
|
2780
|
+
self.load_markets()
|
2781
|
+
userAddress = None
|
2782
|
+
userAddress, params = self.handle_public_address('fetchDepositsWithdrawals', params)
|
2783
|
+
request: dict = {
|
2784
|
+
'type': 'userNonFundingLedgerUpdates',
|
2785
|
+
'user': userAddress,
|
2786
|
+
}
|
2787
|
+
if since is not None:
|
2788
|
+
request['startTime'] = since
|
2789
|
+
until = self.safe_integer(params, 'until')
|
2790
|
+
if until is not None:
|
2791
|
+
request['endTime'] = until
|
2792
|
+
params = self.omit(params, ['until'])
|
2793
|
+
response = self.publicPostInfo(self.extend(request, params))
|
2794
|
+
#
|
2795
|
+
# [
|
2796
|
+
# {
|
2797
|
+
# "time":1724762307531,
|
2798
|
+
# "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
2799
|
+
# "delta":{
|
2800
|
+
# "type":"accountClassTransfer",
|
2801
|
+
# "usdc":"50.0",
|
2802
|
+
# "toPerp":false
|
2803
|
+
# }
|
2804
|
+
# }
|
2805
|
+
# ]
|
2806
|
+
#
|
2807
|
+
records = self.extract_type_from_delta(response)
|
2808
|
+
withdrawals = self.filter_by_array(records, 'type', ['withdraw'], False)
|
2809
|
+
return self.parse_transactions(withdrawals, None, since, limit)
|
2810
|
+
|
2811
|
+
def extract_type_from_delta(self, data=[]):
|
2812
|
+
records = []
|
2813
|
+
for i in range(0, len(data)):
|
2814
|
+
record = data[i]
|
2815
|
+
record['type'] = record['delta']['type']
|
2816
|
+
records.append(record)
|
2817
|
+
return records
|
2818
|
+
|
2548
2819
|
def format_vault_address(self, address: Str = None):
|
2549
2820
|
if address is None:
|
2550
2821
|
return None
|
@@ -2564,7 +2835,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2564
2835
|
raise ArgumentsRequired(self.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set')
|
2565
2836
|
|
2566
2837
|
def coin_to_market_id(self, coin: Str):
|
2567
|
-
if coin.find('/') > -1:
|
2838
|
+
if coin.find('/') > -1 or coin.find('@') > -1:
|
2568
2839
|
return coin # spot
|
2569
2840
|
return coin + '/USDC:USDC'
|
2570
2841
|
|
ccxt/independentreserve.py
CHANGED
@@ -154,11 +154,12 @@ class independentreserve(Exchange, ImplicitAPI):
|
|
154
154
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
155
155
|
:returns dict[]: an array of objects representing market data
|
156
156
|
"""
|
157
|
-
|
157
|
+
baseCurrenciesPromise = self.publicGetGetValidPrimaryCurrencyCodes(params)
|
158
158
|
# ['Xbt', 'Eth', 'Usdt', ...]
|
159
|
-
|
159
|
+
quoteCurrenciesPromise = self.publicGetGetValidSecondaryCurrencyCodes(params)
|
160
160
|
# ['Aud', 'Usd', 'Nzd', 'Sgd']
|
161
|
-
|
161
|
+
limitsPromise = self.publicGetGetOrderMinimumVolumes(params)
|
162
|
+
baseCurrencies, quoteCurrencies, limits = [baseCurrenciesPromise, quoteCurrenciesPromise, limitsPromise]
|
162
163
|
#
|
163
164
|
# {
|
164
165
|
# "Xbt": 0.0001,
|
ccxt/indodax.py
CHANGED
@@ -831,6 +831,8 @@ class indodax(Exchange, ImplicitAPI):
|
|
831
831
|
elif type == 'limit':
|
832
832
|
priceIsRequired = True
|
833
833
|
quantityIsRequired = True
|
834
|
+
if side == 'buy':
|
835
|
+
request[market['quoteId']] = self.parse_to_numeric(Precise.string_mul(self.number_to_string(amount), self.number_to_string(price)))
|
834
836
|
if priceIsRequired:
|
835
837
|
if price is None:
|
836
838
|
raise InvalidOrder(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
|
ccxt/kucoin.py
CHANGED
@@ -644,6 +644,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
644
644
|
'KALT': 'ALT', # ALTLAYER
|
645
645
|
},
|
646
646
|
'options': {
|
647
|
+
'hf': False,
|
647
648
|
'version': 'v1',
|
648
649
|
'symbolSeparator': '-',
|
649
650
|
'fetchMyTradesMethod': 'private_get_fills',
|
@@ -1228,8 +1229,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1228
1229
|
self.options['hfMigrated'] = (status == 2)
|
1229
1230
|
|
1230
1231
|
def handle_hf_and_params(self, params={}):
|
1231
|
-
self.
|
1232
|
-
migrated: Bool = self.safe_bool(self.options, 'hfMigrated')
|
1232
|
+
migrated: Bool = self.safe_bool_2(self.options, 'hfMigrated', 'hf', False)
|
1233
1233
|
loadedHf: Bool = None
|
1234
1234
|
if migrated is not None:
|
1235
1235
|
if migrated:
|