ccxt 4.2.88__py2.py3-none-any.whl → 4.2.90__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 (156) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +2 -0
  3. ccxt/abstract/bybit.py +2 -0
  4. ccxt/ascendex.py +6 -3
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ascendex.py +6 -3
  7. ccxt/async_support/base/exchange.py +15 -2
  8. ccxt/async_support/bigone.py +2 -2
  9. ccxt/async_support/binance.py +88 -14
  10. ccxt/async_support/bingx.py +96 -3
  11. ccxt/async_support/bit2c.py +2 -2
  12. ccxt/async_support/bitbank.py +2 -2
  13. ccxt/async_support/bitfinex.py +2 -2
  14. ccxt/async_support/bitfinex2.py +4 -3
  15. ccxt/async_support/bitflyer.py +4 -2
  16. ccxt/async_support/bitget.py +12 -5
  17. ccxt/async_support/bitmart.py +6 -4
  18. ccxt/async_support/bitmex.py +3 -2
  19. ccxt/async_support/bitopro.py +3 -3
  20. ccxt/async_support/bitrue.py +3 -2
  21. ccxt/async_support/bitso.py +2 -2
  22. ccxt/async_support/bitstamp.py +89 -97
  23. ccxt/async_support/bitteam.py +2 -2
  24. ccxt/async_support/bitvavo.py +3 -3
  25. ccxt/async_support/bl3p.py +2 -2
  26. ccxt/async_support/blockchaincom.py +2 -2
  27. ccxt/async_support/blofin.py +4 -2
  28. ccxt/async_support/bybit.py +57 -5
  29. ccxt/async_support/cex.py +3 -3
  30. ccxt/async_support/coinbase.py +42 -22
  31. ccxt/async_support/coinbaseinternational.py +3 -2
  32. ccxt/async_support/coinbasepro.py +3 -3
  33. ccxt/async_support/coincheck.py +2 -2
  34. ccxt/async_support/coinex.py +101 -13
  35. ccxt/async_support/coinlist.py +3 -3
  36. ccxt/async_support/coinmate.py +2 -2
  37. ccxt/async_support/coinmetro.py +2 -2
  38. ccxt/async_support/coinone.py +2 -2
  39. ccxt/async_support/coinsph.py +6 -4
  40. ccxt/async_support/cryptocom.py +1 -0
  41. ccxt/async_support/currencycom.py +3 -3
  42. ccxt/async_support/delta.py +3 -2
  43. ccxt/async_support/deribit.py +3 -3
  44. ccxt/async_support/digifinex.py +7 -4
  45. ccxt/async_support/exmo.py +4 -3
  46. ccxt/async_support/gate.py +8 -4
  47. ccxt/async_support/gemini.py +13 -12
  48. ccxt/async_support/hitbtc.py +8 -5
  49. ccxt/async_support/hollaex.py +3 -3
  50. ccxt/async_support/htx.py +7 -4
  51. ccxt/async_support/huobijp.py +2 -2
  52. ccxt/async_support/hyperliquid.py +3 -2
  53. ccxt/async_support/idex.py +3 -3
  54. ccxt/async_support/independentreserve.py +2 -2
  55. ccxt/async_support/kraken.py +3 -3
  56. ccxt/async_support/kucoin.py +43 -18
  57. ccxt/async_support/kucoinfutures.py +32 -4
  58. ccxt/async_support/kuna.py +2 -2
  59. ccxt/async_support/latoken.py +7 -3
  60. ccxt/async_support/lbank.py +7 -5
  61. ccxt/async_support/luno.py +4 -2
  62. ccxt/async_support/lykke.py +2 -2
  63. ccxt/async_support/mexc.py +57 -9
  64. ccxt/async_support/ndax.py +2 -2
  65. ccxt/async_support/oceanex.py +2 -2
  66. ccxt/async_support/okcoin.py +2 -2
  67. ccxt/async_support/okx.py +149 -12
  68. ccxt/async_support/onetrading.py +3 -3
  69. ccxt/async_support/phemex.py +3 -2
  70. ccxt/async_support/poloniex.py +3 -3
  71. ccxt/async_support/probit.py +2 -2
  72. ccxt/async_support/timex.py +6 -4
  73. ccxt/async_support/upbit.py +2 -2
  74. ccxt/async_support/wazirx.py +2 -2
  75. ccxt/async_support/whitebit.py +3 -3
  76. ccxt/async_support/woo.py +4 -3
  77. ccxt/async_support/yobit.py +2 -2
  78. ccxt/base/exchange.py +65 -12
  79. ccxt/base/types.py +33 -0
  80. ccxt/bigone.py +2 -2
  81. ccxt/binance.py +88 -14
  82. ccxt/bingx.py +96 -3
  83. ccxt/bit2c.py +2 -2
  84. ccxt/bitbank.py +2 -2
  85. ccxt/bitfinex.py +2 -2
  86. ccxt/bitfinex2.py +4 -3
  87. ccxt/bitflyer.py +4 -2
  88. ccxt/bitget.py +12 -5
  89. ccxt/bitmart.py +6 -4
  90. ccxt/bitmex.py +3 -2
  91. ccxt/bitopro.py +3 -3
  92. ccxt/bitrue.py +3 -2
  93. ccxt/bitso.py +2 -2
  94. ccxt/bitstamp.py +89 -97
  95. ccxt/bitteam.py +2 -2
  96. ccxt/bitvavo.py +3 -3
  97. ccxt/bl3p.py +2 -2
  98. ccxt/blockchaincom.py +2 -2
  99. ccxt/blofin.py +4 -2
  100. ccxt/bybit.py +57 -5
  101. ccxt/cex.py +3 -3
  102. ccxt/coinbase.py +42 -22
  103. ccxt/coinbaseinternational.py +3 -2
  104. ccxt/coinbasepro.py +3 -3
  105. ccxt/coincheck.py +2 -2
  106. ccxt/coinex.py +101 -13
  107. ccxt/coinlist.py +3 -3
  108. ccxt/coinmate.py +2 -2
  109. ccxt/coinmetro.py +2 -2
  110. ccxt/coinone.py +2 -2
  111. ccxt/coinsph.py +6 -4
  112. ccxt/cryptocom.py +1 -0
  113. ccxt/currencycom.py +3 -3
  114. ccxt/delta.py +3 -2
  115. ccxt/deribit.py +3 -3
  116. ccxt/digifinex.py +7 -4
  117. ccxt/exmo.py +4 -3
  118. ccxt/gate.py +8 -4
  119. ccxt/gemini.py +13 -12
  120. ccxt/hitbtc.py +8 -5
  121. ccxt/hollaex.py +3 -3
  122. ccxt/htx.py +7 -4
  123. ccxt/huobijp.py +2 -2
  124. ccxt/hyperliquid.py +3 -2
  125. ccxt/idex.py +3 -3
  126. ccxt/independentreserve.py +2 -2
  127. ccxt/kraken.py +3 -3
  128. ccxt/kucoin.py +43 -18
  129. ccxt/kucoinfutures.py +32 -4
  130. ccxt/kuna.py +2 -2
  131. ccxt/latoken.py +7 -3
  132. ccxt/lbank.py +7 -5
  133. ccxt/luno.py +4 -2
  134. ccxt/lykke.py +2 -2
  135. ccxt/mexc.py +57 -9
  136. ccxt/ndax.py +2 -2
  137. ccxt/oceanex.py +2 -2
  138. ccxt/okcoin.py +2 -2
  139. ccxt/okx.py +149 -12
  140. ccxt/onetrading.py +3 -3
  141. ccxt/phemex.py +3 -2
  142. ccxt/poloniex.py +3 -3
  143. ccxt/pro/__init__.py +1 -1
  144. ccxt/pro/bitget.py +2 -0
  145. ccxt/pro/bitvavo.py +2 -2
  146. ccxt/probit.py +2 -2
  147. ccxt/timex.py +6 -4
  148. ccxt/upbit.py +2 -2
  149. ccxt/wazirx.py +2 -2
  150. ccxt/whitebit.py +3 -3
  151. ccxt/woo.py +4 -3
  152. ccxt/yobit.py +2 -2
  153. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/METADATA +4 -4
  154. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/RECORD +156 -156
  155. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/WHEEL +0 -0
  156. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/top_level.txt +0 -0
