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/xt.py
CHANGED
@@ -912,48 +912,30 @@ class xt(Exchange, ImplicitAPI):
|
|
912
912
|
entry = currenciesData[i]
|
913
913
|
currencyId = self.safe_string(entry, 'currency')
|
914
914
|
code = self.safe_currency_code(currencyId)
|
915
|
-
minPrecision = self.parse_number(self.parse_precision(self.safe_string(entry, 'maxPrecision')))
|
916
915
|
networkEntry = self.safe_value(chainsDataIndexed, currencyId, {})
|
917
916
|
rawNetworks = self.safe_value(networkEntry, 'supportChains', [])
|
918
917
|
networks = {}
|
919
|
-
minWithdrawString = None
|
920
|
-
minWithdrawFeeString = None
|
921
|
-
active = False
|
922
|
-
deposit = False
|
923
|
-
withdraw = False
|
924
918
|
for j in range(0, len(rawNetworks)):
|
925
919
|
rawNetwork = rawNetworks[j]
|
926
920
|
networkId = self.safe_string(rawNetwork, 'chain')
|
927
|
-
|
928
|
-
|
929
|
-
deposit = depositEnabled if (depositEnabled) else deposit
|
930
|
-
withdrawEnabled = self.safe_value(rawNetwork, 'withdrawEnabled')
|
931
|
-
withdraw = withdrawEnabled if (withdrawEnabled) else withdraw
|
932
|
-
networkActive = depositEnabled and withdrawEnabled
|
933
|
-
active = networkActive if (networkActive) else active
|
934
|
-
withdrawFeeString = self.safe_string(rawNetwork, 'withdrawFeeAmount')
|
935
|
-
if withdrawFeeString is not None:
|
936
|
-
minWithdrawFeeString = withdrawFeeString if (minWithdrawFeeString is None) else Precise.string_min(withdrawFeeString, minWithdrawFeeString)
|
937
|
-
minNetworkWithdrawString = self.safe_string(rawNetwork, 'withdrawMinAmount')
|
938
|
-
if minNetworkWithdrawString is not None:
|
939
|
-
minWithdrawString = minNetworkWithdrawString if (minWithdrawString is None) else Precise.string_min(minNetworkWithdrawString, minWithdrawString)
|
940
|
-
networks[network] = {
|
921
|
+
networkCode = self.network_id_to_code(networkId, code)
|
922
|
+
networks[networkCode] = {
|
941
923
|
'info': rawNetwork,
|
942
924
|
'id': networkId,
|
943
|
-
'network':
|
925
|
+
'network': networkCode,
|
944
926
|
'name': None,
|
945
|
-
'active':
|
946
|
-
'fee': self.
|
947
|
-
'precision':
|
948
|
-
'deposit': depositEnabled,
|
949
|
-
'withdraw': withdrawEnabled,
|
927
|
+
'active': None,
|
928
|
+
'fee': self.safe_number(rawNetwork, 'withdrawFeeAmount'),
|
929
|
+
'precision': None,
|
930
|
+
'deposit': self.safe_bool(rawNetwork, 'depositEnabled'),
|
931
|
+
'withdraw': self.safe_bool(rawNetwork, 'withdrawEnabled'),
|
950
932
|
'limits': {
|
951
933
|
'amount': {
|
952
934
|
'min': None,
|
953
935
|
'max': None,
|
954
936
|
},
|
955
937
|
'withdraw': {
|
956
|
-
'min': self.
|
938
|
+
'min': self.safe_number(rawNetwork, 'withdrawMinAmount'),
|
957
939
|
'max': None,
|
958
940
|
},
|
959
941
|
'deposit': {
|
@@ -968,16 +950,16 @@ class xt(Exchange, ImplicitAPI):
|
|
968
950
|
type = 'crypto'
|
969
951
|
else:
|
970
952
|
type = 'other'
|
971
|
-
result[code] = {
|
953
|
+
result[code] = self.safe_currency_structure({
|
972
954
|
'info': entry,
|
973
955
|
'id': currencyId,
|
974
956
|
'code': code,
|
975
957
|
'name': self.safe_string(entry, 'fullName'),
|
976
|
-
'active':
|
977
|
-
'fee':
|
978
|
-
'precision':
|
979
|
-
'deposit':
|
980
|
-
'withdraw':
|
958
|
+
'active': None,
|
959
|
+
'fee': None,
|
960
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(entry, 'maxPrecision'))),
|
961
|
+
'deposit': self.safe_string(entry, 'depositStatus') == '1',
|
962
|
+
'withdraw': self.safe_string(entry, 'withdrawStatus') == '1',
|
981
963
|
'networks': networks,
|
982
964
|
'type': type,
|
983
965
|
'limits': {
|
@@ -986,7 +968,7 @@ class xt(Exchange, ImplicitAPI):
|
|
986
968
|
'max': None,
|
987
969
|
},
|
988
970
|
'withdraw': {
|
989
|
-
'min':
|
971
|
+
'min': None,
|
990
972
|
'max': None,
|
991
973
|
},
|
992
974
|
'deposit': {
|
@@ -994,7 +976,7 @@ class xt(Exchange, ImplicitAPI):
|
|
994
976
|
'max': None,
|
995
977
|
},
|
996
978
|
},
|
997
|
-
}
|
979
|
+
})
|
998
980
|
return result
|
999
981
|
|
1000
982
|
async def fetch_markets(self, params={}) -> List[Market]:
|
@@ -2850,17 +2832,21 @@ class xt(Exchange, ImplicitAPI):
|
|
2850
2832
|
if symbol is not None:
|
2851
2833
|
market = self.market(symbol)
|
2852
2834
|
request['symbol'] = market['id']
|
2835
|
+
if limit is not None:
|
2836
|
+
request['size'] = limit
|
2837
|
+
if since is not None:
|
2838
|
+
request['startTime'] = since
|
2853
2839
|
type = None
|
2854
2840
|
subType = None
|
2855
2841
|
response = None
|
2856
2842
|
type, params = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
2857
2843
|
subType, params = self.handle_sub_type_and_params('fetchOrdersByStatus', market, params)
|
2858
|
-
trigger = self.
|
2844
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
2859
2845
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
2860
2846
|
if status == 'open':
|
2861
2847
|
if trigger or stopLossTakeProfit:
|
2862
2848
|
request['state'] = 'NOT_TRIGGERED'
|
2863
|
-
elif
|
2849
|
+
elif type == 'swap':
|
2864
2850
|
request['state'] = 'NEW'
|
2865
2851
|
elif status == 'closed':
|
2866
2852
|
if trigger or stopLossTakeProfit:
|
@@ -2880,7 +2866,7 @@ class xt(Exchange, ImplicitAPI):
|
|
2880
2866
|
if limit is not None:
|
2881
2867
|
request['size'] = limit
|
2882
2868
|
if trigger:
|
2883
|
-
params = self.omit(params, 'stop')
|
2869
|
+
params = self.omit(params, ['stop', 'trigger'])
|
2884
2870
|
if subType == 'inverse':
|
2885
2871
|
response = await self.privateInverseGetFutureTradeV1EntrustPlanList(self.extend(request, params))
|
2886
2872
|
else:
|
@@ -2905,6 +2891,7 @@ class xt(Exchange, ImplicitAPI):
|
|
2905
2891
|
if since is not None:
|
2906
2892
|
request['startTime'] = since
|
2907
2893
|
if limit is not None:
|
2894
|
+
request = self.omit(request, 'size')
|
2908
2895
|
request['limit'] = limit
|
2909
2896
|
response = await self.privateSpotGetHistoryOrder(self.extend(request, params))
|
2910
2897
|
else:
|
@@ -3087,9 +3074,12 @@ class xt(Exchange, ImplicitAPI):
|
|
3087
3074
|
# }
|
3088
3075
|
# }
|
3089
3076
|
#
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3077
|
+
orders = []
|
3078
|
+
resultDict = self.safe_dict(response, 'result')
|
3079
|
+
if resultDict is not None:
|
3080
|
+
orders = self.safe_list(resultDict, 'items', [])
|
3081
|
+
else:
|
3082
|
+
orders = self.safe_list(response, 'result')
|
3093
3083
|
return self.parse_orders(orders, market, since, limit)
|
3094
3084
|
|
3095
3085
|
async def fetch_open_orders(self, symbol: str = None, since: Int = None, limit: Int = None, params={}):
|
ccxt/base/exchange.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
|
|
@@ -311,6 +311,7 @@ class Exchange(object):
|
|
311
311
|
base_currencies = None
|
312
312
|
quote_currencies = None
|
313
313
|
currencies = None
|
314
|
+
|
314
315
|
options = None # Python does not allow to define properties in run-time with setattr
|
315
316
|
isSandboxModeEnabled = False
|
316
317
|
accounts = None
|
@@ -1533,7 +1534,9 @@ class Exchange(object):
|
|
1533
1534
|
currencies = None
|
1534
1535
|
if self.has['fetchCurrencies'] is True:
|
1535
1536
|
currencies = self.fetch_currencies()
|
1537
|
+
self.options['cachedCurrencies'] = currencies
|
1536
1538
|
markets = self.fetch_markets(params)
|
1539
|
+
del self.options['cachedCurrencies']
|
1537
1540
|
return self.set_markets(markets, currencies)
|
1538
1541
|
|
1539
1542
|
def fetch_markets(self, params={}):
|
@@ -4166,11 +4169,11 @@ class Exchange(object):
|
|
4166
4169
|
raise NotSupported(self.id + ' - ' + networkCode + ' network did not return any result for ' + currencyCode)
|
4167
4170
|
else:
|
4168
4171
|
# if networkCode was provided by user, we should check it after response, referenced exchange doesn't support network-code during request
|
4169
|
-
|
4170
|
-
if
|
4171
|
-
chosenNetworkId =
|
4172
|
+
networkIdOrCode = networkCode if isIndexedByUnifiedNetworkCode else self.network_code_to_id(networkCode, currencyCode)
|
4173
|
+
if networkIdOrCode in indexedNetworkEntries:
|
4174
|
+
chosenNetworkId = networkIdOrCode
|
4172
4175
|
else:
|
4173
|
-
raise NotSupported(self.id + ' - ' +
|
4176
|
+
raise NotSupported(self.id + ' - ' + networkIdOrCode + ' network was not found for ' + currencyCode + ', use one of ' + ', '.join(availableNetworkIds))
|
4174
4177
|
else:
|
4175
4178
|
if responseNetworksLength == 0:
|
4176
4179
|
raise NotSupported(self.id + ' - no networks were returned for ' + currencyCode)
|
@@ -4458,15 +4461,15 @@ class Exchange(object):
|
|
4458
4461
|
if self.enableRateLimit:
|
4459
4462
|
cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
|
4460
4463
|
self.throttle(cost)
|
4464
|
+
retries = None
|
4465
|
+
retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
|
4466
|
+
retryDelay = None
|
4467
|
+
retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
|
4461
4468
|
self.lastRestRequestTimestamp = self.milliseconds()
|
4462
4469
|
request = self.sign(path, api, method, params, headers, body)
|
4463
4470
|
self.last_request_headers = request['headers']
|
4464
4471
|
self.last_request_body = request['body']
|
4465
4472
|
self.last_request_url = request['url']
|
4466
|
-
retries = None
|
4467
|
-
retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
|
4468
|
-
retryDelay = None
|
4469
|
-
retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
|
4470
4473
|
for i in range(0, retries + 1):
|
4471
4474
|
try:
|
4472
4475
|
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
|
ccxt/binance.py
CHANGED
@@ -5023,13 +5023,13 @@ class binance(Exchange, ImplicitAPI):
|
|
5023
5023
|
postOnly = self.is_post_only(initialUppercaseType == 'MARKET', initialUppercaseType == 'LIMIT_MAKER', params)
|
5024
5024
|
if postOnly:
|
5025
5025
|
uppercaseType = 'LIMIT_MAKER'
|
5026
|
-
request['type'] = uppercaseType
|
5027
5026
|
triggerPrice = self.safe_number_2(params, 'stopPrice', 'triggerPrice')
|
5028
5027
|
if triggerPrice is not None:
|
5029
5028
|
if uppercaseType == 'MARKET':
|
5030
5029
|
uppercaseType = 'STOP_LOSS'
|
5031
5030
|
elif uppercaseType == 'LIMIT':
|
5032
5031
|
uppercaseType = 'STOP_LOSS_LIMIT'
|
5032
|
+
request['type'] = uppercaseType
|
5033
5033
|
validOrderTypes = self.safe_list(market['info'], 'orderTypes')
|
5034
5034
|
if not self.in_array(uppercaseType, validOrderTypes):
|
5035
5035
|
if initialUppercaseType != uppercaseType:
|
ccxt/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/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/gate.py
CHANGED
@@ -125,7 +125,7 @@ class gate(Exchange, ImplicitAPI):
|
|
125
125
|
'fetchCurrencies': True,
|
126
126
|
'fetchDepositAddress': True,
|
127
127
|
'fetchDepositAddresses': False,
|
128
|
-
'fetchDepositAddressesByNetwork':
|
128
|
+
'fetchDepositAddressesByNetwork': True,
|
129
129
|
'fetchDeposits': True,
|
130
130
|
'fetchDepositWithdrawFee': 'emulated',
|
131
131
|
'fetchDepositWithdrawFees': True,
|
@@ -734,6 +734,16 @@ class gate(Exchange, ImplicitAPI):
|
|
734
734
|
},
|
735
735
|
'networksById': {
|
736
736
|
'OPETH': 'OP',
|
737
|
+
'ETH': 'ERC20', # for GOlang
|
738
|
+
'ERC20': 'ERC20',
|
739
|
+
'TRX': 'TRC20',
|
740
|
+
'TRC20': 'TRC20',
|
741
|
+
'HT': 'HRC20',
|
742
|
+
'HECO': 'HRC20',
|
743
|
+
'BSC': 'BEP20',
|
744
|
+
'BEP20': 'BEP20',
|
745
|
+
'POLYGON': 'MATIC',
|
746
|
+
'POL': 'MATIC',
|
737
747
|
},
|
738
748
|
'timeInForce': {
|
739
749
|
'GTC': 'gtc',
|
@@ -1223,6 +1233,8 @@ class gate(Exchange, ImplicitAPI):
|
|
1223
1233
|
"""
|
1224
1234
|
if self.options['adjustForTimeDifference']:
|
1225
1235
|
self.load_time_difference()
|
1236
|
+
if self.check_required_credentials(False):
|
1237
|
+
self.load_unified_status()
|
1226
1238
|
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
1227
1239
|
rawPromises = [
|
1228
1240
|
self.fetch_contract_markets(params),
|
@@ -1796,84 +1808,92 @@ class gate(Exchange, ImplicitAPI):
|
|
1796
1808
|
apiBackup = self.safe_value(self.urls, 'apiBackup')
|
1797
1809
|
if apiBackup is not None:
|
1798
1810
|
return None
|
1799
|
-
if self.check_required_credentials(False):
|
1800
|
-
self.load_unified_status()
|
1801
1811
|
response = self.publicSpotGetCurrencies(params)
|
1802
1812
|
#
|
1803
|
-
#
|
1804
|
-
#
|
1805
|
-
#
|
1806
|
-
#
|
1807
|
-
#
|
1808
|
-
#
|
1809
|
-
#
|
1810
|
-
#
|
1811
|
-
#
|
1812
|
-
#
|
1813
|
-
#
|
1814
|
-
#
|
1813
|
+
# [
|
1814
|
+
# {
|
1815
|
+
# "currency": "USDT",
|
1816
|
+
# "name": "Tether",
|
1817
|
+
# "delisted": False,
|
1818
|
+
# "withdraw_disabled": False,
|
1819
|
+
# "withdraw_delayed": False,
|
1820
|
+
# "deposit_disabled": False,
|
1821
|
+
# "trade_disabled": False,
|
1822
|
+
# "fixed_rate": "",
|
1823
|
+
# "chain": "ETH",
|
1824
|
+
# "chains": [
|
1825
|
+
# {
|
1826
|
+
# "name": "ETH",
|
1827
|
+
# "addr": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
1828
|
+
# "withdraw_disabled": False,
|
1829
|
+
# "withdraw_delayed": False,
|
1830
|
+
# "deposit_disabled": False
|
1831
|
+
# },
|
1832
|
+
# {
|
1833
|
+
# "name": "ARBEVM",
|
1834
|
+
# "addr": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
1835
|
+
# "withdraw_disabled": False,
|
1836
|
+
# "withdraw_delayed": False,
|
1837
|
+
# "deposit_disabled": False
|
1838
|
+
# },
|
1839
|
+
# {
|
1840
|
+
# "name": "BSC",
|
1841
|
+
# "addr": "0x55d398326f99059fF775485246999027B3197955",
|
1842
|
+
# "withdraw_disabled": False,
|
1843
|
+
# "withdraw_delayed": False,
|
1844
|
+
# "deposit_disabled": False
|
1845
|
+
# },
|
1846
|
+
# ]
|
1847
|
+
# },
|
1848
|
+
# ]
|
1815
1849
|
#
|
1816
1850
|
indexedCurrencies = self.index_by(response, 'currency')
|
1817
1851
|
result: dict = {}
|
1818
1852
|
for i in range(0, len(response)):
|
1819
1853
|
entry = response[i]
|
1820
1854
|
currencyId = self.safe_string(entry, 'currency')
|
1821
|
-
|
1822
|
-
partFirst = self.safe_string(parts, 0)
|
1823
|
-
# if there's an underscore then the second part is always the chain name(except the _OLD suffix)
|
1824
|
-
currencyName = currencyId if currencyId.endswith('_OLD') else partFirst
|
1825
|
-
withdrawDisabled = self.safe_bool(entry, 'withdraw_disabled', False)
|
1826
|
-
depositDisabled = self.safe_bool(entry, 'deposit_disabled', False)
|
1827
|
-
tradeDisabled = self.safe_bool(entry, 'trade_disabled', False)
|
1828
|
-
precision = self.parse_number('0.0001') # temporary safe default, because no value provided from API
|
1829
|
-
code = self.safe_currency_code(currencyName)
|
1855
|
+
code = self.safe_currency_code(currencyId)
|
1830
1856
|
# check leveraged tokens(e.g. BTC3S, ETH5L)
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
'
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1857
|
+
type = 'leveraged' if self.is_leveraged_currency(currencyId, True, indexedCurrencies) else 'crypto'
|
1858
|
+
chains = self.safe_list(entry, 'chains', [])
|
1859
|
+
networks = {}
|
1860
|
+
for j in range(0, len(chains)):
|
1861
|
+
chain = chains[j]
|
1862
|
+
networkId = self.safe_string(chain, 'name')
|
1863
|
+
networkCode = self.network_id_to_code(networkId)
|
1864
|
+
networks[networkCode] = {
|
1865
|
+
'info': chain,
|
1866
|
+
'id': networkId,
|
1867
|
+
'network': networkCode,
|
1868
|
+
'active': None,
|
1869
|
+
'deposit': not self.safe_bool(chain, 'deposit_disabled'),
|
1870
|
+
'withdraw': not self.safe_bool(chain, 'withdraw_disabled'),
|
1871
|
+
'fee': None,
|
1872
|
+
'precision': self.parse_number('0.0001'), # temporary safe default, because no value provided from API,
|
1873
|
+
'limits': {
|
1874
|
+
'deposit': {
|
1875
|
+
'min': None,
|
1876
|
+
'max': None,
|
1877
|
+
},
|
1878
|
+
'withdraw': {
|
1879
|
+
'min': None,
|
1880
|
+
'max': None,
|
1881
|
+
},
|
1852
1882
|
},
|
1853
|
-
},
|
1854
|
-
'active': not tradeDisabled,
|
1855
|
-
'deposit': not depositDisabled,
|
1856
|
-
'withdraw': not withdrawDisabled,
|
1857
|
-
'fee': None,
|
1858
|
-
'precision': precision,
|
1859
|
-
}
|
1860
|
-
# check if first entry for the specific currency
|
1861
|
-
if not (code in result):
|
1862
|
-
result[code] = {
|
1863
|
-
'id': currencyName,
|
1864
|
-
'lowerCaseId': currencyName.lower(),
|
1865
|
-
'code': code,
|
1866
|
-
'type': type,
|
1867
|
-
'precision': precision,
|
1868
|
-
'limits': None,
|
1869
|
-
'networks': {},
|
1870
|
-
'info': [], # will be filled below
|
1871
1883
|
}
|
1872
|
-
result[code]
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1884
|
+
result[code] = self.safe_currency_structure({
|
1885
|
+
'id': currencyId,
|
1886
|
+
'code': code,
|
1887
|
+
'name': self.safe_string(entry, 'name'),
|
1888
|
+
'type': type,
|
1889
|
+
'active': not self.safe_bool(entry, 'delisted'),
|
1890
|
+
'deposit': not self.safe_bool(entry, 'deposit_disabled'),
|
1891
|
+
'withdraw': not self.safe_bool(entry, 'withdraw_disabled'),
|
1892
|
+
'fee': None,
|
1893
|
+
'networks': networks,
|
1894
|
+
'precision': self.parse_number('0.0001'),
|
1895
|
+
'info': entry,
|
1896
|
+
})
|
1877
1897
|
return result
|
1878
1898
|
|
1879
1899
|
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
@@ -2138,9 +2158,7 @@ class gate(Exchange, ImplicitAPI):
|
|
2138
2158
|
chains = self.safe_value(response, 'multichain_addresses', [])
|
2139
2159
|
currencyId = self.safe_string(response, 'currency')
|
2140
2160
|
currency = self.safe_currency(currencyId, currency)
|
2141
|
-
parsed = self.parse_deposit_addresses(chains,
|
2142
|
-
'currency': currency['id'],
|
2143
|
-
})
|
2161
|
+
parsed = self.parse_deposit_addresses(chains, None, False)
|
2144
2162
|
return self.index_by(parsed, 'network')
|
2145
2163
|
|
2146
2164
|
def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
@@ -2158,8 +2176,8 @@ class gate(Exchange, ImplicitAPI):
|
|
2158
2176
|
networkCode = None
|
2159
2177
|
networkCode, params = self.handle_network_code_and_params(params)
|
2160
2178
|
chainsIndexedById = self.fetch_deposit_addresses_by_network(code, params)
|
2161
|
-
|
2162
|
-
return chainsIndexedById[
|
2179
|
+
selectedNetworkIdOrCode = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
|
2180
|
+
return chainsIndexedById[selectedNetworkIdOrCode]
|
2163
2181
|
|
2164
2182
|
def parse_deposit_address(self, depositAddress, currency=None):
|
2165
2183
|
#
|
ccxt/htx.py
CHANGED
@@ -4286,6 +4286,8 @@ class htx(Exchange, ImplicitAPI):
|
|
4286
4286
|
request: dict = {}
|
4287
4287
|
marketType = None
|
4288
4288
|
marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
4289
|
+
subType = None
|
4290
|
+
subType, params = self.handle_sub_type_and_params('fetchOpenOrders', market, params, 'linear')
|
4289
4291
|
response = None
|
4290
4292
|
if marketType == 'spot':
|
4291
4293
|
if symbol is not None:
|
@@ -4307,16 +4309,16 @@ class htx(Exchange, ImplicitAPI):
|
|
4307
4309
|
params = self.omit(params, 'account-id')
|
4308
4310
|
response = self.spotPrivateGetV1OrderOpenOrders(self.extend(request, params))
|
4309
4311
|
else:
|
4310
|
-
if symbol is None:
|
4311
|
-
raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument')
|
4312
|
+
if symbol is not None:
|
4313
|
+
# raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument')
|
4314
|
+
request['contract_code'] = market['id']
|
4312
4315
|
if limit is not None:
|
4313
4316
|
request['page_size'] = limit
|
4314
|
-
request['contract_code'] = market['id']
|
4315
4317
|
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
4316
4318
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4317
4319
|
trailing = self.safe_bool(params, 'trailing', False)
|
4318
4320
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
4319
|
-
if
|
4321
|
+
if subType == 'linear':
|
4320
4322
|
marginMode = None
|
4321
4323
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
4322
4324
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
@@ -4338,8 +4340,8 @@ class htx(Exchange, ImplicitAPI):
|
|
4338
4340
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTrackOpenorders(self.extend(request, params))
|
4339
4341
|
else:
|
4340
4342
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(self.extend(request, params))
|
4341
|
-
elif
|
4342
|
-
if
|
4343
|
+
elif subType == 'inverse':
|
4344
|
+
if marketType == 'swap':
|
4343
4345
|
if trigger:
|
4344
4346
|
response = self.contractPrivatePostSwapApiV1SwapTriggerOpenorders(self.extend(request, params))
|
4345
4347
|
elif stopLossTakeProfit:
|
@@ -4348,8 +4350,8 @@ class htx(Exchange, ImplicitAPI):
|
|
4348
4350
|
response = self.contractPrivatePostSwapApiV1SwapTrackOpenorders(self.extend(request, params))
|
4349
4351
|
else:
|
4350
4352
|
response = self.contractPrivatePostSwapApiV1SwapOpenorders(self.extend(request, params))
|
4351
|
-
elif
|
4352
|
-
request['symbol'] = market
|
4353
|
+
elif marketType == 'future':
|
4354
|
+
request['symbol'] = self.safe_string(market, 'settleId', 'usdt')
|
4353
4355
|
if trigger:
|
4354
4356
|
response = self.contractPrivatePostApiV1ContractTriggerOpenorders(self.extend(request, params))
|
4355
4357
|
elif stopLossTakeProfit:
|