ccxt 4.3.30__py2.py3-none-any.whl → 4.3.31__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 -1
- ccxt/abstract/binance.py +2 -0
- ccxt/abstract/binancecoinm.py +2 -0
- ccxt/abstract/binanceus.py +2 -0
- ccxt/abstract/binanceusdm.py +2 -0
- ccxt/ace.py +14 -14
- ccxt/alpaca.py +16 -16
- ccxt/ascendex.py +46 -46
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +14 -14
- ccxt/async_support/alpaca.py +16 -16
- ccxt/async_support/ascendex.py +46 -46
- ccxt/async_support/base/exchange.py +23 -23
- ccxt/async_support/bigone.py +32 -32
- ccxt/async_support/binance.py +105 -96
- ccxt/async_support/bingx.py +21 -21
- ccxt/async_support/bit2c.py +13 -13
- ccxt/async_support/bitbank.py +19 -19
- ccxt/async_support/bitbns.py +17 -17
- ccxt/async_support/bitfinex.py +24 -24
- ccxt/async_support/bitfinex2.py +142 -109
- ccxt/async_support/bitflyer.py +23 -23
- ccxt/async_support/bitget.py +76 -76
- ccxt/async_support/bithumb.py +20 -20
- ccxt/async_support/bitmart.py +55 -55
- ccxt/async_support/bitmex.py +41 -41
- ccxt/async_support/bitopro.py +30 -30
- ccxt/async_support/bitrue.py +37 -37
- ccxt/async_support/bitso.py +30 -30
- ccxt/async_support/bitstamp.py +31 -31
- ccxt/async_support/bitteam.py +26 -26
- ccxt/async_support/bitvavo.py +27 -27
- ccxt/async_support/bl3p.py +8 -8
- ccxt/async_support/blockchaincom.py +24 -24
- ccxt/async_support/blofin.py +37 -37
- ccxt/async_support/btcalpha.py +19 -19
- ccxt/async_support/btcbox.py +11 -11
- ccxt/async_support/btcmarkets.py +22 -22
- ccxt/async_support/btcturk.py +13 -13
- ccxt/async_support/bybit.py +96 -96
- ccxt/async_support/cex.py +21 -21
- ccxt/async_support/coinbase.py +53 -53
- ccxt/async_support/coinbaseexchange.py +29 -29
- ccxt/async_support/coinbaseinternational.py +32 -32
- ccxt/async_support/coincheck.py +14 -14
- ccxt/async_support/coinex.py +168 -139
- ccxt/async_support/coinlist.py +35 -35
- ccxt/async_support/coinmate.py +22 -22
- ccxt/async_support/coinmetro.py +22 -22
- ccxt/async_support/coinone.py +18 -18
- ccxt/async_support/coinsph.py +32 -32
- ccxt/async_support/coinspot.py +8 -8
- ccxt/async_support/cryptocom.py +43 -43
- ccxt/async_support/currencycom.py +33 -33
- ccxt/async_support/delta.py +35 -35
- ccxt/async_support/deribit.py +54 -54
- ccxt/async_support/digifinex.py +56 -56
- ccxt/async_support/exmo.py +34 -34
- ccxt/async_support/gate.py +60 -60
- ccxt/async_support/gemini.py +24 -24
- ccxt/async_support/hitbtc.py +51 -51
- ccxt/async_support/hollaex.py +29 -29
- ccxt/async_support/htx.py +73 -73
- ccxt/async_support/huobijp.py +30 -30
- ccxt/async_support/hyperliquid.py +58 -58
- ccxt/async_support/idex.py +33 -33
- ccxt/async_support/independentreserve.py +12 -12
- ccxt/async_support/indodax.py +21 -21
- ccxt/async_support/kraken.py +46 -51
- ccxt/async_support/krakenfutures.py +29 -29
- ccxt/async_support/kucoin.py +51 -51
- ccxt/async_support/kucoinfutures.py +33 -33
- ccxt/async_support/kuna.py +27 -27
- ccxt/async_support/latoken.py +27 -27
- ccxt/async_support/lbank.py +35 -35
- ccxt/async_support/luno.py +19 -19
- ccxt/async_support/lykke.py +20 -20
- ccxt/async_support/mercado.py +17 -17
- ccxt/async_support/mexc.py +64 -64
- ccxt/async_support/ndax.py +38 -38
- ccxt/async_support/novadax.py +26 -26
- ccxt/async_support/oceanex.py +21 -21
- ccxt/async_support/okcoin.py +35 -35
- ccxt/async_support/okx.py +85 -85
- ccxt/async_support/onetrading.py +32 -32
- ccxt/async_support/p2b.py +14 -14
- ccxt/async_support/paymium.py +12 -12
- ccxt/async_support/phemex.py +50 -50
- ccxt/async_support/poloniex.py +35 -35
- ccxt/async_support/poloniexfutures.py +25 -21
- ccxt/async_support/probit.py +30 -30
- ccxt/async_support/timex.py +22 -22
- ccxt/async_support/tokocrypto.py +26 -26
- ccxt/async_support/tradeogre.py +12 -12
- ccxt/async_support/upbit.py +28 -28
- ccxt/async_support/wavesexchange.py +33 -33
- ccxt/async_support/wazirx.py +21 -21
- ccxt/async_support/whitebit.py +37 -37
- ccxt/async_support/woo.py +51 -51
- ccxt/async_support/woofipro.py +46 -46
- ccxt/async_support/yobit.py +20 -20
- ccxt/async_support/zaif.py +12 -12
- ccxt/async_support/zonda.py +22 -22
- ccxt/base/exchange.py +35 -35
- ccxt/base/types.py +13 -0
- ccxt/bigone.py +32 -32
- ccxt/binance.py +105 -96
- ccxt/bingx.py +21 -21
- ccxt/bit2c.py +13 -13
- ccxt/bitbank.py +19 -19
- ccxt/bitbns.py +17 -17
- ccxt/bitfinex.py +24 -24
- ccxt/bitfinex2.py +142 -109
- ccxt/bitflyer.py +23 -23
- ccxt/bitget.py +76 -76
- ccxt/bithumb.py +20 -20
- ccxt/bitmart.py +55 -55
- ccxt/bitmex.py +41 -41
- ccxt/bitopro.py +30 -30
- ccxt/bitrue.py +37 -37
- ccxt/bitso.py +30 -30
- ccxt/bitstamp.py +31 -31
- ccxt/bitteam.py +26 -26
- ccxt/bitvavo.py +27 -27
- ccxt/bl3p.py +8 -8
- ccxt/blockchaincom.py +24 -24
- ccxt/blofin.py +37 -37
- ccxt/btcalpha.py +19 -19
- ccxt/btcbox.py +11 -11
- ccxt/btcmarkets.py +22 -22
- ccxt/btcturk.py +13 -13
- ccxt/bybit.py +96 -96
- ccxt/cex.py +21 -21
- ccxt/coinbase.py +53 -53
- ccxt/coinbaseexchange.py +29 -29
- ccxt/coinbaseinternational.py +32 -32
- ccxt/coincheck.py +14 -14
- ccxt/coinex.py +168 -139
- ccxt/coinlist.py +35 -35
- ccxt/coinmate.py +22 -22
- ccxt/coinmetro.py +22 -22
- ccxt/coinone.py +18 -18
- ccxt/coinsph.py +32 -32
- ccxt/coinspot.py +8 -8
- ccxt/cryptocom.py +43 -43
- ccxt/currencycom.py +33 -33
- ccxt/delta.py +35 -35
- ccxt/deribit.py +54 -54
- ccxt/digifinex.py +56 -56
- ccxt/exmo.py +34 -34
- ccxt/gate.py +60 -60
- ccxt/gemini.py +24 -24
- ccxt/hitbtc.py +51 -51
- ccxt/hollaex.py +29 -29
- ccxt/htx.py +73 -73
- ccxt/huobijp.py +30 -30
- ccxt/hyperliquid.py +58 -58
- ccxt/idex.py +33 -33
- ccxt/independentreserve.py +12 -12
- ccxt/indodax.py +21 -21
- ccxt/kraken.py +46 -51
- ccxt/krakenfutures.py +29 -29
- ccxt/kucoin.py +51 -51
- ccxt/kucoinfutures.py +33 -33
- ccxt/kuna.py +27 -27
- ccxt/latoken.py +27 -27
- ccxt/lbank.py +35 -35
- ccxt/luno.py +19 -19
- ccxt/lykke.py +20 -20
- ccxt/mercado.py +17 -17
- ccxt/mexc.py +64 -64
- ccxt/ndax.py +38 -38
- ccxt/novadax.py +26 -26
- ccxt/oceanex.py +21 -21
- ccxt/okcoin.py +35 -35
- ccxt/okx.py +85 -85
- ccxt/onetrading.py +32 -32
- ccxt/p2b.py +14 -14
- ccxt/paymium.py +12 -12
- ccxt/phemex.py +50 -50
- ccxt/poloniex.py +35 -35
- ccxt/poloniexfutures.py +25 -21
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +8 -8
- ccxt/pro/ascendex.py +4 -4
- ccxt/pro/binance.py +56 -56
- ccxt/pro/bingx.py +5 -5
- ccxt/pro/bitfinex.py +6 -6
- ccxt/pro/bitfinex2.py +10 -10
- ccxt/pro/bitget.py +17 -17
- ccxt/pro/bithumb.py +6 -6
- ccxt/pro/bitmart.py +8 -8
- ccxt/pro/bitmex.py +16 -16
- ccxt/pro/bitopro.py +4 -4
- ccxt/pro/bitrue.py +8 -8
- ccxt/pro/bitstamp.py +5 -5
- ccxt/pro/bitvavo.py +14 -14
- ccxt/pro/blockchaincom.py +7 -7
- ccxt/pro/bybit.py +12 -12
- ccxt/pro/cex.py +19 -19
- ccxt/pro/coinbase.py +2 -2
- ccxt/pro/coinbaseexchange.py +10 -10
- ccxt/pro/coinbaseinternational.py +4 -4
- ccxt/pro/coincheck.py +2 -2
- ccxt/pro/coinex.py +15 -15
- ccxt/pro/coinone.py +4 -4
- ccxt/pro/cryptocom.py +11 -11
- ccxt/pro/currencycom.py +4 -4
- ccxt/pro/deribit.py +9 -9
- ccxt/pro/exmo.py +9 -9
- ccxt/pro/gate.py +12 -12
- ccxt/pro/gemini.py +11 -11
- ccxt/pro/hitbtc.py +13 -13
- ccxt/pro/hollaex.py +6 -6
- ccxt/pro/htx.py +15 -15
- ccxt/pro/huobijp.py +16 -16
- ccxt/pro/hyperliquid.py +9 -9
- ccxt/pro/idex.py +12 -12
- ccxt/pro/independentreserve.py +2 -2
- ccxt/pro/kraken.py +14 -14
- ccxt/pro/krakenfutures.py +12 -12
- ccxt/pro/kucoin.py +12 -12
- ccxt/pro/kucoinfutures.py +16 -16
- ccxt/pro/lbank.py +12 -12
- ccxt/pro/luno.py +4 -4
- ccxt/pro/mexc.py +14 -14
- ccxt/pro/ndax.py +12 -12
- ccxt/pro/okcoin.py +6 -6
- ccxt/pro/okx.py +30 -30
- ccxt/pro/onetrading.py +13 -13
- ccxt/pro/p2b.py +2 -2
- ccxt/pro/phemex.py +9 -9
- ccxt/pro/poloniex.py +9 -9
- ccxt/pro/poloniexfutures.py +10 -10
- ccxt/pro/probit.py +8 -8
- ccxt/pro/upbit.py +1 -1
- ccxt/pro/wazirx.py +10 -10
- ccxt/pro/whitebit.py +8 -8
- ccxt/pro/woo.py +14 -14
- ccxt/pro/woofipro.py +14 -14
- ccxt/probit.py +30 -30
- ccxt/test/base/test_shared_methods.py +1 -0
- ccxt/timex.py +22 -22
- ccxt/tokocrypto.py +26 -26
- ccxt/tradeogre.py +12 -12
- ccxt/upbit.py +28 -28
- ccxt/wavesexchange.py +33 -33
- ccxt/wazirx.py +21 -21
- ccxt/whitebit.py +37 -37
- ccxt/woo.py +51 -51
- ccxt/woofipro.py +46 -46
- ccxt/yobit.py +20 -20
- ccxt/zaif.py +12 -12
- ccxt/zonda.py +22 -22
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/METADATA +4 -4
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/RECORD +258 -258
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/WHEEL +0 -0
- {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/top_level.txt +0 -0
ccxt/hyperliquid.py
CHANGED
@@ -218,7 +218,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
218
218
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
219
219
|
:returns dict: an associative dictionary of currencies
|
220
220
|
"""
|
221
|
-
request = {
|
221
|
+
request: dict = {
|
222
222
|
'type': 'meta',
|
223
223
|
}
|
224
224
|
response = self.publicPostInfo(self.extend(request, params))
|
@@ -237,7 +237,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
237
237
|
# ]
|
238
238
|
#
|
239
239
|
meta = self.safe_list(response, 'universe', [])
|
240
|
-
result = {}
|
240
|
+
result: dict = {}
|
241
241
|
for i in range(0, len(meta)):
|
242
242
|
data = self.safe_dict(meta, i, {})
|
243
243
|
id = i
|
@@ -282,7 +282,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
282
282
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
283
283
|
:returns dict[]: an array of objects representing market data
|
284
284
|
"""
|
285
|
-
request = {
|
285
|
+
request: dict = {
|
286
286
|
'type': 'metaAndAssetCtxs',
|
287
287
|
}
|
288
288
|
response = self.publicPostInfo(self.extend(request, params))
|
@@ -337,7 +337,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
337
337
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
338
338
|
:returns dict[]: an array of objects representing market data
|
339
339
|
"""
|
340
|
-
request = {
|
340
|
+
request: dict = {
|
341
341
|
'type': 'spotMetaAndAssetCtxs',
|
342
342
|
}
|
343
343
|
response = self.publicPostInfo(self.extend(request, params))
|
@@ -622,7 +622,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
622
622
|
type, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
623
623
|
isSpot = (type == 'spot')
|
624
624
|
reqType = 'spotClearinghouseState' if (isSpot) else 'clearinghouseState'
|
625
|
-
request = {
|
625
|
+
request: dict = {
|
626
626
|
'type': reqType,
|
627
627
|
'user': userAddress,
|
628
628
|
}
|
@@ -664,7 +664,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
664
664
|
#
|
665
665
|
balances = self.safe_list(response, 'balances')
|
666
666
|
if balances is not None:
|
667
|
-
spotBalances = {'info': response}
|
667
|
+
spotBalances: dict = {'info': response}
|
668
668
|
for i in range(0, len(balances)):
|
669
669
|
balance = balances[i]
|
670
670
|
code = self.safe_currency_code(self.safe_string(balance, 'coin'))
|
@@ -676,7 +676,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
676
676
|
spotBalances[code] = account
|
677
677
|
return self.safe_balance(spotBalances)
|
678
678
|
data = self.safe_dict(response, 'marginSummary', {})
|
679
|
-
result = {
|
679
|
+
result: dict = {
|
680
680
|
'info': response,
|
681
681
|
'USDC': {
|
682
682
|
'total': self.safe_float(data, 'accountValue'),
|
@@ -699,7 +699,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
699
699
|
"""
|
700
700
|
self.load_markets()
|
701
701
|
market = self.market(symbol)
|
702
|
-
request = {
|
702
|
+
request: dict = {
|
703
703
|
'type': 'l2Book',
|
704
704
|
'coin': market['base'] if market['swap'] else market['id'],
|
705
705
|
}
|
@@ -727,7 +727,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
727
727
|
# }
|
728
728
|
#
|
729
729
|
data = self.safe_list(response, 'levels', [])
|
730
|
-
result = {
|
730
|
+
result: dict = {
|
731
731
|
'bids': self.safe_list(data, 0, []),
|
732
732
|
'asks': self.safe_list(data, 1, []),
|
733
733
|
}
|
@@ -754,7 +754,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
754
754
|
if limit is None:
|
755
755
|
limit = 500
|
756
756
|
params = self.omit(params, ['until'])
|
757
|
-
request = {
|
757
|
+
request: dict = {
|
758
758
|
'type': 'candleSnapshot',
|
759
759
|
'req': {
|
760
760
|
'coin': market['base'] if market['swap'] else market['id'],
|
@@ -824,7 +824,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
824
824
|
userAddress, params = self.handle_public_address('fetchTrades', params)
|
825
825
|
self.load_markets()
|
826
826
|
market = self.safe_market(symbol)
|
827
|
-
request = {
|
827
|
+
request: dict = {
|
828
828
|
'user': userAddress,
|
829
829
|
}
|
830
830
|
if since is not None:
|
@@ -908,7 +908,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
908
908
|
hash = self.action_hash(action, vaultAdress, nonce)
|
909
909
|
isTestnet = self.safe_bool(self.options, 'sandboxMode', False)
|
910
910
|
phantomAgent = self.construct_phantom_agent(hash, isTestnet)
|
911
|
-
# data = {
|
911
|
+
# data: Dict = {
|
912
912
|
# 'domain': {
|
913
913
|
# 'chainId': 1337,
|
914
914
|
# 'name': 'Exchange',
|
@@ -932,13 +932,13 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
932
932
|
# }
|
933
933
|
zeroAddress = self.safe_string(self.options, 'zeroAddress')
|
934
934
|
chainId = 1337 # check self out
|
935
|
-
domain = {
|
935
|
+
domain: dict = {
|
936
936
|
'chainId': chainId,
|
937
937
|
'name': 'Exchange',
|
938
938
|
'verifyingContract': zeroAddress,
|
939
939
|
'version': '1',
|
940
940
|
}
|
941
|
-
messageTypes = {
|
941
|
+
messageTypes: dict = {
|
942
942
|
'Agent': [
|
943
943
|
{'name': 'source', 'type': 'string'},
|
944
944
|
{'name': 'connectionId', 'type': 'bytes32'},
|
@@ -950,7 +950,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
950
950
|
|
951
951
|
def build_sig(self, chainId, messageTypes, message):
|
952
952
|
zeroAddress = self.safe_string(self.options, 'zeroAddress')
|
953
|
-
domain = {
|
953
|
+
domain: dict = {
|
954
954
|
'chainId': chainId,
|
955
955
|
'name': 'Exchange',
|
956
956
|
'verifyingContract': zeroAddress,
|
@@ -963,7 +963,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
963
963
|
def build_transfer_sig(self, message):
|
964
964
|
isSandboxMode = self.safe_bool(self.options, 'sandboxMode')
|
965
965
|
chainId = 421614 if (isSandboxMode) else 42161
|
966
|
-
messageTypes = {
|
966
|
+
messageTypes: dict = {
|
967
967
|
'UsdTransferSignPayload': [
|
968
968
|
{'name': 'destination', 'type': 'string'},
|
969
969
|
{'name': 'amount', 'type': 'string'},
|
@@ -975,7 +975,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
975
975
|
def build_withdraw_sig(self, message):
|
976
976
|
isSandboxMode = self.safe_bool(self.options, 'sandboxMode')
|
977
977
|
chainId = 421614 if (isSandboxMode) else 42161
|
978
|
-
messageTypes = {
|
978
|
+
messageTypes: dict = {
|
979
979
|
'WithdrawFromBridge2SignPayload': [
|
980
980
|
{'name': 'destination', 'type': 'string'},
|
981
981
|
{'name': 'usd', 'type': 'string'},
|
@@ -1016,7 +1016,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1016
1016
|
'price': price,
|
1017
1017
|
'params': params,
|
1018
1018
|
}
|
1019
|
-
globalParams = {}
|
1019
|
+
globalParams: dict = {}
|
1020
1020
|
if vaultAddress is not None:
|
1021
1021
|
globalParams['vaultAddress'] = vaultAddress
|
1022
1022
|
response = self.create_orders([order], globalParams)
|
@@ -1085,7 +1085,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1085
1085
|
px = self.price_to_precision(symbol, price)
|
1086
1086
|
sz = self.amount_to_precision(symbol, amount)
|
1087
1087
|
reduceOnly = self.safe_bool(orderParams, 'reduceOnly', False)
|
1088
|
-
orderType = {}
|
1088
|
+
orderType: dict = {}
|
1089
1089
|
if isTrigger:
|
1090
1090
|
isTp = False
|
1091
1091
|
if takeProfitPrice is not None:
|
@@ -1103,7 +1103,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1103
1103
|
'tif': timeInForce,
|
1104
1104
|
}
|
1105
1105
|
orderParams = self.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly'])
|
1106
|
-
orderObj = {
|
1106
|
+
orderObj: dict = {
|
1107
1107
|
'a': self.parse_to_int(market['baseId']),
|
1108
1108
|
'b': isBuy,
|
1109
1109
|
'p': px,
|
@@ -1116,7 +1116,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1116
1116
|
orderObj['c'] = clientOrderId
|
1117
1117
|
orderReq.append(self.extend(orderObj, orderParams))
|
1118
1118
|
vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
|
1119
|
-
orderAction = {
|
1119
|
+
orderAction: dict = {
|
1120
1120
|
'type': 'order',
|
1121
1121
|
'orders': orderReq,
|
1122
1122
|
'grouping': 'na',
|
@@ -1125,7 +1125,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1125
1125
|
if vaultAddress is None:
|
1126
1126
|
orderAction['brokerCode'] = 1
|
1127
1127
|
signature = self.sign_l1_action(orderAction, nonce, vaultAddress)
|
1128
|
-
request = {
|
1128
|
+
request: dict = {
|
1129
1129
|
'action': orderAction,
|
1130
1130
|
'nonce': nonce,
|
1131
1131
|
'signature': signature,
|
@@ -1191,12 +1191,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1191
1191
|
clientOrderId = self.safe_value_2(params, 'clientOrderId', 'client_id')
|
1192
1192
|
params = self.omit(params, ['clientOrderId', 'client_id'])
|
1193
1193
|
nonce = self.milliseconds()
|
1194
|
-
request = {
|
1194
|
+
request: dict = {
|
1195
1195
|
'nonce': nonce,
|
1196
1196
|
# 'vaultAddress': vaultAddress,
|
1197
1197
|
}
|
1198
1198
|
cancelReq = []
|
1199
|
-
cancelAction = {
|
1199
|
+
cancelAction: dict = {
|
1200
1200
|
'type': '',
|
1201
1201
|
'cancels': [],
|
1202
1202
|
}
|
@@ -1254,12 +1254,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1254
1254
|
self.check_required_credentials()
|
1255
1255
|
self.load_markets()
|
1256
1256
|
nonce = self.milliseconds()
|
1257
|
-
request = {
|
1257
|
+
request: dict = {
|
1258
1258
|
'nonce': nonce,
|
1259
1259
|
# 'vaultAddress': vaultAddress,
|
1260
1260
|
}
|
1261
1261
|
cancelReq = []
|
1262
|
-
cancelAction = {
|
1262
|
+
cancelAction: dict = {
|
1263
1263
|
'type': '',
|
1264
1264
|
'cancels': [],
|
1265
1265
|
}
|
@@ -1278,7 +1278,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1278
1278
|
assetKey = 'asset' if cancelByCloid else 'a'
|
1279
1279
|
idKey = 'cloid' if cancelByCloid else 'o'
|
1280
1280
|
market = self.market(symbol)
|
1281
|
-
cancelObj = {}
|
1281
|
+
cancelObj: dict = {}
|
1282
1282
|
cancelObj[assetKey] = self.parse_to_numeric(market['baseId'])
|
1283
1283
|
cancelObj[idKey] = clientOrderId if cancelByCloid else self.parse_to_numeric(id)
|
1284
1284
|
cancelReq.append(cancelObj)
|
@@ -1319,11 +1319,11 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1319
1319
|
self.load_markets()
|
1320
1320
|
params = self.omit(params, ['clientOrderId', 'client_id'])
|
1321
1321
|
nonce = self.milliseconds()
|
1322
|
-
request = {
|
1322
|
+
request: dict = {
|
1323
1323
|
'nonce': nonce,
|
1324
1324
|
# 'vaultAddress': vaultAddress,
|
1325
1325
|
}
|
1326
|
-
cancelAction = {
|
1326
|
+
cancelAction: dict = {
|
1327
1327
|
'type': 'scheduleCancel',
|
1328
1328
|
'time': nonce + timeout,
|
1329
1329
|
}
|
@@ -1393,7 +1393,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1393
1393
|
px = self.price_to_precision(symbol, str(price))
|
1394
1394
|
sz = self.amount_to_precision(symbol, amount)
|
1395
1395
|
reduceOnly = self.safe_bool(params, 'reduceOnly', False)
|
1396
|
-
orderType = {}
|
1396
|
+
orderType: dict = {}
|
1397
1397
|
if isTrigger:
|
1398
1398
|
isTp = False
|
1399
1399
|
if takeProfitPrice is not None:
|
@@ -1413,7 +1413,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1413
1413
|
if triggerPrice is None:
|
1414
1414
|
triggerPrice = '0'
|
1415
1415
|
nonce = self.milliseconds()
|
1416
|
-
orderReq = {
|
1416
|
+
orderReq: dict = {
|
1417
1417
|
'a': self.parse_to_int(market['baseId']),
|
1418
1418
|
'b': isBuy,
|
1419
1419
|
'p': px,
|
@@ -1424,17 +1424,17 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1424
1424
|
}
|
1425
1425
|
if clientOrderId is not None:
|
1426
1426
|
orderReq['c'] = clientOrderId
|
1427
|
-
modifyReq = {
|
1427
|
+
modifyReq: dict = {
|
1428
1428
|
'oid': self.parse_to_int(id),
|
1429
1429
|
'order': orderReq,
|
1430
1430
|
}
|
1431
|
-
modifyAction = {
|
1431
|
+
modifyAction: dict = {
|
1432
1432
|
'type': 'batchModify',
|
1433
1433
|
'modifies': [modifyReq],
|
1434
1434
|
}
|
1435
1435
|
vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
|
1436
1436
|
signature = self.sign_l1_action(modifyAction, nonce, vaultAddress)
|
1437
|
-
request = {
|
1437
|
+
request: dict = {
|
1438
1438
|
'action': modifyAction,
|
1439
1439
|
'nonce': nonce,
|
1440
1440
|
'signature': signature,
|
@@ -1498,7 +1498,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1498
1498
|
"""
|
1499
1499
|
self.load_markets()
|
1500
1500
|
market = self.market(symbol)
|
1501
|
-
request = {
|
1501
|
+
request: dict = {
|
1502
1502
|
'type': 'fundingHistory',
|
1503
1503
|
'coin': market['base'],
|
1504
1504
|
}
|
@@ -1553,7 +1553,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1553
1553
|
method, params = self.handle_option_and_params(params, 'fetchOpenOrders', 'method', 'frontendOpenOrders')
|
1554
1554
|
self.load_markets()
|
1555
1555
|
market = self.safe_market(symbol)
|
1556
|
-
request = {
|
1556
|
+
request: dict = {
|
1557
1557
|
'type': method,
|
1558
1558
|
'user': userAddress,
|
1559
1559
|
}
|
@@ -1587,7 +1587,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1587
1587
|
userAddress, params = self.handle_public_address('fetchClosedOrders', params)
|
1588
1588
|
self.load_markets()
|
1589
1589
|
market = self.safe_market(symbol)
|
1590
|
-
request = {
|
1590
|
+
request: dict = {
|
1591
1591
|
'type': 'historicalOrders',
|
1592
1592
|
'user': userAddress,
|
1593
1593
|
}
|
@@ -1620,7 +1620,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1620
1620
|
userAddress, params = self.handle_public_address('fetchOrder', params)
|
1621
1621
|
self.load_markets()
|
1622
1622
|
market = self.safe_market(symbol)
|
1623
|
-
request = {
|
1623
|
+
request: dict = {
|
1624
1624
|
'type': 'orderStatus',
|
1625
1625
|
'oid': self.parse_to_numeric(id),
|
1626
1626
|
'user': userAddress,
|
@@ -1656,7 +1656,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1656
1656
|
data = self.safe_dict(response, 'order')
|
1657
1657
|
return self.parse_order(data, market)
|
1658
1658
|
|
1659
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
1659
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
1660
1660
|
#
|
1661
1661
|
# fetchOpenOrders
|
1662
1662
|
#
|
@@ -1794,15 +1794,15 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1794
1794
|
'trades': None,
|
1795
1795
|
}, market)
|
1796
1796
|
|
1797
|
-
def parse_order_status(self, status):
|
1798
|
-
statuses = {
|
1797
|
+
def parse_order_status(self, status: Str):
|
1798
|
+
statuses: dict = {
|
1799
1799
|
'triggered': 'open',
|
1800
1800
|
'filled': 'closed',
|
1801
1801
|
}
|
1802
1802
|
return self.safe_string(statuses, status, status)
|
1803
1803
|
|
1804
1804
|
def parse_order_type(self, status):
|
1805
|
-
statuses = {
|
1805
|
+
statuses: dict = {
|
1806
1806
|
'stop limit': 'limit',
|
1807
1807
|
'stop market': 'market',
|
1808
1808
|
}
|
@@ -1824,7 +1824,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1824
1824
|
userAddress, params = self.handle_public_address('fetchMyTrades', params)
|
1825
1825
|
self.load_markets()
|
1826
1826
|
market = self.safe_market(symbol)
|
1827
|
-
request = {
|
1827
|
+
request: dict = {
|
1828
1828
|
'user': userAddress,
|
1829
1829
|
}
|
1830
1830
|
if since is not None:
|
@@ -1859,7 +1859,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1859
1859
|
#
|
1860
1860
|
return self.parse_trades(response, market, since, limit)
|
1861
1861
|
|
1862
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1862
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1863
1863
|
#
|
1864
1864
|
# {
|
1865
1865
|
# "closedPnl": "0.19343",
|
@@ -1931,7 +1931,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1931
1931
|
userAddress = None
|
1932
1932
|
userAddress, params = self.handle_public_address('fetchPositions', params)
|
1933
1933
|
symbols = self.market_symbols(symbols)
|
1934
|
-
request = {
|
1934
|
+
request: dict = {
|
1935
1935
|
'type': 'clearinghouseState',
|
1936
1936
|
'user': userAddress,
|
1937
1937
|
}
|
@@ -1987,7 +1987,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1987
1987
|
result.append(self.parse_position(data[i], None))
|
1988
1988
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
1989
1989
|
|
1990
|
-
def parse_position(self, position, market: Market = None):
|
1990
|
+
def parse_position(self, position: dict, market: Market = None):
|
1991
1991
|
#
|
1992
1992
|
# {
|
1993
1993
|
# "position": {
|
@@ -2074,7 +2074,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2074
2074
|
isCross = (marginMode == 'cross')
|
2075
2075
|
nonce = self.milliseconds()
|
2076
2076
|
params = self.omit(params, ['leverage'])
|
2077
|
-
updateAction = {
|
2077
|
+
updateAction: dict = {
|
2078
2078
|
'type': 'updateLeverage',
|
2079
2079
|
'asset': asset,
|
2080
2080
|
'isCross': isCross,
|
@@ -2087,7 +2087,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2087
2087
|
vaultAddress = vaultAddress.replace('0x', '')
|
2088
2088
|
extendedAction = self.extend(updateAction, params)
|
2089
2089
|
signature = self.sign_l1_action(extendedAction, nonce, vaultAddress)
|
2090
|
-
request = {
|
2090
|
+
request: dict = {
|
2091
2091
|
'action': extendedAction,
|
2092
2092
|
'nonce': nonce,
|
2093
2093
|
'signature': signature,
|
@@ -2124,7 +2124,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2124
2124
|
asset = self.parse_to_int(market['baseId'])
|
2125
2125
|
nonce = self.milliseconds()
|
2126
2126
|
params = self.omit(params, 'marginMode')
|
2127
|
-
updateAction = {
|
2127
|
+
updateAction: dict = {
|
2128
2128
|
'type': 'updateLeverage',
|
2129
2129
|
'asset': asset,
|
2130
2130
|
'isCross': isCross,
|
@@ -2132,7 +2132,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2132
2132
|
}
|
2133
2133
|
vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
|
2134
2134
|
signature = self.sign_l1_action(updateAction, nonce, vaultAddress)
|
2135
|
-
request = {
|
2135
|
+
request: dict = {
|
2136
2136
|
'action': updateAction,
|
2137
2137
|
'nonce': nonce,
|
2138
2138
|
'signature': signature,
|
@@ -2182,7 +2182,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2182
2182
|
if type == 'reduce':
|
2183
2183
|
sz = -sz
|
2184
2184
|
nonce = self.milliseconds()
|
2185
|
-
updateAction = {
|
2185
|
+
updateAction: dict = {
|
2186
2186
|
'type': 'updateIsolatedMargin',
|
2187
2187
|
'asset': asset,
|
2188
2188
|
'isBuy': True,
|
@@ -2190,7 +2190,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2190
2190
|
}
|
2191
2191
|
vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
|
2192
2192
|
signature = self.sign_l1_action(updateAction, nonce, vaultAddress)
|
2193
|
-
request = {
|
2193
|
+
request: dict = {
|
2194
2194
|
'action': updateAction,
|
2195
2195
|
'nonce': nonce,
|
2196
2196
|
'signature': signature,
|
@@ -2254,7 +2254,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2254
2254
|
vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
|
2255
2255
|
params = self.omit(params, 'vaultAddress')
|
2256
2256
|
toPerp = (toAccount == 'perp') or (toAccount == 'swap')
|
2257
|
-
action = {
|
2257
|
+
action: dict = {
|
2258
2258
|
'type': 'spotUser',
|
2259
2259
|
'classTransfer': {
|
2260
2260
|
'usdc': amount,
|
@@ -2262,7 +2262,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2262
2262
|
},
|
2263
2263
|
}
|
2264
2264
|
signature = self.sign_l1_action(action, nonce, vaultAddress)
|
2265
|
-
innerRequest = {
|
2265
|
+
innerRequest: dict = {
|
2266
2266
|
'action': self.extend(action, params),
|
2267
2267
|
'nonce': nonce,
|
2268
2268
|
'signature': signature,
|
@@ -2277,13 +2277,13 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2277
2277
|
code = code.upper()
|
2278
2278
|
if code != 'USDC':
|
2279
2279
|
raise NotSupported(self.id + 'withdraw() only support USDC')
|
2280
|
-
payload = {
|
2280
|
+
payload: dict = {
|
2281
2281
|
'destination': toAccount,
|
2282
2282
|
'amount': self.number_to_string(amount),
|
2283
2283
|
'time': nonce,
|
2284
2284
|
}
|
2285
2285
|
sig = self.build_transfer_sig(payload)
|
2286
|
-
request = {
|
2286
|
+
request: dict = {
|
2287
2287
|
'action': {
|
2288
2288
|
'chain': 'ArbitrumTestnet' if (isSandboxMode) else 'Arbitrum',
|
2289
2289
|
'payload': payload,
|
@@ -2315,13 +2315,13 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2315
2315
|
raise NotSupported(self.id + 'withdraw() only support USDC')
|
2316
2316
|
isSandboxMode = self.safe_bool(self.options, 'sandboxMode')
|
2317
2317
|
nonce = self.milliseconds()
|
2318
|
-
payload = {
|
2318
|
+
payload: dict = {
|
2319
2319
|
'destination': address,
|
2320
2320
|
'usd': str(amount),
|
2321
2321
|
'time': nonce,
|
2322
2322
|
}
|
2323
2323
|
sig = self.build_withdraw_sig(payload)
|
2324
|
-
request = {
|
2324
|
+
request: dict = {
|
2325
2325
|
'action': {
|
2326
2326
|
'chain': 'ArbitrumTestnet' if (isSandboxMode) else 'Arbitrum',
|
2327
2327
|
'payload': payload,
|