@@ -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
@@ -93,6 +93,7 @@ class kucoin(Exchange, ImplicitAPI):
93
93
  'fetchL3OrderBook': True,
94
94
  'fetchLedger': True,
95
95
  'fetchLeverageTiers': False,
96
+ 'fetchMarginAdjustmentHistory': False,
96
97
  'fetchMarginMode': False,
97
98
  'fetchMarketLeverageTiers': False,
98
99
  'fetchMarkets': True,
@@ -1131,7 +1132,7 @@ class kucoin(Exchange, ImplicitAPI):
1131
1132
  })
1132
1133
  return result
1133
1134
 
1134
- async def fetch_currencies(self, params={}):
1135
+ async def fetch_currencies(self, params={}) -> Currencies:
1135
1136
  """
1136
1137
  fetches all available currencies on an exchange
1137
1138
  :see: https://docs.kucoin.com/#get-currencies
@@ -2961,7 +2962,7 @@ class kucoin(Exchange, ImplicitAPI):
2961
2962
  'fee': fee,
2962
2963
  }, market)
2963
2964
 
2964
- async def fetch_trading_fee(self, symbol: str, params={}):
2965
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2965
2966
  """
2966
2967
  fetch the trading fees for a market
2967
2968
  :see: https://docs.kucoin.com/#actual-fee-rate-of-the-trading-pair
@@ -3315,9 +3316,9 @@ class kucoin(Exchange, ImplicitAPI):
3315
3316
 
3316
3317
  def parse_balance_helper(self, entry):
3317
3318
  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')
3319
+ account['used'] = self.safe_string_2(entry, 'holdBalance', 'hold')
3320
+ account['free'] = self.safe_string_2(entry, 'availableBalance', 'available')
3321
+ account['total'] = self.safe_string_2(entry, 'totalBalance', 'total')
3321
3322
  debt = self.safe_string(entry, 'liability')
3322
3323
  interest = self.safe_string(entry, 'interest')
3323
3324
  account['debt'] = Precise.string_add(debt, interest)
@@ -3366,7 +3367,7 @@ class kucoin(Exchange, ImplicitAPI):
3366
3367
  request['type'] = type
3367
3368
  response = await self.privateGetAccounts(self.extend(request, query))
3368
3369
  #
3369
- # Spot and Cross
3370
+ # Spot
3370
3371
  #
3371
3372
  # {
3372
3373
  # "code": "200000",
@@ -3382,35 +3383,59 @@ class kucoin(Exchange, ImplicitAPI):
3382
3383
  # ]
3383
3384
  # }
3384
3385
  #
3386
+ # Cross
3387
+ #
3388
+ # {
3389
+ # "code": "200000",
3390
+ # "data": {
3391
+ # "debtRatio": "0",
3392
+ # "accounts": [
3393
+ # {
3394
+ # "currency": "USDT",
3395
+ # "totalBalance": "5",
3396
+ # "availableBalance": "5",
3397
+ # "holdBalance": "0",
3398
+ # "liability": "0",
3399
+ # "maxBorrowSize": "20"
3400
+ # },
3401
+ # ]
3402
+ # }
3403
+ # }
3404
+ #
3385
3405
  # Isolated
3386
3406
  #
3387
3407
  # {
3388
3408
  # "code": "200000",
3389
3409
  # "data": {
3390
- # "totalConversionBalance": "0",
3391
- # "liabilityConversionBalance": "0",
3410
+ # "totalAssetOfQuoteCurrency": "0",
3411
+ # "totalLiabilityOfQuoteCurrency": "0",
3412
+ # "timestamp": 1712085661155,
3392
3413
  # "assets": [
3393
3414
  # {
3394
3415
  # "symbol": "MANA-USDT",
3395
- # "status": "CLEAR",
3416
+ # "status": "EFFECTIVE",
3396
3417
  # "debtRatio": "0",
3397
3418
  # "baseAsset": {
3398
3419
  # "currency": "MANA",
3399
- # "totalBalance": "0",
3400
- # "holdBalance": "0",
3401
- # "availableBalance": "0",
3420
+ # "borrowEnabled": True,
3421
+ # "transferInEnabled": True,
3422
+ # "total": "0",
3423
+ # "hold": "0",
3424
+ # "available": "0",
3402
3425
  # "liability": "0",
3403
3426
  # "interest": "0",
3404
- # "borrowableAmount": "0"
3427
+ # "maxBorrowSize": "0"
3405
3428
  # },
3406
3429
  # "quoteAsset": {
3407
3430
  # "currency": "USDT",
