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
ccxt/htx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.htx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, 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 AuthenticationError
@@ -1483,7 +1483,7 @@ class htx(Exchange, ImplicitAPI):
1483
1483
  #
1484
1484
  return self.safe_integer_2(response, 'data', 'ts')
1485
1485
 
1486
- def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1486
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1487
1487
  #
1488
1488
  # {
1489
1489
  # "symbol":"btcusdt",
@@ -1512,7 +1512,7 @@ class htx(Exchange, ImplicitAPI):
1512
1512
  """
1513
1513
  self.load_markets()
1514
1514
  market = self.market(symbol)
1515
- request = {
1515
+ request: dict = {
1516
1516
  'symbols': market['id'], # trading symbols comma-separated
1517
1517
  }
1518
1518
  response = self.spotPrivateGetV2ReferenceTransactFeeRate(self.extend(request, params))
@@ -1542,14 +1542,14 @@ class htx(Exchange, ImplicitAPI):
1542
1542
  self.load_markets()
1543
1543
  if symbols is None:
1544
1544
  symbols = self.symbols
1545
- result = {}
1545
+ result: dict = {}
1546
1546
  for i in range(0, len(symbols)):
1547
1547
  symbol = symbols[i]
1548
1548
  result[symbol] = self.fetch_trading_limits_by_id(self.market_id(symbol), params)
1549
1549
  return result
1550
1550
 
1551
1551
  def fetch_trading_limits_by_id(self, id: str, params={}):
1552
- request = {
1552
+ request: dict = {
1553
1553
  'symbol': id,
1554
1554
  }
1555
1555
  response = self.spotPublicGetV1CommonExchange(self.extend(request, params))
@@ -1628,7 +1628,7 @@ class htx(Exchange, ImplicitAPI):
1628
1628
 
1629
1629
  def fetch_markets_by_type_and_sub_type(self, type, subType, params={}):
1630
1630
  isSpot = (type == 'spot')
1631
- request = {}
1631
+ request: dict = {}
1632
1632
  response = None
1633
1633
  if not isSpot:
1634
1634
  if subType == 'linear':
@@ -1909,7 +1909,7 @@ class htx(Exchange, ImplicitAPI):
1909
1909
  if symbolOrMarketId in futureMarketIdsForSymbols:
1910
1910
  return futureMarketIdsForSymbols[symbolOrMarketId]
1911
1911
  futureMarkets = self.filter_by(self.markets, 'future', True)
1912
- futuresCharsMaps = {
1912
+ futuresCharsMaps: dict = {
1913
1913
  'this_week': 'CW',
1914
1914
  'next_week': 'NW',
1915
1915
  'quarter': 'CQ',
@@ -2034,7 +2034,7 @@ class htx(Exchange, ImplicitAPI):
2034
2034
  """
2035
2035
  self.load_markets()
2036
2036
  market = self.market(symbol)
2037
- request = {}
2037
+ request: dict = {}
2038
2038
  response = None
2039
2039
  if market['linear']:
2040
2040
  request['contract_code'] = market['id']
@@ -2121,7 +2121,7 @@ class htx(Exchange, ImplicitAPI):
2121
2121
  subType = None
2122
2122
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2123
2123
  subType, params = self.handle_sub_type_and_params('fetchTickers', market, params)
2124
- request = {}
2124
+ request: dict = {}
2125
2125
  isSpot = (type == 'spot')
2126
2126
  future = (type == 'future')
2127
2127
  swap = (type == 'swap')
