ccxt 4.4.91__py2.py3-none-any.whl → 4.4.93__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 (57) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/lbank.py +2 -1
  3. ccxt/ascendex.py +9 -8
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/ascendex.py +9 -8
  6. ccxt/async_support/base/exchange.py +4 -1
  7. ccxt/async_support/base/ws/client.py +4 -1
  8. ccxt/async_support/binance.py +42 -1
  9. ccxt/async_support/bitmart.py +7 -0
  10. ccxt/async_support/bitmex.py +3 -3
  11. ccxt/async_support/bitvavo.py +7 -1
  12. ccxt/async_support/bybit.py +81 -8
  13. ccxt/async_support/coinbaseexchange.py +53 -0
  14. ccxt/async_support/coincheck.py +45 -4
  15. ccxt/async_support/coinex.py +16 -12
  16. ccxt/async_support/cryptomus.py +30 -52
  17. ccxt/async_support/deribit.py +6 -6
  18. ccxt/async_support/exmo.py +70 -50
  19. ccxt/async_support/htx.py +1 -1
  20. ccxt/async_support/hyperliquid.py +2 -1
  21. ccxt/async_support/krakenfutures.py +1 -1
  22. ccxt/async_support/kucoin.py +12 -14
  23. ccxt/async_support/latoken.py +19 -71
  24. ccxt/async_support/lbank.py +115 -35
  25. ccxt/async_support/okx.py +151 -2
  26. ccxt/async_support/paradex.py +54 -0
  27. ccxt/async_support/phemex.py +3 -3
  28. ccxt/base/exchange.py +69 -30
  29. ccxt/base/types.py +1 -0
  30. ccxt/binance.py +42 -1
  31. ccxt/bitmart.py +7 -0
  32. ccxt/bitmex.py +3 -3
  33. ccxt/bitvavo.py +7 -1
  34. ccxt/bybit.py +81 -8
  35. ccxt/coinbaseexchange.py +53 -0
  36. ccxt/coincheck.py +45 -4
  37. ccxt/coinex.py +16 -12
  38. ccxt/cryptomus.py +30 -52
  39. ccxt/deribit.py +6 -6
  40. ccxt/exmo.py +70 -50
  41. ccxt/htx.py +1 -1
  42. ccxt/hyperliquid.py +2 -1
  43. ccxt/krakenfutures.py +1 -1
  44. ccxt/kucoin.py +12 -14
  45. ccxt/latoken.py +19 -71
  46. ccxt/lbank.py +115 -35
  47. ccxt/okx.py +151 -2
  48. ccxt/paradex.py +54 -0
  49. ccxt/phemex.py +3 -3
  50. ccxt/pro/__init__.py +1 -1
  51. ccxt/pro/bitstamp.py +48 -16
  52. ccxt/pro/bybit.py +5 -5
  53. {ccxt-4.4.91.dist-info → ccxt-4.4.93.dist-info}/METADATA +4 -4
  54. {ccxt-4.4.91.dist-info → ccxt-4.4.93.dist-info}/RECORD +57 -57
  55. {ccxt-4.4.91.dist-info → ccxt-4.4.93.dist-info}/LICENSE.txt +0 -0
  56. {ccxt-4.4.91.dist-info → ccxt-4.4.93.dist-info}/WHEEL +0 -0
  57. {ccxt-4.4.91.dist-info → ccxt-4.4.93.dist-info}/top_level.txt +0 -0
ccxt/coinbaseexchange.py CHANGED
@@ -39,31 +39,73 @@ class coinbaseexchange(Exchange, ImplicitAPI):
39
39
  'swap': False,
40
40
  'future': False,
41
41
  'option': False,
42
+ 'addMargin': False,
43
+ 'borrowCrossMargin': False,
44
+ 'borrowIsolatedMargin': False,
45
+ 'borrowMargin': False,
42
46
  'cancelAllOrders': True,
43
47
  'cancelOrder': True,
48
+ 'closeAllPositions': False,
49
+ 'closePosition': False,
44
50
  'createDepositAddress': True,
45
51
  'createOrder': True,
52
+ 'createOrderWithTakeProfitAndStopLoss': False,
53
+ 'createOrderWithTakeProfitAndStopLossWs': False,
54
+ 'createPostOnlyOrder': False,
46
55
  'createReduceOnlyOrder': False,
47
56
  'createStopLimitOrder': True,
