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
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
11
+ from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -866,6 +866,7 @@ class binance(Exchange, ImplicitAPI):
866
866
  'order/asyn/id': 10,
867
867
  'trade/asyn': 1000,
868
868
  'trade/asyn/id': 10,
869
+ 'feeBurn': 1,
869
870
  },
870
871
  'post': {
871
872
  'batchOrders': 5,
@@ -880,6 +881,7 @@ class binance(Exchange, ImplicitAPI):
880
881
  # broker endpoints
881
882
  'apiReferral/customization': 1,
882
883
  'apiReferral/userCustomization': 1,
884
+ 'feeBurn': 1,
883
885
  },
884
886
  'put': {
885
887
  'listenKey': 1,
@@ -2627,7 +2629,7 @@ class binance(Exchange, ImplicitAPI):
2627
2629
  if apiBackup is not None:
2628
2630
  return None
2629
2631
  response = await self.sapiGetCapitalConfigGetall(params)
2630
- result = {}
2632
+ result: dict = {}
2631
2633
  for i in range(0, len(response)):
2632
2634
  #
2633
2635
  # {
@@ -2732,9 +2734,9 @@ class binance(Exchange, ImplicitAPI):
2732
2734
  isWithdrawEnabled = True
2733
2735
  isDepositEnabled = True
2734
2736
  networkList = self.safe_list(entry, 'networkList', [])
2735
- fees = {}
2737
+ fees: dict = {}
2736
2738
  fee = None
2737
- networks = {}
2739
+ networks: dict = {}
2738
2740
  for j in range(0, len(networkList)):
2739
2741
  networkItem = networkList[j]
2740
2742
  network = self.safe_string(networkItem, 'network')
@@ -3259,7 +3261,7 @@ class binance(Exchange, ImplicitAPI):
3259
3261
  quote = self.safe_dict(asset, 'quoteAsset', {})
3260
3262
  baseCode = self.safe_currency_code(self.safe_string(base, 'asset'))
3261
3263
  quoteCode = self.safe_currency_code(self.safe_string(quote, 'asset'))
3262
- subResult = {}
3264
+ subResult: dict = {}
3263
3265
  subResult[baseCode] = self.parse_balance_helper(base)
3264
3266
  subResult[quoteCode] = self.parse_balance_helper(quote)
3265
3267
  result[symbol] = self.safe_balance(subResult)
@@ -3335,7 +3337,7 @@ class binance(Exchange, ImplicitAPI):
3335
3337
  marginMode, query = self.handle_margin_mode_and_params('fetchBalance', params)
3336
3338
  query = self.omit(query, 'type')
3337
3339
  response = None
3338
- request = {}
3340
+ request: dict = {}
3339
3341
  if isPortfolioMargin or (type == 'papi'):
3340
3342
  if self.is_linear(type, subType):
3341
3343
  type = 'linear'
@@ -3593,7 +3595,7 @@ class binance(Exchange, ImplicitAPI):
3593
3595
  """
3594
3596
  await self.load_markets()
3595
3597
  market = self.market(symbol)
3596
- request = {
3598
+ request: dict = {
3597
3599
  'symbol': market['id'],
3598
3600
  }
3599
3601
  if limit is not None:
@@ -3831,7 +3833,7 @@ class binance(Exchange, ImplicitAPI):
3831
3833
  """
3832
3834
  await self.load_markets()
3833
3835
  market = self.market(symbol)
3834
- request = {
3836
+ request: dict = {
3835
3837
  'symbol': market['id'],
3836
3838
  }
3837
3839
  response = None
@@ -3877,7 +3879,7 @@ class binance(Exchange, ImplicitAPI):
3877
3879
  elif self.is_inverse(type, subType):
3878
3880
  response = await self.dapiPublicGetTickerBookTicker(params)
3879
3881
  elif type == 'spot':
3880
- request = {}
3882
+ request: dict = {}
3881
3883
  if symbols is not None:
3882
3884
  request['symbols'] = self.json(self.market_ids(symbols))
3883
3885
  response = await self.publicGetTickerBookTicker(self.extend(request, params))
@@ -4010,7 +4012,7 @@ class binance(Exchange, ImplicitAPI):
4010
4012
  elif self.is_inverse(type, subType):
4011
4013
  response = await self.dapiPublicGetTicker24hr(params)
4012
4014
  elif type == 'spot':
4013
- request = {}
4015
+ request: dict = {}
4014
4016
  if symbols is not None:
4015
4017
  request['symbols'] = self.json(self.market_ids(symbols))
4016
4018
  response = await self.publicGetTicker24hr(self.extend(request, params))
@@ -4118,7 +4120,7 @@ class binance(Exchange, ImplicitAPI):
4118
4120
  until = self.safe_integer(params, 'until')
4119
4121
  params = self.omit(params, ['price', 'until'])
4120
4122
  limit = defaultLimit if (limit is None) else min(limit, maxLimit)
4121
- request = {
4123
+ request: dict = {
4122
4124
  'interval': self.safe_string(self.timeframes, timeframe, timeframe),
4123
4125
  'limit': limit,
4124
4126
  }
@@ -4196,7 +4198,7 @@ class binance(Exchange, ImplicitAPI):
4196
4198
  #
4197
4199
  return self.parse_ohlcvs(response, market, timeframe, since, limit)
4198
4200
 
4199
- def parse_trade(self, trade, market: Market = None) -> Trade:
4201
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
4200
4202
  if 'isDustTrade' in trade:
4201
4203
  return self.parse_dust_trade(trade, market)
4202
4204
  #
@@ -4487,7 +4489,7 @@ class binance(Exchange, ImplicitAPI):
4487
4489
  if paginate:
4488
4490
  return await self.fetch_paginated_call_dynamic('fetchTrades', symbol, since, limit, params)
4489
4491
  market = self.market(symbol)
4490
- request = {
4492
+ request: dict = {
4491
4493
  'symbol': market['id'],
4492
4494
  # 'fromId': 123, # ID to get aggregate trades from INCLUSIVE.
4493
4495
  # 'startTime': 456, # Timestamp in ms to get aggregate trades from INCLUSIVE.
@@ -4665,7 +4667,7 @@ class binance(Exchange, ImplicitAPI):
4665
4667
  """
4666
4668
  market = self.market(symbol)
4667
4669
  clientOrderId = self.safe_string_n(params, ['newClientOrderId', 'clientOrderId', 'origClientOrderId'])
4668
- request = {
4670
+ request: dict = {
4669
4671
  'symbol': market['id'],
4670
4672
  'side': side.upper(),
4671
4673
  }
@@ -4758,7 +4760,7 @@ class binance(Exchange, ImplicitAPI):
4758
4760
  market = self.market(symbol)
4759
4761
  if not market['contract']:
4760
4762
  raise NotSupported(self.id + ' editContractOrder() does not support ' + market['type'] + ' orders')
4761
- request = {
4763
+ request: dict = {
4762
4764
  'symbol': market['id'],
4763
4765
  'side': side.upper(),
4764
4766
  }
@@ -4847,8 +4849,8 @@ class binance(Exchange, ImplicitAPI):
4847
4849
  else:
4848
4850
  return await self.edit_contract_order(id, symbol, type, side, amount, price, params)
4849
4851
 
4850
- def parse_order_status(self, status):
4851
- statuses = {
4852
+ def parse_order_status(self, status: Str):
4853
+ statuses: dict = {
4852
4854
  'NEW': 'open',
4853
4855
  'PARTIALLY_FILLED': 'open',
4854
4856
  'ACCEPTED': 'open',
@@ -4862,7 +4864,7 @@ class binance(Exchange, ImplicitAPI):
4862
4864
  }
4863
4865
  return self.safe_string(statuses, status, status)
4864
4866
 
4865
- def parse_order(self, order, market: Market = None) -> Order:
4867
+ def parse_order(self, order: dict, market: Market = None) -> Order:
4866
4868
  #
4867
4869
  # spot
4868
4870
  #
@@ -5445,7 +5447,7 @@ class binance(Exchange, ImplicitAPI):
5445
5447
  if market['spot']:
5446
5448
  raise NotSupported(self.id + ' createOrders() does not support ' + market['type'] + ' orders')
5447
5449
  response = None
5448
- request = {
5450
+ request: dict = {
5449
5451
  'batchOrders': ordersRequests,
5450
5452
  }
5451
5453
  request = self.extend(request, params)
@@ -5600,7 +5602,7 @@ class binance(Exchange, ImplicitAPI):
5600
5602
  initialUppercaseType = type.upper()
5601
5603
  isMarketOrder = initialUppercaseType == 'MARKET'
5602
5604
  isLimitOrder = initialUppercaseType == 'LIMIT'
5603
- request = {
5605
+ request: dict = {
5604
5606
  'symbol': market['id'],
5605
5607
  'side': side.upper(),
5606
5608
  }
@@ -5695,6 +5697,13 @@ class binance(Exchange, ImplicitAPI):
5695
5697
  uppercaseType = 'LIMIT_MAKER'
5696
5698
  if marginMode == 'isolated':
5697
5699
  request['isIsolated'] = True
5700
+ else:
5701
+ postOnly = self.is_post_only(isMarketOrder, initialUppercaseType == 'LIMIT_MAKER', params)
5702
+ if postOnly:
5703
+ if not market['contract']:
5704
+ uppercaseType = 'LIMIT_MAKER' # only self endpoint accepts GTXhttps://binance-docs.github.io/apidocs/pm/en/#new-margin-order-trade
5705
+ else:
5706
+ request['timeInForce'] = 'GTX'
5698
5707
  # handle newOrderRespType response type
5699
5708
  if ((marketType == 'spot') or (marketType == 'margin')) and not isPortfolioMargin:
5700
5709
  request['newOrderRespType'] = self.safe_string(self.options['newOrderRespType'], type, 'FULL') # 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
@@ -5797,7 +5806,7 @@ class binance(Exchange, ImplicitAPI):
5797
5806
  raise InvalidOrder(self.id + ' createOrder() requires a stopPrice, trailingDelta or trailingPercent param for a ' + type + ' order')
5798
5807
  if stopPrice is not None:
5799
5808
  request['stopPrice'] = self.price_to_precision(symbol, stopPrice)
5800
- if timeInForceIsRequired and (self.safe_string(params, 'timeInForce') is None):
5809
+ if timeInForceIsRequired and (self.safe_string(params, 'timeInForce') is None) and (self.safe_string(request, 'timeInForce') is None):
5801
5810
  request['timeInForce'] = self.options['defaultTimeInForce'] # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
5802
5811
  if not isPortfolioMargin and market['contract'] and postOnly:
5803
5812
  request['timeInForce'] = 'GTX'
@@ -5884,7 +5893,7 @@ class binance(Exchange, ImplicitAPI):
5884
5893
  marginMode, params = self.handle_margin_mode_and_params('fetchOrder', params)
5885
5894
  isPortfolioMargin = None
5886
5895
  isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchOrder', 'papi', 'portfolioMargin', False)
5887
- request = {
5896
+ request: dict = {
5888
5897
  'symbol': market['id'],
5889
5898
  }
5890
5899
  clientOrderId = self.safe_string_2(params, 'origClientOrderId', 'clientOrderId')
@@ -5960,7 +5969,7 @@ class binance(Exchange, ImplicitAPI):
5960
5969
  isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchOrders', 'papi', 'portfolioMargin', False)
5961
5970
  isConditional = self.safe_bool_2(params, 'stop', 'conditional')
5962
5971
  params = self.omit(params, ['stop', 'conditional', 'type'])
5963
- request = {
5972
+ request: dict = {
5964
5973
  'symbol': market['id'],
5965
5974
  }
5966
5975
  request, params = self.handle_until_option('endTime', request, params)
@@ -6208,7 +6217,7 @@ class binance(Exchange, ImplicitAPI):
6208
6217
  await self.load_markets()
6209
6218
  market = None
6210
6219
  type = None
6211
- request = {}
6220
+ request: dict = {}
6212
6221
  marginMode = None
6213
6222
  marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
6214
6223
  isPortfolioMargin = None
@@ -6286,7 +6295,7 @@ class binance(Exchange, ImplicitAPI):
6286
6295
  raise ArgumentsRequired(self.id + ' fetchOpenOrder() requires a symbol argument')
6287
6296
  await self.load_markets()
6288
6297
  market = self.market(symbol)
6289
- request = {
6298
+ request: dict = {
6290
6299
  'symbol': market['id'],
6291
6300
  }
6292
6301
  isPortfolioMargin = None
@@ -6582,7 +6591,7 @@ class binance(Exchange, ImplicitAPI):
6582
6591
  isPortfolioMargin = None
6583
6592
  isPortfolioMargin, params = self.handle_option_and_params_2(params, 'cancelOrder', 'papi', 'portfolioMargin', False)
6584
6593
  isConditional = self.safe_bool_2(params, 'stop', 'conditional')
6585
- request = {
6594
+ request: dict = {
6586
6595
  'symbol': market['id'],
6587
6596
  }
6588
6597
  clientOrderId = self.safe_string_n(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId'])
@@ -6654,7 +6663,7 @@ class binance(Exchange, ImplicitAPI):
6654
6663
  raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
6655
6664
  await self.load_markets()
6656
6665
  market = self.market(symbol)
6657
- request = {
6666
+ request: dict = {
6658
6667
  'symbol': market['id'],
6659
6668
  }
6660
6669
  isPortfolioMargin = None
@@ -6717,7 +6726,7 @@ class binance(Exchange, ImplicitAPI):
6717
6726
  market = self.market(symbol)
6718
6727
  if not market['contract']:
6719
6728
  raise BadRequest(self.id + ' cancelOrders is only supported for swap markets.')
6720
- request = {
6729
+ request: dict = {
6721
6730
  'symbol': market['id'],
6722
6731
  'orderidlist': ids,
6723
6732
  }
@@ -6785,7 +6794,7 @@ class binance(Exchange, ImplicitAPI):
6785
6794
  params = self.omit(params, 'type')
6786
6795
  if type != 'spot':
6787
6796
  raise NotSupported(self.id + ' fetchOrderTrades() supports spot markets only')
6788
- request = {
6797
+ request: dict = {
6789
6798
  'orderId': id,
6790
6799
  }
6791
6800
  return await self.fetch_my_trades(symbol, since, limit, self.extend(request, params))
@@ -6814,7 +6823,7 @@ class binance(Exchange, ImplicitAPI):
6814
6823
  paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
6815
6824
  if paginate:
6816
6825
  return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
6817
- request = {}
6826
+ request: dict = {}
6818
6827
  market = None
6819
6828
  type = None
6820
6829
  marginMode = None
@@ -7020,7 +7029,7 @@ class binance(Exchange, ImplicitAPI):
7020
7029
  # https://github.com/binance-exchange/binance-official-api-docs/blob/master/wapi-api.md#dustlog-user_data
7021
7030
  #
7022
7031
  await self.load_markets()
7023
- request = {}
7032
+ request: dict = {}
7024
7033
  if since is not None:
7025
7034
  request['startTime'] = since
7026
7035
  request['endTime'] = self.sum(since, 7776000000)
@@ -7158,7 +7167,7 @@ class binance(Exchange, ImplicitAPI):
7158
7167
  return await self.fetch_paginated_call_dynamic('fetchDeposits', code, since, limit, params)
7159
7168
  currency = None
7160
7169
  response = None
7161
- request = {}
7170
+ request: dict = {}
7162
7171
  legalMoney = self.safe_dict(self.options, 'legalMoney', {})
7163
7172
  fiatOnly = self.safe_bool(params, 'fiat', False)
7164
7173
  params = self.omit(params, 'fiatOnly')
@@ -7261,7 +7270,7 @@ class binance(Exchange, ImplicitAPI):
7261
7270
  legalMoney = self.safe_dict(self.options, 'legalMoney', {})
7262
7271
  fiatOnly = self.safe_bool(params, 'fiat', False)
7263
7272
  params = self.omit(params, 'fiatOnly')
7264
- request = {}
7273
+ request: dict = {}
7265
7274
  until = self.safe_integer(params, 'until')
7266
7275
  if until is not None:
7267
7276
  params = self.omit(params, 'until')
@@ -7361,7 +7370,7 @@ class binance(Exchange, ImplicitAPI):
7361
7370
  return self.parse_transactions(response, currency, since, limit)
7362
7371
 
7363
7372
  def parse_transaction_status_by_type(self, status, type=None):
7364
- statusesByType = {
7373
+ statusesByType: dict = {
7365
7374
  'deposit': {
7366
7375
  '0': 'pending',
7367
7376
  '1': 'ok',
@@ -7396,7 +7405,7 @@ class binance(Exchange, ImplicitAPI):
7396
7405
  statuses = self.safe_dict(statusesByType, type, {})
7397
7406
  return self.safe_string(statuses, status, status)
7398
7407
 
7399
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
7408
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
7400
7409
  #
7401
7410
  # fetchDeposits
7402
7411
  #
@@ -7519,7 +7528,7 @@ class binance(Exchange, ImplicitAPI):
7519
7528
  }
7520
7529
 
7521
7530
  def parse_transfer_status(self, status: Str) -> Str:
7522
- statuses = {
7531
+ statuses: dict = {
7523
7532
  'CONFIRMED': 'ok',
7524
7533
  }
7525
7534
  return self.safe_string(statuses, status, status)
@@ -7612,7 +7621,7 @@ class binance(Exchange, ImplicitAPI):
7612
7621
  """
7613
7622
  await self.load_markets()
7614
7623
  currency = self.currency(code)
7615
- request = {
7624
+ request: dict = {
7616
7625
  'asset': currency['id'],
7617
7626
  'amount': self.currency_to_precision(code, amount),
7618
7627
  }
@@ -7718,7 +7727,7 @@ class binance(Exchange, ImplicitAPI):
7718
7727
  keys = list(accountsByType.keys())
7719
7728
  raise ExchangeError(self.id + ' toAccount parameter must be one of ' + ', '.join(keys))
7720
7729
  type = fromId + '_' + toId
7721
- request = {
7730
+ request: dict = {
7722
7731
  'type': type,
7723
7732
  }
7724
7733
  if since is not None:
@@ -7758,7 +7767,7 @@ class binance(Exchange, ImplicitAPI):
7758
7767
  """
7759
7768
  await self.load_markets()
7760
7769
  currency = self.currency(code)
7761
- request = {
7770
+ request: dict = {
7762
7771
  'coin': currency['id'],
7763
7772
  # 'network': 'ETH', # 'BSC', 'XMR', you can get network and isDefault in networkList in the response of sapiGetCapitalConfigDetail
7764
7773
  }
@@ -7815,7 +7824,7 @@ class binance(Exchange, ImplicitAPI):
7815
7824
  'info': response,
7816
7825
  }
7817
7826
 
7818
- async def fetch_transaction_fees(self, codes: List[str] = None, params={}):
7827
+ async def fetch_transaction_fees(self, codes: Strings = None, params={}):
7819
7828
  """
7820
7829
  * @deprecated
7821
7830
  please use fetchDepositWithdrawFees instead
@@ -7907,7 +7916,7 @@ class binance(Exchange, ImplicitAPI):
7907
7916
  # }
7908
7917
  # ]
7909
7918
  #
7910
- withdrawFees = {}
7919
+ withdrawFees: dict = {}
7911
7920
  for i in range(0, len(response)):
7912
7921
  entry = response[i]
7913
7922
  currencyId = self.safe_string(entry, 'coin')
@@ -8061,7 +8070,7 @@ class binance(Exchange, ImplicitAPI):
8061
8070
  self.check_address(address)
8062
8071
  await self.load_markets()
8063
8072
  currency = self.currency(code)
8064
- request = {
8073
+ request: dict = {
8065
8074
  'coin': currency['id'],
8066
8075
  'address': address,
8067
8076
  'amount': amount,
@@ -8081,7 +8090,7 @@ class binance(Exchange, ImplicitAPI):
8081
8090
  # {id: '9a67628b16ba4988ae20d329333f16bc'}
8082
8091
  return self.parse_transaction(response, currency)
8083
8092
 
8084
- def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
8093
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
8085
8094
  #
8086
8095
  # spot
8087
8096
  # [
@@ -8133,7 +8142,7 @@ class binance(Exchange, ImplicitAPI):
8133
8142
  isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchTradingFee', 'papi', 'portfolioMargin', False)
8134
8143
  isLinear = self.is_linear(type, subType)
8135
8144
  isInverse = self.is_inverse(type, subType)
8136
- request = {
8145
+ request: dict = {
8137
8146
  'symbol': market['id'],
8138
8147
  }
8139
8148
  response = None
@@ -8261,7 +8270,7 @@ class binance(Exchange, ImplicitAPI):
8261
8270
  # },
8262
8271
  # ]
8263
8272
  #
8264
- result = {}
8273
+ result: dict = {}
8265
8274
  for i in range(0, len(response)):
8266
8275
  fee = self.parse_trading_fee(response[i])
8267
8276
  symbol = fee['symbol']
@@ -8290,7 +8299,7 @@ class binance(Exchange, ImplicitAPI):
8290
8299
  # }
8291
8300
  #
8292
8301
  symbols = list(self.markets.keys())
8293
- result = {}
8302
+ result: dict = {}
8294
8303
  feeTier = self.safe_integer(response, 'feeTier')
8295
8304
  feeTiers = self.fees['linear']['trading']['tiers']
8296
8305
  maker = feeTiers['maker'][feeTier][1]
@@ -8319,7 +8328,7 @@ class binance(Exchange, ImplicitAPI):
8319
8328
  # }
8320
8329
  #
8321
8330
  symbols = list(self.markets.keys())
8322
- result = {}
8331
+ result: dict = {}
8323
8332
  feeTier = self.safe_integer(response, 'feeTier')
8324
8333
  feeTiers = self.fees['inverse']['trading']['tiers']
8325
8334
  maker = feeTiers['maker'][feeTier][1]
@@ -8355,7 +8364,7 @@ class binance(Exchange, ImplicitAPI):
8355
8364
  raise ArgumentsRequired(self.id + ' type must be between 1 and 4')
8356
8365
  await self.load_markets()
8357
8366
  currency = self.currency(code)
8358
- request = {
8367
+ request: dict = {
8359
8368
  'asset': currency['id'],
8360
8369
  'amount': amount,
8361
8370
  'type': type,
@@ -8379,7 +8388,7 @@ class binance(Exchange, ImplicitAPI):
8379
8388
  """
8380
8389
  await self.load_markets()
8381
8390
  market = self.market(symbol)
8382
- request = {
8391
+ request: dict = {
8383
8392
  'symbol': market['id'],
8384
8393
  }
8385
8394
  response = None
@@ -8420,7 +8429,7 @@ class binance(Exchange, ImplicitAPI):
8420
8429
  :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
8421
8430
  """
8422
8431
  await self.load_markets()
8423
- request = {}
8432
+ request: dict = {}
8424
8433
  paginate = False
8425
8434
  paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
8426
8435
  if paginate:
@@ -8549,7 +8558,7 @@ class binance(Exchange, ImplicitAPI):
8549
8558
  def parse_account_positions(self, account, filterClosed=False):
8550
8559
  positions = self.safe_list(account, 'positions')
8551
8560
  assets = self.safe_list(account, 'assets', [])
8552
- balances = {}
8561
+ balances: dict = {}
8553
8562
  for i in range(0, len(assets)):
8554
8563
  entry = assets[i]
8555
8564
  currencyId = self.safe_string(entry, 'asset')
@@ -9041,7 +9050,7 @@ class binance(Exchange, ImplicitAPI):
9041
9050
  self.options['leverageBrackets'][symbol] = result
9042
9051
  return self.options['leverageBrackets']
9043
9052
 
9044
- async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
9053
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
9045
9054
  """
9046
9055
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
9047
9056
  :see: https://binance-docs.github.io/apidocs/futures/en/#notional-and-leverage-brackets-user_data
@@ -9114,7 +9123,7 @@ class binance(Exchange, ImplicitAPI):
9114
9123
  #
9115
9124
  return self.parse_leverage_tiers(response, symbols, 'symbol')
9116
9125
 
9117
- def parse_market_leverage_tiers(self, info, market: Market = None):
9126
+ def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
9118
9127
  """
9119
9128
  * @ignore
9120
9129
  :param dict info: Exchange response for 1 market
@@ -9165,7 +9174,7 @@ class binance(Exchange, ImplicitAPI):
9165
9174
  market = self.market(symbol)
9166
9175
  if not market['option']:
9167
9176
  raise NotSupported(self.id + ' fetchPosition() supports option markets only')
9168
- request = {
9177
+ request: dict = {
9169
9178
  'symbol': market['id'],
9170
9179
  }
9171
9180
  response = await self.eapiPrivateGetPosition(self.extend(request, params))
@@ -9204,7 +9213,7 @@ class binance(Exchange, ImplicitAPI):
9204
9213
  """
9205
9214
  await self.load_markets()
9206
9215
  symbols = self.market_symbols(symbols)
9207
- request = {}
9216
+ request: dict = {}
9208
9217
  market = None
9209
9218
  if symbols is not None:
9210
9219
  symbol = None
@@ -9246,7 +9255,7 @@ class binance(Exchange, ImplicitAPI):
9246
9255
  result.append(self.parse_position(response[i], market))
9247
9256
  return self.filter_by_array_positions(result, 'symbol', symbols, False)
9248
9257
 
9249
- def parse_position(self, position, market: Market = None):
9258
+ def parse_position(self, position: dict, market: Market = None):
9250
9259
  #
9251
9260
  # {
9252
9261
  # "entryPrice": "27.70000000",
@@ -9392,7 +9401,7 @@ class binance(Exchange, ImplicitAPI):
9392
9401
  raise ArgumentsRequired(self.id + ' fetchPositionsRisk() requires an array argument for symbols')
9393
9402
  await self.load_markets()
9394
9403
  await self.load_leverage_brackets(False, params)
9395
- request = {}
9404
+ request: dict = {}
9396
9405
  defaultType = 'future'
9397
9406
  defaultType = self.safe_string(self.options, 'defaultType', defaultType)
9398
9407
  type = self.safe_string(params, 'type', defaultType)
@@ -9536,7 +9545,7 @@ class binance(Exchange, ImplicitAPI):
9536
9545
  """
9537
9546
  await self.load_markets()
9538
9547
  market = None
9539
- request = {
9548
+ request: dict = {
9540
9549
  'incomeType': 'FUNDING_FEE', # "TRANSFER","WELCOME_BONUS", "REALIZED_PNL","FUNDING_FEE", "COMMISSION" and "INSURANCE_CLEAR"
9541
9550
  }
9542
9551
  if symbol is not None:
@@ -9592,7 +9601,7 @@ class binance(Exchange, ImplicitAPI):
9592
9601
  raise BadRequest(self.id + ' leverage should be between 1 and 125')
9593
9602
  await self.load_markets()
9594
9603
  market = self.market(symbol)
9595
- request = {
9604
+ request: dict = {
9596
9605
  'symbol': market['id'],
9597
9606
  'leverage': leverage,
9598
9607
  }
@@ -9639,7 +9648,7 @@ class binance(Exchange, ImplicitAPI):
9639
9648
  raise BadRequest(self.id + ' marginMode must be either isolated or cross')
9640
9649
  await self.load_markets()
9641
9650
  market = self.market(symbol)
9642
- request = {
9651
+ request: dict = {
9643
9652
  'symbol': market['id'],
9644
9653
  'marginType': marginMode,
9645
9654
  }
@@ -9693,7 +9702,7 @@ class binance(Exchange, ImplicitAPI):
9693
9702
  dualSidePosition = 'true'
9694
9703
  else:
9695
9704
  dualSidePosition = 'false'
9696
- request = {
9705
+ request: dict = {
9697
9706
  'dualSidePosition': dualSidePosition,
9698
9707
  }
9699
9708
  response = None
@@ -9717,7 +9726,7 @@ class binance(Exchange, ImplicitAPI):
9717
9726
  #
9718
9727
  return response
9719
9728
 
9720
- async def fetch_leverages(self, symbols: List[str] = None, params={}) -> Leverages:
9729
+ async def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
9721
9730
  """
9722
9731
  fetch the set leverage for all markets
9723
9732
  :see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
@@ -9794,7 +9803,7 @@ class binance(Exchange, ImplicitAPI):
9794
9803
  type, params = self.handle_market_type_and_params('fetchSettlementHistory', market, params)
9795
9804
  if type != 'option':
9796
9805
  raise NotSupported(self.id + ' fetchSettlementHistory() supports option markets only')
9797
- request = {}
9806
+ request: dict = {}
9798
9807
  if symbol is not None:
9799
9808
  symbol = market['symbol']
9800
9809
  request['underlying'] = market['baseId'] + market['quoteId']
@@ -9834,7 +9843,7 @@ class binance(Exchange, ImplicitAPI):
9834
9843
  type, params = self.handle_market_type_and_params('fetchMySettlementHistory', market, params)
9835
9844
  if type != 'option':
9836
9845
  raise NotSupported(self.id + ' fetchMySettlementHistory() supports option markets only')
9837
- request = {}
9846
+ request: dict = {}
9838
9847
  if symbol is not None:
9839
9848
  request['symbol'] = market['id']
9840
9849
  if since is not None:
@@ -9951,7 +9960,7 @@ class binance(Exchange, ImplicitAPI):
9951
9960
  await self.load_markets()
9952
9961
  type = None
9953
9962
  type, params = self.handle_market_type_and_params('fetchLedgerEntry', None, params)
9954
- query = {
9963
+ query: dict = {
9955
9964
  'recordId': id,
9956
9965
  'type': type,
9957
9966
  }
@@ -9987,7 +9996,7 @@ class binance(Exchange, ImplicitAPI):
9987
9996
  currency = None
9988
9997
  if code is not None:
9989
9998
  currency = self.currency(code)
9990
- request = {}
9999
+ request: dict = {}
9991
10000
  type, params = self.handle_market_type_and_params('fetchLedger', None, params)
9992
10001
  subType, params = self.handle_sub_type_and_params('fetchLedger', None, params)
9993
10002
  if since is not None:
@@ -10047,7 +10056,7 @@ class binance(Exchange, ImplicitAPI):
10047
10056
  #
10048
10057
  return self.parse_ledger(response, currency, since, limit)
10049
10058
 
10050
- def parse_ledger_entry(self, item, currency: Currency = None):
10059
+ def parse_ledger_entry(self, item: dict, currency: Currency = None):
10051
10060
  #
10052
10061
  # options(eapi)
10053
10062
  #
@@ -10101,7 +10110,7 @@ class binance(Exchange, ImplicitAPI):
10101
10110
  }
10102
10111
 
10103
10112
  def parse_ledger_entry_type(self, type):
10104
- ledgerType = {
10113
+ ledgerType: dict = {
10105
10114
  'FEE': 'fee',
10106
10115
  'FUNDING_FEE': 'fee',
10107
10116
  'OPTIONS_PREMIUM_FEE': 'fee',
@@ -10338,7 +10347,7 @@ class binance(Exchange, ImplicitAPI):
10338
10347
  await self.load_markets()
10339
10348
  market = self.market(symbol)
10340
10349
  amount = self.amount_to_precision(symbol, amount)
10341
- request = {
10350
+ request: dict = {
10342
10351
  'type': addOrReduce,
10343
10352
  'symbol': market['id'],
10344
10353
  'amount': amount,
@@ -10441,7 +10450,7 @@ class binance(Exchange, ImplicitAPI):
10441
10450
  """
10442
10451
  await self.load_markets()
10443
10452
  currency = self.currency(code)
10444
- request = {
10453
+ request: dict = {
10445
10454
  'asset': currency['id'],
10446
10455
  # 'vipLevel': self.safe_integer(params, 'vipLevel'),
10447
10456
  }
@@ -10470,7 +10479,7 @@ class binance(Exchange, ImplicitAPI):
10470
10479
  :param dict [params.vipLevel]: user's current specific margin data will be returned if viplevel is omitted
10471
10480
  :returns dict: an `isolated borrow rate structure <https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure>`
10472
10481
  """
10473
- request = {
10482
+ request: dict = {
10474
10483
  'symbol': symbol,
10475
10484
  }
10476
10485
  borrowRates = await self.fetch_isolated_borrow_rates(self.extend(request, params))
@@ -10488,7 +10497,7 @@ class binance(Exchange, ImplicitAPI):
10488
10497
  :returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
10489
10498
  """
10490
10499
  await self.load_markets()
10491
- request = {}
10500
+ request: dict = {}
10492
10501
  symbol = self.safe_string(params, 'symbol')
10493
10502
  params = self.omit(params, 'symbol')
10494
10503
  if symbol is not None:
@@ -10535,7 +10544,7 @@ class binance(Exchange, ImplicitAPI):
10535
10544
  # Binance API says the limit is 100, but "Illegal characters found in a parameter." is returned when limit is > 93
10536
10545
  raise BadRequest(self.id + ' fetchBorrowRateHistory() limit parameter cannot exceed 92')
10537
10546
  currency = self.currency(code)
10538
- request = {
10547
+ request: dict = {
10539
10548
  'asset': currency['id'],
10540
10549
  'limit': limit,
10541
10550
  }
@@ -10635,7 +10644,7 @@ class binance(Exchange, ImplicitAPI):
10635
10644
  await self.load_markets()
10636
10645
  currency = self.currency(code)
10637
10646
  # ensure you have enough token in your funding account before calling self code
10638
- request = {
10647
+ request: dict = {
10639
10648
  'token': currency['id'],
10640
10649
  'amount': amount,
10641
10650
  }
@@ -10667,7 +10676,7 @@ class binance(Exchange, ImplicitAPI):
10667
10676
  :param dict [params]: extra parameters specific to the exchange API endpoint
10668
10677
  :returns dict: response from the exchange
10669
10678
  """
10670
- request = {
10679
+ request: dict = {
10671
10680
  'code': giftcardCode,
10672
10681
  }
10673
10682
  response = await self.sapiPostGiftcardRedeemCode(self.extend(request, params))
@@ -10692,7 +10701,7 @@ class binance(Exchange, ImplicitAPI):
10692
10701
  :param dict [params]: extra parameters specific to the exchange API endpoint
10693
10702
  :returns dict: response from the exchange
10694
10703
  """
10695
- request = {
10704
+ request: dict = {
10696
10705
  'referenceNo': id,
10697
10706
  }
10698
10707
  response = await self.sapiGetGiftcardVerify(self.extend(request, params))
@@ -10722,7 +10731,7 @@ class binance(Exchange, ImplicitAPI):
10722
10731
  await self.load_markets()
10723
10732
  isPortfolioMargin = None
10724
10733
  isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchBorrowInterest', 'papi', 'portfolioMargin', False)
10725
- request = {}
10734
+ request: dict = {}
10726
10735
  market = None
10727
10736
  if code is not None:
10728
10737
  currency = self.currency(code)
@@ -10780,7 +10789,7 @@ class binance(Exchange, ImplicitAPI):
10780
10789
  interest = self.parse_borrow_interests(rows, market)
10781
10790
  return self.filter_by_currency_since_limit(interest, code, since, limit)
10782
10791
 
10783
- def parse_borrow_interest(self, info, market: Market = None):
10792
+ def parse_borrow_interest(self, info: dict, market: Market = None):
10784
10793
  symbol = self.safe_string(info, 'isolatedSymbol')
10785
10794
  timestamp = self.safe_integer(info, 'interestAccuredTime')
10786
10795
  marginMode = 'cross' if (symbol is None) else 'isolated'
@@ -10810,7 +10819,7 @@ class binance(Exchange, ImplicitAPI):
10810
10819
  """
10811
10820
  await self.load_markets()
10812
10821
  currency = self.currency(code)
10813
- request = {
10822
+ request: dict = {
10814
10823
  'asset': currency['id'],
10815
10824
  'amount': self.currency_to_precision(code, amount),
10816
10825
  }
@@ -10844,7 +10853,7 @@ class binance(Exchange, ImplicitAPI):
10844
10853
  await self.load_markets()
10845
10854
  currency = self.currency(code)
10846
10855
  market = self.market(symbol)
10847
- request = {
10856
+ request: dict = {
10848
10857
  'asset': currency['id'],
10849
10858
  'amount': self.currency_to_precision(code, amount),
10850
10859
  'symbol': market['id'],
@@ -10873,7 +10882,7 @@ class binance(Exchange, ImplicitAPI):
10873
10882
  """
10874
10883
  await self.load_markets()
10875
10884
  currency = self.currency(code)
10876
- request = {
10885
+ request: dict = {
10877
10886
  'asset': currency['id'],
10878
10887
  'amount': self.currency_to_precision(code, amount),
10879
10888
  }
@@ -10907,7 +10916,7 @@ class binance(Exchange, ImplicitAPI):
10907
10916
  await self.load_markets()
10908
10917
  currency = self.currency(code)
10909
10918
  market = self.market(symbol)
10910
- request = {
10919
+ request: dict = {
10911
10920
  'asset': currency['id'],
10912
10921
  'amount': self.currency_to_precision(code, amount),
10913
10922
  'symbol': market['id'],
@@ -10962,7 +10971,7 @@ class binance(Exchange, ImplicitAPI):
10962
10971
  if paginate:
10963
10972
  return await self.fetch_paginated_call_deterministic('fetchOpenInterestHistory', symbol, since, limit, timeframe, params, 500)
10964
10973
  market = self.market(symbol)
10965
- request = {
10974
+ request: dict = {
10966
10975
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
10967
10976
  }
10968
10977
  if limit is not None:
@@ -11013,7 +11022,7 @@ class binance(Exchange, ImplicitAPI):
11013
11022
  """
11014
11023
  await self.load_markets()
11015
11024
  market = self.market(symbol)
11016
- request = {}
11025
+ request: dict = {}
11017
11026
  if market['option']:
11018
11027
  request['underlyingAsset'] = market['baseId']
11019
11028
  request['expiration'] = self.yymmdd(market['expiry'])
@@ -11118,7 +11127,7 @@ class binance(Exchange, ImplicitAPI):
11118
11127
  subType, params = self.handle_sub_type_and_params('fetchMyLiquidations', market, params, 'linear')
11119
11128
  isPortfolioMargin = None
11120
11129
  isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchMyLiquidations', 'papi', 'portfolioMargin', False)
11121
- request = {}
11130
+ request: dict = {}
11122
11131
  if type != 'spot':
11123
11132
  request['autoCloseType'] = 'LIQUIDATION'
11124
11133
  if market is not None:
@@ -11324,7 +11333,7 @@ class binance(Exchange, ImplicitAPI):
11324
11333
  """
11325
11334
  await self.load_markets()
11326
11335
  market = self.market(symbol)
11327
- request = {
11336
+ request: dict = {
11328
11337
  'symbol': market['id'],
11329
11338
  }
11330
11339
  response = await self.eapiPublicGetMark(self.extend(request, params))
@@ -11390,7 +11399,7 @@ class binance(Exchange, ImplicitAPI):
11390
11399
  async def fetch_trading_limits(self, symbols: Strings = None, params={}):
11391
11400
  # self method should not be called directly, use loadTradingLimits() instead
11392
11401
  markets = await self.fetch_markets()
11393
- tradingLimits = {}
11402
+ tradingLimits: dict = {}
11394
11403
  for i in range(0, len(markets)):
11395
11404
  market = markets[i]
11396
11405
  symbol = market['symbol']
@@ -11429,7 +11438,7 @@ class binance(Exchange, ImplicitAPI):
11429
11438
  'hedged': dualSidePosition,
11430
11439
  }
11431
11440
 
11432
- async def fetch_margin_modes(self, symbols: List[str] = None, params={}) -> MarginModes:
11441
+ async def fetch_margin_modes(self, symbols: Strings = None, params={}) -> MarginModes:
11433
11442
  """
11434
11443
  fetches margin modes("isolated" or "cross") that the market for the symbol in in, with symbol=None all markets for a subType(linear/inverse) are returned
11435
11444
  :see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
@@ -11567,7 +11576,7 @@ class binance(Exchange, ImplicitAPI):
11567
11576
  assets = self.safe_list(response, 'positions', [])
11568
11577
  return self.parse_margin_modes(assets, symbols, 'symbol', 'swap')
11569
11578
 
11570
- def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
11579
+ def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
11571
11580
  marketId = self.safe_string(marginMode, 'symbol')
11572
11581
  market = self.safe_market(marketId, market)
11573
11582
  isIsolated = self.safe_bool(marginMode, 'isolated')
@@ -11587,7 +11596,7 @@ class binance(Exchange, ImplicitAPI):
11587
11596
  """
11588
11597
  await self.load_markets()
11589
11598
  market = self.market(symbol)
11590
- request = {
11599
+ request: dict = {
11591
11600
  'symbol': market['id'],
11592
11601
  }
11593
11602
  response = await self.eapiPublicGetTicker(self.extend(request, params))
@@ -11682,7 +11691,7 @@ class binance(Exchange, ImplicitAPI):
11682
11691
  market = self.market(symbol)
11683
11692
  until = self.safe_integer(params, 'until')
11684
11693
  params = self.omit(params, 'until')
11685
- request = {
11694
+ request: dict = {
11686
11695
  'symbol': market['id'],
11687
11696
  }
11688
11697
  if type is not None:
@@ -11735,7 +11744,7 @@ class binance(Exchange, ImplicitAPI):
11735
11744
  # },
11736
11745
  # ]
11737
11746
  #
11738
- result = {}
11747
+ result: dict = {}
11739
11748
  for i in range(0, len(response)):
11740
11749
  entry = response[i]
11741
11750
  id = self.safe_string(entry, 'asset')
@@ -11784,7 +11793,7 @@ class binance(Exchange, ImplicitAPI):
11784
11793
  if amount is None:
11785
11794
  raise ArgumentsRequired(self.id + ' fetchConvertQuote() requires an amount argument')
11786
11795
  await self.load_markets()
11787
- request = {
11796
+ request: dict = {
11788
11797
  'fromAsset': fromCode,
11789
11798
  'toAsset': toCode,
11790
11799
  'fromAmount': amount,
@@ -11817,7 +11826,7 @@ class binance(Exchange, ImplicitAPI):
11817
11826
  :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
11818
11827
  """
11819
11828
  await self.load_markets()
11820
- request = {}
11829
+ request: dict = {}
11821
11830
  response = None
11822
11831
  if (fromCode == 'BUSD') or (toCode == 'BUSD'):
11823
11832
  if amount is None:
@@ -11858,7 +11867,7 @@ class binance(Exchange, ImplicitAPI):
11858
11867
  :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
11859
11868
  """
11860
11869
  await self.load_markets()
11861
- request = {}
11870
+ request: dict = {}
11862
11871
  response = None
11863
11872
  if code == 'BUSD':
11864
11873
  msInDay = 86400000
@@ -11931,7 +11940,7 @@ class binance(Exchange, ImplicitAPI):
11931
11940
  :returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
11932
11941
  """
11933
11942
  await self.load_markets()
11934
- request = {}
11943
+ request: dict = {}
11935
11944
  msInThirtyDays = 2592000000
11936
11945
  now = self.milliseconds()
11937
11946
  if since is not None: