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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +2 -0
  3. ccxt/abstract/binancecoinm.py +2 -0
  4. ccxt/abstract/binanceus.py +2 -0
  5. ccxt/abstract/binanceusdm.py +2 -0
  6. ccxt/ace.py +14 -14
  7. ccxt/alpaca.py +16 -16
  8. ccxt/ascendex.py +46 -46
  9. ccxt/async_support/__init__.py +1 -1
  10. ccxt/async_support/ace.py +14 -14
  11. ccxt/async_support/alpaca.py +16 -16
  12. ccxt/async_support/ascendex.py +46 -46
  13. ccxt/async_support/base/exchange.py +23 -23
  14. ccxt/async_support/bigone.py +32 -32
  15. ccxt/async_support/binance.py +105 -96
  16. ccxt/async_support/bingx.py +21 -21
  17. ccxt/async_support/bit2c.py +13 -13
  18. ccxt/async_support/bitbank.py +19 -19
  19. ccxt/async_support/bitbns.py +17 -17
  20. ccxt/async_support/bitfinex.py +24 -24
  21. ccxt/async_support/bitfinex2.py +142 -109
  22. ccxt/async_support/bitflyer.py +23 -23
  23. ccxt/async_support/bitget.py +76 -76
  24. ccxt/async_support/bithumb.py +20 -20
  25. ccxt/async_support/bitmart.py +55 -55
  26. ccxt/async_support/bitmex.py +41 -41
  27. ccxt/async_support/bitopro.py +30 -30
  28. ccxt/async_support/bitrue.py +37 -37
  29. ccxt/async_support/bitso.py +30 -30
  30. ccxt/async_support/bitstamp.py +31 -31
  31. ccxt/async_support/bitteam.py +26 -26
  32. ccxt/async_support/bitvavo.py +27 -27
  33. ccxt/async_support/bl3p.py +8 -8
  34. ccxt/async_support/blockchaincom.py +24 -24
  35. ccxt/async_support/blofin.py +37 -37
  36. ccxt/async_support/btcalpha.py +19 -19
  37. ccxt/async_support/btcbox.py +11 -11
  38. ccxt/async_support/btcmarkets.py +22 -22
  39. ccxt/async_support/btcturk.py +13 -13
  40. ccxt/async_support/bybit.py +96 -96
  41. ccxt/async_support/cex.py +21 -21
  42. ccxt/async_support/coinbase.py +53 -53
  43. ccxt/async_support/coinbaseexchange.py +29 -29
  44. ccxt/async_support/coinbaseinternational.py +32 -32
  45. ccxt/async_support/coincheck.py +14 -14
  46. ccxt/async_support/coinex.py +168 -139
  47. ccxt/async_support/coinlist.py +35 -35
  48. ccxt/async_support/coinmate.py +22 -22
  49. ccxt/async_support/coinmetro.py +22 -22
  50. ccxt/async_support/coinone.py +18 -18
  51. ccxt/async_support/coinsph.py +32 -32
  52. ccxt/async_support/coinspot.py +8 -8
  53. ccxt/async_support/cryptocom.py +43 -43
  54. ccxt/async_support/currencycom.py +33 -33
  55. ccxt/async_support/delta.py +35 -35
  56. ccxt/async_support/deribit.py +54 -54
  57. ccxt/async_support/digifinex.py +56 -56
  58. ccxt/async_support/exmo.py +34 -34
  59. ccxt/async_support/gate.py +60 -60
  60. ccxt/async_support/gemini.py +24 -24
  61. ccxt/async_support/hitbtc.py +51 -51
  62. ccxt/async_support/hollaex.py +29 -29
  63. ccxt/async_support/htx.py +73 -73
  64. ccxt/async_support/huobijp.py +30 -30
  65. ccxt/async_support/hyperliquid.py +58 -58
  66. ccxt/async_support/idex.py +33 -33
  67. ccxt/async_support/independentreserve.py +12 -12
  68. ccxt/async_support/indodax.py +21 -21
  69. ccxt/async_support/kraken.py +46 -51
  70. ccxt/async_support/krakenfutures.py +29 -29
  71. ccxt/async_support/kucoin.py +51 -51
  72. ccxt/async_support/kucoinfutures.py +33 -33
  73. ccxt/async_support/kuna.py +27 -27
  74. ccxt/async_support/latoken.py +27 -27
  75. ccxt/async_support/lbank.py +35 -35
  76. ccxt/async_support/luno.py +19 -19
  77. ccxt/async_support/lykke.py +20 -20
  78. ccxt/async_support/mercado.py +17 -17
  79. ccxt/async_support/mexc.py +64 -64
  80. ccxt/async_support/ndax.py +38 -38
  81. ccxt/async_support/novadax.py +26 -26
  82. ccxt/async_support/oceanex.py +21 -21
  83. ccxt/async_support/okcoin.py +35 -35
  84. ccxt/async_support/okx.py +85 -85
  85. ccxt/async_support/onetrading.py +32 -32
  86. ccxt/async_support/p2b.py +14 -14
  87. ccxt/async_support/paymium.py +12 -12
  88. ccxt/async_support/phemex.py +50 -50
  89. ccxt/async_support/poloniex.py +35 -35
  90. ccxt/async_support/poloniexfutures.py +25 -21
  91. ccxt/async_support/probit.py +30 -30
  92. ccxt/async_support/timex.py +22 -22
  93. ccxt/async_support/tokocrypto.py +26 -26
  94. ccxt/async_support/tradeogre.py +12 -12
  95. ccxt/async_support/upbit.py +28 -28
  96. ccxt/async_support/wavesexchange.py +33 -33
  97. ccxt/async_support/wazirx.py +21 -21
  98. ccxt/async_support/whitebit.py +37 -37
  99. ccxt/async_support/woo.py +51 -51
  100. ccxt/async_support/woofipro.py +46 -46
  101. ccxt/async_support/yobit.py +20 -20
  102. ccxt/async_support/zaif.py +12 -12
  103. ccxt/async_support/zonda.py +22 -22
  104. ccxt/base/exchange.py +35 -35
  105. ccxt/base/types.py +13 -0
  106. ccxt/bigone.py +32 -32
  107. ccxt/binance.py +105 -96
  108. ccxt/bingx.py +21 -21
  109. ccxt/bit2c.py +13 -13
  110. ccxt/bitbank.py +19 -19
  111. ccxt/bitbns.py +17 -17
  112. ccxt/bitfinex.py +24 -24
  113. ccxt/bitfinex2.py +142 -109
  114. ccxt/bitflyer.py +23 -23
  115. ccxt/bitget.py +76 -76
  116. ccxt/bithumb.py +20 -20
  117. ccxt/bitmart.py +55 -55
  118. ccxt/bitmex.py +41 -41
  119. ccxt/bitopro.py +30 -30
  120. ccxt/bitrue.py +37 -37
  121. ccxt/bitso.py +30 -30
  122. ccxt/bitstamp.py +31 -31
  123. ccxt/bitteam.py +26 -26
  124. ccxt/bitvavo.py +27 -27
  125. ccxt/bl3p.py +8 -8
  126. ccxt/blockchaincom.py +24 -24
  127. ccxt/blofin.py +37 -37
  128. ccxt/btcalpha.py +19 -19
  129. ccxt/btcbox.py +11 -11
  130. ccxt/btcmarkets.py +22 -22
  131. ccxt/btcturk.py +13 -13
  132. ccxt/bybit.py +96 -96
  133. ccxt/cex.py +21 -21
  134. ccxt/coinbase.py +53 -53
  135. ccxt/coinbaseexchange.py +29 -29
  136. ccxt/coinbaseinternational.py +32 -32
  137. ccxt/coincheck.py +14 -14
  138. ccxt/coinex.py +168 -139
  139. ccxt/coinlist.py +35 -35
  140. ccxt/coinmate.py +22 -22
  141. ccxt/coinmetro.py +22 -22
  142. ccxt/coinone.py +18 -18
  143. ccxt/coinsph.py +32 -32
  144. ccxt/coinspot.py +8 -8
  145. ccxt/cryptocom.py +43 -43
  146. ccxt/currencycom.py +33 -33
  147. ccxt/delta.py +35 -35
  148. ccxt/deribit.py +54 -54
  149. ccxt/digifinex.py +56 -56
  150. ccxt/exmo.py +34 -34
  151. ccxt/gate.py +60 -60
  152. ccxt/gemini.py +24 -24
  153. ccxt/hitbtc.py +51 -51
  154. ccxt/hollaex.py +29 -29
  155. ccxt/htx.py +73 -73
  156. ccxt/huobijp.py +30 -30
  157. ccxt/hyperliquid.py +58 -58
  158. ccxt/idex.py +33 -33
  159. ccxt/independentreserve.py +12 -12
  160. ccxt/indodax.py +21 -21
  161. ccxt/kraken.py +46 -51
  162. ccxt/krakenfutures.py +29 -29
  163. ccxt/kucoin.py +51 -51
  164. ccxt/kucoinfutures.py +33 -33
  165. ccxt/kuna.py +27 -27
  166. ccxt/latoken.py +27 -27
  167. ccxt/lbank.py +35 -35
  168. ccxt/luno.py +19 -19
  169. ccxt/lykke.py +20 -20
  170. ccxt/mercado.py +17 -17
  171. ccxt/mexc.py +64 -64
  172. ccxt/ndax.py +38 -38
  173. ccxt/novadax.py +26 -26
  174. ccxt/oceanex.py +21 -21
  175. ccxt/okcoin.py +35 -35
  176. ccxt/okx.py +85 -85
  177. ccxt/onetrading.py +32 -32
  178. ccxt/p2b.py +14 -14
  179. ccxt/paymium.py +12 -12
  180. ccxt/phemex.py +50 -50
  181. ccxt/poloniex.py +35 -35
  182. ccxt/poloniexfutures.py +25 -21
  183. ccxt/pro/__init__.py +1 -1
  184. ccxt/pro/alpaca.py +8 -8
  185. ccxt/pro/ascendex.py +4 -4
  186. ccxt/pro/binance.py +56 -56
  187. ccxt/pro/bingx.py +5 -5
  188. ccxt/pro/bitfinex.py +6 -6
  189. ccxt/pro/bitfinex2.py +10 -10
  190. ccxt/pro/bitget.py +17 -17
  191. ccxt/pro/bithumb.py +6 -6
  192. ccxt/pro/bitmart.py +8 -8
  193. ccxt/pro/bitmex.py +16 -16
  194. ccxt/pro/bitopro.py +4 -4
  195. ccxt/pro/bitrue.py +8 -8
  196. ccxt/pro/bitstamp.py +5 -5
  197. ccxt/pro/bitvavo.py +14 -14
  198. ccxt/pro/blockchaincom.py +7 -7
  199. ccxt/pro/bybit.py +12 -12
  200. ccxt/pro/cex.py +19 -19
  201. ccxt/pro/coinbase.py +2 -2
  202. ccxt/pro/coinbaseexchange.py +10 -10
  203. ccxt/pro/coinbaseinternational.py +4 -4
  204. ccxt/pro/coincheck.py +2 -2
  205. ccxt/pro/coinex.py +15 -15
  206. ccxt/pro/coinone.py +4 -4
  207. ccxt/pro/cryptocom.py +11 -11
  208. ccxt/pro/currencycom.py +4 -4
  209. ccxt/pro/deribit.py +9 -9
  210. ccxt/pro/exmo.py +9 -9
  211. ccxt/pro/gate.py +12 -12
  212. ccxt/pro/gemini.py +11 -11
  213. ccxt/pro/hitbtc.py +13 -13
  214. ccxt/pro/hollaex.py +6 -6
  215. ccxt/pro/htx.py +15 -15
  216. ccxt/pro/huobijp.py +16 -16
  217. ccxt/pro/hyperliquid.py +9 -9
  218. ccxt/pro/idex.py +12 -12
  219. ccxt/pro/independentreserve.py +2 -2
  220. ccxt/pro/kraken.py +14 -14
  221. ccxt/pro/krakenfutures.py +12 -12
  222. ccxt/pro/kucoin.py +12 -12
  223. ccxt/pro/kucoinfutures.py +16 -16
  224. ccxt/pro/lbank.py +12 -12
  225. ccxt/pro/luno.py +4 -4
  226. ccxt/pro/mexc.py +14 -14
  227. ccxt/pro/ndax.py +12 -12
  228. ccxt/pro/okcoin.py +6 -6
  229. ccxt/pro/okx.py +30 -30
  230. ccxt/pro/onetrading.py +13 -13
  231. ccxt/pro/p2b.py +2 -2
  232. ccxt/pro/phemex.py +9 -9
  233. ccxt/pro/poloniex.py +9 -9
  234. ccxt/pro/poloniexfutures.py +10 -10
  235. ccxt/pro/probit.py +8 -8
  236. ccxt/pro/upbit.py +1 -1
  237. ccxt/pro/wazirx.py +10 -10
  238. ccxt/pro/whitebit.py +8 -8
  239. ccxt/pro/woo.py +14 -14
  240. ccxt/pro/woofipro.py +14 -14
  241. ccxt/probit.py +30 -30
  242. ccxt/test/base/test_shared_methods.py +1 -0
  243. ccxt/timex.py +22 -22
  244. ccxt/tokocrypto.py +26 -26
  245. ccxt/tradeogre.py +12 -12
  246. ccxt/upbit.py +28 -28
  247. ccxt/wavesexchange.py +33 -33
  248. ccxt/wazirx.py +21 -21
  249. ccxt/whitebit.py +37 -37
  250. ccxt/woo.py +51 -51
  251. ccxt/woofipro.py +46 -46
  252. ccxt/yobit.py +20 -20
  253. ccxt/zaif.py +12 -12
  254. ccxt/zonda.py +22 -22
  255. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/METADATA +4 -4
  256. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/RECORD +258 -258
  257. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/WHEEL +0 -0
  258. {ccxt-4.3.30.dist-info → ccxt-4.3.31.dist-info}/top_level.txt +0 -0