48
57
  'createStopMarketOrder': True,
49
58
  'createStopOrder': True,
50
59
  'fetchAccounts': True,
51
60
  'fetchBalance': True,
61
+ 'fetchBorrowInterest': False,
62
+ 'fetchBorrowRate': False,
63
+ 'fetchBorrowRateHistories': False,
64
+ 'fetchBorrowRateHistory': False,
65
+ 'fetchBorrowRates': False,
66
+ 'fetchBorrowRatesPerSymbol': False,
52
67
  'fetchClosedOrders': True,
68
+ 'fetchCrossBorrowRate': False,
69
+ 'fetchCrossBorrowRates': False,
53
70
  'fetchCurrencies': True,
54
71
  'fetchDepositAddress': False, # the exchange does not have self method, only createDepositAddress, see https://github.com/ccxt/ccxt/pull/7405
55
72
  'fetchDeposits': True,
56
73
  'fetchDepositsWithdrawals': True,
57
74
  'fetchFundingHistory': False,
75
+ 'fetchFundingInterval': False,
76
+ 'fetchFundingIntervals': False,
58
77
  'fetchFundingRate': False,
59
78
  'fetchFundingRateHistory': False,
60
79
  'fetchFundingRates': False,
80
+ 'fetchGreeks': False,
81
+ 'fetchIndexOHLCV': False,
82
+ 'fetchIsolatedBorrowRate': False,
83
+ 'fetchIsolatedBorrowRates': False,
84
+ 'fetchIsolatedPositions': False,
61
85
  'fetchLedger': True,
86
+ 'fetchLeverage': False,
87
+ 'fetchLeverages': False,
88
+ 'fetchLeverageTiers': False,
89
+ 'fetchLiquidations': False,
90
+ 'fetchLongShortRatio': False,
91
+ 'fetchLongShortRatioHistory': False,
92
+ 'fetchMarginAdjustmentHistory': False,
62
93
  'fetchMarginMode': False,
94
+ 'fetchMarginModes': False,
95
+ 'fetchMarketLeverageTiers': False,
63
96
  'fetchMarkets': True,
97
+ 'fetchMarkOHLCV': False,
98
+ 'fetchMarkPrices': False,
99
+ 'fetchMyLiquidations': False,
100
+ 'fetchMySettlementHistory': False,
64
101
  'fetchMyTrades': True,
65
102
  'fetchOHLCV': True,
103
+ 'fetchOpenInterest': False,
104
+ 'fetchOpenInterestHistory': False,
105
+ 'fetchOpenInterests': False,
66
106
  'fetchOpenOrders': True,
107
+ 'fetchOption': False,
108
+ 'fetchOptionChain': False,
67
109
  'fetchOrder': True,
68
110
  'fetchOrderBook': True,
69
111
  'fetchOrders': True,
@@ -75,6 +117,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
75
117
  'fetchPositionsForSymbol': False,
76
118
  'fetchPositionsHistory': False,
77
119
  'fetchPositionsRisk': False,
120
+ 'fetchPremiumIndexOHLCV': False,
121
+ 'fetchSettlementHistory': False,
78
122
  'fetchTicker': True,
79
123
  'fetchTickers': True,
80
124
  'fetchTime': True,
@@ -82,7 +126,16 @@ class coinbaseexchange(Exchange, ImplicitAPI):
82
126
  'fetchTradingFee': False,
83
127
  'fetchTradingFees': True,
84
128
  'fetchTransactions': 'emulated',
129
+ 'fetchVolatilityHistory': False,
85
130
  'fetchWithdrawals': True,
131
+ 'reduceMargin': False,
132
+ 'repayCrossMargin': False,
133
+ 'repayIsolatedMargin': False,
134
+ 'repayMargin': False,
135
+ 'setLeverage': False,
136
+ 'setMargin': False,
137
+ 'setMarginMode': False,
138
+ 'setPositionMode': False,
86
139
  'withdraw': True,
87
140
  },
88
141
  'timeframes': {
ccxt/coincheck.py CHANGED
@@ -10,6 +10,7 @@ from ccxt.base.types import Any, Balances, Currency, Int, Market, Num, Order, Or
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
13
+ from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadSymbol
14
15
  from ccxt.base.decimal_to_precision import TICK_SIZE
15
16
 
@@ -30,30 +31,59 @@ class coincheck(Exchange, ImplicitAPI):
30
31
  'future': False,
31
32
  'option': False,
32
33
  'addMargin': False,
34
+ 'borrowCrossMargin': False,
35
+ 'borrowIsolatedMargin': False,
36
+ 'borrowMargin': False,
33
37
  'cancelOrder': True,
34
38
  'closeAllPositions': False,
35
39
  'closePosition': False,
36
40
  'createOrder': True,
41
+ 'createOrderWithTakeProfitAndStopLoss': False,
42
+ 'createOrderWithTakeProfitAndStopLossWs': False,
43
+ 'createPostOnlyOrder': False,
37
44
  'createReduceOnlyOrder': False,
38
45
  'fetchBalance': True,
46
+ 'fetchBorrowInterest': False,
47
+ 'fetchBorrowRate': False,
39
48
  'fetchBorrowRateHistories': False,
40
49
  'fetchBorrowRateHistory': False,
50
+ 'fetchBorrowRates': False,
51
+ 'fetchBorrowRatesPerSymbol': False,
41
52
  'fetchCrossBorrowRate': False,
42
53
  'fetchCrossBorrowRates': False,
43
54
  'fetchDeposits': True,
44
55
  'fetchFundingHistory': False,
56
+ 'fetchFundingInterval': False,
57
+ 'fetchFundingIntervals': False,
45
58
  'fetchFundingRate': False,
46
59
  'fetchFundingRateHistory': False,
47
60
  'fetchFundingRates': False,
61
+ 'fetchGreeks': False,
48
62
  'fetchIndexOHLCV': False,
49
63
  'fetchIsolatedBorrowRate': False,
50
64
  'fetchIsolatedBorrowRates': False,
65
+ 'fetchIsolatedPositions': False,
51
66
  'fetchLeverage': False,
67
+ 'fetchLeverages': False,
68
+ 'fetchLeverageTiers': False,
69
+ 'fetchLiquidations': False,
70
+ 'fetchLongShortRatio': False,
71
+ 'fetchLongShortRatioHistory': False,
72
+ 'fetchMarginAdjustmentHistory': False,
52
73
  'fetchMarginMode': False,
74
+ 'fetchMarginModes': False,
75
+ 'fetchMarketLeverageTiers': False,
53
76
  'fetchMarkOHLCV': False,
77
+ 'fetchMarkPrices': False,
78
+ 'fetchMyLiquidations': False,
79
+ 'fetchMySettlementHistory': False,
54
80
  'fetchMyTrades': True,
81
+ 'fetchOpenInterest': False,
55
82
  'fetchOpenInterestHistory': False,
83
+ 'fetchOpenInterests': False,
56
84
  'fetchOpenOrders': True,
85
+ 'fetchOption': False,
86
+ 'fetchOptionChain': False,
57
87
  'fetchOrderBook': True,
58
88
  'fetchPosition': False,
59
89
  'fetchPositionHistory': False,
@@ -63,13 +93,19 @@ class coincheck(Exchange, ImplicitAPI):
63
93
  'fetchPositionsHistory': False,
64
94
  'fetchPositionsRisk': False,
65
95
  'fetchPremiumIndexOHLCV': False,
96
+ 'fetchSettlementHistory': False,
66
97
  'fetchTicker': True,
67
98
  'fetchTrades': True,
68
99
  'fetchTradingFee': False,
69
100
  'fetchTradingFees': True,
101
+ 'fetchVolatilityHistory': False,
70
102
  'fetchWithdrawals': True,
71
103
  'reduceMargin': False,
104
+ 'repayCrossMargin': False,
105
+ 'repayIsolatedMargin': False,
106
+ 'repayMargin': False,
72
107
  'setLeverage': False,
108
+ 'setMargin': False,
73
109
  'setMarginMode': False,
74
110
  'setPositionMode': False,
75
111
  'ws': True,
@@ -637,10 +673,15 @@ class coincheck(Exchange, ImplicitAPI):
637
673
  'pair': market['id'],
638
674
  }
639
675
  if type == 'market':
640
- order_type = type + '_' + side
641
- request['order_type'] = order_type
642
- prefix = (order_type + '_') if (side == 'buy') else ''
643
- request[prefix + 'amount'] = amount
676
+ request['order_type'] = type + '_' + side
677
+ if side == 'sell':
678
+ request['amount'] = amount
679
+ else:
680
+ cost = self.safe_number(params, 'cost')
681
+ params = self.omit(params, 'cost')
682
+ if cost is not None:
683
+ raise ArgumentsRequired(self.id + ' createOrder() : you should use "cost" parameter instead of "amount" argument to create market buy orders')
684
+ request['market_buy_amount'] = cost
644
685
  else:
