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