ccxt 4.2.88__py2.py3-none-any.whl → 4.2.89__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

Files changed (150) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ascendex.py +5 -3
  3. ccxt/async_support/__init__.py +1 -1
  4. ccxt/async_support/ascendex.py +5 -3
  5. ccxt/async_support/base/exchange.py +3 -2
  6. ccxt/async_support/bigone.py +2 -2
  7. ccxt/async_support/binance.py +7 -5
  8. ccxt/async_support/bingx.py +2 -2
  9. ccxt/async_support/bit2c.py +2 -2
  10. ccxt/async_support/bitbank.py +2 -2
  11. ccxt/async_support/bitfinex.py +2 -2
  12. ccxt/async_support/bitfinex2.py +3 -3
  13. ccxt/async_support/bitflyer.py +4 -2
  14. ccxt/async_support/bitget.py +10 -5
  15. ccxt/async_support/bitmart.py +6 -4
  16. ccxt/async_support/bitmex.py +2 -2
  17. ccxt/async_support/bitopro.py +3 -3
  18. ccxt/async_support/bitrue.py +2 -2
  19. ccxt/async_support/bitso.py +2 -2
  20. ccxt/async_support/bitstamp.py +89 -97
  21. ccxt/async_support/bitteam.py +2 -2
  22. ccxt/async_support/bitvavo.py +3 -3
  23. ccxt/async_support/bl3p.py +2 -2
  24. ccxt/async_support/blockchaincom.py +2 -2
  25. ccxt/async_support/blofin.py +4 -2
  26. ccxt/async_support/bybit.py +7 -5
  27. ccxt/async_support/cex.py +3 -3
  28. ccxt/async_support/coinbase.py +2 -2
  29. ccxt/async_support/coinbaseinternational.py +2 -2
  30. ccxt/async_support/coinbasepro.py +3 -3
  31. ccxt/async_support/coincheck.py +2 -2
  32. ccxt/async_support/coinex.py +5 -5
  33. ccxt/async_support/coinlist.py +3 -3
  34. ccxt/async_support/coinmate.py +2 -2
  35. ccxt/async_support/coinmetro.py +2 -2
  36. ccxt/async_support/coinone.py +2 -2
  37. ccxt/async_support/coinsph.py +6 -4
  38. ccxt/async_support/currencycom.py +3 -3
  39. ccxt/async_support/delta.py +2 -2
  40. ccxt/async_support/deribit.py +3 -3
  41. ccxt/async_support/digifinex.py +6 -4
  42. ccxt/async_support/exmo.py +3 -3
  43. ccxt/async_support/gate.py +6 -4
  44. ccxt/async_support/gemini.py +3 -3
  45. ccxt/async_support/hitbtc.py +7 -5
  46. ccxt/async_support/hollaex.py +3 -3
  47. ccxt/async_support/htx.py +6 -4
  48. ccxt/async_support/huobijp.py +2 -2
  49. ccxt/async_support/hyperliquid.py +2 -2
  50. ccxt/async_support/idex.py +3 -3
  51. ccxt/async_support/independentreserve.py +2 -2
  52. ccxt/async_support/kraken.py +3 -3
  53. ccxt/async_support/kucoin.py +42 -18
  54. ccxt/async_support/kuna.py +2 -2
  55. ccxt/async_support/latoken.py +7 -3
  56. ccxt/async_support/lbank.py +7 -5
  57. ccxt/async_support/luno.py +4 -2
  58. ccxt/async_support/lykke.py +2 -2
  59. ccxt/async_support/mexc.py +56 -9
  60. ccxt/async_support/ndax.py +2 -2
  61. ccxt/async_support/oceanex.py +2 -2
  62. ccxt/async_support/okcoin.py +2 -2
  63. ccxt/async_support/okx.py +6 -4
  64. ccxt/async_support/onetrading.py +3 -3
  65. ccxt/async_support/phemex.py +2 -2
  66. ccxt/async_support/poloniex.py +3 -3
  67. ccxt/async_support/probit.py +2 -2
  68. ccxt/async_support/timex.py +6 -4
  69. ccxt/async_support/upbit.py +2 -2
  70. ccxt/async_support/wazirx.py +2 -2
  71. ccxt/async_support/whitebit.py +3 -3
  72. ccxt/async_support/woo.py +3 -3
  73. ccxt/async_support/yobit.py +2 -2
  74. ccxt/base/exchange.py +14 -7
  75. ccxt/base/types.py +32 -0
  76. ccxt/bigone.py +2 -2
  77. ccxt/binance.py +7 -5
  78. ccxt/bingx.py +2 -2
  79. ccxt/bit2c.py +2 -2
  80. ccxt/bitbank.py +2 -2
  81. ccxt/bitfinex.py +2 -2
  82. ccxt/bitfinex2.py +3 -3
  83. ccxt/bitflyer.py +4 -2
  84. ccxt/bitget.py +10 -5
  85. ccxt/bitmart.py +6 -4
  86. ccxt/bitmex.py +2 -2
  87. ccxt/bitopro.py +3 -3
  88. ccxt/bitrue.py +2 -2
  89. ccxt/bitso.py +2 -2
  90. ccxt/bitstamp.py +89 -97
  91. ccxt/bitteam.py +2 -2
  92. ccxt/bitvavo.py +3 -3
  93. ccxt/bl3p.py +2 -2
  94. ccxt/blockchaincom.py +2 -2
  95. ccxt/blofin.py +4 -2
  96. ccxt/bybit.py +7 -5
  97. ccxt/cex.py +3 -3
  98. ccxt/coinbase.py +2 -2
  99. ccxt/coinbaseinternational.py +2 -2
  100. ccxt/coinbasepro.py +3 -3
  101. ccxt/coincheck.py +2 -2
  102. ccxt/coinex.py +5 -5
  103. ccxt/coinlist.py +3 -3
  104. ccxt/coinmate.py +2 -2
  105. ccxt/coinmetro.py +2 -2
  106. ccxt/coinone.py +2 -2
  107. ccxt/coinsph.py +6 -4
  108. ccxt/currencycom.py +3 -3
  109. ccxt/delta.py +2 -2
  110. ccxt/deribit.py +3 -3
  111. ccxt/digifinex.py +6 -4
  112. ccxt/exmo.py +3 -3
  113. ccxt/gate.py +6 -4
  114. ccxt/gemini.py +3 -3
  115. ccxt/hitbtc.py +7 -5
  116. ccxt/hollaex.py +3 -3
  117. ccxt/htx.py +6 -4
  118. ccxt/huobijp.py +2 -2
  119. ccxt/hyperliquid.py +2 -2
  120. ccxt/idex.py +3 -3
  121. ccxt/independentreserve.py +2 -2
  122. ccxt/kraken.py +3 -3
  123. ccxt/kucoin.py +42 -18
  124. ccxt/kuna.py +2 -2
  125. ccxt/latoken.py +7 -3
  126. ccxt/lbank.py +7 -5
  127. ccxt/luno.py +4 -2
  128. ccxt/lykke.py +2 -2
  129. ccxt/mexc.py +56 -9
  130. ccxt/ndax.py +2 -2
  131. ccxt/oceanex.py +2 -2
  132. ccxt/okcoin.py +2 -2
  133. ccxt/okx.py +6 -4
  134. ccxt/onetrading.py +3 -3
  135. ccxt/phemex.py +2 -2
  136. ccxt/poloniex.py +3 -3
  137. ccxt/pro/__init__.py +1 -1
  138. ccxt/pro/bitget.py +2 -0
  139. ccxt/pro/bitvavo.py +2 -2
  140. ccxt/probit.py +2 -2
  141. ccxt/timex.py +6 -4
  142. ccxt/upbit.py +2 -2
  143. ccxt/wazirx.py +2 -2
  144. ccxt/whitebit.py +3 -3
  145. ccxt/woo.py +3 -3
  146. ccxt/yobit.py +2 -2
  147. {ccxt-4.2.88.dist-info → ccxt-4.2.89.dist-info}/METADATA +4 -4
  148. {ccxt-4.2.88.dist-info → ccxt-4.2.89.dist-info}/RECORD +150 -150
  149. {ccxt-4.2.88.dist-info → ccxt-4.2.89.dist-info}/WHEEL +0 -0
  150. {ccxt-4.2.88.dist-info → ccxt-4.2.89.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.latoken import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -401,7 +401,7 @@ class latoken(Exchange, ImplicitAPI):
401
401
  })