645
686
  request['order_type'] = side
646
687
  request['rate'] = price
ccxt/coinex.py CHANGED
@@ -18,6 +18,7 @@ from ccxt.base.errors import InsufficientFunds
18
18
  from ccxt.base.errors import InvalidOrder
19
19
  from ccxt.base.errors import OrderNotFound
20
20
  from ccxt.base.errors import NotSupported
21
+ from ccxt.base.errors import OperationFailed
21
22
  from ccxt.base.errors import RateLimitExceeded
22
23
  from ccxt.base.errors import ExchangeNotAvailable
23
24
  from ccxt.base.errors import RequestTimeout
@@ -670,6 +671,7 @@ class coinex(Exchange, ImplicitAPI):
670
671
  'broad': {
671
672
  'ip not allow visit': PermissionDenied,
672
673
  'service too busy': ExchangeNotAvailable,
674
+ 'Service is not available during funding fee settlement': OperationFailed,
673
675
  },
674
676
  },
675
677
  })
@@ -794,7 +796,7 @@ class coinex(Exchange, ImplicitAPI):
794
796
  'max': None,
795
797
  },
796
798
  },
797
- 'networks': {},
799
+ 'networks': networks,
798
800
  'type': 'crypto',
799
801
  'info': coin,
800
802
  })
@@ -826,17 +828,19 @@ class coinex(Exchange, ImplicitAPI):
826
828
  # "code": 0,
827
829
  # "data": [
828
830
  # {
829
- # "base_ccy": "SORA",
831
+ # "market": "BTCUSDT",
832
+ # "taker_fee_rate": "0.002",
833
+ # "maker_fee_rate": "0.002",
834
+ # "min_amount": "0.0005",
835
+ # "base_ccy": "BTC",
836
+ # "quote_ccy": "USDT",
830
837
  # "base_ccy_precision": 8,
838
+ # "quote_ccy_precision": 2,
831
839
  # "is_amm_available": True,
832
- # "is_margin_available": False,
833
- # "maker_fee_rate": "0.003",
834
- # "market": "SORAUSDT",
835
- # "min_amount": "500",
836
- # "quote_ccy": "USDT",
837
- # "quote_ccy_precision": 6,
838
- # "taker_fee_rate": "0.003"
839
- # },
840
+ # "is_margin_available": True,
841
+ # "is_pre_trading_available": True,
842
+ # "is_api_trading_available": True
843
+ # }
840
844
  # ],
841
845
  # "message": "OK"
842
846
  # }
@@ -862,11 +866,11 @@ class coinex(Exchange, ImplicitAPI):
862
866
  'settleId': None,
863
867
  'type': 'spot',
864
868
  'spot': True,
865
- 'margin': None,
869
+ 'margin': self.safe_bool(market, 'is_margin_available'),
866
870
  'swap': False,
867
871
  'future': False,
868
872
  'option': False,
869
- 'active': None,
873
+ 'active': self.safe_bool(market, 'is_api_trading_available'),
870
874
  'contract': False,
871
875
  'linear': None,
872
876
  'inverse': None,
ccxt/cryptomus.py CHANGED
@@ -367,66 +367,44 @@ class cryptomus(Exchange, ImplicitAPI):
367
367
  # }
368
368
  #
369
369
  coins = self.safe_list(response, 'result')
370
+ groupedById = self.group_by(coins, 'currency_code')
371
+ keys = list(groupedById.keys())
370
372
  result: dict = {}
