ccxt 4.2.87__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 (154) 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 +17 -11
  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 +27 -21
  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/cryptocom.py +1 -1
  39. ccxt/async_support/currencycom.py +3 -3
  40. ccxt/async_support/delta.py +2 -2
  41. ccxt/async_support/deribit.py +3 -3
  42. ccxt/async_support/digifinex.py +6 -4
  43. ccxt/async_support/exmo.py +3 -3
  44. ccxt/async_support/gate.py +20 -18
  45. ccxt/async_support/gemini.py +3 -3
  46. ccxt/async_support/hitbtc.py +7 -5
  47. ccxt/async_support/hollaex.py +3 -3
  48. ccxt/async_support/htx.py +6 -4
  49. ccxt/async_support/huobijp.py +2 -2
  50. ccxt/async_support/hyperliquid.py +2 -2
  51. ccxt/async_support/idex.py +3 -3
  52. ccxt/async_support/independentreserve.py +2 -2
  53. ccxt/async_support/kraken.py +3 -3
  54. ccxt/async_support/krakenfutures.py +2 -1
  55. ccxt/async_support/kucoin.py +49 -22
  56. ccxt/async_support/kuna.py +2 -2
  57. ccxt/async_support/latoken.py +7 -3
  58. ccxt/async_support/lbank.py +7 -5
  59. ccxt/async_support/luno.py +4 -2
  60. ccxt/async_support/lykke.py +2 -2
  61. ccxt/async_support/mexc.py +57 -10
  62. ccxt/async_support/ndax.py +2 -2
  63. ccxt/async_support/oceanex.py +2 -2
  64. ccxt/async_support/okcoin.py +2 -2
  65. ccxt/async_support/okx.py +6 -4
  66. ccxt/async_support/onetrading.py +3 -3
  67. ccxt/async_support/phemex.py +2 -2
  68. ccxt/async_support/poloniex.py +3 -3
  69. ccxt/async_support/probit.py +2 -2
  70. ccxt/async_support/timex.py +6 -4
  71. ccxt/async_support/upbit.py +2 -2
  72. ccxt/async_support/wazirx.py +2 -2
  73. ccxt/async_support/whitebit.py +3 -3
  74. ccxt/async_support/woo.py +3 -3
  75. ccxt/async_support/yobit.py +2 -2
  76. ccxt/base/exchange.py +35 -9
  77. ccxt/base/types.py +32 -0
  78. ccxt/bigone.py +2 -2
  79. ccxt/binance.py +17 -11
  80. ccxt/bingx.py +2 -2
  81. ccxt/bit2c.py +2 -2
  82. ccxt/bitbank.py +2 -2
  83. ccxt/bitfinex.py +2 -2
  84. ccxt/bitfinex2.py +3 -3
  85. ccxt/bitflyer.py +4 -2
  86. ccxt/bitget.py +27 -21
  87. ccxt/bitmart.py +6 -4
  88. ccxt/bitmex.py +2 -2
  89. ccxt/bitopro.py +3 -3
  90. ccxt/bitrue.py +2 -2
  91. ccxt/bitso.py +2 -2
  92. ccxt/bitstamp.py +89 -97
  93. ccxt/bitteam.py +2 -2
  94. ccxt/bitvavo.py +3 -3
  95. ccxt/bl3p.py +2 -2
  96. ccxt/blockchaincom.py +2 -2
  97. ccxt/blofin.py +4 -2
  98. ccxt/bybit.py +7 -5
  99. ccxt/cex.py +3 -3
  100. ccxt/coinbase.py +2 -2
  101. ccxt/coinbaseinternational.py +2 -2
  102. ccxt/coinbasepro.py +3 -3
  103. ccxt/coincheck.py +2 -2
  104. ccxt/coinex.py +5 -5
  105. ccxt/coinlist.py +3 -3
  106. ccxt/coinmate.py +2 -2
  107. ccxt/coinmetro.py +2 -2
  108. ccxt/coinone.py +2 -2
  109. ccxt/coinsph.py +6 -4
  110. ccxt/cryptocom.py +1 -1
  111. ccxt/currencycom.py +3 -3
  112. ccxt/delta.py +2 -2
  113. ccxt/deribit.py +3 -3
  114. ccxt/digifinex.py +6 -4
  115. ccxt/exmo.py +3 -3
  116. ccxt/gate.py +20 -18
  117. ccxt/gemini.py +3 -3
  118. ccxt/hitbtc.py +7 -5
  119. ccxt/hollaex.py +3 -3
  120. ccxt/htx.py +6 -4
  121. ccxt/huobijp.py +2 -2
  122. ccxt/hyperliquid.py +2 -2
  123. ccxt/idex.py +3 -3
  124. ccxt/independentreserve.py +2 -2
  125. ccxt/kraken.py +3 -3
  126. ccxt/krakenfutures.py +2 -1
  127. ccxt/kucoin.py +49 -22
  128. ccxt/kuna.py +2 -2
  129. ccxt/latoken.py +7 -3
  130. ccxt/lbank.py +7 -5
  131. ccxt/luno.py +4 -2
  132. ccxt/lykke.py +2 -2
  133. ccxt/mexc.py +57 -10
  134. ccxt/ndax.py +2 -2
  135. ccxt/oceanex.py +2 -2
  136. ccxt/okcoin.py +2 -2
  137. ccxt/okx.py +6 -4
  138. ccxt/onetrading.py +3 -3
  139. ccxt/phemex.py +2 -2
  140. ccxt/poloniex.py +3 -3
  141. ccxt/pro/__init__.py +1 -1
  142. ccxt/pro/bitget.py +2 -0
  143. ccxt/pro/bitvavo.py +2 -2
  144. ccxt/probit.py +2 -2
  145. ccxt/timex.py +6 -4
  146. ccxt/upbit.py +2 -2
  147. ccxt/wazirx.py +2 -2
  148. ccxt/whitebit.py +3 -3
  149. ccxt/woo.py +3 -3
  150. ccxt/yobit.py +2 -2
  151. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/METADATA +5 -6
  152. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/RECORD +154 -154
  153. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/WHEEL +0 -0
  154. {ccxt-4.2.87.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.kraken import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, IndexType, 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
@@ -641,7 +641,7 @@ class kraken(Exchange, ImplicitAPI):
641
641
  result.append(self.extend(defaults, markets[i]))
642
642
  return result
643
643
 
644
- async def fetch_currencies(self, params={}):
644
+ async def fetch_currencies(self, params={}) -> Currencies:
645
645
  """
646
646
  fetches all available currencies on an exchange
647
647
  :see: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getAssetInfo
@@ -697,7 +697,7 @@ class kraken(Exchange, ImplicitAPI):
697
697
  }
698
698
  return result
699
699
 
700
- async def fetch_trading_fee(self, symbol: str, params={}):
700
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
701
701
  """
702
702
  fetch the trading fees for a market
703
703
  :see: https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeVolume
@@ -363,7 +363,8 @@ class krakenfutures(Exchange, ImplicitAPI):
363
363
  # swap == perpetual
364
364
  settle = None
365
365
  settleId = None
366
- amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'contractValueTradePrecision', '0')))
366
+ cvtp = self.safe_string(market, 'contractValueTradePrecision')
367
+ amountPrecision = self.parse_number(self.integer_precision_to_amount(cvtp))
367
368
  pricePrecision = self.safe_number(market, 'tickSize')
