ccxt 4.3.30__py2.py3-none-any.whl → 4.3.31__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 (258) 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 +168 -139
  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 +35 -35
  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 +168 -139
  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 +19 -19
  201. ccxt/pro/coinbase.py +2 -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/timex.py +22 -22
  244. ccxt/tokocrypto.py +26 -26
  245. ccxt/tradeogre.py +12 -12
  246. ccxt/upbit.py +28 -28
  247. ccxt/wavesexchange.py +33 -33
  248. ccxt/wazirx.py +21 -21
  249. ccxt/whitebit.py +37 -37
  250. ccxt/woo.py +51 -51
  251. ccxt/woofipro.py +46 -46
  252. ccxt/yobit.py +20 -20
  253. ccxt/zaif.py +12 -12
  254. ccxt/zonda.py +22 -22
  255. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/METADATA +4 -4
  256. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/RECORD +258 -258
  257. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/WHEEL +0 -0
  258. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/top_level.txt +0 -0
ccxt/async_support/htx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.htx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- 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
10
+ 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
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -1484,7 +1484,7 @@ class htx(Exchange, ImplicitAPI):
1484
1484
  #
1485
1485
  return self.safe_integer_2(response, 'data', 'ts')
1486
1486
 
1487
- def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1487
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1488
1488
  #
1489
1489
  # {
1490
1490
  # "symbol":"btcusdt",
@@ -1513,7 +1513,7 @@ class htx(Exchange, ImplicitAPI):
1513
1513
  """
1514
1514
  await self.load_markets()
1515
1515
  market = self.market(symbol)
1516
- request = {
1516
+ request: dict = {
1517
1517
  'symbols': market['id'], # trading symbols comma-separated
1518
1518
  }
1519
1519
  response = await self.spotPrivateGetV2ReferenceTransactFeeRate(self.extend(request, params))
@@ -1543,14 +1543,14 @@ class htx(Exchange, ImplicitAPI):
1543
1543
  await self.load_markets()
1544
1544
  if symbols is None:
1545
1545
  symbols = self.symbols
1546
- result = {}
1546
+ result: dict = {}
1547
1547
  for i in range(0, len(symbols)):
1548
1548
  symbol = symbols[i]
1549
1549
  result[symbol] = await self.fetch_trading_limits_by_id(self.market_id(symbol), params)
1550
1550
  return result
1551
1551
 
1552
1552
  async def fetch_trading_limits_by_id(self, id: str, params={}):
1553
- request = {
1553
+ request: dict = {
1554
1554
  'symbol': id,
1555
1555
  }
1556
1556
  response = await self.spotPublicGetV1CommonExchange(self.extend(request, params))
@@ -1629,7 +1629,7 @@ class htx(Exchange, ImplicitAPI):
1629
1629
 
1630
1630
  async def fetch_markets_by_type_and_sub_type(self, type, subType, params={}):
1631
1631
  isSpot = (type == 'spot')
1632
- request = {}
1632
+ request: dict = {}
1633
1633
  response = None
1634
1634
  if not isSpot:
1635
1635
  if subType == 'linear':
@@ -1910,7 +1910,7 @@ class htx(Exchange, ImplicitAPI):
1910
1910
  if symbolOrMarketId in futureMarketIdsForSymbols:
1911
1911
  return futureMarketIdsForSymbols[symbolOrMarketId]
1912
1912
  futureMarkets = self.filter_by(self.markets, 'future', True)
1913
- futuresCharsMaps = {
1913
+ futuresCharsMaps: dict = {
1914
1914
  'this_week': 'CW',
1915
1915
  'next_week': 'NW',
1916
1916
  'quarter': 'CQ',
@@ -2035,7 +2035,7 @@ class htx(Exchange, ImplicitAPI):
2035
2035
  """
2036
2036
  await self.load_markets()
2037
2037
  market = self.market(symbol)
2038
- request = {}
2038
+ request: dict = {}
2039
2039
  response = None
2040
2040
  if market['linear']:
2041
2041
  request['contract_code'] = market['id']
@@ -2122,7 +2122,7 @@ class htx(Exchange, ImplicitAPI):
2122
2122
  subType = None
2123
2123
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2124
2124
  subType, params = self.handle_sub_type_and_params('fetchTickers', market, params)
2125
- request = {}
2125
+ request: dict = {}
2126
2126
  isSpot = (type == 'spot')
2127
2127
  future = (type == 'future')
2128
2128
  swap = (type == 'swap')
@@ -2329,7 +2329,7 @@ class htx(Exchange, ImplicitAPI):
2329
2329
  """
2330
2330
  await self.load_markets()
2331
2331
  market = self.market(symbol)
2332
- request = {
2332
+ request: dict = {
2333
2333
  #
2334
2334
  # from the API docs
2335
2335
  #
@@ -2399,7 +2399,7 @@ class htx(Exchange, ImplicitAPI):
2399
2399
  return result
2400
2400
  raise ExchangeError(self.id + ' fetchOrderBook() returned unrecognized response: ' + self.json(response))
2401
2401
 
2402
- def parse_trade(self, trade, market: Market = None) -> Trade:
2402
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
2403
2403
  #
2404
2404
  # spot fetchTrades(public)
2405
2405
  #
@@ -2551,7 +2551,7 @@ class htx(Exchange, ImplicitAPI):
2551
2551
 
2552
2552
  async def fetch_spot_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2553
2553
  await self.load_markets()
2554
- request = {
2554
+ request: dict = {
2555
2555
  'order-id': id,
2556
2556
  }
2557
2557
  response = await self.spotPrivateGetV1OrderOrdersOrderIdMatchresults(self.extend(request, params))
@@ -2581,7 +2581,7 @@ class htx(Exchange, ImplicitAPI):
2581
2581
  market = self.market(symbol)
2582
2582
  marketType = None
2583
2583
  marketType, params = self.handle_market_type_and_params('fetchMyTrades', market, params)
2584
- request = {
2584
+ request: dict = {
2585
2585
  # spot -----------------------------------------------------------
2586
2586
  # 'symbol': market['id'],
2587
2587
  # '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',
@@ -2725,7 +2725,7 @@ class htx(Exchange, ImplicitAPI):
2725
2725
  """
2726
2726
  await self.load_markets()
2727
2727
  market = self.market(symbol)
2728
- request = {
2728
+ request: dict = {
2729
2729
  # 'symbol': market['id'], # spot, future
2730
2730
  # 'contract_code': market['id'], # swap
2731
2731
  }
@@ -2826,7 +2826,7 @@ class htx(Exchange, ImplicitAPI):
2826
2826
  if paginate:
2827
2827
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000)
2828
2828
  market = self.market(symbol)
2829
- request = {
2829
+ request: dict = {
2830
2830
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
2831
2831
  # 'symbol': market['id'], # spot, future
2832
2832
  # 'contract_code': market['id'], # swap
@@ -3039,7 +3039,7 @@ class htx(Exchange, ImplicitAPI):
3039
3039
  # }
3040
3040
  #
3041
3041
  data = self.safe_value(response, 'data', [])
3042
- result = {}
3042
+ result: dict = {}
3043
3043
  self.options['networkChainIdsByNames'] = {}
3044
3044
  self.options['networkNamesByChainIds'] = {}
3045
3045
  for i in range(0, len(data)):
@@ -3048,7 +3048,7 @@ class htx(Exchange, ImplicitAPI):
3048
3048
  code = self.safe_currency_code(currencyId)
3049
3049
  self.options['networkChainIdsByNames'][code] = {}
3050
3050
  chains = self.safe_value(entry, 'chains', [])
3051
- networks = {}
3051
+ networks: dict = {}
3052
3052
  instStatus = self.safe_string(entry, 'instStatus')
3053
3053
  currencyActive = instStatus == 'normal'
3054
3054
  minPrecision = None
@@ -3167,7 +3167,7 @@ class htx(Exchange, ImplicitAPI):
3167
3167
  options = self.safe_value(self.options, 'fetchBalance', {})
3168
3168
  isUnifiedAccount = self.safe_value_2(params, 'isUnifiedAccount', 'unified', False)
3169
3169
  params = self.omit(params, ['isUnifiedAccount', 'unified'])
3170
- request = {}
3170
+ request: dict = {}
3171
3171
  spot = (type == 'spot')
3172
3172
  future = (type == 'future')
3173
3173
  defaultSubType = self.safe_string_2(self.options, 'defaultSubType', 'subType', 'linear')
@@ -3364,7 +3364,7 @@ class htx(Exchange, ImplicitAPI):
3364
3364
  #
3365
3365
  # TODO add balance parsing for linear swap
3366
3366
  #
3367
- result = {'info': response}
3367
+ result: dict = {'info': response}
3368
3368
  data = self.safe_value(response, 'data')
3369
3369
  if spot or margin:
3370
3370
  if isolated:
@@ -3372,7 +3372,7 @@ class htx(Exchange, ImplicitAPI):
3372
3372
  entry = data[i]
3373
3373
  symbol = self.safe_symbol(self.safe_string(entry, 'symbol'))
3374
3374
  balances = self.safe_value(entry, 'list')
3375
- subResult = {}
3375
+ subResult: dict = {}
3376
3376
  for j in range(0, len(balances)):
3377
3377
  balance = balances[j]
3378
3378
  currencyId = self.safe_string(balance, 'currency')
@@ -3397,7 +3397,7 @@ class htx(Exchange, ImplicitAPI):
3397
3397
  for j in range(0, len(isolated_swap)):
3398
3398
  balance = isolated_swap[j]
3399
3399
  marketId = self.safe_string(balance, 'contract_code')
3400
- subBalance = {
3400
+ subBalance: dict = {
3401
3401
  'code': currencyCode,
3402
3402
  'free': self.safe_number(balance, 'margin_available'),
3403
3403
  }
@@ -3427,7 +3427,7 @@ class htx(Exchange, ImplicitAPI):
3427
3427
  account = self.account()
3428
3428
  account['free'] = self.safe_string(balance, 'margin_balance')
3429
3429
  account['used'] = self.safe_string(balance, 'margin_frozen')
3430
- accountsByCode = {}
3430
+ accountsByCode: dict = {}
3431
3431
  accountsByCode[code] = account
3432
3432
  symbol = market['symbol']
3433
3433
  result[symbol] = self.safe_balance(accountsByCode)
@@ -3464,7 +3464,7 @@ class htx(Exchange, ImplicitAPI):
3464
3464
  market = self.market(symbol)
3465
3465
  marketType = None
3466
3466
  marketType, params = self.handle_market_type_and_params('fetchOrder', market, params)
3467
- request = {
3467
+ request: dict = {
3468
3468
  # spot -----------------------------------------------------------
3469
3469
  # 'order-id': 'id',
3470
3470
  # 'symbol': market['id'],
@@ -3663,7 +3663,7 @@ class htx(Exchange, ImplicitAPI):
3663
3663
  raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
3664
3664
  await self.load_markets()
3665
3665
  market = None
3666
- request = {
3666
+ request: dict = {
3667
3667
  # spot_private_get_v1_order_orders GET /v1/order/orders ----------
3668
3668
  # 'symbol': market['id'], # required
3669
3669
  # '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',
@@ -3734,7 +3734,7 @@ class htx(Exchange, ImplicitAPI):
3734
3734
  raise ArgumentsRequired(self.id + ' fetchContractOrders() requires a symbol argument')
3735
3735
  await self.load_markets()
3736
3736
  market = self.market(symbol)
3737
- request = {
3737
+ request: dict = {
3738
3738
  # POST /api/v1/contract_hisorders inverse futures ----------------
3739
3739
  # 'symbol': market['settleId'], # BTC, ETH, ...
3740
3740
  # '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
@@ -3951,7 +3951,7 @@ class htx(Exchange, ImplicitAPI):
3951
3951
  return self.parse_orders(orders, market, since, limit)
3952
3952
 
3953
3953
  async def fetch_closed_contract_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
3954
- request = {
3954
+ request: dict = {
3955
3955
  'status': '5,6,7', # comma separated, 0 all, 3 submitted orders, 4 partially matched, 5 partially cancelled, 6 fully matched and closed, 7 canceled
3956
3956
  }
3957
3957
  return await self.fetch_contract_orders(symbol, since, limit, self.extend(request, params))
@@ -4040,7 +4040,7 @@ class htx(Exchange, ImplicitAPI):
4040
4040
  market = None
4041
4041
  if symbol is not None:
4042
4042
  market = self.market(symbol)
4043
- request = {}
4043
+ request: dict = {}
4044
4044
  marketType = None
4045
4045
  marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
4046
4046
  response = None
@@ -4304,8 +4304,8 @@ class htx(Exchange, ImplicitAPI):
4304
4304
  orders = self.safe_value(orders, 'orders', [])
4305
4305
  return self.parse_orders(orders, market, since, limit)
4306
4306
 
4307
- def parse_order_status(self, status):
4308
- statuses = {
4307
+ def parse_order_status(self, status: Str):
4308
+ statuses: dict = {
4309
4309
  # spot
4310
4310
  'partial-filled': 'open',
4311
4311
  'partial-canceled': 'canceled',
@@ -4325,7 +4325,7 @@ class htx(Exchange, ImplicitAPI):
4325
4325
  }
4326
4326
  return self.safe_string(statuses, status, status)
4327
4327
 
4328
- def parse_order(self, order, market: Market = None) -> Order:
4328
+ def parse_order(self, order: dict, market: Market = None) -> Order:
4329
4329
  #
4330
4330
  # spot
4331
4331
  #
@@ -4816,7 +4816,7 @@ class htx(Exchange, ImplicitAPI):
4816
4816
  marginMode = None
4817
4817
  marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
4818
4818
  accountId = await self.fetch_account_id_by_type(market['type'], marginMode, symbol)
4819
- request = {
4819
+ request: dict = {
4820
4820
  # spot -----------------------------------------------------------
4821
4821
  'account-id': accountId,
4822
4822
  'symbol': market['id'],
@@ -4916,7 +4916,7 @@ class htx(Exchange, ImplicitAPI):
4916
4916
  :returns dict: request to be sent to the exchange
4917
4917
  """
4918
4918
  market = self.market(symbol)
4919
- request = {
4919
+ request: dict = {
4920
4920
  'contract_code': market['id'],
4921
4921
  'volume': self.amount_to_precision(symbol, amount),
4922
4922
  'direction': side,
@@ -5181,7 +5181,7 @@ class htx(Exchange, ImplicitAPI):
5181
5181
  orderRequest = self.create_contract_order_request(marketId, type, side, amount, price, orderParams)
5182
5182
  orderRequest = self.omit(orderRequest, 'marginMode')
5183
5183
  ordersRequests.append(orderRequest)
5184
- request = {}
5184
+ request: dict = {}
5185
5185
  response = None
5186
5186
  if market['spot']:
5187
5187
  response = await self.privatePostOrderBatchOrders(ordersRequests)
@@ -5266,7 +5266,7 @@ class htx(Exchange, ImplicitAPI):
5266
5266
  market = self.market(symbol)
5267
5267
  marketType = None
5268
5268
  marketType, params = self.handle_market_type_and_params('cancelOrder', market, params)
5269
- request = {
5269
+ request: dict = {
5270
5270
  # spot -----------------------------------------------------------
5271
5271
  # 'order-id': 'id',
5272
5272
  # 'symbol': market['id'],
@@ -5388,7 +5388,7 @@ class htx(Exchange, ImplicitAPI):
5388
5388
  market = self.market(symbol)
5389
5389
  marketType = None
5390
5390
  marketType, params = self.handle_market_type_and_params('cancelOrders', market, params)
5391
- request = {
5391
+ request: dict = {
5392
5392
  # spot -----------------------------------------------------------
5393
5393
  # 'order-ids': ','.join(ids), # max 50
5394
5394
  # 'client-order-ids': ','.join(ids), # max 50
@@ -5535,7 +5535,7 @@ class htx(Exchange, ImplicitAPI):
5535
5535
  market = self.market(symbol)
5536
5536
  marketType = None
5537
5537
  marketType, params = self.handle_market_type_and_params('cancelAllOrders', market, params)
5538
- request = {
5538
+ request: dict = {
5539
5539
  # spot -----------------------------------------------------------
5540
5540
  # 'account-id': account['id'],
5541
5541
  # 'symbol': market['id'], # a list of comma-separated symbols, all symbols by default
@@ -5692,7 +5692,7 @@ class htx(Exchange, ImplicitAPI):
5692
5692
  """
5693
5693
  await self.load_markets()
5694
5694
  currency = self.currency(code)
5695
- request = {
5695
+ request: dict = {
5696
5696
  'currency': currency['id'],
5697
5697
  }
5698
5698
  response = await self.spotPrivateGetV2AccountDepositAddress(self.extend(request, params))
@@ -5730,7 +5730,7 @@ class htx(Exchange, ImplicitAPI):
5730
5730
  async def fetch_withdraw_addresses(self, code: str, note=None, networkCode=None, params={}):
5731
5731
  await self.load_markets()
5732
5732
  currency = self.currency(code)
5733
- request = {
5733
+ request: dict = {
5734
5734
  'currency': currency['id'],
5735
5735
  }
5736
5736
  response = await self.spotPrivateGetV2AccountWithdrawAddress(self.extend(request, params))
@@ -5774,7 +5774,7 @@ class htx(Exchange, ImplicitAPI):
5774
5774
  currency = None
5775
5775
  if code is not None:
5776
5776
  currency = self.currency(code)
5777
- request = {
5777
+ request: dict = {
5778
5778
  'type': 'deposit',
5779
5779
  'direct': 'next',
5780
5780
  'from': 0, # From 'id' ... if you want to get results after a particular transaction id, pass the id in params.from
@@ -5827,7 +5827,7 @@ class htx(Exchange, ImplicitAPI):
5827
5827
  currency = None
5828
5828
  if code is not None:
5829
5829
  currency = self.currency(code)
5830
- request = {
5830
+ request: dict = {
5831
5831
  'type': 'withdraw',
5832
5832
  'direct': 'next',
5833
5833
  'from': 0, # From 'id' ... if you want to get results after a particular transaction id, pass the id in params.from
@@ -5863,7 +5863,7 @@ class htx(Exchange, ImplicitAPI):
5863
5863
  #
5864
5864
  return self.parse_transactions(response['data'], currency, since, limit)
5865
5865
 
5866
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
5866
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
5867
5867
  #
5868
5868
  # fetchDeposits
5869
5869
  #
@@ -5956,7 +5956,7 @@ class htx(Exchange, ImplicitAPI):
5956
5956
  }
5957
5957
 
5958
5958
  def parse_transaction_status(self, status):
5959
- statuses = {
5959
+ statuses: dict = {
5960
5960
  # deposit statuses
5961
5961
  'unknown': 'failed',
5962
5962
  'confirming': 'pending',
@@ -5992,7 +5992,7 @@ class htx(Exchange, ImplicitAPI):
5992
5992
  await self.load_markets()
5993
5993
  self.check_address(address)
5994
5994
  currency = self.currency(code)
5995
- request = {
5995
+ request: dict = {
5996
5996
  'address': address, # only supports existing addresses in your withdraw address list
5997
5997
  'currency': currency['id'].lower(),
5998
5998
  }
@@ -6075,7 +6075,7 @@ class htx(Exchange, ImplicitAPI):
6075
6075
  """
6076
6076
  await self.load_markets()
6077
6077
  currency = self.currency(code)
6078
- request = {
6078
+ request: dict = {
6079
6079
  'currency': currency['id'],
6080
6080
  'amount': float(self.currency_to_precision(code, amount)),
6081
6081
  }
@@ -6239,7 +6239,7 @@ class htx(Exchange, ImplicitAPI):
6239
6239
  return await self.fetch_paginated_call_cursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50)
6240
6240
  await self.load_markets()
6241
6241
  market = self.market(symbol)
6242
- request = {
6242
+ request: dict = {
6243
6243
  'contract_code': market['id'],
6244
6244
  }
6245
6245
  response = None
@@ -6341,7 +6341,7 @@ class htx(Exchange, ImplicitAPI):
6341
6341
  """
6342
6342
  await self.load_markets()
6343
6343
  market = self.market(symbol)
6344
- request = {
6344
+ request: dict = {
6345
6345
  'contract_code': market['id'],
6346
6346
  }
6347
6347
  response = None
@@ -6382,7 +6382,7 @@ class htx(Exchange, ImplicitAPI):
6382
6382
  defaultSubType = self.safe_string(self.options, 'defaultSubType', 'inverse')
6383
6383
  subType = self.safe_string(options, 'subType', defaultSubType)
6384
6384
  subType = self.safe_string(params, 'subType', subType)
6385
- request = {
6385
+ request: dict = {
6386
6386
  # 'contract_code': market['id'],
6387
6387
  }
6388
6388
  params = self.omit(params, 'subType')
@@ -6429,7 +6429,7 @@ class htx(Exchange, ImplicitAPI):
6429
6429
  marginMode = None
6430
6430
  marginMode, params = self.handle_margin_mode_and_params('fetchBorrowInterest', params)
6431
6431
  marginMode = 'cross' if (marginMode is None) else marginMode
6432
- request = {}
6432
+ request: dict = {}
6433
6433
  if since is not None:
6434
6434
  request['start-date'] = self.yyyymmdd(since)
6435
6435
  if limit is not None:
@@ -6472,7 +6472,7 @@ class htx(Exchange, ImplicitAPI):
6472
6472
  interest = self.parse_borrow_interests(data, market)
6473
6473
  return self.filter_by_currency_since_limit(interest, code, since, limit)
6474
6474
 
6475
- def parse_borrow_interest(self, info, market: Market = None):
6475
+ def parse_borrow_interest(self, info: dict, market: Market = None):
6476
6476
  # isolated
6477
6477
  # {
6478
6478
  # "interest-rate":"0.000040830000000000",
@@ -6545,7 +6545,7 @@ class htx(Exchange, ImplicitAPI):
6545
6545
  if api == 'private' or api == 'v2Private':
6546
6546
  self.check_required_credentials()
6547
6547
  timestamp = self.ymdhms(self.milliseconds(), 'T')
6548
- request = {
6548
+ request: dict = {
6549
6549
  'SignatureMethod': 'HmacSHA256',
6550
6550
  'SignatureVersion': '2',
6551
6551
  'AccessKeyId': self.apiKey,
@@ -6609,7 +6609,7 @@ class htx(Exchange, ImplicitAPI):
6609
6609
  if clientOrderId is None:
6610
6610
  params['client-order-id'] = id + self.uuid()
6611
6611
  timestamp = self.ymdhms(self.milliseconds(), 'T')
6612
- request = {
6612
+ request: dict = {
6613
6613
  'SignatureMethod': 'HmacSHA256',
6614
6614
  'SignatureVersion': '2',
6615
6615
  'AccessKeyId': self.apiKey,
@@ -6678,7 +6678,7 @@ class htx(Exchange, ImplicitAPI):
6678
6678
  await self.load_markets()
6679
6679
  market = self.market(symbol)
6680
6680
  marketType, query = self.handle_market_type_and_params('fetchFundingHistory', market, params)
6681
- request = {
6681
+ request: dict = {
6682
6682
  'type': '30,31',
6683
6683
  }
6684
6684
  if since is not None:
@@ -6758,7 +6758,7 @@ class htx(Exchange, ImplicitAPI):
6758
6758
  await self.load_markets()
6759
6759
  market = self.market(symbol)
6760
6760
  marketType, query = self.handle_market_type_and_params('setLeverage', market, params)
6761
- request = {
6761
+ request: dict = {
6762
6762
  'lever_rate': leverage,
6763
6763
  }
6764
6764
  if marketType == 'future' and market['inverse']:
@@ -6840,7 +6840,7 @@ class htx(Exchange, ImplicitAPI):
6840
6840
  'amount': amount,
6841
6841
  }
6842
6842
 
6843
- def parse_position(self, position, market: Market = None):
6843
+ def parse_position(self, position: dict, market: Market = None):
6844
6844
  #
6845
6845
  # {
6846
6846
  # "symbol": "BTC",
@@ -7068,7 +7068,7 @@ class htx(Exchange, ImplicitAPI):
7068
7068
  marginMode, params = self.handle_margin_mode_and_params('fetchPosition', params)
7069
7069
  marginMode = 'cross' if (marginMode is None) else marginMode
7070
7070
  marketType, query = self.handle_market_type_and_params('fetchPosition', market, params)
7071
- request = {}
7071
+ request: dict = {}
7072
7072
  if market['future'] and market['inverse']:
7073
7073
  request['symbol'] = market['settleId']
7074
7074
  else:
@@ -7300,7 +7300,7 @@ class htx(Exchange, ImplicitAPI):
7300
7300
  return parsed
7301
7301
 
7302
7302
  def parse_ledger_entry_type(self, type):
7303
- types = {
7303
+ types: dict = {
7304
7304
  'trade': 'trade',
7305
7305
  'etf': 'trade',
7306
7306
  'transact-fee': 'fee',
@@ -7318,7 +7318,7 @@ class htx(Exchange, ImplicitAPI):
7318
7318
  }
7319
7319
  return self.safe_string(types, type, type)
7320
7320
 
7321
- def parse_ledger_entry(self, item, currency: Currency = None):
7321
+ def parse_ledger_entry(self, item: dict, currency: Currency = None):
7322
7322
  #
7323
7323
  # {
7324
7324
  # "accountId": 10000001,
@@ -7378,7 +7378,7 @@ class htx(Exchange, ImplicitAPI):
7378
7378
  if paginate:
7379
7379
  return await self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params, 500)
7380
7380
  accountId = await self.fetch_account_id_by_type('spot', None, None, params)
7381
- request = {
7381
+ request: dict = {
7382
7382
  'accountId': accountId,
7383
7383
  # 'currency': code,
7384
7384
  # 'transactTypes': 'all', # default all
@@ -7433,7 +7433,7 @@ class htx(Exchange, ImplicitAPI):
7433
7433
  data = self.safe_value(response, 'data', [])
7434
7434
  return self.parse_ledger(data, currency, since, limit)
7435
7435
 
7436
- async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
7436
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
7437
7437
  """
7438
7438
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
7439
7439
  :param str[]|None symbols: list of unified market symbols
@@ -7474,7 +7474,7 @@ class htx(Exchange, ImplicitAPI):
7474
7474
  data = self.safe_list(response, 'data')
7475
7475
  return self.parse_leverage_tiers(data, symbols, 'contract_code')
7476
7476
 
7477
- async def fetch_market_leverage_tiers(self, symbol: str, params={}):
7477
+ async def fetch_market_leverage_tiers(self, symbol: str, params={}) -> List[LeverageTier]:
7478
7478
  """
7479
7479
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
7480
7480
  :param str symbol: unified market symbol
@@ -7482,7 +7482,7 @@ class htx(Exchange, ImplicitAPI):
7482
7482
  :returns dict: a `leverage tiers structure <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`
7483
7483
  """
7484
7484
  await self.load_markets()
7485
- request = {}
7485
+ request: dict = {}
7486
7486
  if symbol is not None:
7487
7487
  market = self.market(symbol)
7488
7488
  if not market['contract']:
@@ -7523,7 +7523,7 @@ class htx(Exchange, ImplicitAPI):
7523
7523
  return self.safe_value(tiers, symbol)
7524
7524
 
7525
7525
  def parse_leverage_tiers(self, response, symbols: Strings = None, marketIdKey=None):
7526
- result = {}
7526
+ result: dict = {}
7527
7527
  for i in range(0, len(response)):
7528
7528
  item = response[i]
7529
7529
  list = self.safe_value(item, 'list', [])
@@ -7569,7 +7569,7 @@ class htx(Exchange, ImplicitAPI):
7569
7569
  if timeframe != '1h' and timeframe != '4h' and timeframe != '12h' and timeframe != '1d':
7570
7570
  raise BadRequest(self.id + ' fetchOpenInterestHistory cannot only use the 1h, 4h, 12h and 1d timeframe')
7571
7571
  await self.load_markets()
7572
- timeframes = {
7572
+ timeframes: dict = {
7573
7573
  '1h': '60min',
7574
7574
  '4h': '4hour',
7575
7575
  '12h': '12hour',
@@ -7577,7 +7577,7 @@ class htx(Exchange, ImplicitAPI):
7577
7577
  }
7578
7578
  market = self.market(symbol)
7579
7579
  amountType = self.safe_integer_2(params, 'amount_type', 'amountType', 2)
7580
- request = {
7580
+ request: dict = {
7581
7581
  'period': timeframes[timeframe],
7582
7582
  'amount_type': amountType,
7583
7583
  }
@@ -7679,7 +7679,7 @@ class htx(Exchange, ImplicitAPI):
7679
7679
  raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
7680
7680
  if market['option']:
7681
7681
  raise NotSupported(self.id + ' fetchOpenInterest() does not currently support option markets')
7682
- request = {
7682
+ request: dict = {
7683
7683
  'contract_code': market['id'],
7684
7684
  }
7685
7685
  response = None
@@ -7844,7 +7844,7 @@ class htx(Exchange, ImplicitAPI):
7844
7844
  await self.load_markets()
7845
7845
  currency = self.currency(code)
7846
7846
  market = self.market(symbol)
7847
- request = {
7847
+ request: dict = {
7848
7848
  'currency': currency['id'],
7849
7849
  'amount': self.currency_to_precision(code, amount),
7850
7850
  'symbol': market['id'],
@@ -7875,7 +7875,7 @@ class htx(Exchange, ImplicitAPI):
7875
7875
  """
7876
7876
  await self.load_markets()
7877
7877
  currency = self.currency(code)
7878
- request = {
7878
+ request: dict = {
7879
7879
  'currency': currency['id'],
7880
7880
  'amount': self.currency_to_precision(code, amount),
7881
7881
  }
@@ -7906,7 +7906,7 @@ class htx(Exchange, ImplicitAPI):
7906
7906
  await self.load_markets()
7907
7907
  currency = self.currency(code)
7908
7908
  accountId = await self.fetch_account_id_by_type('spot', 'isolated', symbol, params)
7909
- request = {
7909
+ request: dict = {
7910
7910
  'currency': currency['id'],
7911
7911
  'amount': self.currency_to_precision(code, amount),
7912
7912
  'accountId': accountId,
@@ -7943,7 +7943,7 @@ class htx(Exchange, ImplicitAPI):
7943
7943
  await self.load_markets()
7944
7944
  currency = self.currency(code)
7945
7945
  accountId = await self.fetch_account_id_by_type('spot', 'cross', None, params)
7946
- request = {
7946
+ request: dict = {
7947
7947
  'currency': currency['id'],
7948
7948
  'amount': self.currency_to_precision(code, amount),
7949
7949
  'accountId': accountId,
@@ -8017,7 +8017,7 @@ class htx(Exchange, ImplicitAPI):
8017
8017
  until = self.safe_integer(params, 'until')
8018
8018
  params = self.omit(params, ['until'])
8019
8019
  market = self.market(symbol)
8020
- request = {}
8020
+ request: dict = {}
8021
8021
  if market['future']:
8022
8022
  request['symbol'] = market['baseId']
8023
8023
  else:
@@ -8248,7 +8248,7 @@ class htx(Exchange, ImplicitAPI):
8248
8248
  list = self.safe_value(settlement, 'list')
8249
8249
  if list is not None:
8250
8250
  timestamp = self.safe_integer(settlement, 'settlement_time')
8251
- timestampDetails = {
8251
+ timestampDetails: dict = {
8252
8252
  'timestamp': timestamp,
8253
8253
  'datetime': self.iso8601(timestamp),
8254
8254
  }
@@ -8311,7 +8311,7 @@ class htx(Exchange, ImplicitAPI):
8311
8311
  await self.load_markets()
8312
8312
  market = self.market(symbol)
8313
8313
  tradeType = self.safe_integer(params, 'trade_type', 0)
8314
- request = {
8314
+ request: dict = {
8315
8315
  'trade_type': tradeType,
8316
8316
  }
8317
8317
  if since is not None:
@@ -8404,7 +8404,7 @@ class htx(Exchange, ImplicitAPI):
8404
8404
  market = self.market(symbol)
8405
8405
  marginMode = None
8406
8406
  marginMode, params = self.handle_margin_mode_and_params('setPositionMode', params, 'cross')
8407
- request = {
8407
+ request: dict = {
8408
8408
  'position_mode': posMode,
8409
8409
  }
8410
8410
  response = None