371
- for i in range(0, len(coins)):
372
- networkEntry = coins[i]
373
- currencyId = self.safe_string(networkEntry, 'currency_code')
374
- code = self.safe_currency_code(currencyId)
375
- if not (code in result):
376
- result[code] = {
377
- 'id': currencyId,
378
- 'code': code,
379
- 'precision': None,
380
- 'type': None,
381
- 'name': None,
382
- 'active': None,
383
- 'deposit': None,
384
- 'withdraw': None,
385
- 'fee': None,
373
+ for i in range(0, len(keys)):
374
+ id = keys[i]
375
+ code = self.safe_currency_code(id)
376
+ networks = {}
377
+ networkEntries = groupedById[id]
378
+ for j in range(0, len(networkEntries)):
379
+ networkEntry = networkEntries[j]
380
+ networkId = self.safe_string(networkEntry, 'network_code')
381
+ networkCode = self.network_id_to_code(networkId)
382
+ networks[networkCode] = {
383
+ 'id': networkId,
384
+ 'network': networkCode,
386
385
  'limits': {
387
386
  'withdraw': {
388
- 'min': None,
389
- 'max': None,
387
+ 'min': self.safe_number(networkEntry, 'min_withdraw'),
388
+ 'max': self.safe_number(networkEntry, 'max_withdraw'),
390
389
  },
391
390
  'deposit': {
392
- 'min': None,
393
- 'max': None,
391
+ 'min': self.safe_number(networkEntry, 'min_deposit'),
392
+ 'max': self.safe_number(networkEntry, 'max_deposit'),
394
393
  },
395
394
  },
396
- 'networks': {},
397
- 'info': {},
395
+ 'active': None,
396
+ 'deposit': self.safe_bool(networkEntry, 'can_withdraw'),
397
+ 'withdraw': self.safe_bool(networkEntry, 'can_deposit'),
398
+ 'fee': None,
399
+ 'precision': None,
400
+ 'info': networkEntry,
398
401
  }
399
- networkId = self.safe_string(networkEntry, 'network_code')
400
- networkCode = self.network_id_to_code(networkId)
401
- result[code]['networks'][networkCode] = {
402
- 'id': networkId,
403
- 'network': networkCode,
404
- 'limits': {
405
- 'withdraw': {
406
- 'min': self.safe_number(networkEntry, 'min_withdraw'),
407
- 'max': self.safe_number(networkEntry, 'max_withdraw'),
408
- },
409
- 'deposit': {
410
- 'min': self.safe_number(networkEntry, 'min_deposit'),
411
- 'max': self.safe_number(networkEntry, 'max_deposit'),
412
- },
413
- },
414
- 'active': None,
415
- 'deposit': self.safe_bool(networkEntry, 'can_withdraw'),
416
- 'withdraw': self.safe_bool(networkEntry, 'can_deposit'),
417
- 'fee': None,
418
- 'precision': None,
419
- 'info': networkEntry,
420
- }
421
- # add entry in info
422
- info = self.safe_list(result[code], 'info', [])
423
- info.append(networkEntry)
424
- result[code]['info'] = info
425
- # only after all entries are formed in currencies, restructure each entry
426
- allKeys = list(result.keys())
427
- for i in range(0, len(allKeys)):
428
- code = allKeys[i]
429
- result[code] = self.safe_currency_structure(result[code]) # self is needed after adding network entry
402
+ result[code] = self.safe_currency_structure({
403
+ 'id': id,
404
+ 'code': code,
405
+ 'networks': networks,
406
+ 'info': networkEntries,
407
+ })
430
408
  return result
431
409
 
432
410
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
ccxt/deribit.py CHANGED
@@ -2596,21 +2596,21 @@ class deribit(Exchange, ImplicitAPI):
2596
2596
  unrealizedPnl = self.safe_string(position, 'floating_profit_loss')
2597
2597
  initialMarginString = self.safe_string(position, 'initial_margin')
2598
2598
  notionalString = self.safe_string(position, 'size_currency')
2599
+ notionalStringAbs = Precise.string_abs(notionalString)
2599
2600
  maintenanceMarginString = self.safe_string(position, 'maintenance_margin')
2600
- currentTime = self.milliseconds()
2601
2601
  return self.safe_position({
2602
2602
  'info': position,
2603
2603
  'id': None,
2604
2604
  'symbol': self.safe_string(market, 'symbol'),
2605
- 'timestamp': currentTime,
2606
- 'datetime': self.iso8601(currentTime),
2605
+ 'timestamp': None,
2606
+ 'datetime': None,
2607
2607
  'lastUpdateTimestamp': None,
2608
2608
  'initialMargin': self.parse_number(initialMarginString),
2609
- 'initialMarginPercentage': self.parse_number(Precise.string_mul(Precise.string_div(initialMarginString, notionalString), '100')),
2609
+ 'initialMarginPercentage': self.parse_number(Precise.string_mul(Precise.string_div(initialMarginString, notionalStringAbs), '100')),
2610
2610
  'maintenanceMargin': self.parse_number(maintenanceMarginString),
2611
- 'maintenanceMarginPercentage': self.parse_number(Precise.string_mul(Precise.string_div(maintenanceMarginString, notionalString), '100')),
2611
+ 'maintenanceMarginPercentage': self.parse_number(Precise.string_mul(Precise.string_div(maintenanceMarginString, notionalStringAbs), '100')),
2612
2612
  'entryPrice': self.safe_number(position, 'average_price'),
2613
- 'notional': self.parse_number(notionalString),
2613
+ 'notional': self.parse_number(notionalStringAbs),
2614
2614
  'leverage': self.safe_integer(position, 'leverage'),
2615
2615
  'unrealizedPnl': self.parse_number(unrealizedPnl),
2616
2616
  'contracts': None,
ccxt/exmo.py CHANGED
@@ -666,8 +666,9 @@ class exmo(Exchange, ImplicitAPI):
666
666
  :param dict [params]: extra parameters specific to the exchange API endpoint
667
667
  :returns dict: an associative dictionary of currencies
668
668
  """
669
+ promises = []
669
670
  #
670
- currencyList = self.publicGetCurrencyListExtended(params)
671
+ promises.append(self.publicGetCurrencyListExtended(params))
671
672
  #
672
673
  # [
673
674
  # {"name":"VLX","description":"Velas"},
@@ -676,7 +677,7 @@ class exmo(Exchange, ImplicitAPI):
676
677
  # {"name":"USD","description":"US Dollar"}
677
678
  # ]
678
679
  #
679
- cryptoList = self.publicGetPaymentsProvidersCryptoList(params)
680
+ promises.append(self.publicGetPaymentsProvidersCryptoList(params))
680
681
  #
681
682
  # {
682
683
  # "BTC":[
@@ -701,73 +702,92 @@ class exmo(Exchange, ImplicitAPI):
701
702
  # ],
702
703
  # }
703
704
  #
705
+ responses = promises
706
+ currencyList = responses[0]
707
+ cryptoList = responses[1]
704
708
  result: dict = {}
705
709
  for i in range(0, len(currencyList)):
706
710
  currency = currencyList[i]
707
711
  currencyId = self.safe_string(currency, 'name')
708
- name = self.safe_string(currency, 'description')
709
- providers = self.safe_value(cryptoList, currencyId)
710
- active = False
712
+ code = self.safe_currency_code(currencyId)
711
713
  type = 'crypto'
712
- limits: dict = {
713
- 'deposit': {
714
- 'min': None,
715
- 'max': None,
716
- },
717
- 'withdraw': {
718
- 'min': None,
719
- 'max': None,
720
- },
721
- }
722
- fee = None
723
- depositEnabled = None
724
- withdrawEnabled = None
714
+ networks = {}
715
+ providers = self.safe_list(cryptoList, currencyId)
725
716
  if providers is None:
726
- active = True
727
717
  type = 'fiat'
728
718
  else:
729
719
  for j in range(0, len(providers)):
730
720
  provider = providers[j]
721
+ name = self.safe_string(provider, 'name')
722
+ # get network-id by removing extra things
723
+ networkId = name.replace(currencyId + ' ', '')
724
+ networkId = networkId.replace('(', '')
725
+ replaceChar = ')' # transpiler trick
726
+ networkId = networkId.replace(replaceChar, '')
727
+ networkCode = self.network_id_to_code(networkId)
728
+ if not (networkCode in networks):
729
+ networks[networkCode] = {
730
+ 'id': networkId,
731
+ 'network': networkCode,
732
+ 'active': None,
733
+ 'deposit': None,
734
+ 'withdraw': None,
735
+ 'fee': None,
736
+ 'limits': {
737
+ 'withdraw': {
738
+ 'min': None,
739
+ 'max': None,
740
+ },
741
+ 'deposit': {
742
+ 'min': None,
743
+ 'max': None,
744
+ },
745
+ },
746
+ 'info': [], # set, because of multiple network sub-entries
747
+ }
731
748
  typeInner = self.safe_string(provider, 'type')
732
749
  minValue = self.safe_string(provider, 'min')
733
750
  maxValue = self.safe_string(provider, 'max')
734
- if Precise.string_eq(maxValue, '0.0'):
735
- maxValue = None
736
- activeProvider = self.safe_value(provider, 'enabled')
751
+ activeProvider = self.safe_bool(provider, 'enabled')
752
+ networkEntry = networks[networkCode]
737
753
  if typeInner == 'deposit':
738
- if activeProvider and not depositEnabled:
739
- depositEnabled = True
740
- elif not activeProvider:
741
- depositEnabled = False
754
+ networkEntry['deposit'] = activeProvider
755
+ networkEntry['limits']['deposit']['min'] = minValue
756
+ networkEntry['limits']['deposit']['max'] = maxValue
742
757
  elif typeInner == 'withdraw':
743
- if activeProvider and not withdrawEnabled:
744
- withdrawEnabled = True
745
- elif not activeProvider:
746
- withdrawEnabled = False
747
- if activeProvider:
748
- active = True
749
- limitMin = self.number_to_string(limits[typeInner]['min'])
750
- if (limits[typeInner]['min'] is None) or (Precise.string_lt(minValue, limitMin)):
751
- limits[typeInner]['min'] = minValue
752
- limits[typeInner]['max'] = maxValue
753
- if typeInner == 'withdraw':
754
- commissionDesc = self.safe_string(provider, 'commission_desc')
755
- fee = self.parse_fixed_float_value(commissionDesc)
756
- code = self.safe_currency_code(currencyId)
757
- result[code] = {
758
+ networkEntry['withdraw'] = activeProvider
759
+ networkEntry['limits']['withdraw']['min'] = minValue
760
+ networkEntry['limits']['withdraw']['max'] = maxValue
761
+ info = self.safe_list(networkEntry, 'info')
762
+ info.append(provider)
763
+ networkEntry['info'] = info
764
+ networks[networkCode] = networkEntry
765
+ result[code] = self.safe_currency_structure({
758
766
  'id': currencyId,
759
767
  'code': code,
760
- 'name': name,
768
+ 'name': self.safe_string(currency, 'description'),
761
769
  'type': type,
762
- 'active': active,
763
- 'deposit': depositEnabled,
764
- 'withdraw': withdrawEnabled,
765
- 'fee': fee,
770
+ 'active': None,
771
+ 'deposit': None,
772
+ 'withdraw': None,
773
+ 'fee': None,
766
774
  'precision': self.parse_number('1e-8'),
767
- 'limits': limits,
768
- 'info': providers,
769
- 'networks': {},
770
- }
775
+ 'limits': {
776
+ 'withdraw': {
777
+ 'min': None,
778
+ 'max': None,
779
+ },
780
+ 'deposit': {
781
+ 'min': None,
782
+ 'max': None,
783
+ },
784
+ },
785
+ 'info': {
786
+ 'currency': currency,
787
+ 'providers': providers,
788
+ },
789
+ 'networks': networks,
790
+ })
771
791
  return result
772
792
 
773
793
  def fetch_markets(self, params={}) -> List[Market]:
ccxt/htx.py CHANGED
@@ -6341,7 +6341,7 @@ class htx(Exchange, ImplicitAPI):
6341
6341
  fee = self.safe_number(params, 'fee')
6342
6342
  if fee is None:
6343
6343
  currencies = self.fetch_currencies()
6344
- self.currencies = self.deep_extend(self.currencies, currencies)
6344
+ self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, currencies))
6345
6345
  targetNetwork = self.safe_value(currency['networks'], networkCode, {})
6346
6346
  fee = self.safe_number(targetNetwork, 'fee')
6347
6347
  if fee is None:
ccxt/hyperliquid.py CHANGED
@@ -695,7 +695,8 @@ class hyperliquid(Exchange, ImplicitAPI):
695
695
  # }
696
696
  #
697
697
  quoteId = 'USDC'
698
- base = self.safe_string(market, 'name')
698
+ baseName = self.safe_string(market, 'name')
699
+ base = self.safe_currency_code(baseName)
699
700
  quote = self.safe_currency_code(quoteId)
700
701
  baseId = self.safe_string(market, 'baseId')
701
702
  settleId = 'USDC'
ccxt/krakenfutures.py CHANGED
@@ -538,7 +538,7 @@ class krakenfutures(Exchange, ImplicitAPI):
538
538
  'code': code,
539
539
  'precision': None,
540
540
  })
541
- self.currencies = self.deep_extend(currencies, self.currencies)
541
+ self.currencies = self.map_to_safe_map(self.deep_extend(currencies, self.currencies))
542
542
  return result
543
543
 
544
544
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook: