ccxt 4.4.86__py2.py3-none-any.whl → 4.4.87__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 +5 -1
- ccxt/abstract/modetrade.py +119 -0
- ccxt/abstract/okxus.py +349 -0
- ccxt/async_support/__init__.py +5 -1
- ccxt/async_support/base/exchange.py +5 -5
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bitteam.py +31 -0
- ccxt/async_support/coinmetro.py +3 -0
- ccxt/async_support/gate.py +91 -73
- ccxt/async_support/htx.py +10 -8
- ccxt/async_support/hyperliquid.py +32 -16
- ccxt/async_support/kraken.py +5 -8
- ccxt/async_support/modetrade.py +2727 -0
- ccxt/async_support/okx.py +90 -3
- ccxt/async_support/okxus.py +54 -0
- ccxt/async_support/paradex.py +4 -1
- ccxt/async_support/phemex.py +4 -6
- ccxt/async_support/poloniex.py +172 -159
- ccxt/async_support/probit.py +18 -47
- ccxt/async_support/timex.py +5 -10
- ccxt/async_support/vertex.py +3 -4
- ccxt/async_support/whitebit.py +41 -11
- ccxt/async_support/woo.py +101 -75
- ccxt/async_support/woofipro.py +25 -20
- ccxt/async_support/xt.py +31 -41
- ccxt/base/exchange.py +12 -9
- ccxt/binance.py +1 -1
- ccxt/bitteam.py +31 -0
- ccxt/coinmetro.py +3 -0
- ccxt/gate.py +91 -73
- ccxt/htx.py +10 -8
- ccxt/hyperliquid.py +32 -16
- ccxt/kraken.py +5 -8
- ccxt/modetrade.py +2727 -0
- ccxt/okx.py +90 -3
- ccxt/okxus.py +54 -0
- ccxt/paradex.py +4 -1
- ccxt/phemex.py +4 -6
- ccxt/poloniex.py +172 -159
- ccxt/pro/__init__.py +61 -1
- ccxt/pro/modetrade.py +1271 -0
- ccxt/pro/okxus.py +38 -0
- ccxt/probit.py +18 -47
- ccxt/test/tests_async.py +17 -1
- ccxt/test/tests_sync.py +17 -1
- ccxt/timex.py +5 -10
- ccxt/vertex.py +3 -4
- ccxt/whitebit.py +41 -11
- ccxt/woo.py +100 -75
- ccxt/woofipro.py +24 -20
- ccxt/xt.py +31 -41
- {ccxt-4.4.86.dist-info → ccxt-4.4.87.dist-info}/METADATA +18 -6
- {ccxt-4.4.86.dist-info → ccxt-4.4.87.dist-info}/RECORD +56 -48
- {ccxt-4.4.86.dist-info → ccxt-4.4.87.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.86.dist-info → ccxt-4.4.87.dist-info}/WHEEL +0 -0
- {ccxt-4.4.86.dist-info → ccxt-4.4.87.dist-info}/top_level.txt +0 -0
ccxt/async_support/__init__.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.87'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -140,12 +140,14 @@ from ccxt.async_support.lbank import lbank
|
|
140
140
|
from ccxt.async_support.luno import luno # noqa: F401
|
141
141
|
from ccxt.async_support.mercado import mercado # noqa: F401
|
142
142
|
from ccxt.async_support.mexc import mexc # noqa: F401
|
143
|
+
from ccxt.async_support.modetrade import modetrade # noqa: F401
|
143
144
|
from ccxt.async_support.myokx import myokx # noqa: F401
|
144
145
|
from ccxt.async_support.ndax import ndax # noqa: F401
|
145
146
|
from ccxt.async_support.novadax import novadax # noqa: F401
|
146
147
|
from ccxt.async_support.oceanex import oceanex # noqa: F401
|
147
148
|
from ccxt.async_support.okcoin import okcoin # noqa: F401
|
148
149
|
from ccxt.async_support.okx import okx # noqa: F401
|
150
|
+
from ccxt.async_support.okxus import okxus # noqa: F401
|
149
151
|
from ccxt.async_support.onetrading import onetrading # noqa: F401
|
150
152
|
from ccxt.async_support.oxfun import oxfun # noqa: F401
|
151
153
|
from ccxt.async_support.p2b import p2b # noqa: F401
|
@@ -246,12 +248,14 @@ exchanges = [
|
|
246
248
|
'luno',
|
247
249
|
'mercado',
|
248
250
|
'mexc',
|
251
|
+
'modetrade',
|
249
252
|
'myokx',
|
250
253
|
'ndax',
|
251
254
|
'novadax',
|
252
255
|
'oceanex',
|
253
256
|
'okcoin',
|
254
257
|
'okx',
|
258
|
+
'okxus',
|
255
259
|
'onetrading',
|
256
260
|
'oxfun',
|
257
261
|
'p2b',
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.4.
|
5
|
+
__version__ = '4.4.87'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -903,15 +903,15 @@ class Exchange(BaseExchange):
|
|
903
903
|
if self.enableRateLimit:
|
904
904
|
cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
|
905
905
|
await self.throttle(cost)
|
906
|
+
retries = None
|
907
|
+
retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
|
908
|
+
retryDelay = None
|
909
|
+
retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
|
906
910
|
self.lastRestRequestTimestamp = self.milliseconds()
|
907
911
|
request = self.sign(path, api, method, params, headers, body)
|
908
912
|
self.last_request_headers = request['headers']
|
909
913
|
self.last_request_body = request['body']
|
910
914
|
self.last_request_url = request['url']
|
911
|
-
retries = None
|
912
|
-
retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
|
913
|
-
retryDelay = None
|
914
|
-
retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
|
915
915
|
for i in range(0, retries + 1):
|
916
916
|
try:
|
917
917
|
return await self.fetch(request['url'], request['method'], request['headers'], request['body'])
|
ccxt/async_support/binance.py
CHANGED
@@ -5024,13 +5024,13 @@ class binance(Exchange, ImplicitAPI):
|
|
5024
5024
|
postOnly = self.is_post_only(initialUppercaseType == 'MARKET', initialUppercaseType == 'LIMIT_MAKER', params)
|
5025
5025
|
if postOnly:
|
5026
5026
|
uppercaseType = 'LIMIT_MAKER'
|
5027
|
-
request['type'] = uppercaseType
|
5028
5027
|
triggerPrice = self.safe_number_2(params, 'stopPrice', 'triggerPrice')
|
5029
5028
|
if triggerPrice is not None:
|
5030
5029
|
if uppercaseType == 'MARKET':
|
5031
5030
|
uppercaseType = 'STOP_LOSS'
|
5032
5031
|
elif uppercaseType == 'LIMIT':
|
5033
5032
|
uppercaseType = 'STOP_LOSS_LIMIT'
|
5033
|
+
request['type'] = uppercaseType
|
5034
5034
|
validOrderTypes = self.safe_list(market['info'], 'orderTypes')
|
5035
5035
|
if not self.in_array(uppercaseType, validOrderTypes):
|
5036
5036
|
if initialUppercaseType != uppercaseType:
|
ccxt/async_support/bitteam.py
CHANGED
@@ -38,12 +38,18 @@ class bitteam(Exchange, ImplicitAPI):
|
|
38
38
|
'future': False,
|
39
39
|
'option': False,
|
40
40
|
'addMargin': False,
|
41
|
+
'borrowCrossMargin': False,
|
42
|
+
'borrowIsolatedMargin': False,
|
41
43
|
'borrowMargin': False,
|
42
44
|
'cancelAllOrders': True,
|
43
45
|
'cancelOrder': True,
|
44
46
|
'cancelOrders': False,
|
47
|
+
'closeAllPositions': False,
|
48
|
+
'closePosition': False,
|
45
49
|
'createDepositAddress': False,
|
46
50
|
'createOrder': True,
|
51
|
+
'createOrderWithTakeProfitAndStopLoss': False,
|
52
|
+
'createOrderWithTakeProfitAndStopLossWs': False,
|
47
53
|
'createPostOnlyOrder': False,
|
48
54
|
'createReduceOnlyOrder': False,
|
49
55
|
'createStopLimitOrder': False,
|
@@ -55,8 +61,11 @@ class bitteam(Exchange, ImplicitAPI):
|
|
55
61
|
'fetchBalance': True,
|
56
62
|
'fetchBidsAsks': False,
|
57
63
|
'fetchBorrowInterest': False,
|
64
|
+
'fetchBorrowRate': False,
|
58
65
|
'fetchBorrowRateHistories': False,
|
59
66
|
'fetchBorrowRateHistory': False,
|
67
|
+
'fetchBorrowRates': False,
|
68
|
+
'fetchBorrowRatesPerSymbol': False,
|
60
69
|
'fetchCanceledOrders': True,
|
61
70
|
'fetchClosedOrder': False,
|
62
71
|
'fetchClosedOrders': True,
|
@@ -72,24 +81,42 @@ class bitteam(Exchange, ImplicitAPI):
|
|
72
81
|
'fetchDepositWithdrawFee': False,
|
73
82
|
'fetchDepositWithdrawFees': False,
|
74
83
|
'fetchFundingHistory': False,
|
84
|
+
'fetchFundingInterval': False,
|
85
|
+
'fetchFundingIntervals': False,
|
75
86
|
'fetchFundingRate': False,
|
76
87
|
'fetchFundingRateHistory': False,
|
77
88
|
'fetchFundingRates': False,
|
89
|
+
'fetchGreeks': False,
|
78
90
|
'fetchIndexOHLCV': False,
|
79
91
|
'fetchIsolatedBorrowRate': False,
|
80
92
|
'fetchIsolatedBorrowRates': False,
|
93
|
+
'fetchIsolatedPositions': False,
|
81
94
|
'fetchL3OrderBook': False,
|
82
95
|
'fetchLedger': False,
|
83
96
|
'fetchLeverage': False,
|
97
|
+
'fetchLeverages': False,
|
84
98
|
'fetchLeverageTiers': False,
|
99
|
+
'fetchLiquidations': False,
|
100
|
+
'fetchLongShortRatio': False,
|
101
|
+
'fetchLongShortRatioHistory': False,
|
102
|
+
'fetchMarginAdjustmentHistory': False,
|
103
|
+
'fetchMarginMode': False,
|
104
|
+
'fetchMarginModes': False,
|
85
105
|
'fetchMarketLeverageTiers': False,
|
86
106
|
'fetchMarkets': True,
|
87
107
|
'fetchMarkOHLCV': False,
|
108
|
+
'fetchMarkPrices': False,
|
109
|
+
'fetchMyLiquidations': False,
|
110
|
+
'fetchMySettlementHistory': False,
|
88
111
|
'fetchMyTrades': True,
|
89
112
|
'fetchOHLCV': True,
|
113
|
+
'fetchOpenInterest': False,
|
90
114
|
'fetchOpenInterestHistory': False,
|
115
|
+
'fetchOpenInterests': False,
|
91
116
|
'fetchOpenOrder': False,
|
92
117
|
'fetchOpenOrders': True,
|
118
|
+
'fetchOption': False,
|
119
|
+
'fetchOptionChain': False,
|
93
120
|
'fetchOrder': True,
|
94
121
|
'fetchOrderBook': True,
|
95
122
|
'fetchOrderBooks': False,
|
@@ -103,6 +130,7 @@ class bitteam(Exchange, ImplicitAPI):
|
|
103
130
|
'fetchPositionsHistory': False,
|
104
131
|
'fetchPositionsRisk': False,
|
105
132
|
'fetchPremiumIndexOHLCV': False,
|
133
|
+
'fetchSettlementHistory': False,
|
106
134
|
'fetchStatus': False,
|
107
135
|
'fetchTicker': True,
|
108
136
|
'fetchTickers': True,
|
@@ -115,10 +143,13 @@ class bitteam(Exchange, ImplicitAPI):
|
|
115
143
|
'fetchTransactionFees': False,
|
116
144
|
'fetchTransactions': True,
|
117
145
|
'fetchTransfers': False,
|
146
|
+
'fetchVolatilityHistory': False,
|
118
147
|
'fetchWithdrawal': False,
|
119
148
|
'fetchWithdrawals': False,
|
120
149
|
'fetchWithdrawalWhitelist': False,
|
121
150
|
'reduceMargin': False,
|
151
|
+
'repayCrossMargin': False,
|
152
|
+
'repayIsolatedMargin': False,
|
122
153
|
'repayMargin': False,
|
123
154
|
'setLeverage': False,
|
124
155
|
'setMargin': False,
|
ccxt/async_support/coinmetro.py
CHANGED
@@ -394,6 +394,9 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
394
394
|
elif typeRaw == 'fiat':
|
395
395
|
type = 'fiat'
|
396
396
|
precisionDigits = self.safe_string_2(currency, 'digits', 'notabeneDecimals')
|
397
|
+
if code == 'RENDER':
|
398
|
+
# RENDER is an exception(with broken info)
|
399
|
+
precisionDigits = '4'
|
397
400
|
result[code] = self.safe_currency_structure({
|
398
401
|
'id': id,
|
399
402
|
'code': code,
|
ccxt/async_support/gate.py
CHANGED
@@ -126,7 +126,7 @@ class gate(Exchange, ImplicitAPI):
|
|
126
126
|
'fetchCurrencies': True,
|
127
127
|
'fetchDepositAddress': True,
|
128
128
|
'fetchDepositAddresses': False,
|
129
|
-
'fetchDepositAddressesByNetwork':
|
129
|
+
'fetchDepositAddressesByNetwork': True,
|
130
130
|
'fetchDeposits': True,
|
131
131
|
'fetchDepositWithdrawFee': 'emulated',
|
132
132
|
'fetchDepositWithdrawFees': True,
|
@@ -735,6 +735,16 @@ class gate(Exchange, ImplicitAPI):
|
|
735
735
|
},
|
736
736
|
'networksById': {
|
737
737
|
'OPETH': 'OP',
|
738
|
+
'ETH': 'ERC20', # for GOlang
|
739
|
+
'ERC20': 'ERC20',
|
740
|
+
'TRX': 'TRC20',
|
741
|
+
'TRC20': 'TRC20',
|
742
|
+
'HT': 'HRC20',
|
743
|
+
'HECO': 'HRC20',
|
744
|
+
'BSC': 'BEP20',
|
745
|
+
'BEP20': 'BEP20',
|
746
|
+
'POLYGON': 'MATIC',
|
747
|
+
'POL': 'MATIC',
|
738
748
|
},
|
739
749
|
'timeInForce': {
|
740
750
|
'GTC': 'gtc',
|
@@ -1224,6 +1234,8 @@ class gate(Exchange, ImplicitAPI):
|
|
1224
1234
|
"""
|
1225
1235
|
if self.options['adjustForTimeDifference']:
|
1226
1236
|
await self.load_time_difference()
|
1237
|
+
if self.check_required_credentials(False):
|
1238
|
+
await self.load_unified_status()
|
1227
1239
|
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
1228
1240
|
rawPromises = [
|
1229
1241
|
self.fetch_contract_markets(params),
|
@@ -1797,84 +1809,92 @@ class gate(Exchange, ImplicitAPI):
|
|
1797
1809
|
apiBackup = self.safe_value(self.urls, 'apiBackup')
|
1798
1810
|
if apiBackup is not None:
|
1799
1811
|
return None
|
1800
|
-
if self.check_required_credentials(False):
|
1801
|
-
await self.load_unified_status()
|
1802
1812
|
response = await self.publicSpotGetCurrencies(params)
|
1803
1813
|
#
|
1804
|
-
#
|
1805
|
-
#
|
1806
|
-
#
|
1807
|
-
#
|
1808
|
-
#
|
1809
|
-
#
|
1810
|
-
#
|
1811
|
-
#
|
1812
|
-
#
|
1813
|
-
#
|
1814
|
-
#
|
1815
|
-
#
|
1814
|
+
# [
|
1815
|
+
# {
|
1816
|
+
# "currency": "USDT",
|
1817
|
+
# "name": "Tether",
|
1818
|
+
# "delisted": False,
|
1819
|
+
# "withdraw_disabled": False,
|
1820
|
+
# "withdraw_delayed": False,
|
1821
|
+
# "deposit_disabled": False,
|
1822
|
+
# "trade_disabled": False,
|
1823
|
+
# "fixed_rate": "",
|
1824
|
+
# "chain": "ETH",
|
1825
|
+
# "chains": [
|
1826
|
+
# {
|
1827
|
+
# "name": "ETH",
|
1828
|
+
# "addr": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
1829
|
+
# "withdraw_disabled": False,
|
1830
|
+
# "withdraw_delayed": False,
|
1831
|
+
# "deposit_disabled": False
|
1832
|
+
# },
|
1833
|
+
# {
|
1834
|
+
# "name": "ARBEVM",
|
1835
|
+
# "addr": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
1836
|
+
# "withdraw_disabled": False,
|
1837
|
+
# "withdraw_delayed": False,
|
1838
|
+
# "deposit_disabled": False
|
1839
|
+
# },
|
1840
|
+
# {
|
1841
|
+
# "name": "BSC",
|
1842
|
+
# "addr": "0x55d398326f99059fF775485246999027B3197955",
|
1843
|
+
# "withdraw_disabled": False,
|
1844
|
+
# "withdraw_delayed": False,
|
1845
|
+
# "deposit_disabled": False
|
1846
|
+
# },
|
1847
|
+
# ]
|
1848
|
+
# },
|
1849
|
+
# ]
|
1816
1850
|
#
|
1817
1851
|
indexedCurrencies = self.index_by(response, 'currency')
|
1818
1852
|
result: dict = {}
|
1819
1853
|
for i in range(0, len(response)):
|
1820
1854
|
entry = response[i]
|
1821
1855
|
currencyId = self.safe_string(entry, 'currency')
|
1822
|
-
|
1823
|
-
partFirst = self.safe_string(parts, 0)
|
1824
|
-
# if there's an underscore then the second part is always the chain name(except the _OLD suffix)
|
1825
|
-
currencyName = currencyId if currencyId.endswith('_OLD') else partFirst
|
1826
|
-
withdrawDisabled = self.safe_bool(entry, 'withdraw_disabled', False)
|
1827
|
-
depositDisabled = self.safe_bool(entry, 'deposit_disabled', False)
|
1828
|
-
tradeDisabled = self.safe_bool(entry, 'trade_disabled', False)
|
1829
|
-
precision = self.parse_number('0.0001') # temporary safe default, because no value provided from API
|
1830
|
-
code = self.safe_currency_code(currencyName)
|
1856
|
+
code = self.safe_currency_code(currencyId)
|
1831
1857
|
# check leveraged tokens(e.g. BTC3S, ETH5L)
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
'
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1858
|
+
type = 'leveraged' if self.is_leveraged_currency(currencyId, True, indexedCurrencies) else 'crypto'
|
1859
|
+
chains = self.safe_list(entry, 'chains', [])
|
1860
|
+
networks = {}
|
1861
|
+
for j in range(0, len(chains)):
|
1862
|
+
chain = chains[j]
|
1863
|
+
networkId = self.safe_string(chain, 'name')
|
1864
|
+
networkCode = self.network_id_to_code(networkId)
|
1865
|
+
networks[networkCode] = {
|
1866
|
+
'info': chain,
|
1867
|
+
'id': networkId,
|
1868
|
+
'network': networkCode,
|
1869
|
+
'active': None,
|
1870
|
+
'deposit': not self.safe_bool(chain, 'deposit_disabled'),
|
1871
|
+
'withdraw': not self.safe_bool(chain, 'withdraw_disabled'),
|
1872
|
+
'fee': None,
|
1873
|
+
'precision': self.parse_number('0.0001'), # temporary safe default, because no value provided from API,
|
1874
|
+
'limits': {
|
1875
|
+
'deposit': {
|
1876
|
+
'min': None,
|
1877
|
+
'max': None,
|
1878
|
+
},
|
1879
|
+
'withdraw': {
|
1880
|
+
'min': None,
|
1881
|
+
'max': None,
|
1882
|
+
},
|
1853
1883
|
},
|
1854
|
-
},
|
1855
|
-
'active': not tradeDisabled,
|
1856
|
-
'deposit': not depositDisabled,
|
1857
|
-
'withdraw': not withdrawDisabled,
|
1858
|
-
'fee': None,
|
1859
|
-
'precision': precision,
|
1860
|
-
}
|
1861
|
-
# check if first entry for the specific currency
|
1862
|
-
if not (code in result):
|
1863
|
-
result[code] = {
|
1864
|
-
'id': currencyName,
|
1865
|
-
'lowerCaseId': currencyName.lower(),
|
1866
|
-
'code': code,
|
1867
|
-
'type': type,
|
1868
|
-
'precision': precision,
|
1869
|
-
'limits': None,
|
1870
|
-
'networks': {},
|
1871
|
-
'info': [], # will be filled below
|
1872
1884
|
}
|
1873
|
-
result[code]
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1885
|
+
result[code] = self.safe_currency_structure({
|
1886
|
+
'id': currencyId,
|
1887
|
+
'code': code,
|
1888
|
+
'name': self.safe_string(entry, 'name'),
|
1889
|
+
'type': type,
|
1890
|
+
'active': not self.safe_bool(entry, 'delisted'),
|
1891
|
+
'deposit': not self.safe_bool(entry, 'deposit_disabled'),
|
1892
|
+
'withdraw': not self.safe_bool(entry, 'withdraw_disabled'),
|
1893
|
+
'fee': None,
|
1894
|
+
'networks': networks,
|
1895
|
+
'precision': self.parse_number('0.0001'),
|
1896
|
+
'info': entry,
|
1897
|
+
})
|
1878
1898
|
return result
|
1879
1899
|
|
1880
1900
|
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
@@ -2139,9 +2159,7 @@ class gate(Exchange, ImplicitAPI):
|
|
2139
2159
|
chains = self.safe_value(response, 'multichain_addresses', [])
|
2140
2160
|
currencyId = self.safe_string(response, 'currency')
|
2141
2161
|
currency = self.safe_currency(currencyId, currency)
|
2142
|
-
parsed = self.parse_deposit_addresses(chains,
|
2143
|
-
'currency': currency['id'],
|
2144
|
-
})
|
2162
|
+
parsed = self.parse_deposit_addresses(chains, None, False)
|
2145
2163
|
return self.index_by(parsed, 'network')
|
2146
2164
|
|
2147
2165
|
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
@@ -2159,8 +2177,8 @@ class gate(Exchange, ImplicitAPI):
|
|
2159
2177
|
networkCode = None
|
2160
2178
|
networkCode, params = self.handle_network_code_and_params(params)
|
2161
2179
|
chainsIndexedById = await self.fetch_deposit_addresses_by_network(code, params)
|
2162
|
-
|
2163
|
-
return chainsIndexedById[
|
2180
|
+
selectedNetworkIdOrCode = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
|
2181
|
+
return chainsIndexedById[selectedNetworkIdOrCode]
|
2164
2182
|
|
2165
2183
|
def parse_deposit_address(self, depositAddress, currency=None):
|
2166
2184
|
#
|
ccxt/async_support/htx.py
CHANGED
@@ -4287,6 +4287,8 @@ class htx(Exchange, ImplicitAPI):
|
|
4287
4287
|
request: dict = {}
|
4288
4288
|
marketType = None
|
4289
4289
|
marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
4290
|
+
subType = None
|
4291
|
+
subType, params = self.handle_sub_type_and_params('fetchOpenOrders', market, params, 'linear')
|
4290
4292
|
response = None
|
4291
4293
|
if marketType == 'spot':
|
4292
4294
|
if symbol is not None:
|
@@ -4308,16 +4310,16 @@ class htx(Exchange, ImplicitAPI):
|
|
4308
4310
|
params = self.omit(params, 'account-id')
|
4309
4311
|
response = await self.spotPrivateGetV1OrderOpenOrders(self.extend(request, params))
|
4310
4312
|
else:
|
4311
|
-
if symbol is None:
|
4312
|
-
raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument')
|
4313
|
+
if symbol is not None:
|
4314
|
+
# raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument')
|
4315
|
+
request['contract_code'] = market['id']
|
4313
4316
|
if limit is not None:
|
4314
4317
|
request['page_size'] = limit
|
4315
|
-
request['contract_code'] = market['id']
|
4316
4318
|
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
4317
4319
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4318
4320
|
trailing = self.safe_bool(params, 'trailing', False)
|
4319
4321
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
4320
|
-
if
|
4322
|
+
if subType == 'linear':
|
4321
4323
|
marginMode = None
|
4322
4324
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
4323
4325
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
@@ -4339,8 +4341,8 @@ class htx(Exchange, ImplicitAPI):
|
|
4339
4341
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTrackOpenorders(self.extend(request, params))
|
4340
4342
|
else:
|
4341
4343
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(self.extend(request, params))
|
4342
|
-
elif
|
4343
|
-
if
|
4344
|
+
elif subType == 'inverse':
|
4345
|
+
if marketType == 'swap':
|
4344
4346
|
if trigger:
|
4345
4347
|
response = await self.contractPrivatePostSwapApiV1SwapTriggerOpenorders(self.extend(request, params))
|
4346
4348
|
elif stopLossTakeProfit:
|
@@ -4349,8 +4351,8 @@ class htx(Exchange, ImplicitAPI):
|
|
4349
4351
|
response = await self.contractPrivatePostSwapApiV1SwapTrackOpenorders(self.extend(request, params))
|
4350
4352
|
else:
|
4351
4353
|
response = await self.contractPrivatePostSwapApiV1SwapOpenorders(self.extend(request, params))
|
4352
|
-
elif
|
4353
|
-
request['symbol'] = market
|
4354
|
+
elif marketType == 'future':
|
4355
|
+
request['symbol'] = self.safe_string(market, 'settleId', 'usdt')
|
4354
4356
|
if trigger:
|
4355
4357
|
response = await self.contractPrivatePostApiV1ContractTriggerOpenorders(self.extend(request, params))
|
4356
4358
|
elif stopLossTakeProfit:
|
@@ -1495,7 +1495,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1495
1495
|
if clientOrderId is not None:
|
1496
1496
|
orderObj['c'] = clientOrderId
|
1497
1497
|
orderReq.append(orderObj)
|
1498
|
-
vaultAddress =
|
1498
|
+
vaultAddress = None
|
1499
|
+
vaultAddress, params = self.handle_option_and_params(params, 'createOrder', 'vaultAddress')
|
1500
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
1499
1501
|
orderAction: dict = {
|
1500
1502
|
'type': 'order',
|
1501
1503
|
'orders': orderReq,
|
@@ -1582,7 +1584,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1582
1584
|
'o': self.parse_to_numeric(ids[i]),
|
1583
1585
|
})
|
1584
1586
|
cancelAction['cancels'] = cancelReq
|
1585
|
-
vaultAddress =
|
1587
|
+
vaultAddress = None
|
1588
|
+
vaultAddress, params = self.handle_option_and_params(params, 'cancelOrders', 'vaultAddress')
|
1589
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
1586
1590
|
signature = self.sign_l1_action(cancelAction, nonce, vaultAddress)
|
1587
1591
|
request['action'] = cancelAction
|
1588
1592
|
request['signature'] = signature
|
@@ -1660,7 +1664,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1660
1664
|
cancelReq.append(cancelObj)
|
1661
1665
|
cancelAction['type'] = 'cancelByCloid' if cancelByCloid else 'cancel'
|
1662
1666
|
cancelAction['cancels'] = cancelReq
|
1663
|
-
vaultAddress =
|
1667
|
+
vaultAddress = None
|
1668
|
+
vaultAddress, params = self.handle_option_and_params(params, 'cancelOrdersForSymbols', 'vaultAddress')
|
1669
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
1664
1670
|
signature = self.sign_l1_action(cancelAction, nonce, vaultAddress)
|
1665
1671
|
request['action'] = cancelAction
|
1666
1672
|
request['signature'] = signature
|
@@ -1703,7 +1709,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1703
1709
|
'type': 'scheduleCancel',
|
1704
1710
|
'time': nonce + timeout,
|
1705
1711
|
}
|
1706
|
-
vaultAddress =
|
1712
|
+
vaultAddress = None
|
1713
|
+
vaultAddress, params = self.handle_option_and_params(params, 'cancelAllOrdersAfter', 'vaultAddress')
|
1714
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
1707
1715
|
signature = self.sign_l1_action(cancelAction, nonce, vaultAddress)
|
1708
1716
|
request['action'] = cancelAction
|
1709
1717
|
request['signature'] = signature
|
@@ -1812,7 +1820,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1812
1820
|
'type': 'batchModify',
|
1813
1821
|
'modifies': modifies,
|
1814
1822
|
}
|
1815
|
-
vaultAddress =
|
1823
|
+
vaultAddress = None
|
1824
|
+
vaultAddress, params = self.handle_option_and_params(params, 'editOrder', 'vaultAddress')
|
1825
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
1816
1826
|
signature = self.sign_l1_action(modifyAction, nonce, vaultAddress)
|
1817
1827
|
request: dict = {
|
1818
1828
|
'action': modifyAction,
|
@@ -1821,7 +1831,6 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1821
1831
|
# 'vaultAddress': vaultAddress,
|
1822
1832
|
}
|
1823
1833
|
if vaultAddress is not None:
|
1824
|
-
params = self.omit(params, 'vaultAddress')
|
1825
1834
|
request['vaultAddress'] = vaultAddress
|
1826
1835
|
return request
|
1827
1836
|
|
@@ -2639,9 +2648,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2639
2648
|
'isCross': isCross,
|
2640
2649
|
'leverage': leverage,
|
2641
2650
|
}
|
2642
|
-
vaultAddress =
|
2651
|
+
vaultAddress = None
|
2652
|
+
vaultAddress, params = self.handle_option_and_params(params, 'setMarginMode', 'vaultAddress')
|
2643
2653
|
if vaultAddress is not None:
|
2644
|
-
params = self.omit(params, 'vaultAddress')
|
2645
2654
|
if vaultAddress.startswith('0x'):
|
2646
2655
|
vaultAddress = vaultAddress.replace('0x', '')
|
2647
2656
|
signature = self.sign_l1_action(updateAction, nonce, vaultAddress)
|
@@ -2688,7 +2697,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2688
2697
|
'isCross': isCross,
|
2689
2698
|
'leverage': leverage,
|
2690
2699
|
}
|
2691
|
-
vaultAddress =
|
2700
|
+
vaultAddress = None
|
2701
|
+
vaultAddress, params = self.handle_option_and_params(params, 'setLeverage', 'vaultAddress')
|
2702
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
2692
2703
|
signature = self.sign_l1_action(updateAction, nonce, vaultAddress)
|
2693
2704
|
request: dict = {
|
2694
2705
|
'action': updateAction,
|
@@ -2750,7 +2761,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2750
2761
|
'isBuy': True,
|
2751
2762
|
'ntli': sz,
|
2752
2763
|
}
|
2753
|
-
vaultAddress =
|
2764
|
+
vaultAddress = None
|
2765
|
+
vaultAddress, params = self.handle_option_and_params(params, 'modifyMargin', 'vaultAddress')
|
2766
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
2754
2767
|
signature = self.sign_l1_action(updateAction, nonce, vaultAddress)
|
2755
2768
|
request: dict = {
|
2756
2769
|
'action': updateAction,
|
@@ -2759,7 +2772,6 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2759
2772
|
# 'vaultAddress': vaultAddress,
|
2760
2773
|
}
|
2761
2774
|
if vaultAddress is not None:
|
2762
|
-
params = self.omit(params, 'vaultAddress')
|
2763
2775
|
request['vaultAddress'] = vaultAddress
|
2764
2776
|
response = await self.privatePostExchange(request)
|
2765
2777
|
#
|
@@ -2816,8 +2828,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2816
2828
|
if not self.in_array(toAccount, ['spot', 'swap', 'perp']):
|
2817
2829
|
raise NotSupported(self.id + ' transfer() only support spot <> swap transfer')
|
2818
2830
|
strAmount = self.number_to_string(amount)
|
2819
|
-
vaultAddress =
|
2820
|
-
params = self.
|
2831
|
+
vaultAddress = None
|
2832
|
+
vaultAddress, params = self.handle_option_and_params(params, 'transfer', 'vaultAddress')
|
2833
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
2821
2834
|
if vaultAddress is not None:
|
2822
2835
|
strAmount = strAmount + ' subaccount:' + vaultAddress
|
2823
2836
|
toPerp = (toAccount == 'perp') or (toAccount == 'swap')
|
@@ -2913,7 +2926,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2913
2926
|
code = code.upper()
|
2914
2927
|
if code != 'USDC':
|
2915
2928
|
raise NotSupported(self.id + ' withdraw() only support USDC')
|
2916
|
-
vaultAddress =
|
2929
|
+
vaultAddress = None
|
2930
|
+
vaultAddress, params = self.handle_option_and_params(params, 'withdraw', 'vaultAddress')
|
2931
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
2917
2932
|
params = self.omit(params, 'vaultAddress')
|
2918
2933
|
nonce = self.milliseconds()
|
2919
2934
|
action: dict = {}
|
@@ -3495,8 +3510,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
3495
3510
|
|
3496
3511
|
def parse_create_edit_order_args(self, id: Str, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
3497
3512
|
market = self.market(symbol)
|
3498
|
-
vaultAddress =
|
3499
|
-
params = self.
|
3513
|
+
vaultAddress = None
|
3514
|
+
vaultAddress, params = self.handle_option_and_params(params, 'createOrder', 'vaultAddress')
|
3515
|
+
vaultAddress = self.format_vault_address(vaultAddress)
|
3500
3516
|
symbol = market['symbol']
|
3501
3517
|
order = {
|
3502
3518
|
'symbol': symbol,
|
ccxt/async_support/kraken.py
CHANGED
@@ -861,24 +861,21 @@ class kraken(Exchange, ImplicitAPI):
|
|
861
861
|
self.commonCurrencies[id] = code
|
862
862
|
else:
|
863
863
|
code = self.safe_currency_code(id)
|
864
|
-
precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
|
865
|
-
# assumes all currencies are active except those listed above
|
866
|
-
active = self.safe_string(currency, 'status') == 'enabled'
|
867
864
|
isFiat = code.find('.HOLD') >= 0
|
868
|
-
result[code] = {
|
865
|
+
result[code] = self.safe_currency_structure({
|
869
866
|
'id': id,
|
870
867
|
'code': code,
|
871
868
|
'info': currency,
|
872
869
|
'name': self.safe_string(currency, 'altname'),
|
873
|
-
'active':
|
870
|
+
'active': self.safe_string(currency, 'status') == 'enabled',
|
874
871
|
'type': 'fiat' if isFiat else 'crypto',
|
875
872
|
'deposit': None,
|
876
873
|
'withdraw': None,
|
877
874
|
'fee': None,
|
878
|
-
'precision':
|
875
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals'))),
|
879
876
|
'limits': {
|
880
877
|
'amount': {
|
881
|
-
'min':
|
878
|
+
'min': None,
|
882
879
|
'max': None,
|
883
880
|
},
|
884
881
|
'withdraw': {
|
@@ -887,7 +884,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
887
884
|
},
|
888
885
|
},
|
889
886
|
'networks': {},
|
890
|
-
}
|
887
|
+
})
|
891
888
|
return result
|
892
889
|
|
893
890
|
def safe_currency_code(self, currencyId: Str, currency: Currency = None) -> Str:
|