@@ -621,15 +621,15 @@ class kraken(Exchange, ImplicitAPI):
621
621
 
622
622
  def append_inactive_markets(self, result):
623
623
  # result should be an array to append to
624
- precision = {
624
+ precision: dict = {
625
625
  'amount': self.parse_number('1e-8'),
626
626
  'price': self.parse_number('1e-8'),
627
627
  }
628
- costLimits = {'min': None, 'max': None}
629
- priceLimits = {'min': precision['price'], 'max': None}
630
- amountLimits = {'min': precision['amount'], 'max': None}
631
- limits = {'amount': amountLimits, 'price': priceLimits, 'cost': costLimits}
632
- defaults = {
628
+ costLimits: dict = {'min': None, 'max': None}
629
+ priceLimits: dict = {'min': precision['price'], 'max': None}
630
+ amountLimits: dict = {'min': precision['amount'], 'max': None}
631
+ limits: dict = {'amount': amountLimits, 'price': priceLimits, 'cost': costLimits}
632
+ defaults: dict = {
633
633
  'darkpool': False,
634
634
  'info': None,
635
635
  'maker': None,
@@ -670,7 +670,7 @@ class kraken(Exchange, ImplicitAPI):
670
670
  #
671
671
  currencies = self.safe_value(response, 'result', {})
672
672
  ids = list(currencies.keys())
673
- result = {}
673
+ result: dict = {}
674
674
  for i in range(0, len(ids)):
675
675
  id = ids[i]
676
676
  currency = currencies[id]
@@ -716,7 +716,7 @@ class kraken(Exchange, ImplicitAPI):
716
716
  """
717
717
  await self.load_markets()
718
718
  market = self.market(symbol)
719
- request = {
719
+ request: dict = {
720
720
  'pair': market['id'],
721
721
  'fee-info': True,
722
722
  }
@@ -786,7 +786,7 @@ class kraken(Exchange, ImplicitAPI):
786
786
  market = self.market(symbol)
787
787
  if market['darkpool']:
788
788
  raise ExchangeError(self.id + ' fetchOrderBook() does not provide an order book for darkpool symbol ' + symbol)
789
- request = {
789
+ request: dict = {
790
790
  'pair': market['id'],
791
791
  }
792
792
  if limit is not None:
@@ -879,7 +879,7 @@ class kraken(Exchange, ImplicitAPI):
879
879
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
880
880
  """
881
881
  await self.load_markets()
882
- request = {}
882
+ request: dict = {}
883
883
  if symbols is not None:
884
884
  symbols = self.market_symbols(symbols)
885
885
  marketIds = []
@@ -892,7 +892,7 @@ class kraken(Exchange, ImplicitAPI):
892
892
  response = await self.publicGetTicker(self.extend(request, params))
893
893
  tickers = response['result']
894
894
  ids = list(tickers.keys())
895
- result = {}
895
+ result: dict = {}
896
896
  for i in range(0, len(ids)):
897
897
  id = ids[i]
898
898
  market = self.safe_market(id)
@@ -914,7 +914,7 @@ class kraken(Exchange, ImplicitAPI):
914
914
  if darkpool:
915
915
  raise ExchangeError(self.id + ' fetchTicker() does not provide a ticker for darkpool symbol ' + symbol)
916
916
  market = self.market(symbol)
917
- request = {
917
+ request: dict = {
918
918
  'pair': market['id'],
919
919
  }
920
920
  response = await self.publicGetTicker(self.extend(request, params))
@@ -962,7 +962,7 @@ class kraken(Exchange, ImplicitAPI):
962
962
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 720)
963
963
  market = self.market(symbol)
964
964
  parsedTimeframe = self.safe_integer(self.timeframes, timeframe)
965
- request = {
965
+ request: dict = {
966
966
  'pair': market['id'],
967
967
  }
968
968
  if parsedTimeframe is not None:
@@ -970,9 +970,7 @@ class kraken(Exchange, ImplicitAPI):
970
970
  else:
971
971
  request['interval'] = timeframe
972
972
  if since is not None:
973
- # contrary to kraken's api documentation, the since parameter must be passed in nanoseconds
974
- # the adding of '000000' is copied from the fetchTrades function
975
- request['since'] = self.number_to_string(since) + '000000' # expected to be in nanoseconds
973
+ request['since'] = self.number_to_string(self.parse_to_int(since / 1000)) # expected to be in seconds
976
974
  response = await self.publicGetOHLC(self.extend(request, params))
977
975
  #
978
976
  # {
@@ -992,7 +990,7 @@ class kraken(Exchange, ImplicitAPI):
992
990
  return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
993
991
 
994
992
  def parse_ledger_entry_type(self, type):
995
- types = {
993
+ types: dict = {
996
994
  'trade': 'trade',
997
995
  'withdrawal': 'transaction',
998
996
  'deposit': 'transaction',
@@ -1001,7 +999,7 @@ class kraken(Exchange, ImplicitAPI):
1001
999
  }
1002
1000
  return self.safe_string(types, type, type)
1003
1001
 
1004
- def parse_ledger_entry(self, item, currency: Currency = None):
1002
+ def parse_ledger_entry(self, item: dict, currency: Currency = None):
1005
1003
  #
1006
1004
  # {
1007
1005
  # 'LTFK7F-N2CUX-PNY4SX': {
@@ -1065,7 +1063,7 @@ class kraken(Exchange, ImplicitAPI):
1065
1063
  """
1066
1064
  # https://www.kraken.com/features/api#get-ledgers-info
1067
1065
  await self.load_markets()
1068
- request = {}
1066
+ request: dict = {}
1069
1067
  currency = None
1070
1068
  if code is not None:
1071
1069
  currency = self.currency(code)
@@ -1125,7 +1123,7 @@ class kraken(Exchange, ImplicitAPI):
1125
1123
  items = await self.fetch_ledger_entries_by_ids([id], code, params)
1126
1124
  return items[0]
1127
1125
 
1128
- def parse_trade(self, trade, market: Market = None) -> Trade:
1126
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1129
1127
  #
1130
1128
  # fetchTrades(public)
1131
1129
  #
@@ -1231,16 +1229,13 @@ class kraken(Exchange, ImplicitAPI):
1231
1229
  await self.load_markets()
1232
1230
  market = self.market(symbol)
1233
1231
  id = market['id']
1234
- request = {
1232
+ request: dict = {
1235
1233
  'pair': id,
1236
1234
  }
1237
1235
  # https://support.kraken.com/hc/en-us/articles/218198197-How-to-pull-all-trade-data-using-the-Kraken-REST-API
1238
1236
  # https://github.com/ccxt/ccxt/issues/5677
1239
1237
  if since is not None:
1240
- # php does not format it properly
1241
- # therefore we use string concatenation here
1242
- request['since'] = since * 1e6
1243
- request['since'] = str(since) + '000000' # expected to be in nanoseconds
1238
+ request['since'] = self.number_to_string(self.parse_to_int(since / 1000)) # expected to be in seconds
1244
1239
  if limit is not None:
1245
1240
  request['count'] = limit
1246
1241
  response = await self.publicGetTrades(self.extend(request, params))
@@ -1269,7 +1264,7 @@ class kraken(Exchange, ImplicitAPI):
1269
1264
 
1270
1265
  def parse_balance(self, response) -> Balances:
1271
1266
  balances = self.safe_value(response, 'result', {})
1272
- result = {
1267
+ result: dict = {
1273
1268
  'info': response,
1274
1269
  'timestamp': None,
1275
1270
  'datetime': None,
@@ -1360,7 +1355,7 @@ class kraken(Exchange, ImplicitAPI):
1360
1355
  """
1361
1356
  await self.load_markets()
1362
1357
  market = self.market(symbol)
1363
- request = {
1358
+ request: dict = {
1364
1359
  'pair': market['id'],
1365
1360
  'type': side,
1366
1361
  'ordertype': type,
@@ -1420,8 +1415,8 @@ class kraken(Exchange, ImplicitAPI):
1420
1415
  self.options['delistedMarketsById'][id] = market
1421
1416
  return market
1422
1417
 
1423
- def parse_order_status(self, status):
1424
- statuses = {
1418
+ def parse_order_status(self, status: Str):
1419
+ statuses: dict = {
1425
1420
  'pending': 'open', # order pending book entry
1426
1421
  'open': 'open',
1427
1422
  'closed': 'closed',
@@ -1431,7 +1426,7 @@ class kraken(Exchange, ImplicitAPI):
1431
1426
  return self.safe_string(statuses, status, status)
1432
1427
 
1433
1428
  def parse_order_type(self, status):
1434
- statuses = {
1429
+ statuses: dict = {
1435
1430
  'take-profit': 'market',
1436
1431
  'stop-loss-limit': 'limit',
1437
1432
  'stop-loss': 'market',
@@ -1440,7 +1435,7 @@ class kraken(Exchange, ImplicitAPI):
1440
1435
  }
1441
1436
  return self.safe_string(statuses, status, status)
1442
1437
 
1443
- def parse_order(self, order, market: Market = None) -> Order:
1438
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1444
1439
  #
1445
1440
  # createOrder for regular orders
1446
1441
  #
@@ -1753,7 +1748,7 @@ class kraken(Exchange, ImplicitAPI):
1753
1748
  market = self.market(symbol)
1754
1749
  if not market['spot']:
1755
1750
  raise NotSupported(self.id + ' editOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted')
1756
- request = {
1751
+ request: dict = {
1757
1752
  'txid': id,
1758
1753
  'pair': market['id'],
1759
1754
  }
@@ -1790,7 +1785,7 @@ class kraken(Exchange, ImplicitAPI):
1790
1785
  """
1791
1786
  await self.load_markets()
1792
1787
  clientOrderId = self.safe_value_2(params, 'userref', 'clientOrderId')
1793
- request = {
1788
+ request: dict = {
1794
1789
  'trades': True, # whether or not to include trades in output(optional, default False)
1795
1790
  # 'txid': id, # do not comma separate a list of ids - use fetchOrdersByIds instead
1796
1791
  # 'userref': 'optional', # restrict results to given user reference id(optional)
@@ -1881,7 +1876,7 @@ class kraken(Exchange, ImplicitAPI):
1881
1876
  index = self.sum(j * batchSize, k)
1882
1877
  if index < numTradeIds:
1883
1878
  requestIds.append(tradeIds[index])
1884
- request = {
1879
+ request: dict = {
1885
1880
  'txid': ','.join(requestIds),
1886
1881
  }
1887
1882
  response = await self.privatePostQueryTrades(request)
@@ -1949,7 +1944,7 @@ class kraken(Exchange, ImplicitAPI):
1949
1944
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1950
1945
  """
1951
1946
  await self.load_markets()
1952
- request = {
1947
+ request: dict = {
1953
1948
  # 'type': 'all', # any position, closed position, closing position, no position
1954
1949
  # 'trades': False, # whether or not to include trades related to position in output
1955
1950
  # 'start': 1234567890, # starting unix timestamp or trade tx id of results(exclusive)
@@ -2005,7 +2000,7 @@ class kraken(Exchange, ImplicitAPI):
2005
2000
  await self.load_markets()
2006
2001
  response = None
2007
2002
  clientOrderId = self.safe_value_2(params, 'userref', 'clientOrderId', id)
2008
- request = {
2003
+ request: dict = {
2009
2004
  'txid': clientOrderId, # order id or userref
2010
2005
  }
2011
2006
  params = self.omit(params, ['userref', 'clientOrderId'])
@@ -2027,7 +2022,7 @@ class kraken(Exchange, ImplicitAPI):
2027
2022
  :param dict [params]: extra parameters specific to the exchange API endpoint
2028
2023
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2029
2024
  """
2030
- request = {
2025
+ request: dict = {
2031
2026
  'orders': ids,
2032
2027
  }
2033
2028
  response = await self.privatePostCancelOrderBatch(self.extend(request, params))
@@ -2089,7 +2084,7 @@ class kraken(Exchange, ImplicitAPI):
2089
2084
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2090
2085
  """
2091
2086
  await self.load_markets()
2092
- request = {}
2087
+ request: dict = {}
2093
2088
  if since is not None:
2094
2089
  request['start'] = self.parse_to_int(since / 1000)
2095
2090
  query = params
@@ -2117,7 +2112,7 @@ class kraken(Exchange, ImplicitAPI):
2117
2112
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2118
2113
  """
2119
2114
  await self.load_markets()
2120
- request = {}
2115
+ request: dict = {}
2121
2116
  if since is not None:
2122
2117
  request['start'] = self.parse_to_int(since / 1000)
2123
2118
  query = params
@@ -2175,7 +2170,7 @@ class kraken(Exchange, ImplicitAPI):
2175
2170
 
2176
2171
  def parse_transaction_status(self, status):
2177
2172
  # IFEX transaction states
2178
- statuses = {
2173
+ statuses: dict = {
2179
2174
  'Initial': 'pending',
2180
2175
  'Pending': 'pending',
2181
2176
  'Success': 'ok',
@@ -2189,7 +2184,7 @@ class kraken(Exchange, ImplicitAPI):
2189
2184
  withdrawMethods = self.safe_value(self.options, 'withdrawMethods', {})
2190
2185
  return self.safe_string(withdrawMethods, network, network)
2191
2186
 
2192
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
2187
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2193
2188
  #
2194
2189
  # fetchDeposits
2195
2190
  #
@@ -2319,7 +2314,7 @@ class kraken(Exchange, ImplicitAPI):
2319
2314
  raise ArgumentsRequired(self.id + ' fetchDeposits() requires a currency code argument')
2320
2315
  await self.load_markets()
2321
2316
  currency = self.currency(code)
2322
- request = {
2317
+ request: dict = {
2323
2318
  'asset': currency['id'],
2324
2319
  }
2325
2320
  if since is not None:
@@ -2379,7 +2374,7 @@ class kraken(Exchange, ImplicitAPI):
2379
2374
  if paginate:
2380
2375
  params['cursor'] = True
2381
2376
  return await self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'next_cursor', 'cursor')
2382
- request = {}
2377
+ request: dict = {}
2383
2378
  if code is not None:
2384
2379
  currency = self.currency(code)
2385
2380
  request['asset'] = currency['id']
@@ -2450,7 +2445,7 @@ class kraken(Exchange, ImplicitAPI):
2450
2445
  :param dict [params]: extra parameters specific to the exchange API endpoint
2451
2446
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2452
2447
  """
2453
- request = {
2448
+ request: dict = {
2454
2449
  'new': 'true',
2455
2450
  }
2456
2451
  return await self.fetch_deposit_address(code, self.extend(request, params))
@@ -2465,7 +2460,7 @@ class kraken(Exchange, ImplicitAPI):
2465
2460
  """
2466
2461
  await self.load_markets()
2467
2462
  currency = self.currency(code)
2468
- request = {
2463
+ request: dict = {
2469
2464
  'asset': currency['id'],
2470
2465
  }
2471
2466
  response = await self.privatePostDepositMethods(self.extend(request, params))
@@ -2528,7 +2523,7 @@ class kraken(Exchange, ImplicitAPI):
2528
2523
  if depositMethod is None:
2529
2524
  firstDepositMethod = self.safe_value(depositMethods, 0, {})
2530
2525
  depositMethod = self.safe_string(firstDepositMethod, 'method')
2531
- request = {
2526
+ request: dict = {
2532
2527
  'asset': currency['id'],
2533
2528
  'method': depositMethod,
2534
2529
  }
@@ -2583,7 +2578,7 @@ class kraken(Exchange, ImplicitAPI):
2583
2578
  if 'key' in params:
2584
2579
  await self.load_markets()
2585
2580
  currency = self.currency(code)
2586
- request = {
2581
+ request: dict = {
2587
2582
  'asset': currency['id'],
2588
2583
  'amount': amount,
2589
2584
  'address': address,
@@ -2610,7 +2605,7 @@ class kraken(Exchange, ImplicitAPI):
2610
2605
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
2611
2606
  """
2612
2607
  await self.load_markets()
2613
- request = {
2608
+ request: dict = {
2614
2609
  # 'txid': 'comma delimited list of transaction ids to restrict output to',
2615
2610
  'docalcs': 'true', # whether or not to include profit/loss calculations
2616
2611
  'consolidation': 'market', # what to consolidate the positions data around, market will consolidate positions based on market pair
@@ -2666,7 +2661,7 @@ class kraken(Exchange, ImplicitAPI):
2666
2661
  results = self.parse_positions(result, symbols)
2667
2662
  return self.filter_by_array_positions(results, 'symbol', symbols, False)
2668
2663
 
2669
- def parse_position(self, position, market: Market = None):
2664
+ def parse_position(self, position: dict, market: Market = None):
2670
2665
  #
2671
2666
  # {
2672
2667
  # "pair": "ETHUSDT",
@@ -2715,7 +2710,7 @@ class kraken(Exchange, ImplicitAPI):
2715
2710
  })
2716
2711
 
2717
2712
  def parse_account_type(self, account):
2718
- accountByType = {
2713
+ accountByType: dict = {
2719
2714
  'spot': 'Spot Wallet',
2720
2715
  'swap': 'Futures Wallet',
2721
2716
  'future': 'Futures Wallet',
@@ -2748,7 +2743,7 @@ class kraken(Exchange, ImplicitAPI):
2748
2743
  currency = self.currency(code)
2749
2744
  fromAccount = self.parse_account_type(fromAccount)
2750
2745
  toAccount = self.parse_account_type(toAccount)
2751
- request = {
2746
+ request: dict = {
2752
2747
  'amount': self.currency_to_precision(code, amount),
2753
2748
  'from': fromAccount,
2754
2749
  'to': toAccount,
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.krakenfutures import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TransferEntry
9
+ from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -459,7 +459,7 @@ class krakenfutures(Exchange, ImplicitAPI):
459
459
  """
460
460
  await self.load_markets()
461
461
  market = self.market(symbol)
462
- request = {
462
+ request: dict = {
463
463
  'symbol': market['id'],
464
464
  }
465
465
  response = await self.publicGetOrderbook(self.extend(request, params))
@@ -627,7 +627,7 @@ class krakenfutures(Exchange, ImplicitAPI):
627
627
  paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
628
628
  if paginate:
629
629
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000)
630
- request = {
630
+ request: dict = {
631
631
  'symbol': market['id'],
632
632
  'price_type': self.safe_string(params, 'price', 'trade'),
633
633
  'interval': self.timeframes[timeframe],
@@ -706,7 +706,7 @@ class krakenfutures(Exchange, ImplicitAPI):
706
706
  if paginate:
707
707
  return await self.fetch_paginated_call_dynamic('fetchTrades', symbol, since, limit, params)
708
708
  market = self.market(symbol)
709
- request = {
709
+ request: dict = {
710
710
  'symbol': market['id'],
711
711
  }
712
712
  method = None
@@ -805,7 +805,7 @@ class krakenfutures(Exchange, ImplicitAPI):
805
805
  rawTrades = self.safe_list(response, 'history', [])
806
806
  return self.parse_trades(rawTrades, market, since, limit)
807
807
 
808
- def parse_trade(self, trade, market: Market = None) -> Trade:
808
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
809
809
  #
810
810
  # fetchTrades(recent trades)
811
811
  #
@@ -950,7 +950,7 @@ class krakenfutures(Exchange, ImplicitAPI):
950
950
  type = 'lmt'
951
951
  elif type == 'market':
952
952
  type = 'mkt'
953
- request = {
953
+ request: dict = {
954
954
  'symbol': market['id'],
955
955
  'side': side,
956
956
  'size': self.amount_to_precision(symbol, amount),
@@ -1068,7 +1068,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1068
1068
  extendedParams['order'] = 'send'
1069
1069
  orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
1070
1070
  ordersRequests.append(orderRequest)
1071
- request = {
1071
+ request: dict = {
1072
1072
  'batchOrder': ordersRequests,
1073
1073
  }
1074
1074
  response = await self.privatePostBatchorder(self.extend(request, params))
@@ -1105,7 +1105,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1105
1105
  :returns: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1106
1106
  """
1107
1107
  await self.load_markets()
1108
- request = {
1108
+ request: dict = {
1109
1109
  'orderId': id,
1110
1110
  }
1111
1111
  if amount is not None:
@@ -1132,7 +1132,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1132
1132
  response = await self.privatePostCancelorder(self.extend({'order_id': id}, params))
1133
1133
  status = self.safe_string(self.safe_value(response, 'cancelStatus', {}), 'status')
1134
1134
  self.verify_order_action_success(status, 'cancelOrder')
1135
- order = {}
1135
+ order: dict = {}
1136
1136
  if 'cancelStatus' in response:
1137
1137
  order = self.parse_order(response['cancelStatus'])
1138
1138
  return self.extend({'info': response}, order)
@@ -1159,7 +1159,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1159
1159
  else:
1160
1160
  for i in range(0, len(ids)):
1161
1161
  orders.append({'order': 'cancel', 'order_id': ids[i]})
1162
- request = {
1162
+ request: dict = {
1163
1163
  'batchOrder': orders,
1164
1164
  }
1165
1165
  response = await self.privatePostBatchorder(self.extend(request, params))
@@ -1203,7 +1203,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1203
1203
  :param dict [params]: Exchange specific params
1204
1204
  :returns: Response from exchange api
1205
1205
  """
1206
- request = {}
1206
+ request: dict = {}
1207
1207
  if symbol is not None:
1208
1208
  request['symbol'] = self.market_id(symbol)
1209
1209
  response = await self.privatePostCancelallorders(self.extend(request, params))
@@ -1266,7 +1266,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1266
1266
  market = None
1267
1267
  if symbol is not None:
1268
1268
  market = self.market(symbol)
1269
- request = {}
1269
+ request: dict = {}
1270
1270
  if limit is not None:
1271
1271
  request['count'] = limit
1272
1272
  if since is not None:
@@ -1300,7 +1300,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1300
1300
  market = None
1301
1301
  if symbol is not None:
1302
1302
  market = self.market(symbol)
1303
- request = {}
1303
+ request: dict = {}
1304
1304
  if limit is not None:
1305
1305
  request['count'] = limit
1306
1306
  if since is not None:
@@ -1331,7 +1331,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1331
1331
  return self.parse_orders(canceledAndRejected, market, since, limit)
1332
1332
 
1333
1333
  def parse_order_type(self, orderType):
1334
- map = {
1334
+ map: dict = {
1335
1335
  'lmt': 'limit',
1336
1336
  'mkt': 'market',
1337
1337
  'post': 'limit',
@@ -1340,7 +1340,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1340
1340
  return self.safe_string(map, orderType, orderType)
1341
1341
 
1342
1342
  def verify_order_action_success(self, status, method, omit=[]):
1343
- errors = {
1343
+ errors: dict = {
1344
1344
  'invalidOrderType': InvalidOrder,
1345
1345
  'invalidSide': InvalidOrder,
1346
1346
  'invalidSize': InvalidOrder,
@@ -1365,8 +1365,8 @@ class krakenfutures(Exchange, ImplicitAPI):
1365
1365
  if (status in errors) and not self.in_array(status, omit):
1366
1366
  raise errors[status](self.id + ': ' + method + ' failed due to ' + status)
1367
1367
 
1368
- def parse_order_status(self, status):
1369
- statuses = {
1368
+ def parse_order_status(self, status: Str):
1369
+ statuses: dict = {
1370
1370
  'placed': 'open', # the order was placed successfully
1371
1371
  'cancelled': 'canceled', # the order was cancelled successfully
1372
1372
  'invalidOrderType': 'rejected', # the order was not placed because orderType is invalid
@@ -1396,7 +1396,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1396
1396
  }
1397
1397
  return self.safe_string(statuses, status, status)
1398
1398
 
1399
- def parse_order(self, order, market: Market = None) -> Order:
1399
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1400
1400
  #
1401
1401
  # LIMIT
1402
1402
  #
@@ -1946,7 +1946,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1946
1946
  isFlex = (accountType == 'multiCollateralMarginAccount')
1947
1947
  isCash = (accountType == 'cashAccount')
1948
1948
  balances = self.safe_value_2(response, 'balances', 'currencies', {})
1949
- result = {}
1949
+ result: dict = {}
1950
1950
  currencyIds = list(balances.keys())
1951
1951
  for i in range(0, len(currencyIds)):
1952
1952
  currencyId = currencyIds[i]
@@ -2066,7 +2066,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2066
2066
  market = self.market(symbol)
2067
2067
  if not market['swap']:
2068
2068
  raise BadRequest(self.id + ' fetchFundingRateHistory() supports swap contracts only')
2069
- request = {
2069
+ request: dict = {
2070
2070
  'symbol': market['id'].upper(),
2071
2071
  }
2072
2072
  response = await self.publicGetHistoricalfundingrates(self.extend(request, params))
@@ -2106,7 +2106,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2106
2106
  :returns: Parsed exchange response for positions
2107
2107
  """
2108
2108
  await self.load_markets()
2109
- request = {}
2109
+ request: dict = {}
2110
2110
  response = await self.privateGetOpenpositions(request)
2111
2111
  #
2112
2112
  # {
@@ -2135,7 +2135,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2135
2135
  result.append(position)
2136
2136
  return result
2137
2137
 
2138
- def parse_position(self, position, market: Market = None):
2138
+ def parse_position(self, position: dict, market: Market = None):
2139
2139
  # cross
2140
2140
  # {
2141
2141
  # "side": "long",
@@ -2189,7 +2189,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2189
2189
  'percentage': None,
2190
2190
  }
2191
2191
 
2192
- async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
2192
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
2193
2193
  """
2194
2194
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
2195
2195
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
@@ -2246,7 +2246,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2246
2246
  data = self.safe_list(response, 'instruments')
2247
2247
  return self.parse_leverage_tiers(data, symbols, 'symbol')
2248
2248
 
2249
- def parse_market_leverage_tiers(self, info, market: Market = None):
2249
+ def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
2250
2250
  """
2251
2251
  * @ignore
2252
2252
  * @param info Exchange market response for 1 market
@@ -2331,7 +2331,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2331
2331
  }
2332
2332
 
2333
2333
  def parse_account(self, account):
2334
- accountByType = {
2334
+ accountByType: dict = {
2335
2335
  'main': 'cash',
2336
2336
  'funding': 'cash',
2337
2337
  'future': 'cash',
@@ -2380,7 +2380,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2380
2380
  currency = self.currency(code)
2381
2381
  if fromAccount == 'spot':
2382
2382
  raise BadRequest(self.id + ' transfer does not yet support transfers from spot')
2383
- request = {
2383
+ request: dict = {
2384
2384
  'amount': amount,
2385
2385
  }
2386
2386
  response = None
@@ -2419,7 +2419,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2419
2419
  if symbol is None:
2420
2420
  raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
2421
2421
  await self.load_markets()
2422
- request = {
2422
+ request: dict = {
2423
2423
  'maxLeverage': leverage,
2424
2424
  'symbol': self.market_id(symbol).upper(),
2425
2425
  }
@@ -2428,7 +2428,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2428
2428
  #
2429
2429
  return await self.privatePutLeveragepreferences(self.extend(request, params))
2430
2430
 
2431
- async def fetch_leverages(self, symbols: List[str] = None, params={}) -> Leverages:
2431
+ async def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
2432
2432
  """
2433
2433
  fetch the set leverage for all contract and margin markets
2434
2434
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
@@ -2465,7 +2465,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2465
2465
  raise ArgumentsRequired(self.id + ' fetchLeverage() requires a symbol argument')
2466
2466
  await self.load_markets()
2467
2467
  market = self.market(symbol)
2468
- request = {
2468
+ request: dict = {
2469
2469
  'symbol': self.market_id(symbol).upper(),
2470
2470
  }
2471
2471
  response = await self.privateGetLeveragepreferences(self.extend(request, params))