402
402
  return self.safe_value(self.options['fetchCurrencies'], 'response')
403
403
 
404
- async def fetch_currencies(self, params={}):
404
+ async def fetch_currencies(self, params={}) -> Currencies:
405
405
  """
406
406
  fetches all available currencies on an exchange
407
407
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -808,7 +808,7 @@ class latoken(Exchange, ImplicitAPI):
808
808
  #
809
809
  return self.parse_trades(response, market, since, limit)
810
810
 
811
- async def fetch_trading_fee(self, symbol: str, params={}):
811
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
812
812
  """
813
813
  fetch the trading fees for a market
814
814
  :see: https://api.latoken.com/doc/v2/#tag/Trade/operation/getFeeByPair
@@ -849,6 +849,8 @@ class latoken(Exchange, ImplicitAPI):
849
849
  'symbol': market['symbol'],
850
850
  'maker': self.safe_number(response, 'makerFee'),
851
851
  'taker': self.safe_number(response, 'takerFee'),
852
+ 'percentage': None,
853
+ 'tierBased': None,
852
854
  }
853
855
 
854
856
  async def fetch_private_trading_fee(self, symbol: str, params={}):
@@ -872,6 +874,8 @@ class latoken(Exchange, ImplicitAPI):
872
874
  'symbol': market['symbol'],
873
875
  'maker': self.safe_number(response, 'makerFee'),
874
876
  'taker': self.safe_number(response, 'takerFee'),
877
+ 'percentage': None,
878
+ 'tierBased': None,
875
879
  }
876
880
 
877
881
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.lbank import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -1183,7 +1183,7 @@ class lbank(Exchange, ImplicitAPI):
1183
1183
  #
1184
1184
  return self.parse_balance(response)
1185
1185
 
1186
- def parse_trading_fee(self, fee, market: Market = None):
1186
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1187
1187
  #
1188
1188
  # {
1189
1189
  # "symbol":"skt_usdt",
@@ -1198,9 +1198,11 @@ class lbank(Exchange, ImplicitAPI):
1198
1198
  'symbol': symbol,
1199
1199
  'maker': self.safe_number(fee, 'makerCommission'),
1200
1200
  'taker': self.safe_number(fee, 'takerCommission'),
1201
+ 'percentage': None,
1202
+ 'tierBased': None,
1201
1203
  }
1202
1204
 
1203
- async def fetch_trading_fee(self, symbol: str, params={}):
1205
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1204
1206
  """
1205
1207
  fetch the trading fees for a market
1206
1208
  :see: https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
@@ -1210,9 +1212,9 @@ class lbank(Exchange, ImplicitAPI):
1210
1212
  """
1211
1213
  market = self.market(symbol)
1212
1214
  result = await self.fetch_trading_fees(self.extend(params, {'category': market['id']}))
1213
- return result
1215
+ return self.safe_dict(result, symbol)
1214
1216
 
1215
- async def fetch_trading_fees(self, params={}):
1217
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
1216
1218
  """
1217
1219
  fetch the trading fees for multiple markets
1218
1220
  :see: https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.luno import ImplicitAPI
8
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
8
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import ArgumentsRequired
@@ -812,7 +812,7 @@ class luno(Exchange, ImplicitAPI):
812
812
  trades = self.safe_list(response, 'trades', [])
813
813
  return self.parse_trades(trades, market, since, limit)
814
814
 
815
- async def fetch_trading_fee(self, symbol: str, params={}):
815
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
816
816
  """
817
817
  fetch the trading fees for a market
818
818
  :see: https://www.luno.com/en/developers/api#tag/Orders/operation/getFeeInfo
@@ -838,6 +838,8 @@ class luno(Exchange, ImplicitAPI):
838
838
  'symbol': symbol,
839
839
  'maker': self.safe_number(response, 'maker_fee'),
840
840
  'taker': self.safe_number(response, 'taker_fee'),
841
+ 'percentage': None,
842
+ 'tierBased': None,
841
843
  }
842
844
 
843
845
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.lykke import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import BadRequest
@@ -187,7 +187,7 @@ class lykke(Exchange, ImplicitAPI):
187
187
  },
188
188
  })