@@ -2328,7 +2328,7 @@ class htx(Exchange, ImplicitAPI):
2328
2328
  """
2329
2329
  self.load_markets()
2330
2330
  market = self.market(symbol)
2331
- request = {
2331
+ request: dict = {
2332
2332
  #
2333
2333
  # from the API docs
2334
2334
  #
@@ -2398,7 +2398,7 @@ class htx(Exchange, ImplicitAPI):
2398
2398
  return result
2399
2399
  raise ExchangeError(self.id + ' fetchOrderBook() returned unrecognized response: ' + self.json(response))
2400
2400
 
2401
- def parse_trade(self, trade, market: Market = None) -> Trade:
2401
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
2402
2402
  #
2403
2403
  # spot fetchTrades(public)
2404
2404
  #
@@ -2550,7 +2550,7 @@ class htx(Exchange, ImplicitAPI):
2550
2550
 
2551
2551
  def fetch_spot_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2552
2552
  self.load_markets()
2553
- request = {
2553
+ request: dict = {
2554
2554
  'order-id': id,
2555
2555
  }
2556
2556
  response = self.spotPrivateGetV1OrderOrdersOrderIdMatchresults(self.extend(request, params))
@@ -2580,7 +2580,7 @@ class htx(Exchange, ImplicitAPI):
2580
2580
  market = self.market(symbol)
2581
2581
  marketType = None
2582
2582
  marketType, params = self.handle_market_type_and_params('fetchMyTrades', market, params)
2583
- request = {
2583
+ request: dict = {
2584
2584
  # spot -----------------------------------------------------------
2585
2585
  # 'symbol': market['id'],
2586
2586
  # 'types': 'buy-market,sell-market,buy-limit,sell-limit,buy-ioc,sell-ioc,buy-limit-maker,sell-limit-maker,buy-stop-limit,sell-stop-limit',
@@ -2724,7 +2724,7 @@ class htx(Exchange, ImplicitAPI):
2724
2724
  """
2725
2725
  self.load_markets()
2726
2726
  market = self.market(symbol)
2727
- request = {
2727
+ request: dict = {
2728
2728
  # 'symbol': market['id'], # spot, future
2729
2729
  # 'contract_code': market['id'], # swap
2730
2730
  }
@@ -2825,7 +2825,7 @@ class htx(Exchange, ImplicitAPI):
2825
2825
  if paginate:
2826
2826
  return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000)
2827
2827
  market = self.market(symbol)
