ccxt 4.4.85__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.
Files changed (92) hide show
  1. ccxt/__init__.py +7 -5
  2. ccxt/abstract/modetrade.py +119 -0
  3. ccxt/abstract/myokx.py +2 -0
  4. ccxt/abstract/okx.py +2 -0
  5. ccxt/abstract/okxus.py +349 -0
  6. ccxt/ascendex.py +187 -151
  7. ccxt/async_support/__init__.py +7 -5
  8. ccxt/async_support/ascendex.py +187 -151
  9. ccxt/async_support/base/exchange.py +30 -26
  10. ccxt/async_support/bequant.py +1 -1
  11. ccxt/async_support/binance.py +1 -1
  12. ccxt/async_support/bitget.py +4 -4
  13. ccxt/async_support/bitmart.py +1 -1
  14. ccxt/async_support/bitteam.py +31 -0
  15. ccxt/async_support/{huobijp.py → bittrade.py} +11 -11
  16. ccxt/async_support/coinbase.py +2 -5
  17. ccxt/async_support/coinmetro.py +3 -0
  18. ccxt/async_support/deribit.py +4 -5
  19. ccxt/async_support/gate.py +91 -73
  20. ccxt/async_support/hollaex.py +106 -49
  21. ccxt/async_support/htx.py +30 -51
  22. ccxt/async_support/hyperliquid.py +36 -20
  23. ccxt/async_support/kraken.py +5 -8
  24. ccxt/async_support/mexc.py +2 -2
  25. ccxt/async_support/modetrade.py +2727 -0
  26. ccxt/async_support/ndax.py +25 -24
  27. ccxt/async_support/okcoin.py +12 -29
  28. ccxt/async_support/okx.py +99 -3
  29. ccxt/async_support/okxus.py +54 -0
  30. ccxt/async_support/onetrading.py +10 -7
  31. ccxt/async_support/oxfun.py +40 -110
  32. ccxt/async_support/paradex.py +6 -0
  33. ccxt/async_support/phemex.py +4 -6
  34. ccxt/async_support/poloniex.py +172 -159
  35. ccxt/async_support/probit.py +18 -47
  36. ccxt/async_support/timex.py +5 -10
  37. ccxt/async_support/vertex.py +3 -4
  38. ccxt/async_support/whitebit.py +41 -11
  39. ccxt/async_support/woo.py +101 -75
  40. ccxt/async_support/woofipro.py +25 -20
  41. ccxt/async_support/xt.py +31 -41
  42. ccxt/base/exchange.py +12 -9
  43. ccxt/bequant.py +1 -1
  44. ccxt/binance.py +1 -1
  45. ccxt/bitget.py +4 -4
  46. ccxt/bitmart.py +1 -1
  47. ccxt/bitteam.py +31 -0
  48. ccxt/{huobijp.py → bittrade.py} +11 -11
  49. ccxt/coinbase.py +2 -5
  50. ccxt/coinmetro.py +3 -0
  51. ccxt/deribit.py +4 -5
  52. ccxt/gate.py +91 -73
  53. ccxt/hollaex.py +106 -49
  54. ccxt/htx.py +30 -51
  55. ccxt/hyperliquid.py +36 -20
  56. ccxt/kraken.py +5 -8
  57. ccxt/mexc.py +2 -2
  58. ccxt/modetrade.py +2727 -0
  59. ccxt/ndax.py +25 -24
  60. ccxt/okcoin.py +12 -29
  61. ccxt/okx.py +99 -3
  62. ccxt/okxus.py +54 -0
  63. ccxt/onetrading.py +10 -7
  64. ccxt/oxfun.py +40 -110
  65. ccxt/paradex.py +6 -0
  66. ccxt/phemex.py +4 -6
  67. ccxt/poloniex.py +172 -159
  68. ccxt/pro/__init__.py +101 -3
  69. ccxt/pro/binance.py +1 -0
  70. ccxt/pro/{huobijp.py → bittrade.py} +3 -3
  71. ccxt/pro/luno.py +6 -5
  72. ccxt/pro/mexc.py +2 -0
  73. ccxt/pro/modetrade.py +1271 -0
  74. ccxt/pro/okxus.py +38 -0
  75. ccxt/probit.py +18 -47
  76. ccxt/test/tests_async.py +17 -1
  77. ccxt/test/tests_sync.py +17 -1
  78. ccxt/timex.py +5 -10
  79. ccxt/vertex.py +3 -4
  80. ccxt/whitebit.py +41 -11
  81. ccxt/woo.py +100 -75
  82. ccxt/woofipro.py +24 -20
  83. ccxt/xt.py +31 -41
  84. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/METADATA +19 -8
  85. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/RECORD +89 -84
  86. ccxt/abstract/kuna.py +0 -182
  87. ccxt/async_support/kuna.py +0 -1935
  88. ccxt/kuna.py +0 -1935
  89. /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
  90. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/LICENSE.txt +0 -0
  91. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/WHEEL +0 -0
  92. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/top_level.txt +0 -0
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.85'
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
- networkId = networkCode if isIndexedByUnifiedNetworkCode else self.network_code_to_id(networkCode, currencyCode)
4170
- if networkId in indexedNetworkEntries:
4171
- chosenNetworkId = networkId
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 + ' - ' + networkId + ' network was not found for ' + currencyCode + ', use one of ' + ', '.join(availableNetworkIds))
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/bequant.py CHANGED
@@ -14,8 +14,8 @@ class bequant(hitbtc, ImplicitAPI):
14
14
  return self.deep_extend(super(bequant, self).describe(), {
15
15
  'id': 'bequant',
16
16
  'name': 'Bequant',
17
- 'countries': ['MT'], # Malta
18
17
  'pro': True,
18
+ 'countries': ['MT'], # Malta
19
19
  'urls': {
20
20
  'logo': 'https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867',
21
21
  'api': {
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/bitget.py CHANGED
@@ -2370,7 +2370,7 @@ class bitget(Exchange, ImplicitAPI):
2370
2370
  'coin': currency['id'],
2371
2371
  'address': address,
2372
2372
  'chain': networkId,
2373
- 'size': amount,
2373
+ 'size': self.currency_to_precision(code, amount, networkCode),
2374
2374
  'transferType': 'on_chain',
2375
2375
  }
2376
2376
  if tag is not None:
@@ -2394,8 +2394,6 @@ class bitget(Exchange, ImplicitAPI):
2394
2394
  fillResponseFromRequest = self.safe_bool(withdrawOptions, 'fillResponseFromRequest', True)
2395
2395
  if fillResponseFromRequest:
2396
2396
  result['currency'] = code
2397
- result['timestamp'] = self.milliseconds()
2398
- result['datetime'] = self.iso8601(self.milliseconds())
2399
2397
  result['amount'] = amount
2400
2398
  result['tag'] = tag
2401
2399
  result['address'] = address
@@ -2513,7 +2511,9 @@ class bitget(Exchange, ImplicitAPI):
2513
2511
  status = self.safe_string(transaction, 'status')
2514
2512
  tag = self.safe_string(transaction, 'tag')
2515
2513
  feeCostString = self.safe_string(transaction, 'fee')
2516
- feeCostAbsString = Precise.string_abs(feeCostString)
2514
+ feeCostAbsString = None
2515
+ if feeCostString is not None:
2516
+ feeCostAbsString = Precise.string_abs(feeCostString)
2517
2517
  fee = None
2518
2518
  amountString = self.safe_string(transaction, 'size')
2519
2519
  if feeCostAbsString is not None:
ccxt/bitmart.py CHANGED
@@ -2306,7 +2306,7 @@ class bitmart(Exchange, ImplicitAPI):
2306
2306
  code = self.safe_currency_code(currencyId)
2307
2307
  account = self.account()
2308
2308
  account['free'] = self.safe_string_2(balance, 'available', 'available_balance')
2309
- account['used'] = self.safe_string_2(balance, 'frozen', 'frozen_balance')
2309
+ account['used'] = self.safe_string_n(balance, ['unAvailable', 'frozen', 'frozen_balance'])
2310
2310
  result[code] = account
2311
2311
  return self.safe_balance(result)
2312
2312
 
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,
@@ -4,7 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
- from ccxt.abstract.huobijp import ImplicitAPI
7
+ from ccxt.abstract.bittrade import ImplicitAPI
8
8
  import hashlib
9
9
  from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
@@ -27,12 +27,12 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
27
27
  from ccxt.base.precise import Precise
28
28
 
29
29
 
30
- class huobijp(Exchange, ImplicitAPI):
30
+ class bittrade(Exchange, ImplicitAPI):
31
31
 
32
32
  def describe(self) -> Any:
33
- return self.deep_extend(super(huobijp, self).describe(), {
34
- 'id': 'huobijp',
35
- 'name': 'Huobi Japan',
33
+ return self.deep_extend(super(bittrade, self).describe(), {
34
+ 'id': 'bittrade',
35
+ 'name': 'BitTrade',
36
36
  'countries': ['JP'],
37
37
  'rateLimit': 100,
38
38
  'userAgent': self.userAgents['chrome39'],
@@ -108,10 +108,10 @@ class huobijp(Exchange, ImplicitAPI):
108
108
  'v2Public': 'https://{hostname}',
109
109
  'v2Private': 'https://{hostname}',
110
110
  },
111
- 'www': 'https://www.huobi.co.jp',
112
- 'referral': 'https://www.huobi.co.jp/register/?invite_code=znnq3',
113
- 'doc': 'https://api-doc.huobi.co.jp',
114
- 'fees': 'https://www.huobi.co.jp/support/fee',
111
+ 'www': 'https://www.bittrade.co.jp',
112
+ 'referral': 'https://www.bittrade.co.jp/register/?invite_code=znnq3',
113
+ 'doc': 'https://api-doc.bittrade.co.jp',
114
+ 'fees': 'https://www.bittrade.co.jp/ja-jp/support/fee',
115
115
  },
116
116
  'api': {
117
117
  'v2Public': {
@@ -1483,7 +1483,7 @@ class huobijp(Exchange, ImplicitAPI):
1483
1483
  """
1484
1484
  cancels an open order
1485
1485
  :param str id: order id
1486
- :param str symbol: not used by huobijp cancelOrder()
1486
+ :param str symbol: not used by bittrade cancelOrder()
1487
1487
  :param dict [params]: extra parameters specific to the exchange API endpoint
1488
1488
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1489
1489
  """
@@ -1503,7 +1503,7 @@ class huobijp(Exchange, ImplicitAPI):
1503
1503
  """
1504
1504
  cancel multiple orders
1505
1505
  :param str[] ids: order ids
1506
- :param str symbol: not used by huobijp cancelOrders()
1506
+ :param str symbol: not used by bittrade cancelOrders()
1507
1507
  :param dict [params]: extra parameters specific to the exchange API endpoint
1508
1508
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1509
1509
  """
ccxt/coinbase.py CHANGED
@@ -1424,9 +1424,6 @@ class coinbase(Exchange, ImplicitAPI):
1424
1424
  self.v3PublicGetBrokerageMarketProducts(self.extend(params, {'product_type': 'FUTURE'})),
1425
1425
  self.v3PublicGetBrokerageMarketProducts(self.extend(params, {'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL'})),
1426
1426
  ]
1427
- if self.check_required_credentials(False):
1428
- unresolvedContractPromises.append(self.extend(params, {'product_type': 'FUTURE'}))
1429
- unresolvedContractPromises.append(self.extend(params, {'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL'}))
1430
1427
  except Exception as e:
1431
1428
  unresolvedContractPromises = [] # the sync version of ccxt won't have the promise.all line so the request is made here. Some users can't access perpetual products
1432
1429
  promises = spotUnresolvedPromises
@@ -1439,8 +1436,8 @@ class coinbase(Exchange, ImplicitAPI):
1439
1436
  fees = self.safe_dict(promises, 1, {})
1440
1437
  expiringFutures = self.safe_dict(contractPromises, 0, {})
1441
1438
  perpetualFutures = self.safe_dict(contractPromises, 1, {})
1442
- expiringFees = self.safe_dict(contractPromises, 2, {})
1443
- perpetualFees = self.safe_dict(contractPromises, 3, {})
1439
+ expiringFees = self.safe_dict(contractPromises, 0, {})
1440
+ perpetualFees = self.safe_dict(contractPromises, 1, {})
1444
1441
  #
1445
1442
  # {
1446
1443
  # "total_volume": 0,
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/deribit.py CHANGED
@@ -640,18 +640,17 @@ class deribit(Exchange, ImplicitAPI):
640
640
  # "testnet": True
641
641
  # }
642
642
  #
643
- data = self.safe_value(response, 'result', {})
643
+ data = self.safe_list(response, 'result', [])
644
644
  result: dict = {}
645
645
  for i in range(0, len(data)):
646
646
  currency = data[i]
647
647
  currencyId = self.safe_string(currency, 'currency')
648
648
  code = self.safe_currency_code(currencyId)
649
- name = self.safe_string(currency, 'currency_long')
650
- result[code] = {
649
+ result[code] = self.safe_currency_structure({
651
650
  'info': currency,
652
651
  'code': code,
653
652
  'id': currencyId,
654
- 'name': name,
653
+ 'name': self.safe_string(currency, 'currency_long'),
655
654
  'active': None,
656
655
  'deposit': None,
657
656
  'withdraw': None,
@@ -673,7 +672,7 @@ class deribit(Exchange, ImplicitAPI):
673
672
  },
674
673
  },
675
674
  'networks': None,
676
- }
675
+ })
677
676
  return result
678
677
 
679
678
  def code_from_options(self, methodName, params={}):
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': False,
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
- # "currency": "USDT_ETH",
1806
- # "name": "Tether",
1807
- # "delisted": False,
1808
- # "withdraw_disabled": False,
1809
- # "withdraw_delayed": False,
1810
- # "deposit_disabled": False,
1811
- # "trade_disabled": True,
1812
- # "chain": "ETH"
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
- parts = currencyId.split('_')
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
- isLeveragedToken = False
1832
- if currencyId.endswith('3S') or currencyId.endswith('3L') or currencyId.endswith('5S') or currencyId.endswith('5L'):
1833
- realCurrencyId = currencyId[0:-2]
1834
- if realCurrencyId in indexedCurrencies:
1835
- isLeveragedToken = True
1836
- type = 'leveraged' if isLeveragedToken else 'crypto'
1837
- # some networks are null, they are mostly obsolete & unsupported dead tokens, so we can default their networkId to their tokenname
1838
- networkId = self.safe_string(entry, 'chain', currencyId)
1839
- networkCode = self.network_id_to_code(networkId, code)
1840
- networkEntry = {
1841
- 'info': entry,
1842
- 'id': networkId,
1843
- 'network': networkCode,
1844
- 'limits': {
1845
- 'deposit': {
1846
- 'min': None,
1847
- 'max': None,
1848
- },
1849
- 'withdraw': {
1850
- 'min': None,
1851
- 'max': None,
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]['networks'][networkCode] = networkEntry
1873
- info = self.safe_list(result[code], 'info', [])
1874
- info.append(entry)
1875
- result[code]['info'] = info
1876
- result[code] = self.safe_currency_structure(result[code]) # self is needed after adding network entry
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, [currency['code']], False, {
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
- selectedNetworkId = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
2162
- return chainsIndexedById[selectedNetworkId]
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
  #