3408
- # "totalBalance": "0",
3409
- # "holdBalance": "0",
3410
- # "availableBalance": "0",
3431
+ # "borrowEnabled": True,
3432
+ # "transferInEnabled": True,
3433
+ # "total": "0",
3434
+ # "hold": "0",
3435
+ # "available": "0",
3411
3436
  # "liability": "0",
3412
3437
  # "interest": "0",
3413
- # "borrowableAmount": "0"
3438
+ # "maxBorrowSize": "0"
3414
3439
  # }
3415
3440
  # },
3416
3441
  # ...
@@ -80,6 +80,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
80
80
  'fetchL3OrderBook': True,
81
81
  'fetchLedger': True,
82
82
  'fetchLeverageTiers': False,
83
+ 'fetchMarginAdjustmentHistory': False,
83
84
  'fetchMarginMode': False,
84
85
  'fetchMarketLeverageTiers': True,
85
86
  'fetchMarkets': True,
@@ -1497,7 +1498,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1497
1498
  'direction': 'in',
1498
1499
  })
1499
1500
 
1500
- def parse_margin_modification(self, info, market: Market = None):
1501
+ def parse_margin_modification(self, info, market: Market = None) -> MarginModification:
1501
1502
  #
1502
1503
  # {
1503
1504
  # "id": "62311d26064e8f00013f2c6d",
@@ -1549,14 +1550,18 @@ class kucoinfutures(kucoin, ImplicitAPI):
1549
1550
  crossMode = self.safe_value(info, 'crossMode')
1550
1551
  mode = 'cross' if crossMode else 'isolated'
1551
1552
  marketId = self.safe_string(market, 'symbol')
1553
+ timestamp = self.safe_integer(info, 'currentTimestamp')
1552
1554
  return {
1553
1555
  'info': info,
1554
- 'direction': None,
1555
- 'mode': mode,
1556
+ 'symbol': self.safe_symbol(marketId, market),
1557
+ 'type': None,
1558
+ 'marginMode': mode,
1556
1559
  'amount': None,
1560
+ 'total': None,
1557
1561
  'code': self.safe_currency_code(currencyId),
1558
- 'symbol': self.safe_symbol(marketId, market),
1559
1562
  'status': None,
1563
+ 'timestamp': timestamp,
1564
+ 'datetime': self.iso8601(timestamp),
1560
1565
  }
1561
1566
 
1562
1567
  async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1682,6 +1687,29 @@ class kucoinfutures(kucoin, ImplicitAPI):
1682
1687
  return await self.fetch_paginated_call_dynamic('fetchClosedOrders', symbol, since, limit, params)
1683
1688
  return await self.fetch_orders_by_status('done', symbol, since, limit, params)
1684
1689
 
1690
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1691
+ """
1692
+ fetches information on multiple open orders made by the user
1693
+ :see: https://docs.kucoin.com/futures/#get-order-list
1694
+ :see: https://docs.kucoin.com/futures/#get-untriggered-stop-order-list
1695
+ :param str symbol: unified market symbol of the market orders were made in
1696
+ :param int [since]: the earliest time in ms to fetch orders for
1697
+ :param int [limit]: the maximum number of order structures to retrieve
1698
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1699
+ :param int [params.till]: end time in ms
1700
+ :param str [params.side]: buy or sell
1701
+ :param str [params.type]: limit, or market
1702
+ :param boolean [params.trigger]: set to True to retrieve untriggered stop orders
1703
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1704
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1705
+ """
1706
+ await self.load_markets()
1707
+ paginate = False
1708
+ paginate, params = self.handle_option_and_params(params, 'fetchOpenOrders', 'paginate')
1709
+ if paginate:
1710
+ return await self.fetch_paginated_call_dynamic('fetchOpenOrders', symbol, since, limit, params)
1711
+ return await self.fetch_orders_by_status('open', symbol, since, limit, params)
1712
+
1685
1713
  async def fetch_order(self, id: Str = None, symbol: Str = None, params={}):
1686
1714
  """
1687
1715
  fetches information on an order made by the user
@@ -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
@@ -89,6 +89,7 @@ class mexc(Exchange, ImplicitAPI):
89
89
  'fetchLeverage': True,
90
90
  'fetchLeverages': False,
91
91
  'fetchLeverageTiers': True,
92
+ 'fetchMarginAdjustmentHistory': False,
92
93
  'fetchMarginMode': False,
93
94
  'fetchMarketLeverageTiers': None,
94
95
  'fetchMarkets': True,
@@ -998,7 +999,7 @@ class mexc(Exchange, ImplicitAPI):
998
999
  return self.safe_integer(response, 'data')
999
1000
  return None
1000
1001
 
1001
- async def fetch_currencies(self, params={}):
1002
+ async def fetch_currencies(self, params={}) -> Currencies:
1002
1003
  """
1003
1004
  fetches all available currencies on an exchange
1004
1005
  :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information
@@ -3343,7 +3344,7 @@ class mexc(Exchange, ImplicitAPI):
3343
3344
  })
3344
3345
  return result
3345
3346
 
3346
- async def fetch_trading_fees(self, params={}):
3347
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
3347
3348
  """
3348
3349
  fetch the trading fees for multiple markets
3349
3350
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4031,8 +4032,9 @@ class mexc(Exchange, ImplicitAPI):
4031
4032
 
4032
4033
  async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
4033
4034
  """
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
4035
+ 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
4036
+ :see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
4037
+ :param str[] [symbols]: list of unified market symbols
4036
4038
  :param dict [params]: extra parameters specific to the exchange API endpoint
4037
4039
  :returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
4038
4040
  """
@@ -4088,10 +4090,44 @@ class mexc(Exchange, ImplicitAPI):
4088
4090
  return self.parse_leverage_tiers(data, symbols, 'symbol')
4089
4091
 
4090
4092
  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
- """
4093
+ #
4094
+ # {
4095
+ # "symbol": "BTC_USDT",
4096
+ # "displayName": "BTC_USDT永续",
4097
+ # "displayNameEn": "BTC_USDT SWAP",
4098
+ # "positionOpenType": 3,
4099
+ # "baseCoin": "BTC",
4100
+ # "quoteCoin": "USDT",
4101
+ # "settleCoin": "USDT",
4102
+ # "contractSize": 0.0001,
4103
+ # "minLeverage": 1,
4104
+ # "maxLeverage": 125,
4105
+ # "priceScale": 2,
4106
+ # "volScale": 0,
4107
+ # "amountScale": 4,
4108
+ # "priceUnit": 0.5,
4109
+ # "volUnit": 1,
4110
+ # "minVol": 1,
4111
+ # "maxVol": 1000000,
4112
+ # "bidLimitPriceRate": 0.1,
4113
+ # "askLimitPriceRate": 0.1,
4114
+ # "takerFeeRate": 0.0006,
4115
+ # "makerFeeRate": 0.0002,
4116
+ # "maintenanceMarginRate": 0.004,
4117
+ # "initialMarginRate": 0.008,
4118
+ # "riskBaseVol": 10000,
4119
+ # "riskIncrVol": 200000,
4120
+ # "riskIncrMmr": 0.004,
4121
+ # "riskIncrImr": 0.004,
4122
+ # "riskLevelLimit": 5,
4123
+ # "priceCoefficientVariation": 0.1,
4124
+ # "indexOrigin": ["BINANCE","GATEIO","HUOBI","MXC"],
4125
+ # "state": 0, # 0 enabled, 1 delivery, 2 completed, 3 offline, 4 pause
4126
+ # "isNew": False,
4127
+ # "isHot": True,
4128
+ # "isHidden": False
4129
+ # }
4130
+ #
4095
4131
  maintenanceMarginRate = self.safe_string(info, 'maintenanceMarginRate')
4096
4132
  initialMarginRate = self.safe_string(info, 'initialMarginRate')
4097
4133
  maxVol = self.safe_string(info, 'maxVol')
@@ -4101,6 +4137,18 @@ class mexc(Exchange, ImplicitAPI):
4101
4137
  floor = '0'
4102
4138
  tiers = []
4103
4139
  quoteId = self.safe_string(info, 'quoteCoin')
4140
+ if riskIncrVol == '0':
4141
+ return [
4142
+ {
4143
+ 'tier': 0,
4144
+ 'currency': self.safe_currency_code(quoteId),
4145
+ 'notionalFloor': None,
4146
+ 'notionalCap': None,
4147
+ 'maintenanceMarginRate': None,
4148
+ 'maxLeverage': self.safe_number(info, 'maxLeverage'),
4149
+ 'info': info,
4150
+ },
4151
+ ]
4104
4152
  while(Precise.string_lt(floor, maxVol)):
4105
4153
  cap = Precise.string_add(floor, riskIncrVol)
4106
4154
  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