2828
- request = {
2828
+ request: dict = {
2829
2829
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
2830
2830
  # 'symbol': market['id'], # spot, future
2831
2831
  # 'contract_code': market['id'], # swap
@@ -3038,7 +3038,7 @@ class htx(Exchange, ImplicitAPI):
3038
3038
  # }
3039
3039
  #
3040
3040
  data = self.safe_value(response, 'data', [])
3041
- result = {}
3041
+ result: dict = {}
3042
3042
  self.options['networkChainIdsByNames'] = {}
3043
3043
  self.options['networkNamesByChainIds'] = {}
3044
3044
  for i in range(0, len(data)):
@@ -3047,7 +3047,7 @@ class htx(Exchange, ImplicitAPI):
3047
3047
  code = self.safe_currency_code(currencyId)
3048
3048
  self.options['networkChainIdsByNames'][code] = {}
3049
3049
  chains = self.safe_value(entry, 'chains', [])
3050
- networks = {}
3050
+ networks: dict = {}
3051
3051
  instStatus = self.safe_string(entry, 'instStatus')
3052
3052
  currencyActive = instStatus == 'normal'
3053
3053
  minPrecision = None
@@ -3166,7 +3166,7 @@ class htx(Exchange, ImplicitAPI):
3166
3166
  options = self.safe_value(self.options, 'fetchBalance', {})
3167
3167
  isUnifiedAccount = self.safe_value_2(params, 'isUnifiedAccount', 'unified', False)
3168
3168
  params = self.omit(params, ['isUnifiedAccount', 'unified'])
3169
- request = {}
3169
+ request: dict = {}
3170
3170
  spot = (type == 'spot')
3171
3171
  future = (type == 'future')
3172
3172
  defaultSubType = self.safe_string_2(self.options, 'defaultSubType', 'subType', 'linear')
@@ -3363,7 +3363,7 @@ class htx(Exchange, ImplicitAPI):
3363
3363
  #
3364
3364
  # TODO add balance parsing for linear swap
3365
3365
  #
3366
- result = {'info': response}
3366
+ result: dict = {'info': response}
3367
3367
  data = self.safe_value(response, 'data')
3368
3368
  if spot or margin:
3369
3369
  if isolated:
@@ -3371,7 +3371,7 @@ class htx(Exchange, ImplicitAPI):
3371
3371
  entry = data[i]
3372
3372
  symbol = self.safe_symbol(self.safe_string(entry, 'symbol'))
3373
3373
  balances = self.safe_value(entry, 'list')
3374
- subResult = {}
3374
+ subResult: dict = {}
3375
3375
  for j in range(0, len(balances)):
3376
3376
  balance = balances[j]
3377
3377
  currencyId = self.safe_string(balance, 'currency')
@@ -3396,7 +3396,7 @@ class htx(Exchange, ImplicitAPI):
3396
3396
  for j in range(0, len(isolated_swap)):
3397
3397
  balance = isolated_swap[j]
3398
3398
  marketId = self.safe_string(balance, 'contract_code')
3399
- subBalance = {
3399
+ subBalance: dict = {
3400
3400
  'code': currencyCode,
3401
3401
  'free': self.safe_number(balance, 'margin_available'),
3402
3402
  }
@@ -3426,7 +3426,7 @@ class htx(Exchange, ImplicitAPI):
3426
3426
  account = self.account()
3427
3427
  account['free'] = self.safe_string(balance, 'margin_balance')
3428
3428
  account['used'] = self.safe_string(balance, 'margin_frozen')
3429
- accountsByCode = {}
3429
+ accountsByCode: dict = {}
3430
3430
  accountsByCode[code] = account
3431
3431
  symbol = market['symbol']
3432
3432
  result[symbol] = self.safe_balance(accountsByCode)
@@ -3463,7 +3463,7 @@ class htx(Exchange, ImplicitAPI):
3463
3463
  market = self.market(symbol)
3464
3464
  marketType = None
3465
3465
  marketType, params = self.handle_market_type_and_params('fetchOrder', market, params)
3466
- request = {
3466
+ request: dict = {
3467
3467
  # spot -----------------------------------------------------------
3468
3468
  # 'order-id': 'id',
3469
3469
  # 'symbol': market['id'],
@@ -3662,7 +3662,7 @@ class htx(Exchange, ImplicitAPI):
3662
3662
  raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
3663
3663
  self.load_markets()
3664
3664
  market = None
3665
- request = {
3665
+ request: dict = {
3666
3666
  # spot_private_get_v1_order_orders GET /v1/order/orders ----------
3667
3667
  # 'symbol': market['id'], # required
3668
3668
  # 'types': 'buy-market,sell-market,buy-limit,sell-limit,buy-ioc,sell-ioc,buy-stop-limit,sell-stop-limit,buy-limit-fok,sell-limit-fok,buy-stop-limit-fok,sell-stop-limit-fok',
@@ -3733,7 +3733,7 @@ class htx(Exchange, ImplicitAPI):
3733
3733
  raise ArgumentsRequired(self.id + ' fetchContractOrders() requires a symbol argument')
3734
3734
  self.load_markets()
3735
3735
  market = self.market(symbol)
3736
- request = {
3736
+ request: dict = {
3737
3737
  # POST /api/v1/contract_hisorders inverse futures ----------------
3738
3738
  # 'symbol': market['settleId'], # BTC, ETH, ...
3739
3739
  # 'order_type': '1', # 1 limit,3 opponent,4 lightning, 5 trigger order, 6 pst_only, 7 optimal_5, 8 optimal_10, 9 optimal_20, 10 fok, 11 ioc
@@ -3950,7 +3950,7 @@ class htx(Exchange, ImplicitAPI):
3950
3950
  return self.parse_orders(orders, market, since, limit)
3951
3951
 
3952
3952
  def fetch_closed_contract_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
3953
- request = {
3953
+ request: dict = {
3954
3954
  'status': '5,6,7', # comma separated, 0 all, 3 submitted orders, 4 partially matched, 5 partially cancelled, 6 fully matched and closed, 7 canceled
3955
3955
  }
3956
3956
  return self.fetch_contract_orders(symbol, since, limit, self.extend(request, params))
@@ -4039,7 +4039,7 @@ class htx(Exchange, ImplicitAPI):
4039
4039
  market = None
4040
4040
  if symbol is not None:
4041
4041
  market = self.market(symbol)
4042
- request = {}
4042
+ request: dict = {}
4043
4043
  marketType = None
4044
4044
  marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
4045
4045
  response = None
@@ -4303,8 +4303,8 @@ class htx(Exchange, ImplicitAPI):
4303
4303
  orders = self.safe_value(orders, 'orders', [])
4304
4304
  return self.parse_orders(orders, market, since, limit)
4305
4305
 
4306
- def parse_order_status(self, status):
4307
- statuses = {
4306
+ def parse_order_status(self, status: Str):
4307
+ statuses: dict = {
4308
4308
  # spot
4309
4309
  'partial-filled': 'open',
4310
4310
  'partial-canceled': 'canceled',
@@ -4324,7 +4324,7 @@ class htx(Exchange, ImplicitAPI):
4324
4324
  }
4325
4325
  return self.safe_string(statuses, status, status)
4326
4326
 
4327
- def parse_order(self, order, market: Market = None) -> Order:
4327
+ def parse_order(self, order: dict, market: Market = None) -> Order:
4328
4328
  #
4329
4329
  # spot
4330
4330
  #
@@ -4815,7 +4815,7 @@ class htx(Exchange, ImplicitAPI):
4815
4815
  marginMode = None
4816
4816
  marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
4817
4817
  accountId = self.fetch_account_id_by_type(market['type'], marginMode, symbol)
4818
- request = {
4818
+ request: dict = {
4819
4819
  # spot -----------------------------------------------------------
4820
4820
  'account-id': accountId,
4821
4821
  'symbol': market['id'],
@@ -4915,7 +4915,7 @@ class htx(Exchange, ImplicitAPI):
4915
4915
  :returns dict: request to be sent to the exchange
4916
4916
  """
4917
4917
  market = self.market(symbol)
4918
- request = {
4918
+ request: dict = {
4919
4919
  'contract_code': market['id'],
4920
4920
  'volume': self.amount_to_precision(symbol, amount),
4921
4921
  'direction': side,
@@ -5180,7 +5180,7 @@ class htx(Exchange, ImplicitAPI):
5180
5180
  orderRequest = self.create_contract_order_request(marketId, type, side, amount, price, orderParams)
5181
5181
  orderRequest = self.omit(orderRequest, 'marginMode')
5182
5182
  ordersRequests.append(orderRequest)
5183
- request = {}
5183
+ request: dict = {}
5184
5184
  response = None
5185
5185
  if market['spot']:
5186
5186
  response = self.privatePostOrderBatchOrders(ordersRequests)
@@ -5265,7 +5265,7 @@ class htx(Exchange, ImplicitAPI):
5265
5265
  market = self.market(symbol)
5266
5266
  marketType = None
5267
5267
  marketType, params = self.handle_market_type_and_params('cancelOrder', market, params)
5268
- request = {
5268
+ request: dict = {
5269
5269
  # spot -----------------------------------------------------------
5270
5270
  # 'order-id': 'id',
5271
5271
  # 'symbol': market['id'],
@@ -5387,7 +5387,7 @@ class htx(Exchange, ImplicitAPI):
5387
5387
  market = self.market(symbol)
5388
5388
  marketType = None
5389
5389
  marketType, params = self.handle_market_type_and_params('cancelOrders', market, params)
5390
- request = {
5390
+ request: dict = {
5391
5391
  # spot -----------------------------------------------------------
5392
5392
  # 'order-ids': ','.join(ids), # max 50
5393
5393
  # 'client-order-ids': ','.join(ids), # max 50
@@ -5534,7 +5534,7 @@ class htx(Exchange, ImplicitAPI):
5534
5534
  market = self.market(symbol)
5535
5535
  marketType = None
5536
5536
  marketType, params = self.handle_market_type_and_params('cancelAllOrders', market, params)
5537
- request = {
5537
+ request: dict = {
5538
5538
  # spot -----------------------------------------------------------
5539
5539
  # 'account-id': account['id'],
5540
5540
  # 'symbol': market['id'], # a list of comma-separated symbols, all symbols by default
@@ -5691,7 +5691,7 @@ class htx(Exchange, ImplicitAPI):
5691
5691
  """
5692
5692
  self.load_markets()
5693
5693
  currency = self.currency(code)
5694
- request = {
5694
+ request: dict = {
5695
5695
  'currency': currency['id'],
5696
5696
  }
5697
5697
  response = self.spotPrivateGetV2AccountDepositAddress(self.extend(request, params))
@@ -5729,7 +5729,7 @@ class htx(Exchange, ImplicitAPI):
5729
5729
  def fetch_withdraw_addresses(self, code: str, note=None, networkCode=None, params={}):
5730
5730
  self.load_markets()
5731
5731
  currency = self.currency(code)
5732
- request = {
5732
+ request: dict = {
5733
5733
  'currency': currency['id'],
5734
5734
  }
5735
5735
  response = self.spotPrivateGetV2AccountWithdrawAddress(self.extend(request, params))
@@ -5773,7 +5773,7 @@ class htx(Exchange, ImplicitAPI):
5773
5773
  currency = None
5774
5774
  if code is not None:
5775
5775
  currency = self.currency(code)
5776
- request = {
5776
+ request: dict = {
5777
5777
  'type': 'deposit',
5778
5778
  'direct': 'next',
5779
5779
  'from': 0, # From 'id' ... if you want to get results after a particular transaction id, pass the id in params.from
@@ -5826,7 +5826,7 @@ class htx(Exchange, ImplicitAPI):
5826
5826
  currency = None
5827
5827
  if code is not None:
5828
5828
  currency = self.currency(code)
5829
- request = {
5829
+ request: dict = {
5830
5830
  'type': 'withdraw',
5831
5831
  'direct': 'next',
5832
5832
  'from': 0, # From 'id' ... if you want to get results after a particular transaction id, pass the id in params.from
@@ -5862,7 +5862,7 @@ class htx(Exchange, ImplicitAPI):
5862
5862
  #
5863
5863
  return self.parse_transactions(response['data'], currency, since, limit)
5864
5864
 
5865
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
5865
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
5866
5866
  #
5867
5867
  # fetchDeposits
5868
5868
  #
@@ -5955,7 +5955,7 @@ class htx(Exchange, ImplicitAPI):
5955
5955
  }
5956
5956
 
5957
5957
  def parse_transaction_status(self, status):
5958
- statuses = {
5958
+ statuses: dict = {
5959
5959
  # deposit statuses
5960
5960
  'unknown': 'failed',
5961
5961
  'confirming': 'pending',
@@ -5991,7 +5991,7 @@ class htx(Exchange, ImplicitAPI):
5991
5991
  self.load_markets()
5992
5992
  self.check_address(address)
5993
5993
  currency = self.currency(code)
5994
- request = {
5994
+ request: dict = {
5995
5995
  'address': address, # only supports existing addresses in your withdraw address list
5996
5996
  'currency': currency['id'].lower(),
5997
5997
  }
@@ -6074,7 +6074,7 @@ class htx(Exchange, ImplicitAPI):
6074
6074
  """
6075
6075
  self.load_markets()
6076
6076
  currency = self.currency(code)
6077
- request = {
6077
+ request: dict = {
6078
6078
  'currency': currency['id'],
6079
6079
  'amount': float(self.currency_to_precision(code, amount)),
6080
6080
  }
@@ -6238,7 +6238,7 @@ class htx(Exchange, ImplicitAPI):
6238
6238
  return self.fetch_paginated_call_cursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50)
6239
6239
  self.load_markets()
6240
6240
  market = self.market(symbol)
6241
- request = {
6241
+ request: dict = {
6242
6242
  'contract_code': market['id'],
6243
6243
  }
6244
6244
  response = None
@@ -6340,7 +6340,7 @@ class htx(Exchange, ImplicitAPI):
6340
6340
  """
6341
6341
  self.load_markets()
6342
6342
  market = self.market(symbol)
6343
- request = {
6343
+ request: dict = {
6344
6344
  'contract_code': market['id'],
6345
6345
  }
6346
6346
  response = None
@@ -6381,7 +6381,7 @@ class htx(Exchange, ImplicitAPI):
6381
6381
  defaultSubType = self.safe_string(self.options, 'defaultSubType', 'inverse')
6382
6382
  subType = self.safe_string(options, 'subType', defaultSubType)
6383
6383
  subType = self.safe_string(params, 'subType', subType)
6384
- request = {
6384
+ request: dict = {
6385
6385
  # 'contract_code': market['id'],
6386
6386
  }
6387
6387
  params = self.omit(params, 'subType')
@@ -6428,7 +6428,7 @@ class htx(Exchange, ImplicitAPI):
6428
6428
  marginMode = None
6429
6429
  marginMode, params = self.handle_margin_mode_and_params('fetchBorrowInterest', params)
6430
6430
  marginMode = 'cross' if (marginMode is None) else marginMode
6431
- request = {}
6431
+ request: dict = {}
6432
6432
  if since is not None:
6433
6433
  request['start-date'] = self.yyyymmdd(since)
6434
6434
  if limit is not None:
@@ -6471,7 +6471,7 @@ class htx(Exchange, ImplicitAPI):
6471
6471
  interest = self.parse_borrow_interests(data, market)
6472
6472
  return self.filter_by_currency_since_limit(interest, code, since, limit)
6473
6473
 
6474
- def parse_borrow_interest(self, info, market: Market = None):
6474
+ def parse_borrow_interest(self, info: dict, market: Market = None):
6475
6475
  # isolated
6476
6476
  # {
6477
6477
  # "interest-rate":"0.000040830000000000",
@@ -6544,7 +6544,7 @@ class htx(Exchange, ImplicitAPI):
6544
6544
  if api == 'private' or api == 'v2Private':
6545
6545
  self.check_required_credentials()
6546
6546
  timestamp = self.ymdhms(self.milliseconds(), 'T')
6547
- request = {
6547
+ request: dict = {
6548
6548
  'SignatureMethod': 'HmacSHA256',
6549
6549
  'SignatureVersion': '2',
6550
6550
  'AccessKeyId': self.apiKey,
@@ -6608,7 +6608,7 @@ class htx(Exchange, ImplicitAPI):
6608
6608
  if clientOrderId is None:
6609
6609
  params['client-order-id'] = id + self.uuid()
6610
6610
  timestamp = self.ymdhms(self.milliseconds(), 'T')
6611
- request = {
6611
+ request: dict = {
6612
6612
  'SignatureMethod': 'HmacSHA256',
6613
6613
  'SignatureVersion': '2',
6614
6614
  'AccessKeyId': self.apiKey,
@@ -6677,7 +6677,7 @@ class htx(Exchange, ImplicitAPI):
6677
6677
  self.load_markets()
6678
6678
  market = self.market(symbol)
6679
6679
  marketType, query = self.handle_market_type_and_params('fetchFundingHistory', market, params)
6680
- request = {
6680
+ request: dict = {
6681
6681
  'type': '30,31',
6682
6682
  }
6683
6683
  if since is not None:
@@ -6757,7 +6757,7 @@ class htx(Exchange, ImplicitAPI):
6757
6757
  self.load_markets()
6758
6758
  market = self.market(symbol)
6759
6759
  marketType, query = self.handle_market_type_and_params('setLeverage', market, params)
6760
- request = {
6760
+ request: dict = {
6761
6761
  'lever_rate': leverage,
6762
6762
  }
6763
6763
  if marketType == 'future' and market['inverse']:
@@ -6839,7 +6839,7 @@ class htx(Exchange, ImplicitAPI):
6839
6839
  'amount': amount,
6840
6840
  }
6841
6841
 
6842
- def parse_position(self, position, market: Market = None):
6842
+ def parse_position(self, position: dict, market: Market = None):
6843
6843
  #
6844
6844
  # {
6845
6845
  # "symbol": "BTC",
@@ -7067,7 +7067,7 @@ class htx(Exchange, ImplicitAPI):
7067
7067
  marginMode, params = self.handle_margin_mode_and_params('fetchPosition', params)
7068
7068
  marginMode = 'cross' if (marginMode is None) else marginMode
7069
7069
  marketType, query = self.handle_market_type_and_params('fetchPosition', market, params)
7070
- request = {}
7070
+ request: dict = {}
7071
7071
  if market['future'] and market['inverse']:
7072
7072
  request['symbol'] = market['settleId']
7073
7073
  else:
@@ -7299,7 +7299,7 @@ class htx(Exchange, ImplicitAPI):
7299
7299
  return parsed
7300
7300
 
7301
7301
  def parse_ledger_entry_type(self, type):
7302
- types = {
7302
+ types: dict = {
7303
7303
  'trade': 'trade',
7304
7304
  'etf': 'trade',
7305
7305
  'transact-fee': 'fee',
@@ -7317,7 +7317,7 @@ class htx(Exchange, ImplicitAPI):
7317
7317
  }
7318
7318
  return self.safe_string(types, type, type)
7319
7319
 
7320
- def parse_ledger_entry(self, item, currency: Currency = None):
7320
+ def parse_ledger_entry(self, item: dict, currency: Currency = None):
7321
7321
  #
7322
7322
  # {
7323
7323
  # "accountId": 10000001,
@@ -7377,7 +7377,7 @@ class htx(Exchange, ImplicitAPI):
7377
7377
  if paginate:
7378
7378
  return self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params, 500)
7379
7379
  accountId = self.fetch_account_id_by_type('spot', None, None, params)
7380
- request = {
7380
+ request: dict = {
7381
7381
  'accountId': accountId,
7382
7382
  # 'currency': code,
7383
7383
  # 'transactTypes': 'all', # default all
@@ -7432,7 +7432,7 @@ class htx(Exchange, ImplicitAPI):
7432
7432
  data = self.safe_value(response, 'data', [])
7433
7433
  return self.parse_ledger(data, currency, since, limit)
7434
7434
 
7435
- def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
7435
+ def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
7436
7436
  """
7437
7437
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
7438
7438
  :param str[]|None symbols: list of unified market symbols
@@ -7473,7 +7473,7 @@ class htx(Exchange, ImplicitAPI):
7473
7473
  data = self.safe_list(response, 'data')
7474
7474
  return self.parse_leverage_tiers(data, symbols, 'contract_code')
7475
7475
 
7476
- def fetch_market_leverage_tiers(self, symbol: str, params={}):
7476
+ def fetch_market_leverage_tiers(self, symbol: str, params={}) -> List[LeverageTier]:
7477
7477
  """
7478
7478
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
7479
7479
  :param str symbol: unified market symbol
@@ -7481,7 +7481,7 @@ class htx(Exchange, ImplicitAPI):
7481
7481
  :returns dict: a `leverage tiers structure <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`
7482
7482
  """
7483
7483
  self.load_markets()
7484
- request = {}
7484
+ request: dict = {}
7485
7485
  if symbol is not None:
7486
7486
  market = self.market(symbol)
7487
7487
  if not market['contract']:
@@ -7522,7 +7522,7 @@ class htx(Exchange, ImplicitAPI):
7522
7522
  return self.safe_value(tiers, symbol)
7523
7523
 
7524
7524
  def parse_leverage_tiers(self, response, symbols: Strings = None, marketIdKey=None):
7525
- result = {}
7525
+ result: dict = {}
7526
7526
  for i in range(0, len(response)):
7527
7527
  item = response[i]
7528
7528
  list = self.safe_value(item, 'list', [])
@@ -7568,7 +7568,7 @@ class htx(Exchange, ImplicitAPI):
7568
7568
  if timeframe != '1h' and timeframe != '4h' and timeframe != '12h' and timeframe != '1d':
7569
7569
  raise BadRequest(self.id + ' fetchOpenInterestHistory cannot only use the 1h, 4h, 12h and 1d timeframe')
7570
7570
  self.load_markets()
7571
- timeframes = {
7571
+ timeframes: dict = {
7572
7572
  '1h': '60min',
7573
7573
  '4h': '4hour',
7574
7574
  '12h': '12hour',
@@ -7576,7 +7576,7 @@ class htx(Exchange, ImplicitAPI):
7576
7576
  }
7577
7577
  market = self.market(symbol)
7578
7578
  amountType = self.safe_integer_2(params, 'amount_type', 'amountType', 2)
7579
- request = {
7579
+ request: dict = {
7580
7580
  'period': timeframes[timeframe],
7581
7581
  'amount_type': amountType,
7582
7582
  }
@@ -7678,7 +7678,7 @@ class htx(Exchange, ImplicitAPI):
7678
7678
  raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
7679
7679
  if market['option']:
7680
7680
  raise NotSupported(self.id + ' fetchOpenInterest() does not currently support option markets')
7681
- request = {
7681
+ request: dict = {
7682
7682
  'contract_code': market['id'],
7683
7683
  }
7684
7684
  response = None
@@ -7843,7 +7843,7 @@ class htx(Exchange, ImplicitAPI):
7843
7843
  self.load_markets()
7844
7844
  currency = self.currency(code)
7845
7845
  market = self.market(symbol)
7846
- request = {
7846
+ request: dict = {
7847
7847
  'currency': currency['id'],
7848
7848
  'amount': self.currency_to_precision(code, amount),
7849
7849
  'symbol': market['id'],
@@ -7874,7 +7874,7 @@ class htx(Exchange, ImplicitAPI):
7874
7874
  """
7875
7875
  self.load_markets()
7876
7876
  currency = self.currency(code)
7877
- request = {
7877
+ request: dict = {
7878
7878
  'currency': currency['id'],
7879
7879
  'amount': self.currency_to_precision(code, amount),
7880
7880
  }
@@ -7905,7 +7905,7 @@ class htx(Exchange, ImplicitAPI):
7905
7905
  self.load_markets()
7906
7906
  currency = self.currency(code)
7907
7907
  accountId = self.fetch_account_id_by_type('spot', 'isolated', symbol, params)
7908
- request = {
7908
+ request: dict = {
7909
7909
  'currency': currency['id'],
7910
7910
  'amount': self.currency_to_precision(code, amount),
7911
7911
  'accountId': accountId,
@@ -7942,7 +7942,7 @@ class htx(Exchange, ImplicitAPI):
7942
7942
  self.load_markets()
7943
7943
  currency = self.currency(code)
7944
7944
  accountId = self.fetch_account_id_by_type('spot', 'cross', None, params)
7945
- request = {
7945
+ request: dict = {
7946
7946
  'currency': currency['id'],
7947
7947
  'amount': self.currency_to_precision(code, amount),
7948
7948
  'accountId': accountId,
@@ -8016,7 +8016,7 @@ class htx(Exchange, ImplicitAPI):
8016
8016
  until = self.safe_integer(params, 'until')
8017
8017
  params = self.omit(params, ['until'])
8018
8018
  market = self.market(symbol)
8019
- request = {}
8019
+ request: dict = {}
8020
8020
  if market['future']:
8021
8021
  request['symbol'] = market['baseId']
8022
8022
  else:
@@ -8247,7 +8247,7 @@ class htx(Exchange, ImplicitAPI):
8247
8247
  list = self.safe_value(settlement, 'list')
8248
8248
  if list is not None:
8249
8249
  timestamp = self.safe_integer(settlement, 'settlement_time')
8250
- timestampDetails = {
8250
+ timestampDetails: dict = {
8251
8251
  'timestamp': timestamp,
8252
8252
  'datetime': self.iso8601(timestamp),
8253
8253
  }
@@ -8310,7 +8310,7 @@ class htx(Exchange, ImplicitAPI):
8310
8310
  self.load_markets()
8311
8311
  market = self.market(symbol)
8312
8312
  tradeType = self.safe_integer(params, 'trade_type', 0)
8313
- request = {
8313
+ request: dict = {
8314
8314
  'trade_type': tradeType,
8315
8315
  }
8316
8316
  if since is not None:
@@ -8403,7 +8403,7 @@ class htx(Exchange, ImplicitAPI):
8403
8403
  market = self.market(symbol)
8404
8404
  marginMode = None
8405
8405
  marginMode, params = self.handle_margin_mode_and_params('setPositionMode', params, 'cross')
8406
- request = {
8406
+ request: dict = {
8407
8407
  'position_mode': posMode,
8408
8408
  }
8409
8409
  response = None