368
369
  contract = (swap or future or index)
369
370
  swapOrFutures = (swap or future)
@@ -9,7 +9,7 @@ import asyncio
9
9
  import hashlib
10
10
  import math
11
11
  import json
12
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
12
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
13
13
  from typing import List
14
14
  from ccxt.base.errors import ExchangeError
15
15
  from ccxt.base.errors import PermissionDenied
@@ -1131,7 +1131,7 @@ class kucoin(Exchange, ImplicitAPI):
1131
1131
  })
1132
1132
  return result
1133
1133
 
1134
- async def fetch_currencies(self, params={}):
1134
+ async def fetch_currencies(self, params={}) -> Currencies:
1135
1135
  """
1136
1136
  fetches all available currencies on an exchange
1137
1137
  :see: https://docs.kucoin.com/#get-currencies
@@ -2961,7 +2961,7 @@ class kucoin(Exchange, ImplicitAPI):
2961
2961
  'fee': fee,
2962
2962
  }, market)
2963
2963
 
2964
- async def fetch_trading_fee(self, symbol: str, params={}):
2964
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2965
2965
  """
2966
2966
  fetch the trading fees for a market
2967
2967
  :see: https://docs.kucoin.com/#actual-fee-rate-of-the-trading-pair
@@ -3315,9 +3315,9 @@ class kucoin(Exchange, ImplicitAPI):
3315
3315
 