189
189
 
190
- async def fetch_currencies(self, params={}):
190
+ async def fetch_currencies(self, params={}) -> Currencies:
191
191
  """
192
192
  fetches all available currencies on an exchange
193
193
  :see: https://lykkecity.github.io/Trading-API/#get-all-assets
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -998,7 +998,7 @@ class mexc(Exchange, ImplicitAPI):
998
998
  return self.safe_integer(response, 'data')
999
999
  return None
1000
1000
 
1001
- async def fetch_currencies(self, params={}):
1001
+ async def fetch_currencies(self, params={}) -> Currencies:
1002
1002
  """
1003
1003
  fetches all available currencies on an exchange
1004
1004
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information
@@ -3343,7 +3343,7 @@ class mexc(Exchange, ImplicitAPI):
3343
3343
  })
3344
3344
  return result
3345
3345
 
3346
- async def fetch_trading_fees(self, params={}):
3346
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
3347
3347
  """
3348
3348
  fetch the trading fees for multiple markets
3349
3349
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4031,8 +4031,9 @@ class mexc(Exchange, ImplicitAPI):
4031
4031
 
4032
4032
  async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
4033
4033
  """
4034
- retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
4035
- :param str[]|None symbols: list of unified market symbols
4034
+ retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes, if a market has a leverage tier of 0, then the leverage tiers cannot be obtained for self market
4035
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
4036
+ :param str[] [symbols]: list of unified market symbols
4036
4037
  :param dict [params]: extra parameters specific to the exchange API endpoint
4037
4038
  :returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
4038
4039
  """
@@ -4088,10 +4089,44 @@ class mexc(Exchange, ImplicitAPI):
4088
4089
  return self.parse_leverage_tiers(data, symbols, 'symbol')
4089
4090
 
4090
4091
  def parse_market_leverage_tiers(self, info, market: Market = None):
4091
- """
4092
- @param info {object} Exchange response for 1 market
4093
- @param market {object} CCXT market
4094
- """
4092
+ #
4093
+ # {
4094
+ # "symbol": "BTC_USDT",
4095
+ # "displayName": "BTC_USDT永续",
4096
+ # "displayNameEn": "BTC_USDT SWAP",
4097
+ # "positionOpenType": 3,
4098
+ # "baseCoin": "BTC",
4099
+ # "quoteCoin": "USDT",
4100
+ # "settleCoin": "USDT",
4101
+ # "contractSize": 0.0001,
4102
+ # "minLeverage": 1,
4103
+ # "maxLeverage": 125,
4104
+ # "priceScale": 2,
4105
+ # "volScale": 0,
4106
+ # "amountScale": 4,
4107
+ # "priceUnit": 0.5,
4108
+ # "volUnit": 1,
4109
+ # "minVol": 1,
4110
+ # "maxVol": 1000000,
4111
+ # "bidLimitPriceRate": 0.1,
4112
+ # "askLimitPriceRate": 0.1,
4113
+ # "takerFeeRate": 0.0006,
4114
+ # "makerFeeRate": 0.0002,
4115
+ # "maintenanceMarginRate": 0.004,
4116
+ # "initialMarginRate": 0.008,
4117
+ # "riskBaseVol": 10000,
4118
+ # "riskIncrVol": 200000,
4119
+ # "riskIncrMmr": 0.004,
4120
+ # "riskIncrImr": 0.004,
4121
+ # "riskLevelLimit": 5,
4122
+ # "priceCoefficientVariation": 0.1,
4123
+ # "indexOrigin": ["BINANCE","GATEIO","HUOBI","MXC"],
4124
+ # "state": 0, # 0 enabled, 1 delivery, 2 completed, 3 offline, 4 pause
4125
+ # "isNew": False,
4126
+ # "isHot": True,
4127
+ # "isHidden": False
4128
+ # }
4129
+ #
4095
4130
  maintenanceMarginRate = self.safe_string(info, 'maintenanceMarginRate')
4096
4131
  initialMarginRate = self.safe_string(info, 'initialMarginRate')
4097
4132
  maxVol = self.safe_string(info, 'maxVol')
@@ -4101,6 +4136,18 @@ class mexc(Exchange, ImplicitAPI):
4101
4136
  floor = '0'
4102
4137
  tiers = []
4103
4138
  quoteId = self.safe_string(info, 'quoteCoin')
4139
+ if riskIncrVol == '0':
4140
+ return [
4141
+ {
4142
+ 'tier': 0,
4143
+ 'currency': self.safe_currency_code(quoteId),
4144
+ 'notionalFloor': None,
4145
+ 'notionalCap': None,
4146
+ 'maintenanceMarginRate': None,
4147
+ 'maxLeverage': self.safe_number(info, 'maxLeverage'),
4148
+ 'info': info,
4149
+ },
4150
+ ]
4104
4151
  while(Precise.string_lt(floor, maxVol)):
4105
4152
  cap = Precise.string_add(floor, riskIncrVol)
4106
4153
  tiers.append({
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.ndax import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Account, Balances, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
10
+ from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import BadSymbol
@@ -329,7 +329,7 @@ class ndax(Exchange, ImplicitAPI):
329
329
  return responseInner
330
330
  return response
331
331
 
332
- async def fetch_currencies(self, params={}):
332
+ async def fetch_currencies(self, params={}) -> Currencies:
333
333
  """
334
334
  fetches all available currencies on an exchange
335
335
  :see: https://apidoc.ndax.io/#getproduct
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.oceanex import ImplicitAPI
8
- from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
8
+ from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -543,7 +543,7 @@ class oceanex(Exchange, ImplicitAPI):
543
543
  #
544
544
  return self.safe_timestamp(response, 'data')
545
545
 
546
- async def fetch_trading_fees(self, params={}):
546
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
547
547
  """
548
548
  fetch the trading fees for multiple markets
549
549
  :see: https://api.oceanex.pro/doc/v1/#trading-fees-post
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.okcoin import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -733,7 +733,7 @@ class okcoin(Exchange, ImplicitAPI):
733
733
  }
734
734
  return self.safe_string(networksById, networkId, networkId)
735
735
 
736
- async def fetch_currencies(self, params={}):
736
+ async def fetch_currencies(self, params={}) -> Currencies:
737
737
  """
738
738
  fetches all available currencies on an exchange
739
739
  :param dict [params]: extra parameters specific to the exchange API endpoint
ccxt/async_support/okx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Account, Balances, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -1543,7 +1543,7 @@ class okx(Exchange, ImplicitAPI):
1543
1543
  }
1544
1544
  return self.safe_string(networksById, networkId, networkId)
1545
1545
 
1546
- async def fetch_currencies(self, params={}):
1546
+ async def fetch_currencies(self, params={}) -> Currencies:
1547
1547
  """
1548
1548
  fetches all available currencies on an exchange
1549
1549
  :see: https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
@@ -2267,7 +2267,7 @@ class okx(Exchange, ImplicitAPI):
2267
2267
  result[code] = account
2268
2268
  return self.safe_balance(result)
2269
2269
 
2270
- def parse_trading_fee(self, fee, market: Market = None):
2270
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
2271
2271
  # https://www.okx.com/docs-v5/en/#rest-api-account-get-fee-rates
2272
2272
  #
2273
2273
  # {
@@ -2287,9 +2287,11 @@ class okx(Exchange, ImplicitAPI):
2287
2287
  # OKX returns the fees values opposed to other exchanges, so the sign needs to be flipped
2288
2288
  'maker': self.parse_number(Precise.string_neg(self.safe_string_2(fee, 'maker', 'makerU'))),
2289
2289
  'taker': self.parse_number(Precise.string_neg(self.safe_string_2(fee, 'taker', 'takerU'))),
2290
+ 'percentage': None,
2291
+ 'tierBased': None,
2290
2292
  }
2291
2293
 
2292
- async def fetch_trading_fee(self, symbol: str, params={}):
2294
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2293
2295
  """
2294
2296
  fetch the trading fees for a market
2295
2297
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.onetrading import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -325,7 +325,7 @@ class onetrading(Exchange, ImplicitAPI):
325
325
  #
326
326
  return self.safe_integer(response, 'epoch_millis')
327
327
 
