ccxt 4.4.86__py2.py3-none-any.whl → 4.4.88__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.
Files changed (58) hide show
  1. ccxt/__init__.py +5 -1
  2. ccxt/abstract/modetrade.py +119 -0
  3. ccxt/abstract/okxus.py +349 -0
  4. ccxt/async_support/__init__.py +5 -1
  5. ccxt/async_support/base/exchange.py +8 -5
  6. ccxt/async_support/binance.py +1 -1
  7. ccxt/async_support/bitteam.py +31 -0
  8. ccxt/async_support/bybit.py +19 -57
  9. ccxt/async_support/coinmetro.py +3 -0
  10. ccxt/async_support/gate.py +91 -73
  11. ccxt/async_support/htx.py +10 -8
  12. ccxt/async_support/hyperliquid.py +32 -16
  13. ccxt/async_support/kraken.py +5 -8
  14. ccxt/async_support/modetrade.py +2727 -0
  15. ccxt/async_support/okx.py +90 -3
  16. ccxt/async_support/okxus.py +54 -0
  17. ccxt/async_support/paradex.py +4 -1
  18. ccxt/async_support/phemex.py +4 -6
  19. ccxt/async_support/poloniex.py +172 -159
  20. ccxt/async_support/probit.py +18 -47
  21. ccxt/async_support/timex.py +5 -10
  22. ccxt/async_support/vertex.py +3 -4
  23. ccxt/async_support/whitebit.py +41 -11
  24. ccxt/async_support/woo.py +101 -75
  25. ccxt/async_support/woofipro.py +25 -20
  26. ccxt/async_support/xt.py +31 -41
  27. ccxt/base/exchange.py +13 -9
  28. ccxt/binance.py +1 -1
  29. ccxt/bitteam.py +31 -0
  30. ccxt/bybit.py +19 -57
  31. ccxt/coinmetro.py +3 -0
  32. ccxt/gate.py +91 -73
  33. ccxt/htx.py +10 -8
  34. ccxt/hyperliquid.py +32 -16
  35. ccxt/kraken.py +5 -8
  36. ccxt/modetrade.py +2727 -0
  37. ccxt/okx.py +90 -3
  38. ccxt/okxus.py +54 -0
  39. ccxt/paradex.py +4 -1
  40. ccxt/phemex.py +4 -6
  41. ccxt/poloniex.py +172 -159
  42. ccxt/pro/__init__.py +69 -1
  43. ccxt/pro/modetrade.py +1271 -0
  44. ccxt/pro/okxus.py +38 -0
  45. ccxt/probit.py +18 -47
  46. ccxt/test/tests_async.py +17 -1
  47. ccxt/test/tests_sync.py +17 -1
  48. ccxt/timex.py +5 -10
  49. ccxt/vertex.py +3 -4
  50. ccxt/whitebit.py +41 -11
  51. ccxt/woo.py +100 -75
  52. ccxt/woofipro.py +24 -20
  53. ccxt/xt.py +31 -41
  54. {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/METADATA +18 -6
  55. {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/RECORD +58 -50
  56. {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/LICENSE.txt +0 -0
  57. {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/WHEEL +0 -0
  58. {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/top_level.txt +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.86'
7
+ __version__ = '4.4.88'
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.86'
5
+ __version__ = '4.4.88'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -282,7 +282,10 @@ class Exchange(BaseExchange):
282
282
  currencies = None
283
283
  if self.has['fetchCurrencies'] is True:
284
284
  currencies = await self.fetch_currencies()
285
+ self.options['cachedCurrencies'] = currencies
285
286
  markets = await self.fetch_markets(params)
287
+ if 'cachedCurrencies' in self.options:
288
+ del self.options['cachedCurrencies']
286
289
  return self.set_markets(markets, currencies)
287
290
 
288
291
 
@@ -903,15 +906,15 @@ class Exchange(BaseExchange):
903
906
  if self.enableRateLimit:
904
907
  cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
905
908
  await self.throttle(cost)
909
+ retries = None
910
+ retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
911
+ retryDelay = None
912
+ retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
906
913
  self.lastRestRequestTimestamp = self.milliseconds()
907
914
  request = self.sign(path, api, method, params, headers, body)
908
915
  self.last_request_headers = request['headers']
909
916
  self.last_request_body = request['body']
910
917
  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
918
  for i in range(0, retries + 1):
916
919
  try:
917
920
  return await self.fetch(request['url'], request['method'], request['headers'], request['body'])
@@ -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:
@@ -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,
@@ -2302,15 +2302,9 @@ class bybit(Exchange, ImplicitAPI):
2302
2302
  # 'baseCoin': '', Base coin. For option only
2303
2303
  # 'expDate': '', Expiry date. e.g., 25DEC22. For option only
2304
2304
  }
2305
- if market['spot']:
2306
- request['category'] = 'spot'
2307
- else:
2308
- if market['option']:
2309
- request['category'] = 'option'
2310
- elif market['linear']:
2311
- request['category'] = 'linear'
2312
- elif market['inverse']:
2313
- request['category'] = 'inverse'
2305
+ category = None
2306
+ category, params = self.get_bybit_type('fetchTicker', market, params)
2307
+ request['category'] = category
2314
2308
  response = await self.publicGetV5MarketTickers(self.extend(request, params))
2315
2309
  #
2316
2310
  # {
@@ -2402,24 +2396,14 @@ class bybit(Exchange, ImplicitAPI):
2402
2396
  # 'baseCoin': '', # Base coin. For option only
2403
2397
  # 'expDate': '', # Expiry date. e.g., 25DEC22. For option only
2404
2398
  }
2405
- type = None
2406
- type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2407
- # Calls like `.fetchTickers(None, {subType:'inverse'})` should be supported for self exchange, so
2408
- # as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2409
- # with higher priority and only default to spot, if `subType` is not set in params
2410
- passedSubType = self.safe_string(params, 'subType')
2411
- subType = None
2412
- subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
2413
- # only if passedSubType is None, then use spot
2414
- if type == 'spot' and passedSubType is None:
2415
- request['category'] = 'spot'
2416
- elif type == 'option':
2399
+ category = None
2400
+ category, params = self.get_bybit_type('fetchTickers', market, params)
2401
+ request['category'] = category
2402
+ if category == 'option':
2417
2403
  request['category'] = 'option'
2418
2404
  if code is None:
2419
2405
  code = 'BTC'
2420
2406
  request['baseCoin'] = code
2421
- elif type == 'swap' or type == 'future' or subType is not None:
2422
- request['category'] = subType
2423
2407
  response = await self.publicGetV5MarketTickers(self.extend(request, params))
2424
2408
  #
2425
2409
  # {
@@ -3891,14 +3875,9 @@ class bybit(Exchange, ImplicitAPI):
3891
3875
  request['orderLinkId'] = self.uuid16()
3892
3876
  if isLimit:
3893
3877
  request['price'] = priceString
3894
- if market['spot']:
3895
- request['category'] = 'spot'
3896
- elif market['option']:
3897
- request['category'] = 'option'
3898
- elif market['linear']:
3899
- request['category'] = 'linear'
3900
- elif market['inverse']:
3901
- request['category'] = 'inverse'
3878
+ category = None
3879
+ category, params = self.get_bybit_type('createOrderRequest', market, params)
3880
+ request['category'] = category
3902
3881
  cost = self.safe_string(params, 'cost')
3903
3882
  params = self.omit(params, 'cost')
3904
3883
  # if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -4091,14 +4070,9 @@ class bybit(Exchange, ImplicitAPI):
4091
4070
  # Valid for option only.
4092
4071
  # 'orderIv': '0', # Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
4093
4072
  }
4094
- if market['spot']:
4095
- request['category'] = 'spot'
4096
- elif market['linear']:
4097
- request['category'] = 'linear'
4098
- elif market['inverse']:
4099
- request['category'] = 'inverse'
4100
- elif market['option']:
4101
- request['category'] = 'option'
4073
+ category = None
4074
+ category, params = self.get_bybit_type('editOrderRequest', market, params)
4075
+ request['category'] = category
4102
4076
  if amount is not None:
4103
4077
  request['qty'] = self.get_amount(symbol, amount)
4104
4078
  if price is not None:
@@ -4289,14 +4263,9 @@ class bybit(Exchange, ImplicitAPI):
4289
4263
  request['orderFilter'] = 'StopOrder' if isTrigger else 'Order'
4290
4264
  if id is not None: # The user can also use argument params["orderLinkId"]
4291
4265
  request['orderId'] = id
4292
- if market['spot']:
4293
- request['category'] = 'spot'
4294
- elif market['linear']:
4295
- request['category'] = 'linear'
4296
- elif market['inverse']:
4297
- request['category'] = 'inverse'
4298
- elif market['option']:
4299
- request['category'] = 'option'
4266
+ category = None
4267
+ category, params = self.get_bybit_type('cancelOrderRequest', market, params)
4268
+ request['category'] = category
4300
4269
  return self.extend(request, params)
4301
4270
 
4302
4271
  async def cancel_order(self, id: str, symbol: Str = None, params={}) -> Order:
@@ -7189,14 +7158,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7189
7158
  'symbol': market['id'],
7190
7159
  }
7191
7160
  category = None
7192
- if market['linear']:
7193
- category = 'linear'
7194
- elif market['inverse']:
7195
- category = 'inverse'
7196
- elif market['spot']:
7197
- category = 'spot'
7198
- else:
7199
- category = 'option'
7161
+ category, params = self.get_bybit_type('fetchTradingFee', market, params)
7200
7162
  request['category'] = category
7201
7163
  response = await self.privateGetV5AccountFeeRate(self.extend(request, params))
7202
7164
  #
@@ -7435,9 +7397,9 @@ classic accounts only/ spot not supported* fetches information on an order made
7435
7397
  request['symbol'] = market['id']
7436
7398
  type = None
7437
7399
  type, params = self.get_bybit_type('fetchMySettlementHistory', market, params)
7438
- if type == 'spot' or type == 'inverse':
7400
+ if type == 'spot':
7439
7401
  raise NotSupported(self.id + ' fetchMySettlementHistory() is not supported for spot market')
7440
- request['category'] = 'linear'
7402
+ request['category'] = type
7441
7403
  if limit is not None:
7442
7404
  request['limit'] = limit
7443
7405
  response = await self.privateGetV5AssetDeliveryRecord(self.extend(request, params))
@@ -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,
@@ -126,7 +126,7 @@ class gate(Exchange, ImplicitAPI):
126
126
  'fetchCurrencies': True,
127
127
  'fetchDepositAddress': True,
128
128
  'fetchDepositAddresses': False,
129
- 'fetchDepositAddressesByNetwork': False,
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
- # "currency": "USDT_ETH",
1807
- # "name": "Tether",
1808
- # "delisted": False,
1809
- # "withdraw_disabled": False,
1810
- # "withdraw_delayed": False,
1811
- # "deposit_disabled": False,
1812
- # "trade_disabled": True,
1813
- # "chain": "ETH"
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
- parts = currencyId.split('_')
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
- isLeveragedToken = False
1833
- if currencyId.endswith('3S') or currencyId.endswith('3L') or currencyId.endswith('5S') or currencyId.endswith('5L'):
1834
- realCurrencyId = currencyId[0:-2]
1835
- if realCurrencyId in indexedCurrencies:
1836
- isLeveragedToken = True
1837
- type = 'leveraged' if isLeveragedToken else 'crypto'
1838
- # some networks are null, they are mostly obsolete & unsupported dead tokens, so we can default their networkId to their tokenname
1839
- networkId = self.safe_string(entry, 'chain', currencyId)
1840
- networkCode = self.network_id_to_code(networkId, code)
1841
- networkEntry = {
1842
- 'info': entry,
1843
- 'id': networkId,
1844
- 'network': networkCode,
1845
- 'limits': {
1846
- 'deposit': {
1847
- 'min': None,
1848
- 'max': None,
1849
- },
1850
- 'withdraw': {
1851
- 'min': None,
1852
- 'max': None,
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]['networks'][networkCode] = networkEntry
1874
- info = self.safe_list(result[code], 'info', [])
1875
- info.append(entry)
1876
- result[code]['info'] = info
1877
- result[code] = self.safe_currency_structure(result[code]) # self is needed after adding network entry
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, [currency['code']], False, {
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
- selectedNetworkId = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
2163
- return chainsIndexedById[selectedNetworkId]
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 market['linear']:
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 market['inverse']:
4343
- if market['swap']:
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 market['future']:
4353
- request['symbol'] = market['settleId']
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: