ccxt 4.3.30__py2.py3-none-any.whl → 4.3.32__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +2 -0
  3. ccxt/abstract/binancecoinm.py +2 -0
  4. ccxt/abstract/binanceus.py +2 -0
  5. ccxt/abstract/binanceusdm.py +2 -0
  6. ccxt/ace.py +14 -14
  7. ccxt/alpaca.py +16 -16
  8. ccxt/ascendex.py +46 -46
  9. ccxt/async_support/__init__.py +1 -1
  10. ccxt/async_support/ace.py +14 -14
  11. ccxt/async_support/alpaca.py +16 -16
  12. ccxt/async_support/ascendex.py +46 -46
  13. ccxt/async_support/base/exchange.py +23 -23
  14. ccxt/async_support/bigone.py +32 -32
  15. ccxt/async_support/binance.py +105 -96
  16. ccxt/async_support/bingx.py +21 -21
  17. ccxt/async_support/bit2c.py +13 -13
  18. ccxt/async_support/bitbank.py +19 -19
  19. ccxt/async_support/bitbns.py +17 -17
  20. ccxt/async_support/bitfinex.py +24 -24
  21. ccxt/async_support/bitfinex2.py +142 -109
  22. ccxt/async_support/bitflyer.py +23 -23
  23. ccxt/async_support/bitget.py +76 -76
  24. ccxt/async_support/bithumb.py +20 -20
  25. ccxt/async_support/bitmart.py +55 -55
  26. ccxt/async_support/bitmex.py +41 -41
  27. ccxt/async_support/bitopro.py +30 -30
  28. ccxt/async_support/bitrue.py +37 -37
  29. ccxt/async_support/bitso.py +30 -30
  30. ccxt/async_support/bitstamp.py +31 -31
  31. ccxt/async_support/bitteam.py +26 -26
  32. ccxt/async_support/bitvavo.py +27 -27
  33. ccxt/async_support/bl3p.py +8 -8
  34. ccxt/async_support/blockchaincom.py +24 -24
  35. ccxt/async_support/blofin.py +37 -37
  36. ccxt/async_support/btcalpha.py +19 -19
  37. ccxt/async_support/btcbox.py +11 -11
  38. ccxt/async_support/btcmarkets.py +22 -22
  39. ccxt/async_support/btcturk.py +13 -13
  40. ccxt/async_support/bybit.py +96 -96
  41. ccxt/async_support/cex.py +21 -21
  42. ccxt/async_support/coinbase.py +53 -53
  43. ccxt/async_support/coinbaseexchange.py +29 -29
  44. ccxt/async_support/coinbaseinternational.py +32 -32
  45. ccxt/async_support/coincheck.py +14 -14
  46. ccxt/async_support/coinex.py +208 -175
  47. ccxt/async_support/coinlist.py +35 -35
  48. ccxt/async_support/coinmate.py +22 -22
  49. ccxt/async_support/coinmetro.py +22 -22
  50. ccxt/async_support/coinone.py +18 -18
  51. ccxt/async_support/coinsph.py +32 -32
  52. ccxt/async_support/coinspot.py +8 -8
  53. ccxt/async_support/cryptocom.py +43 -43
  54. ccxt/async_support/currencycom.py +33 -33
  55. ccxt/async_support/delta.py +35 -35
  56. ccxt/async_support/deribit.py +54 -54
  57. ccxt/async_support/digifinex.py +56 -56
  58. ccxt/async_support/exmo.py +34 -34
  59. ccxt/async_support/gate.py +60 -60
  60. ccxt/async_support/gemini.py +24 -24
  61. ccxt/async_support/hitbtc.py +51 -51
  62. ccxt/async_support/hollaex.py +29 -29
  63. ccxt/async_support/htx.py +73 -73
  64. ccxt/async_support/huobijp.py +30 -30
  65. ccxt/async_support/hyperliquid.py +58 -58
  66. ccxt/async_support/idex.py +33 -33
  67. ccxt/async_support/independentreserve.py +12 -12
  68. ccxt/async_support/indodax.py +21 -21
  69. ccxt/async_support/kraken.py +46 -51
  70. ccxt/async_support/krakenfutures.py +29 -29
  71. ccxt/async_support/kucoin.py +51 -51
  72. ccxt/async_support/kucoinfutures.py +33 -33
  73. ccxt/async_support/kuna.py +27 -27
  74. ccxt/async_support/latoken.py +27 -27
  75. ccxt/async_support/lbank.py +35 -35
  76. ccxt/async_support/luno.py +19 -19
  77. ccxt/async_support/lykke.py +20 -20
  78. ccxt/async_support/mercado.py +17 -17
  79. ccxt/async_support/mexc.py +64 -64
  80. ccxt/async_support/ndax.py +38 -38
  81. ccxt/async_support/novadax.py +26 -26
  82. ccxt/async_support/oceanex.py +21 -21
  83. ccxt/async_support/okcoin.py +35 -35
  84. ccxt/async_support/okx.py +85 -85
  85. ccxt/async_support/onetrading.py +32 -32
  86. ccxt/async_support/p2b.py +14 -14
  87. ccxt/async_support/paymium.py +12 -12
  88. ccxt/async_support/phemex.py +50 -50
  89. ccxt/async_support/poloniex.py +35 -35
  90. ccxt/async_support/poloniexfutures.py +25 -21
  91. ccxt/async_support/probit.py +30 -30
  92. ccxt/async_support/timex.py +22 -22
  93. ccxt/async_support/tokocrypto.py +26 -26
  94. ccxt/async_support/tradeogre.py +12 -12
  95. ccxt/async_support/upbit.py +28 -28
  96. ccxt/async_support/wavesexchange.py +33 -33
  97. ccxt/async_support/wazirx.py +21 -21
  98. ccxt/async_support/whitebit.py +37 -37
  99. ccxt/async_support/woo.py +51 -51
  100. ccxt/async_support/woofipro.py +46 -46
  101. ccxt/async_support/yobit.py +20 -20
  102. ccxt/async_support/zaif.py +12 -12
  103. ccxt/async_support/zonda.py +22 -22
  104. ccxt/base/exchange.py +48 -36
  105. ccxt/base/types.py +13 -0
  106. ccxt/bigone.py +32 -32
  107. ccxt/binance.py +105 -96
  108. ccxt/bingx.py +21 -21
  109. ccxt/bit2c.py +13 -13
  110. ccxt/bitbank.py +19 -19
  111. ccxt/bitbns.py +17 -17
  112. ccxt/bitfinex.py +24 -24
  113. ccxt/bitfinex2.py +142 -109
  114. ccxt/bitflyer.py +23 -23
  115. ccxt/bitget.py +76 -76
  116. ccxt/bithumb.py +20 -20
  117. ccxt/bitmart.py +55 -55
  118. ccxt/bitmex.py +41 -41
  119. ccxt/bitopro.py +30 -30
  120. ccxt/bitrue.py +37 -37
  121. ccxt/bitso.py +30 -30
  122. ccxt/bitstamp.py +31 -31
  123. ccxt/bitteam.py +26 -26
  124. ccxt/bitvavo.py +27 -27
  125. ccxt/bl3p.py +8 -8
  126. ccxt/blockchaincom.py +24 -24
  127. ccxt/blofin.py +37 -37
  128. ccxt/btcalpha.py +19 -19
  129. ccxt/btcbox.py +11 -11
  130. ccxt/btcmarkets.py +22 -22
  131. ccxt/btcturk.py +13 -13
  132. ccxt/bybit.py +96 -96
  133. ccxt/cex.py +21 -21
  134. ccxt/coinbase.py +53 -53
  135. ccxt/coinbaseexchange.py +29 -29
  136. ccxt/coinbaseinternational.py +32 -32
  137. ccxt/coincheck.py +14 -14
  138. ccxt/coinex.py +208 -175
  139. ccxt/coinlist.py +35 -35
  140. ccxt/coinmate.py +22 -22
  141. ccxt/coinmetro.py +22 -22
  142. ccxt/coinone.py +18 -18
  143. ccxt/coinsph.py +32 -32
  144. ccxt/coinspot.py +8 -8
  145. ccxt/cryptocom.py +43 -43
  146. ccxt/currencycom.py +33 -33
  147. ccxt/delta.py +35 -35
  148. ccxt/deribit.py +54 -54
  149. ccxt/digifinex.py +56 -56
  150. ccxt/exmo.py +34 -34
  151. ccxt/gate.py +60 -60
  152. ccxt/gemini.py +24 -24
  153. ccxt/hitbtc.py +51 -51
  154. ccxt/hollaex.py +29 -29
  155. ccxt/htx.py +73 -73
  156. ccxt/huobijp.py +30 -30
  157. ccxt/hyperliquid.py +58 -58
  158. ccxt/idex.py +33 -33
  159. ccxt/independentreserve.py +12 -12
  160. ccxt/indodax.py +21 -21
  161. ccxt/kraken.py +46 -51
  162. ccxt/krakenfutures.py +29 -29
  163. ccxt/kucoin.py +51 -51
  164. ccxt/kucoinfutures.py +33 -33
  165. ccxt/kuna.py +27 -27
  166. ccxt/latoken.py +27 -27
  167. ccxt/lbank.py +35 -35
  168. ccxt/luno.py +19 -19
  169. ccxt/lykke.py +20 -20
  170. ccxt/mercado.py +17 -17
  171. ccxt/mexc.py +64 -64
  172. ccxt/ndax.py +38 -38
  173. ccxt/novadax.py +26 -26
  174. ccxt/oceanex.py +21 -21
  175. ccxt/okcoin.py +35 -35
  176. ccxt/okx.py +85 -85
  177. ccxt/onetrading.py +32 -32
  178. ccxt/p2b.py +14 -14
  179. ccxt/paymium.py +12 -12
  180. ccxt/phemex.py +50 -50
  181. ccxt/poloniex.py +35 -35
  182. ccxt/poloniexfutures.py +25 -21
  183. ccxt/pro/__init__.py +1 -1
  184. ccxt/pro/alpaca.py +8 -8
  185. ccxt/pro/ascendex.py +4 -4
  186. ccxt/pro/binance.py +56 -56
  187. ccxt/pro/bingx.py +5 -5
  188. ccxt/pro/bitfinex.py +6 -6
  189. ccxt/pro/bitfinex2.py +10 -10
  190. ccxt/pro/bitget.py +17 -17
  191. ccxt/pro/bithumb.py +6 -6
  192. ccxt/pro/bitmart.py +8 -8
  193. ccxt/pro/bitmex.py +16 -16
  194. ccxt/pro/bitopro.py +4 -4
  195. ccxt/pro/bitrue.py +8 -8
  196. ccxt/pro/bitstamp.py +5 -5
  197. ccxt/pro/bitvavo.py +14 -14
  198. ccxt/pro/blockchaincom.py +7 -7
  199. ccxt/pro/bybit.py +12 -12
  200. ccxt/pro/cex.py +20 -20
  201. ccxt/pro/coinbase.py +32 -2
  202. ccxt/pro/coinbaseexchange.py +10 -10
  203. ccxt/pro/coinbaseinternational.py +4 -4
  204. ccxt/pro/coincheck.py +2 -2
  205. ccxt/pro/coinex.py +15 -15
  206. ccxt/pro/coinone.py +4 -4
  207. ccxt/pro/cryptocom.py +11 -11
  208. ccxt/pro/currencycom.py +4 -4
  209. ccxt/pro/deribit.py +9 -9
  210. ccxt/pro/exmo.py +9 -9
  211. ccxt/pro/gate.py +12 -12
  212. ccxt/pro/gemini.py +11 -11
  213. ccxt/pro/hitbtc.py +13 -13
  214. ccxt/pro/hollaex.py +6 -6
  215. ccxt/pro/htx.py +15 -15
  216. ccxt/pro/huobijp.py +16 -16
  217. ccxt/pro/hyperliquid.py +9 -9
  218. ccxt/pro/idex.py +12 -12
  219. ccxt/pro/independentreserve.py +2 -2
  220. ccxt/pro/kraken.py +14 -14
  221. ccxt/pro/krakenfutures.py +12 -12
  222. ccxt/pro/kucoin.py +12 -12
  223. ccxt/pro/kucoinfutures.py +16 -16
  224. ccxt/pro/lbank.py +12 -12
  225. ccxt/pro/luno.py +4 -4
  226. ccxt/pro/mexc.py +14 -14
  227. ccxt/pro/ndax.py +12 -12
  228. ccxt/pro/okcoin.py +6 -6
  229. ccxt/pro/okx.py +30 -30
  230. ccxt/pro/onetrading.py +13 -13
  231. ccxt/pro/p2b.py +2 -2
  232. ccxt/pro/phemex.py +9 -9
  233. ccxt/pro/poloniex.py +9 -9
  234. ccxt/pro/poloniexfutures.py +10 -10
  235. ccxt/pro/probit.py +8 -8
  236. ccxt/pro/upbit.py +1 -1
  237. ccxt/pro/wazirx.py +10 -10
  238. ccxt/pro/whitebit.py +8 -8
  239. ccxt/pro/woo.py +14 -14
  240. ccxt/pro/woofipro.py +14 -14
  241. ccxt/probit.py +30 -30
  242. ccxt/test/base/test_shared_methods.py +1 -0
  243. ccxt/test/test_async.py +1 -1
  244. ccxt/test/test_sync.py +1 -1
  245. ccxt/timex.py +22 -22
  246. ccxt/tokocrypto.py +26 -26
  247. ccxt/tradeogre.py +12 -12
  248. ccxt/upbit.py +28 -28
  249. ccxt/wavesexchange.py +33 -33
  250. ccxt/wazirx.py +21 -21
  251. ccxt/whitebit.py +37 -37
  252. ccxt/woo.py +51 -51
  253. ccxt/woofipro.py +46 -46
  254. ccxt/yobit.py +20 -20
  255. ccxt/zaif.py +12 -12
  256. ccxt/zonda.py +22 -22
  257. {ccxt-4.3.30.dist-info → ccxt-4.3.32.dist-info}/METADATA +4 -4
  258. {ccxt-4.3.30.dist-info → ccxt-4.3.32.dist-info}/RECORD +260 -260
  259. {ccxt-4.3.30.dist-info → ccxt-4.3.32.dist-info}/WHEEL +0 -0
  260. {ccxt-4.3.30.dist-info → ccxt-4.3.32.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.coinex import ImplicitAPI
8
8
  import asyncio
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -82,8 +82,8 @@ class coinex(Exchange, ImplicitAPI):
82
82
  'fetchDepositAddressByNetwork': False,
83
83
  'fetchDepositAddresses': False,
84
84
  'fetchDeposits': True,
85
- 'fetchDepositWithdrawFee': 'emulated',
86
- 'fetchDepositWithdrawFees': True,
85
+ 'fetchDepositWithdrawFee': True,
86
+ 'fetchDepositWithdrawFees': False,
87
87
  'fetchFundingHistory': True,
88
88
  'fetchFundingRate': True,
89
89
  'fetchFundingRateHistory': True,
@@ -91,8 +91,8 @@ class coinex(Exchange, ImplicitAPI):
91
91
  'fetchIndexOHLCV': False,
92
92
  'fetchIsolatedBorrowRate': True,
93
93
  'fetchIsolatedBorrowRates': False,
94
- 'fetchLeverage': 'emulated',
95
- 'fetchLeverages': True,
94
+ 'fetchLeverage': True,
95
+ 'fetchLeverages': False,
96
96
  'fetchLeverageTiers': True,
97
97
  'fetchMarginAdjustmentHistory': True,
98
98
  'fetchMarketLeverageTiers': 'emulated',
@@ -567,7 +567,7 @@ class coinex(Exchange, ImplicitAPI):
567
567
  #
568
568
  data = self.safe_value(response, 'data', [])
569
569
  coins = list(data.keys())
570
- result = {}
570
+ result: dict = {}
571
571
  for i in range(0, len(coins)):
572
572
  coin = coins[i]
573
573
  currency = data[coin]
@@ -628,7 +628,7 @@ class coinex(Exchange, ImplicitAPI):
628
628
  if precisionString is not None:
629
629
  minPrecisionString = precisionString if (minPrecisionString is None) else Precise.string_min(precisionString, minPrecisionString)
630
630
  networks = self.safe_value(result[code], 'networks', {})
631
- network = {
631
+ network: dict = {
632
632
  'info': currency,
633
633
  'id': networkId,
634
634
  'network': networkId,
@@ -936,7 +936,7 @@ class coinex(Exchange, ImplicitAPI):
936
936
  """
937
937
  await self.load_markets()
938
938
  market = self.market(symbol)
939
- request = {
939
+ request: dict = {
940
940
  'market': market['id'],
941
941
  }
942
942
  response = None
@@ -1100,7 +1100,7 @@ class coinex(Exchange, ImplicitAPI):
1100
1100
  market = self.market(symbol)
1101
1101
  if limit is None:
1102
1102
  limit = 20 # default
1103
- request = {
1103
+ request: dict = {
1104
1104
  'market': market['id'],
1105
1105
  'limit': limit,
1106
1106
  'interval': '0',
@@ -1165,7 +1165,7 @@ class coinex(Exchange, ImplicitAPI):
1165
1165
  timestamp = self.safe_integer(depth, 'updated_at')
1166
1166
  return self.parse_order_book(depth, symbol, timestamp)
1167
1167
 
1168
- def parse_trade(self, trade, market: Market = None) -> Trade:
1168
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1169
1169
  #
1170
1170
  # Spot and Swap fetchTrades(public)
1171
1171
  #
@@ -1237,7 +1237,7 @@ class coinex(Exchange, ImplicitAPI):
1237
1237
  """
1238
1238
  await self.load_markets()
1239
1239
  market = self.market(symbol)
1240
- request = {
1240
+ request: dict = {
1241
1241
  'market': market['id'],
1242
1242
  # 'last_id': 0,
1243
1243
  }
@@ -1278,7 +1278,7 @@ class coinex(Exchange, ImplicitAPI):
1278
1278
  """
1279
1279
  await self.load_markets()
1280
1280
  market = self.market(symbol)
1281
- request = {
1281
+ request: dict = {
1282
1282
  'market': market['id'],
1283
1283
  }
1284
1284
  response = None
@@ -1389,7 +1389,7 @@ class coinex(Exchange, ImplicitAPI):
1389
1389
  # }
1390
1390
  #
1391
1391
  data = self.safe_list(response, 'data', [])
1392
- result = {}
1392
+ result: dict = {}
1393
1393
  for i in range(0, len(data)):
1394
1394
  entry = data[i]
1395
1395
  marketId = self.safe_string(entry, 'market')
@@ -1398,7 +1398,7 @@ class coinex(Exchange, ImplicitAPI):
1398
1398
  result[symbol] = self.parse_trading_fee(entry, market)
1399
1399
  return result
1400
1400
 
1401
- def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1401
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1402
1402
  marketId = self.safe_value(fee, 'market')
1403
1403
  symbol = self.safe_symbol(marketId, market)
1404
1404
  return {
@@ -1446,7 +1446,7 @@ class coinex(Exchange, ImplicitAPI):
1446
1446
  """
1447
1447
  await self.load_markets()
1448
1448
  market = self.market(symbol)
1449
- request = {
1449
+ request: dict = {
1450
1450
  'market': market['id'],
1451
1451
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
1452
1452
  }
@@ -1514,7 +1514,7 @@ class coinex(Exchange, ImplicitAPI):
1514
1514
  # "message": "OK"
1515
1515
  # }
1516
1516
  #
1517
- result = {'info': response}
1517
+ result: dict = {'info': response}
1518
1518
  balances = self.safe_list(response, 'data', [])
1519
1519
  for i in range(0, len(balances)):
1520
1520
  entry = balances[i]
@@ -1549,7 +1549,7 @@ class coinex(Exchange, ImplicitAPI):
1549
1549
  # "message": "OK"
1550
1550
  # }
1551
1551
  #
1552
- result = {'info': response}
1552
+ result: dict = {'info': response}
1553
1553
  balances = self.safe_list(response, 'data', [])
1554
1554
  for i in range(0, len(balances)):
1555
1555
  entry = balances[i]
@@ -1580,7 +1580,7 @@ class coinex(Exchange, ImplicitAPI):
1580
1580
  # "message": "OK"
1581
1581
  # }
1582
1582
  #
1583
- result = {'info': response}
1583
+ result: dict = {'info': response}
1584
1584
  balances = self.safe_list(response, 'data', [])
1585
1585
  for i in range(0, len(balances)):
1586
1586
  entry = balances[i]
@@ -1608,7 +1608,7 @@ class coinex(Exchange, ImplicitAPI):
1608
1608
  # "message": "OK"
1609
1609
  # }
1610
1610
  #
1611
- result = {'info': response}
1611
+ result: dict = {'info': response}
1612
1612
  balances = self.safe_list(response, 'data', [])
1613
1613
  for i in range(0, len(balances)):
1614
1614
  entry = balances[i]
@@ -1646,8 +1646,8 @@ class coinex(Exchange, ImplicitAPI):
1646
1646
  else:
1647
1647
  return await self.fetch_spot_balance(params)
1648
1648
 
1649
- def parse_order_status(self, status):
1650
- statuses = {
1649
+ def parse_order_status(self, status: Str):
1650
+ statuses: dict = {
1651
1651
  'rejected': 'rejected',
1652
1652
  'open': 'open',
1653
1653
  'not_deal': 'open',
@@ -1657,7 +1657,7 @@ class coinex(Exchange, ImplicitAPI):
1657
1657
  }
1658
1658
  return self.safe_string(statuses, status, status)
1659
1659
 
1660
- def parse_order(self, order, market: Market = None) -> Order:
1660
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1661
1661
  #
1662
1662
  # Spot and Margin createOrder, createOrders, editOrder, cancelOrders, cancelOrder, fetchOpenOrders
1663
1663
  #
@@ -1952,7 +1952,7 @@ class coinex(Exchange, ImplicitAPI):
1952
1952
  if reduceOnly:
1953
1953
  if not market['swap']:
1954
1954
  raise InvalidOrder(self.id + ' createOrder() does not support reduceOnly for ' + market['type'] + ' orders, reduceOnly orders are supported for swap markets only')
1955
- request = {
1955
+ request: dict = {
1956
1956
  'market': market['id'],
1957
1957
  }
1958
1958
  if clientOrderId is None:
@@ -2298,7 +2298,7 @@ class coinex(Exchange, ImplicitAPI):
2298
2298
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
2299
2299
  ordersRequests.append(orderRequest)
2300
2300
  market = self.market(symbol)
2301
- request = {
2301
+ request: dict = {
2302
2302
  'market': market['id'],
2303
2303
  'orders': ordersRequests,
2304
2304
  }
@@ -2457,7 +2457,7 @@ class coinex(Exchange, ImplicitAPI):
2457
2457
  raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
2458
2458
  await self.load_markets()
2459
2459
  market = self.market(symbol)
2460
- request = {
2460
+ request: dict = {
2461
2461
  'market': market['id'],
2462
2462
  }
2463
2463
  stop = self.safe_bool_2(params, 'stop', 'trigger')
@@ -2632,7 +2632,7 @@ class coinex(Exchange, ImplicitAPI):
2632
2632
  raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
2633
2633
  await self.load_markets()
2634
2634
  market = self.market(symbol)
2635
- request = {
2635
+ request: dict = {
2636
2636
  'market': market['id'],
2637
2637
  }
2638
2638
  if amount is not None:
@@ -2768,7 +2768,7 @@ class coinex(Exchange, ImplicitAPI):
2768
2768
  market = self.market(symbol)
2769
2769
  isTriggerOrder = self.safe_bool_2(params, 'stop', 'trigger')
2770
2770
  swap = market['swap']
2771
- request = {
2771
+ request: dict = {
2772
2772
  'market': market['id'],
2773
2773
  }
2774
2774
  marginMode = None
@@ -3039,7 +3039,7 @@ class coinex(Exchange, ImplicitAPI):
3039
3039
  raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
3040
3040
  await self.load_markets()
3041
3041
  market = self.market(symbol)
3042
- request = {
3042
+ request: dict = {
3043
3043
  'market': market['id'],
3044
3044
  }
3045
3045
  response = None
@@ -3075,7 +3075,7 @@ class coinex(Exchange, ImplicitAPI):
3075
3075
  raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
3076
3076
  await self.load_markets()
3077
3077
  market = self.market(symbol)
3078
- request = {
3078
+ request: dict = {
3079
3079
  'market': market['id'],
3080
3080
  'order_id': self.parse_to_numeric(id),
3081
3081
  }
@@ -3161,7 +3161,7 @@ class coinex(Exchange, ImplicitAPI):
3161
3161
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
3162
3162
  """
3163
3163
  await self.load_markets()
3164
- request = {}
3164
+ request: dict = {}
3165
3165
  market = None
3166
3166
  if symbol is not None:
3167
3167
  market = self.market(symbol)
@@ -3497,7 +3497,7 @@ class coinex(Exchange, ImplicitAPI):
3497
3497
  if network is None:
3498
3498
  raise ArgumentsRequired(self.id + ' createDepositAddress() requires a network parameter')
3499
3499
  params = self.omit(params, 'network')
3500
- request = {
3500
+ request: dict = {
3501
3501
  'ccy': currency['id'],
3502
3502
  'chain': self.network_code_to_id(network, currency['code']),
3503
3503
  }
@@ -3536,7 +3536,7 @@ class coinex(Exchange, ImplicitAPI):
3536
3536
  raise ArgumentsRequired(self.id + ' fetchDepositAddress() ' + code + ' requires a network parameter')
3537
3537
  if not (network in networks):
3538
3538
  raise ExchangeError(self.id + ' fetchDepositAddress() ' + network + ' network not supported for ' + code)
3539
- request = {
3539
+ request: dict = {
3540
3540
  'ccy': currency['id'],
3541
3541
  'chain': network,
3542
3542
  }
@@ -3616,7 +3616,7 @@ class coinex(Exchange, ImplicitAPI):
3616
3616
  raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
3617
3617
  await self.load_markets()
3618
3618
  market = self.market(symbol)
3619
- request = {
3619
+ request: dict = {
3620
3620
  'market': market['id'],
3621
3621
  }
3622
3622
  if limit is not None:
@@ -3694,7 +3694,7 @@ class coinex(Exchange, ImplicitAPI):
3694
3694
  defaultMethod = None
3695
3695
  defaultMethod, params = self.handle_option_and_params(params, 'fetchPositions', 'method', 'v2PrivateGetFuturesPendingPosition')
3696
3696
  symbols = self.market_symbols(symbols)
3697
- request = {
3697
+ request: dict = {
3698
3698
  'market_type': 'FUTURES',
3699
3699
  }
3700
3700
  market = None
@@ -3773,7 +3773,7 @@ class coinex(Exchange, ImplicitAPI):
3773
3773
  """
3774
3774
  await self.load_markets()
3775
3775
  market = self.market(symbol)
3776
- request = {
3776
+ request: dict = {
3777
3777
  'market_type': 'FUTURES',
3778
3778
  'market': market['id'],
3779
3779
  }
@@ -3824,7 +3824,7 @@ class coinex(Exchange, ImplicitAPI):
3824
3824
  data = self.safe_list(response, 'data', [])
3825
3825
  return self.parse_position(data[0], market)
3826
3826
 
3827
- def parse_position(self, position, market: Market = None):
3827
+ def parse_position(self, position: dict, market: Market = None):
3828
3828
  #
3829
3829
  # {
3830
3830
  # "position_id": 305891033,
@@ -3918,7 +3918,7 @@ class coinex(Exchange, ImplicitAPI):
3918
3918
  raise ArgumentsRequired(self.id + ' setMarginMode() requires a leverage parameter')
3919
3919
  if (leverage < 1) or (leverage > maxLeverage):
3920
3920
  raise BadRequest(self.id + ' setMarginMode() leverage should be between 1 and ' + str(maxLeverage) + ' for ' + symbol)
3921
- request = {
3921
+ request: dict = {
3922
3922
  'market': market['id'],
3923
3923
  'market_type': 'FUTURES',
3924
3924
  'margin_mode': marginMode,
@@ -3958,7 +3958,7 @@ class coinex(Exchange, ImplicitAPI):
3958
3958
  maxLeverage = self.safe_integer(market['limits']['leverage'], 'max', 100)
3959
3959
  if (leverage < minLeverage) or (leverage > maxLeverage):
3960
3960
  raise BadRequest(self.id + ' setLeverage() leverage should be between ' + str(minLeverage) + ' and ' + str(maxLeverage) + ' for ' + symbol)
3961
- request = {
3961
+ request: dict = {
3962
3962
  'market': market['id'],
3963
3963
  'market_type': 'FUTURES',
3964
3964
  'margin_mode': marginMode,
@@ -3976,7 +3976,7 @@ class coinex(Exchange, ImplicitAPI):
3976
3976
  # }
3977
3977
  #
3978
3978
 
3979
- async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
3979
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
3980
3980
  """
3981
3981
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
3982
3982
  :see: https://docs.coinex.com/api/v2/futures/market/http/list-market-position-level
@@ -3985,7 +3985,7 @@ class coinex(Exchange, ImplicitAPI):
3985
3985
  :returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
3986
3986
  """
3987
3987
  await self.load_markets()
3988
- request = {}
3988
+ request: dict = {}
3989
3989
  if symbols is not None:
3990
3990
  marketIds = self.market_ids(symbols)
3991
3991
  request['market'] = ','.join(marketIds)
@@ -4018,7 +4018,7 @@ class coinex(Exchange, ImplicitAPI):
4018
4018
  data = self.safe_list(response, 'data', [])
4019
4019
  return self.parse_leverage_tiers(data, symbols, 'market')
4020
4020
 
4021
- def parse_market_leverage_tiers(self, info, market: Market = None):
4021
+ def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
4022
4022
  tiers = []
4023
4023
  brackets = self.safe_list(info, 'level', [])
4024
4024
  minNotional = 0
@@ -4046,7 +4046,7 @@ class coinex(Exchange, ImplicitAPI):
4046
4046
  requestAmount = rawAmount
4047
4047
  if addOrReduce == 'reduce':
4048
4048
  requestAmount = Precise.string_neg(rawAmount)
4049
- request = {
4049
+ request: dict = {
4050
4050
  'market': market['id'],
4051
4051
  'market_type': 'FUTURES',
4052
4052
  'amount': requestAmount,
@@ -4205,7 +4205,7 @@ class coinex(Exchange, ImplicitAPI):
4205
4205
  raise ArgumentsRequired(self.id + ' fetchFundingHistory() requires a symbol argument')
4206
4206
  await self.load_markets()
4207
4207
  market = self.market(symbol)
4208
- request = {
4208
+ request: dict = {
4209
4209
  'market': market['id'],
4210
4210
  'market_type': 'FUTURES',
4211
4211
  }
@@ -4266,7 +4266,7 @@ class coinex(Exchange, ImplicitAPI):
4266
4266
  market = self.market(symbol)
4267
4267
  if not market['swap']:
4268
4268
  raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
4269
- request = {
4269
+ request: dict = {
4270
4270
  'market': market['id'],
4271
4271
  }
4272
4272
  response = await self.v2PublicGetFuturesFundingRate(self.extend(request, params))
@@ -4340,7 +4340,7 @@ class coinex(Exchange, ImplicitAPI):
4340
4340
  """
4341
4341
  await self.load_markets()
4342
4342
  symbols = self.market_symbols(symbols)
4343
- request = {}
4343
+ request: dict = {}
4344
4344
  market = None
4345
4345
  if symbols is not None:
4346
4346
  symbol = self.safe_value(symbols, 0)
@@ -4392,7 +4392,7 @@ class coinex(Exchange, ImplicitAPI):
4392
4392
  params = self.omit(params, 'network')
4393
4393
  if tag:
4394
4394
  address = address + ':' + tag
4395
- request = {
4395
+ request: dict = {
4396
4396
  'coin_type': currency['id'],
4397
4397
  'coin_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
4398
4398
  'actual_amount': float(self.number_to_string(amount)), # the actual amount without fees, https://www.coinex.com/fees
@@ -4423,7 +4423,7 @@ class coinex(Exchange, ImplicitAPI):
4423
4423
  return self.parse_transaction(transaction, currency)
4424
4424
 
4425
4425
  def parse_transaction_status(self, status):
4426
- statuses = {
4426
+ statuses: dict = {
4427
4427
  'audit': 'pending',
4428
4428
  'pass': 'pending',
4429
4429
  'processing': 'pending',
@@ -4455,7 +4455,7 @@ class coinex(Exchange, ImplicitAPI):
4455
4455
  if paginate:
4456
4456
  return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 1000)
4457
4457
  market = self.market(symbol)
4458
- request = {
4458
+ request: dict = {
4459
4459
  'market': market['id'],
4460
4460
  }
4461
4461
  if since is not None:
@@ -4498,7 +4498,7 @@ class coinex(Exchange, ImplicitAPI):
4498
4498
  sorted = self.sort_by(rates, 'timestamp')
4499
4499
  return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
4500
4500
 
4501
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
4501
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
4502
4502
  #
4503
4503
  # fetchDeposits
4504
4504
  #
@@ -4615,7 +4615,7 @@ class coinex(Exchange, ImplicitAPI):
4615
4615
  accountsByType = self.safe_dict(self.options, 'accountsById', {})
4616
4616
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
4617
4617
  toId = self.safe_string(accountsByType, toAccount, toAccount)
4618
- request = {
4618
+ request: dict = {
4619
4619
  'ccy': currency['id'],
4620
4620
  'amount': amountToPrecision,
4621
4621
  'from_account_type': fromId,
@@ -4644,7 +4644,7 @@ class coinex(Exchange, ImplicitAPI):
4644
4644
  })
4645
4645
 
4646
4646
  def parse_transfer_status(self, status):
4647
- statuses = {
4647
+ statuses: dict = {
4648
4648
  '0': 'ok',
4649
4649
  'SUCCESS': 'ok',
4650
4650
  'OK': 'ok',
@@ -4685,7 +4685,7 @@ class coinex(Exchange, ImplicitAPI):
4685
4685
  if code is None:
4686
4686
  raise ArgumentsRequired(self.id + ' fetchTransfers() requires a code argument')
4687
4687
  currency = self.currency(code)
4688
- request = {
4688
+ request: dict = {
4689
4689
  'ccy': currency['id'],
4690
4690
  }
4691
4691
  marginMode = None
@@ -4734,7 +4734,7 @@ class coinex(Exchange, ImplicitAPI):
4734
4734
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
4735
4735
  """
4736
4736
  await self.load_markets()
4737
- request = {}
4737
+ request: dict = {}
4738
4738
  currency = None
4739
4739
  if code is not None:
4740
4740
  currency = self.currency(code)
@@ -4788,7 +4788,7 @@ class coinex(Exchange, ImplicitAPI):
4788
4788
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
4789
4789
  """
4790
4790
  await self.load_markets()
4791
- request = {}
4791
+ request: dict = {}
4792
4792
  currency = None
4793
4793
  if code is not None:
4794
4794
  currency = self.currency(code)
@@ -4877,7 +4877,7 @@ class coinex(Exchange, ImplicitAPI):
4877
4877
  params = self.omit(params, 'code')
4878
4878
  currency = self.currency(code)
4879
4879
  market = self.market(symbol)
4880
- request = {
4880
+ request: dict = {
4881
4881
  'market': market['id'],
4882
4882
  'ccy': currency['id'],
4883
4883
  }
@@ -4911,7 +4911,7 @@ class coinex(Exchange, ImplicitAPI):
4911
4911
  :returns dict[]: a list of `borrow interest structures <https://docs.ccxt.com/#/?id=borrow-interest-structure>`
4912
4912
  """
4913
4913
  await self.load_markets()
4914
- request = {}
4914
+ request: dict = {}
4915
4915
  market = None
4916
4916
  if symbol is not None:
4917
4917
  market = self.market(symbol)
@@ -4947,7 +4947,7 @@ class coinex(Exchange, ImplicitAPI):
4947
4947
  interest = self.parse_borrow_interests(rows, market)
4948
4948
  return self.filter_by_currency_since_limit(interest, code, since, limit)
4949
4949
 
4950
- def parse_borrow_interest(self, info, market: Market = None):
4950
+ def parse_borrow_interest(self, info: dict, market: Market = None):
4951
4951
  #
4952
4952
  # {
4953
4953
  # "borrow_id": 2642934,
@@ -4995,7 +4995,7 @@ class coinex(Exchange, ImplicitAPI):
4995
4995
  currency = self.currency(code)
4996
4996
  isAutoRenew = self.safe_bool_2(params, 'isAutoRenew', 'is_auto_renew', False)
4997
4997
  params = self.omit(params, 'isAutoRenew')
4998
- request = {
4998
+ request: dict = {
4999
4999
  'market': market['id'],
5000
5000
  'ccy': currency['id'],
5001
5001
  'borrow_amount': self.currency_to_precision(code, amount),
@@ -5039,7 +5039,7 @@ class coinex(Exchange, ImplicitAPI):
5039
5039
  await self.load_markets()
5040
5040
  market = self.market(symbol)
5041
5041
  currency = self.currency(code)
5042
- request = {
5042
+ request: dict = {
5043
5043
  'market': market['id'],
5044
5044
  'ccy': currency['id'],
5045
5045
  'amount': self.currency_to_precision(code, amount),
@@ -5085,143 +5085,176 @@ class coinex(Exchange, ImplicitAPI):
5085
5085
  'info': info,
5086
5086
  }
5087
5087
 
5088
- async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
5088
+ async def fetch_deposit_withdraw_fee(self, code: str, params={}):
5089
5089
  """
5090
- fetch deposit and withdraw fees
5091
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market010_asset_config
5092
- :param str[]|None codes: list of unified currency codes
5090
+ fetch the fee for deposits and withdrawals
5091
+ :see: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/get-deposit-withdrawal-config
5092
+ :param str code: unified currency code
5093
5093
  :param dict [params]: extra parameters specific to the exchange API endpoint
5094
- :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
5094
+ :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
5095
5095
  """
5096
5096
  await self.load_markets()
5097
- request = {}
5098
- if codes is not None:
5099
- codesLength = len(codes)
5100
- if codesLength == 1:
5101
- request['coin_type'] = self.safe_value(codes, 0)
5102
- response = await self.v1PublicGetCommonAssetConfig(self.extend(request, params))
5103
- #
5104
- # {
5105
- # "code": 0,
5106
- # "data": {
5107
- # "CET-CSC": {
5108
- # "asset": "CET",
5109
- # "chain": "CSC",
5110
- # "can_deposit": True,
5111
- # "can_withdraw ": False,
5112
- # "deposit_least_amount": "1",
5113
- # "withdraw_least_amount": "1",
5114
- # "withdraw_tx_fee": "0.1"
5115
- # },
5116
- # "CET-ERC20": {
5117
- # "asset": "CET",
5118
- # "chain": "ERC20",
5119
- # "can_deposit": True,
5120
- # "can_withdraw": False,
5121
- # "deposit_least_amount": "14",
5122
- # "withdraw_least_amount": "14",
5123
- # "withdraw_tx_fee": "14"
5124
- # }
5125
- # },
5126
- # "message": "Success"
5127
- # }
5128
- #
5129
- return self.parse_deposit_withdraw_fees(response, codes)
5097
+ currency = self.currency(code)
5098
+ request: dict = {
5099
+ 'ccy': currency['id'],
5100
+ }
5101
+ response = await self.v2PrivateGetAssetsDepositWithdrawConfig(self.extend(request, params))
5102
+ #
5103
+ # {
5104
+ # "code": 0,
5105
+ # "data": {
5106
+ # "asset": {
5107
+ # "ccy": "USDT",
5108
+ # "deposit_enabled": True,
5109
+ # "withdraw_enabled": True,
5110
+ # "inter_transfer_enabled": True,
5111
+ # "is_st": False
5112
+ # },
5113
+ # "chains": [
5114
+ # {
5115
+ # "chain": "TRC20",
5116
+ # "min_deposit_amount": "2.4",
5117
+ # "min_withdraw_amount": "2.4",
5118
+ # "deposit_enabled": True,
5119
+ # "withdraw_enabled": True,
5120
+ # "deposit_delay_minutes": 0,
5121
+ # "safe_confirmations": 10,
5122
+ # "irreversible_confirmations": 20,
5123
+ # "deflation_rate": "0",
5124
+ # "withdrawal_fee": "2.4",
5125
+ # "withdrawal_precision": 6,
5126
+ # "memo": "",
5127
+ # "is_memo_required_for_deposit": False,
5128
+ # "explorer_asset_url": "https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
5129
+ # },
5130
+ # ]
5131
+ # },
5132
+ # "message": "OK"
5133
+ # }
5134
+ #
5135
+ data = self.safe_dict(response, 'data', {})
5136
+ return self.parse_deposit_withdraw_fee(data, currency)
5130
5137
 
5131
- def parse_deposit_withdraw_fees(self, response, codes=None, currencyIdKey=None):
5132
- depositWithdrawFees = {}
5133
- codes = self.market_codes(codes)
5134
- data = self.safe_value(response, 'data')
5135
- currencyIds = list(data.keys())
5136
- for i in range(0, len(currencyIds)):
5137
- entry = currencyIds[i]
5138
- splitEntry = entry.split('-')
5139
- feeInfo = data[currencyIds[i]]
5140
- currencyId = self.safe_string(feeInfo, 'asset')
5141
- currency = self.safe_currency(currencyId)
5142
- code = self.safe_string(currency, 'code')
5143
- if (codes is None) or (self.in_array(code, codes)):
5144
- depositWithdrawFee = self.safe_value(depositWithdrawFees, code)
5145
- if depositWithdrawFee is None:
5146
- depositWithdrawFees[code] = self.deposit_withdraw_fee({})
5147
- depositWithdrawFees[code]['info'][entry] = feeInfo
5148
- networkId = self.safe_string(splitEntry, 1)
5149
- withdrawFee = self.safe_value(feeInfo, 'withdraw_tx_fee')
5150
- withdrawResult = {
5151
- 'fee': withdrawFee,
5152
- 'percentage': False if (withdrawFee is not None) else None,
5153
- }
5154
- depositResult = {
5155
- 'fee': None,
5156
- 'percentage': None,
5157
- }
5158
- if networkId is not None:
5159
- networkCode = self.network_id_to_code(networkId)
5160
- depositWithdrawFees[code]['networks'][networkCode] = {
5161
- 'withdraw': withdrawResult,
5162
- 'deposit': depositResult,
5138
+ def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
5139
+ #
5140
+ # {
5141
+ # "asset": {
5142
+ # "ccy": "USDT",
5143
+ # "deposit_enabled": True,
5144
+ # "withdraw_enabled": True,
5145
+ # "inter_transfer_enabled": True,
5146
+ # "is_st": False
5147
+ # },
5148
+ # "chains": [
5149
+ # {
5150
+ # "chain": "TRC20",
5151
+ # "min_deposit_amount": "2.4",
5152
+ # "min_withdraw_amount": "2.4",
5153
+ # "deposit_enabled": True,
5154
+ # "withdraw_enabled": True,
5155
+ # "deposit_delay_minutes": 0,
5156
+ # "safe_confirmations": 10,
5157
+ # "irreversible_confirmations": 20,
5158
+ # "deflation_rate": "0",
5159
+ # "withdrawal_fee": "2.4",
5160
+ # "withdrawal_precision": 6,
5161
+ # "memo": "",
5162
+ # "is_memo_required_for_deposit": False,
5163
+ # "explorer_asset_url": "https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
5164
+ # },
5165
+ # ]
5166
+ # }
5167
+ #
5168
+ result: dict = {
5169
+ 'info': fee,
5170
+ 'withdraw': {
5171
+ 'fee': None,
5172
+ 'percentage': None,
5173
+ },
5174
+ 'deposit': {
5175
+ 'fee': None,
5176
+ 'percentage': None,
5177
+ },
5178
+ 'networks': {},
5179
+ }
5180
+ chains = self.safe_list(fee, 'chains', [])
5181
+ asset = self.safe_dict(fee, 'asset', {})
5182
+ for i in range(0, len(chains)):
5183
+ entry = chains[i]
5184
+ isWithdrawEnabled = self.safe_bool(entry, 'withdraw_enabled')
5185
+ if isWithdrawEnabled:
5186
+ result['withdraw']['fee'] = self.safe_number(entry, 'withdrawal_fee')
5187
+ result['withdraw']['percentage'] = False
5188
+ networkId = self.safe_string(entry, 'chain')
5189
+ if networkId:
5190
+ networkCode = self.network_id_to_code(networkId, self.safe_string(asset, 'ccy'))
5191
+ result['networks'][networkCode] = {
5192
+ 'withdraw': {
5193
+ 'fee': self.safe_number(entry, 'withdrawal_fee'),
5194
+ 'percentage': False,
5195
+ },
5196
+ 'deposit': {
5197
+ 'fee': None,
5198
+ 'percentage': None,
5199
+ },
5163
5200
  }
5164
- else:
5165
- depositWithdrawFees[code]['withdraw'] = withdrawResult
5166
- depositWithdrawFees[code]['deposit'] = depositResult
5167
- depositWithdrawCodes = list(depositWithdrawFees.keys())
5168
- for i in range(0, len(depositWithdrawCodes)):
5169
- code = depositWithdrawCodes[i]
5170
- currency = self.currency(code)
5171
- depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
5172
- return depositWithdrawFees
5201
+ return result
5173
5202
 
5174
- async def fetch_leverages(self, symbols: List[str] = None, params={}) -> Leverages:
5203
+ async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
5175
5204
  """
5176
- fetch the set leverage for all contract and margin markets
5177
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
5178
- :param str[] [symbols]: a list of unified market symbols
5205
+ fetch the set leverage for a market
5206
+ :see: https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit
5207
+ :param str symbol: unified market symbol
5179
5208
  :param dict [params]: extra parameters specific to the exchange API endpoint
5180
- :returns dict: a list of `leverage structures <https://docs.ccxt.com/#/?id=leverage-structure>`
5209
+ :param str params['code']: unified currency code
5210
+ :returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
5181
5211
  """
5182
5212
  await self.load_markets()
5183
- symbols = self.market_symbols(symbols)
5184
- market = None
5185
- if symbols is not None:
5186
- symbol = self.safe_value(symbols, 0)
5187
- market = self.market(symbol)
5188
- marketType = None
5189
- marketType, params = self.handle_market_type_and_params('fetchLeverages', market, params)
5190
- if marketType != 'spot':
5191
- raise NotSupported(self.id + ' fetchLeverages() supports spot margin markets only')
5192
- response = await self.v1PrivateGetMarginConfig(params)
5213
+ code = self.safe_string(params, 'code')
5214
+ if code is None:
5215
+ raise ArgumentsRequired(self.id + ' fetchLeverage() requires a code parameter')
5216
+ params = self.omit(params, 'code')
5217
+ currency = self.currency(code)
5218
+ market = self.market(symbol)
5219
+ request: dict = {
5220
+ 'market': market['id'],
5221
+ 'ccy': currency['id'],
5222
+ }
5223
+ response = await self.v2PrivateGetAssetsMarginInterestLimit(self.extend(request, params))
5193
5224
  #
5194
5225
  # {
5195
5226
  # "code": 0,
5196
- # "data": [
5197
- # {
5198
- # "market": "BTCUSDT",
5199
- # "leverage": 10,
5200
- # "BTC": {
5201
- # "min_amount": "0.0008",
5202
- # "max_amount": "200",
5203
- # "day_rate": "0.0015"
5204
- # },
5205
- # "USDT": {
5206
- # "min_amount": "50",
5207
- # "max_amount": "500000",
5208
- # "day_rate": "0.001"
5209
- # }
5210
- # },
5211
- # ],
5212
- # "message": "Success"
5227
+ # "data": {
5228
+ # "market": "BTCUSDT",
5229
+ # "ccy": "USDT",
5230
+ # "leverage": 10,
5231
+ # "min_amount": "50",
5232
+ # "max_amount": "500000",
5233
+ # "daily_interest_rate": "0.001"
5234
+ # },
5235
+ # "message": "OK"
5213
5236
  # }
5214
5237
  #
5215
- leverages = self.safe_list(response, 'data', [])
5216
- return self.parse_leverages(leverages, symbols, 'market', marketType)
5238
+ data = self.safe_dict(response, 'data', {})
5239
+ return self.parse_leverage(data, market)
5217
5240
 
5218
5241
  def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
5242
+ #
5243
+ # {
5244
+ # "market": "BTCUSDT",
5245
+ # "ccy": "USDT",
5246
+ # "leverage": 10,
5247
+ # "min_amount": "50",
5248
+ # "max_amount": "500000",
5249
+ # "daily_interest_rate": "0.001"
5250
+ # }
5251
+ #
5219
5252
  marketId = self.safe_string(leverage, 'market')
5220
5253
  leverageValue = self.safe_integer(leverage, 'leverage')
5221
5254
  return {
5222
5255
  'info': leverage,
5223
5256
  'symbol': self.safe_symbol(marketId, market, None, 'spot'),
5224
- 'marginMode': None,
5257
+ 'marginMode': 'isolated',
5225
5258
  'longLeverage': leverageValue,
5226
5259
  'shortLeverage': leverageValue,
5227
5260
  }
@@ -5239,7 +5272,7 @@ class coinex(Exchange, ImplicitAPI):
5239
5272
  """
5240
5273
  await self.load_markets()
5241
5274
  market = self.market(symbol)
5242
- request = {
5275
+ request: dict = {
5243
5276
  'market_type': 'FUTURES',
5244
5277
  'market': market['id'],
5245
5278
  }
@@ -5442,7 +5475,7 @@ class coinex(Exchange, ImplicitAPI):
5442
5475
  if positionId is None:
5443
5476
  raise ArgumentsRequired(self.id + ' fetchMarginAdjustmentHistory() requires a positionId parameter')
5444
5477
  market = self.market(symbol)
5445
- request = {
5478
+ request: dict = {
5446
5479
  'market': market['id'],
5447
5480
  'market_type': 'FUTURES',
5448
5481
  'position_id': positionId,