3316
3316
  def parse_balance_helper(self, entry):
3317
3317
  account = self.account()
3318
- account['used'] = self.safe_string(entry, 'holdBalance')
3319
- account['free'] = self.safe_string(entry, 'availableBalance')
3320
- account['total'] = self.safe_string(entry, 'totalBalance')
3318
+ account['used'] = self.safe_string_2(entry, 'holdBalance', 'hold')
3319
+ account['free'] = self.safe_string_2(entry, 'availableBalance', 'available')
3320
+ account['total'] = self.safe_string_2(entry, 'totalBalance', 'total')
3321
3321
  debt = self.safe_string(entry, 'liability')
3322
3322
  interest = self.safe_string(entry, 'interest')
3323
3323
  account['debt'] = Precise.string_add(debt, interest)
@@ -3326,9 +3326,9 @@ class kucoin(Exchange, ImplicitAPI):
3326
3326
  async def fetch_balance(self, params={}) -> Balances:
3327
3327
  """
3328
3328
  query for balance and get the amount of funds available for trading or funds locked in orders
3329
- :see: https://docs.kucoin.com/#list-accounts
3330
3329
  :see: https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
3331
- :see: https://docs.kucoin.com/#query-isolated-margin-account-info
3330
+ :see: https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-margin
3331
+ :see: https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-isolated-margin
3332
3332
  :param dict [params]: extra parameters specific to the exchange API endpoint
3333
3333
  :param dict [params.marginMode]: 'cross' or 'isolated', margin type for fetching margin balance
3334
3334
  :param dict [params.type]: extra parameters specific to the exchange API endpoint
@@ -3353,7 +3353,7 @@ class kucoin(Exchange, ImplicitAPI):
3353
3353
  response = None
3354
3354
  request = {}
3355
3355
  isolated = (marginMode == 'isolated') or (type == 'isolated')
3356
- cross = (marginMode == 'cross') or (type == 'cross')
3356
+ cross = (marginMode == 'cross') or (type == 'margin')
3357
3357
  if isolated:
3358
3358
  if currency is not None:
3359
3359
  request['balanceCurrency'] = currency['id']
@@ -3366,7 +3366,7 @@ class kucoin(Exchange, ImplicitAPI):
3366
3366
  request['type'] = type
3367
3367
  response = await self.privateGetAccounts(self.extend(request, query))
3368
3368
  #
3369
- # Spot and Cross
3369
+ # Spot
3370
3370
  #
3371
3371
  # {
3372
3372
  # "code": "200000",
@@ -3382,35 +3382,59 @@ class kucoin(Exchange, ImplicitAPI):
3382
3382
  # ]
3383
3383
  # }
3384
3384
  #
3385
+ # Cross
3386
+ #
3387
+ # {
3388
+ # "code": "200000",
3389
+ # "data": {
3390
+ # "debtRatio": "0",
3391
+ # "accounts": [
3392
+ # {
3393
+ # "currency": "USDT",
3394
+ # "totalBalance": "5",
3395
+ # "availableBalance": "5",
3396
+ # "holdBalance": "0",
3397
+ # "liability": "0",
3398
+ # "maxBorrowSize": "20"
3399
+ # },
3400
+ # ]
3401
+ # }
3402
+ # }
3403
+ #
3385
3404
  # Isolated
3386
3405
  #
3387
3406
  # {
3388
3407
  # "code": "200000",
3389
3408
  # "data": {
3390
- # "totalConversionBalance": "0",
3391
- # "liabilityConversionBalance": "0",
3409
+ # "totalAssetOfQuoteCurrency": "0",
3410
+ # "totalLiabilityOfQuoteCurrency": "0",
3411
+ # "timestamp": 1712085661155,
3392
3412
  # "assets": [
3393
3413
  # {
3394
3414
  # "symbol": "MANA-USDT",
3395
- # "status": "CLEAR",
3415
+ # "status": "EFFECTIVE",
3396
3416
  # "debtRatio": "0",
3397
3417
  # "baseAsset": {
3398
3418
  # "currency": "MANA",
3399
- # "totalBalance": "0",
3400
- # "holdBalance": "0",
3401
- # "availableBalance": "0",
3419
+ # "borrowEnabled": True,
3420
+ # "transferInEnabled": True,
3421
+ # "total": "0",
3422
+ # "hold": "0",
3423
+ # "available": "0",
3402
3424
  # "liability": "0",
3403
3425
  # "interest": "0",
3404
- # "borrowableAmount": "0"
3426
+ # "maxBorrowSize": "0"
3405
3427
  # },
3406
3428
  # "quoteAsset": {
3407
3429
  # "currency": "USDT",
3408
- # "totalBalance": "0",
3409
- # "holdBalance": "0",
3410
- # "availableBalance": "0",
3430
+ # "borrowEnabled": True,
3431
+ # "transferInEnabled": True,
3432
+ # "total": "0",
3433
+ # "hold": "0",
3434
+ # "available": "0",
3411
3435
  # "liability": "0",
3412
3436
  # "interest": "0",
3413
- # "borrowableAmount": "0"
3437
+ # "maxBorrowSize": "0"
3414
3438
  # }
3415
3439
  # },
3416
3440
  # ...
@@ -3418,13 +3442,14 @@ class kucoin(Exchange, ImplicitAPI):
3418
3442
  # }
3419
3443
  # }
3420
3444
  #
3421
- data = self.safe_list(response, 'data', [])
3445
+ data = None
3422
3446
  result = {
3423
3447
  'info': response,
3424
3448
  'timestamp': None,
3425
3449
  'datetime': None,
3426
3450
  }
3427
3451
  if isolated:
3452
+ data = self.safe_dict(response, 'data', {})
3428
3453
  assets = self.safe_value(data, 'assets', data)
3429
3454
  for i in range(0, len(assets)):
3430
3455
  entry = assets[i]
@@ -3439,6 +3464,7 @@ class kucoin(Exchange, ImplicitAPI):
3439
3464
  subResult[quoteCode] = self.parse_balance_helper(quote)
3440
3465
  result[symbol] = self.safe_balance(subResult)
3441
3466
  elif cross:
3467
+ data = self.safe_dict(response, 'data', {})
3442
3468
  accounts = self.safe_list(data, 'accounts', [])
3443
3469
  for i in range(0, len(accounts)):
3444
3470
  balance = accounts[i]
@@ -3446,6 +3472,7 @@ class kucoin(Exchange, ImplicitAPI):
3446
3472
  codeInner = self.safe_currency_code(currencyId)
3447
3473
  result[codeInner] = self.parse_balance_helper(balance)
3448
3474
  else:
3475
+ data = self.safe_list(response, 'data', [])
3449
3476
  for i in range(0, len(data)):
3450
3477
  balance = data[i]
3451
3478
  balanceType = self.safe_string(balance, 'type')
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.kuna import ImplicitAPI
8
8
  import hashlib
9
9
  import json
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, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import ArgumentsRequired
@@ -425,7 +425,7 @@ class kuna(Exchange, ImplicitAPI):
425
425
  data = self.safe_value(response, 'data', {})
426
426
  return self.safe_integer(data, 'timestamp_miliseconds')
427
427
 
428
- async def fetch_currencies(self, params={}):
428
+ async def fetch_currencies(self, params={}) -> Currencies:
429
429
  """
430
430
  fetches all available currencies on an exchange
431
431
  :see: https://docs.kuna.io/docs/get-information-about-available-currencies
@@ -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({
@@ -4228,7 +4275,7 @@ class mexc(Exchange, ImplicitAPI):
4228
4275
  key = self.safe_string(keys, 0)
4229
4276
  result = self.safe_dict(addressStructures, key)
4230
4277
  if result is None:
4231
- raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using the MEXC platform')
4278
+ raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using .createDepositAddress() method or in MEXC website')
4232
4279
  return result
4233
4280
 
4234
4281
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -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