328
- async def fetch_currencies(self, params={}):
328
+ async def fetch_currencies(self, params={}) -> Currencies:
329
329
  """
330
330
  fetches all available currencies on an exchange
331
331
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -443,7 +443,7 @@ class onetrading(Exchange, ImplicitAPI):
443
443
  'info': market,
444
444
  }
445
445
 
446
- async def fetch_trading_fees(self, params={}):
446
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
447
447
  """
448
448
  fetch the trading fees for multiple markets
449
449
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.phemex import ImplicitAPI
8
8
  import hashlib
9
9
  import numbers
10
- from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -971,7 +971,7 @@ class phemex(Exchange, ImplicitAPI):
971
971
  result.append(market)
972
972
  return result
973
973
 
974
- async def fetch_currencies(self, params={}):
974
+ async def fetch_currencies(self, params={}) -> Currencies:
975
975
  """
976
976
  fetches all available currencies on an exchange
977
977
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.poloniex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -671,7 +671,7 @@ class poloniex(Exchange, ImplicitAPI):
671
671
  #
672
672
  return self.parse_tickers(response, symbols)
673
673
 
674
- async def fetch_currencies(self, params={}):
674
+ async def fetch_currencies(self, params={}) -> Currencies:
675
675
  """
676
676
  fetches all available currencies on an exchange
677
677
  :see: https://docs.poloniex.com/#public-endpoints-reference-data-currency-information
@@ -1570,7 +1570,7 @@ class poloniex(Exchange, ImplicitAPI):
1570
1570
  #
1571
1571
  return self.parse_balance(response)
1572
1572
 
1573
- async def fetch_trading_fees(self, params={}):
1573
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
1574
1574
  """
1575
1575
  fetch the trading fees for multiple markets
1576
1576
  :see: https://docs.poloniex.com/#authenticated-endpoints-accounts-fee-info
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.probit import ImplicitAPI
8
8
  import math
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -355,7 +355,7 @@ class probit(Exchange, ImplicitAPI):
355
355
  'info': market,
356
356
  }
357
357
 
358
- async def fetch_currencies(self, params={}):
358
+ async def fetch_currencies(self, params={}) -> Currencies:
359
359
  """
360
360
  :see: https://docs-en.probit.com/reference/currency
361
361
  fetches all available currencies on an exchange
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.timex import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -323,7 +323,7 @@ class timex(Exchange, ImplicitAPI):
323
323
  #
324
324
  return self.parse_markets(response)
325
325
 
326
- async def fetch_currencies(self, params={}):
326
+ async def fetch_currencies(self, params={}) -> Currencies:
327
327
  """
328
328
  fetches all available currencies on an exchange
329
329
  :see: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCurrencies
@@ -1096,7 +1096,7 @@ class timex(Exchange, ImplicitAPI):
1096
1096
  trades = self.safe_list(response, 'trades', [])
1097
1097
  return self.parse_trades(trades, market, since, limit)
1098
1098
 
1099
- def parse_trading_fee(self, fee, market: Market = None):
1099
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1100
1100
  #
1101
1101
  # {
1102
1102
  # "fee": 0.0075,
@@ -1110,9 +1110,11 @@ class timex(Exchange, ImplicitAPI):
1110
1110
  'symbol': self.safe_symbol(marketId, market),
1111
1111
  'maker': rate,
1112
1112
  'taker': rate,
1113
+ 'percentage': None,
1114
+ 'tierBased': None,
1113
1115
  }
1114
1116
 
1115
- async def fetch_trading_fee(self, symbol: str, params={}):
1117
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1116
1118
  """
1117
1119
  fetch the trading fees for a market
1118
1120
  :see: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getFees
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.upbit import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -836,7 +836,7 @@ class upbit(Exchange, ImplicitAPI):
836
836
  #
837
837
  return self.parse_trades(response, market, since, limit)
838
838
 
839
- async def fetch_trading_fee(self, symbol: str, params={}):
839
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
840
840
  """
841
841
  :see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4
842
842
  fetch the trading fees for a market
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.wazirx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -882,7 +882,7 @@ class wazirx(Exchange, ImplicitAPI):
882
882
  }
883
883
  return self.safe_string(statuses, status, status)
884
884
 
885
- async def fetch_currencies(self, params={}):
885
+ async def fetch_currencies(self, params={}) -> Currencies:
886
886
  """
887
887
  fetches all available currencies on an exchange
888
888
  :see: https://docs.wazirx.com/#all-coins-39-information-user_data
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.whitebit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Bool, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -401,7 +401,7 @@ class whitebit(Exchange, ImplicitAPI):
401
401
  'info': market,
402
402
  }
403
403
 
404
- async def fetch_currencies(self, params={}):
404
+ async def fetch_currencies(self, params={}) -> Currencies:
405
405
  """
406
406
  fetches all available currencies on an exchange
407
407
  :see: https://docs.whitebit.com/public/http-v4/#asset-status-list
@@ -652,7 +652,7 @@ class whitebit(Exchange, ImplicitAPI):
652
652
  depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
653
653
  return depositWithdrawFees
654
654
 
655
- async def fetch_trading_fees(self, params={}):
655
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
656
656
  """
657
657
  fetch the trading fees for multiple markets
658
658
  :see: https://docs.whitebit.com/public/http-v4/#asset-status-list
ccxt/async_support/woo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.woo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Bool, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -620,7 +620,7 @@ class woo(Exchange, ImplicitAPI):
620
620
  }
621
621
  return fee
622
622
 
623
- async def fetch_trading_fees(self, params={}):
623
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
624
624
  """
625
625
  fetch the trading fees for multiple markets
626
626
  :see: https://docs.woo.org/#get-account-information-new
@@ -673,7 +673,7 @@ class woo(Exchange, ImplicitAPI):
673
673
  }
674
674
  return result
675
675
 
676
- async def fetch_currencies(self, params={}):
676
+ async def fetch_currencies(self, params={}) -> Currencies:
677
677
  """
678
678
  fetches all available currencies on an exchange
679
679
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.yobit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -700,7 +700,7 @@ class yobit(Exchange, ImplicitAPI):
700
700
  result = self.safe_list(response, market['id'], [])
701
701
  return self.parse_trades(result, market, since, limit)
702
702
 
703
- async def fetch_trading_fees(self, params={}):
703
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
704
704
  """
705
705
  :see: https://yobit.net/en/api
706
706
  fetch the trading fees for multiple markets
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.88'
7
+ __version__ = '4.2.89'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -3732,11 +3732,11 @@ class Exchange(object):
3732
3732
  code = currencyId
3733
3733
  if currencyId is not None:
3734
3734
  code = self.common_currency_code(currencyId.upper())
3735
- return {
3735
+ return self.safe_currency_structure({
3736
3736
  'id': currencyId,
3737
3737
  'code': code,
3738
3738
  'precision': None,
3739
- }
3739
+ })
3740
3740
 
3741
3741
  def safe_market(self, marketId: Str, market: Market = None, delimiter: Str = None, marketType: Str = None):
3742
3742
  result = self.safe_market_structure({
@@ -4390,10 +4390,16 @@ class Exchange(object):
4390
4390
  'total': None,
4391
4391
  }
4392
4392
 
4393
- def common_currency_code(self, currency: str):
4393
+ def common_currency_code(self, code: str):
4394
4394
  if not self.substituteCommonCurrencyCodes:
4395
- return currency
4396
- return self.safe_string(self.commonCurrencies, currency, currency)
4395
+ return code
4396
+ # if the provided code already exists value in commonCurrencies dict, then we should not again transform it
4397
+ # more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
4398
+ commonCurrencies = list(self.commonCurrencies.values())
4399
+ exists = self.in_array(code, commonCurrencies)
4400
+ if exists:
4401
+ return code
4402
+ return self.safe_string(self.commonCurrencies, code, code)
4397
4403
 
4398
4404
  def currency(self, code: str):
4399
4405
  if self.currencies is None:
@@ -4791,7 +4797,8 @@ class Exchange(object):
4791
4797
  def fetch_trading_fee(self, symbol: str, params={}):
4792
4798
  if not self.has['fetchTradingFees']:
4793
4799
  raise NotSupported(self.id + ' fetchTradingFee() is not supported yet')
4794
- return self.fetch_trading_fees(params)
4800
+ fees = self.fetch_trading_fees(params)
4801
+ return self.safe_dict(fees, symbol)
4795
4802
 
4796
4803
  def parse_open_interest(self, interest, market: Market = None):
4797
4804
  raise NotSupported(self.id + ' parseOpenInterest() is not supported yet')