ccxt 4.2.76__py2.py3-none-any.whl → 4.4.48__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 (546) hide show
  1. ccxt/__init__.py +36 -14
  2. ccxt/abstract/alpaca.py +4 -0
  3. ccxt/abstract/bigone.py +1 -1
  4. ccxt/abstract/binance.py +112 -48
  5. ccxt/abstract/binancecoinm.py +112 -48
  6. ccxt/abstract/binanceus.py +147 -83
  7. ccxt/abstract/binanceusdm.py +112 -48
  8. ccxt/abstract/bingx.py +133 -78
  9. ccxt/abstract/bitbank.py +5 -0
  10. ccxt/abstract/bitfinex.py +136 -65
  11. ccxt/abstract/bitfinex1.py +69 -0
  12. ccxt/abstract/bitflyer.py +1 -0
  13. ccxt/abstract/bitget.py +8 -1
  14. ccxt/abstract/bitmart.py +13 -1
  15. ccxt/abstract/bitopro.py +1 -0
  16. ccxt/abstract/bitpanda.py +0 -12
  17. ccxt/abstract/bitrue.py +3 -3
  18. ccxt/abstract/bitstamp.py +26 -3
  19. ccxt/abstract/blofin.py +24 -0
  20. ccxt/abstract/btcbox.py +1 -0
  21. ccxt/abstract/bybit.py +29 -14
  22. ccxt/abstract/cex.py +28 -29
  23. ccxt/abstract/coinbase.py +6 -0
  24. ccxt/abstract/coinbaseadvanced.py +94 -0
  25. ccxt/abstract/{coinbasepro.py → coinbaseexchange.py} +1 -0
  26. ccxt/abstract/coinbaseinternational.py +1 -1
  27. ccxt/abstract/coincatch.py +94 -0
  28. ccxt/abstract/coinex.py +233 -123
  29. ccxt/abstract/coinmetro.py +1 -0
  30. ccxt/abstract/cryptocom.py +14 -0
  31. ccxt/abstract/defx.py +69 -0
  32. ccxt/abstract/deribit.py +1 -0
  33. ccxt/abstract/digifinex.py +1 -0
  34. ccxt/abstract/ellipx.py +25 -0
  35. ccxt/abstract/gate.py +20 -0
  36. ccxt/abstract/gateio.py +20 -0
  37. ccxt/abstract/gemini.py +1 -0
  38. ccxt/abstract/hashkey.py +67 -0
  39. ccxt/abstract/hyperliquid.py +1 -1
  40. ccxt/abstract/independentreserve.py +6 -0
  41. ccxt/abstract/kraken.py +4 -3
  42. ccxt/abstract/krakenfutures.py +4 -0
  43. ccxt/abstract/kucoin.py +25 -0
  44. ccxt/abstract/kucoinfutures.py +35 -0
  45. ccxt/abstract/luno.py +2 -0
  46. ccxt/abstract/mexc.py +4 -0
  47. ccxt/abstract/myokx.py +340 -0
  48. ccxt/abstract/oceanex.py +5 -0
  49. ccxt/abstract/okx.py +30 -0
  50. ccxt/abstract/onetrading.py +0 -12
  51. ccxt/abstract/oxfun.py +34 -0
  52. ccxt/abstract/paradex.py +40 -0
  53. ccxt/abstract/phemex.py +1 -0
  54. ccxt/abstract/upbit.py +4 -0
  55. ccxt/abstract/vertex.py +19 -0
  56. ccxt/abstract/whitebit.py +31 -1
  57. ccxt/abstract/woo.py +6 -2
  58. ccxt/abstract/woofipro.py +119 -0
  59. ccxt/abstract/xt.py +153 -0
  60. ccxt/abstract/zonda.py +6 -0
  61. ccxt/ace.py +164 -60
  62. ccxt/alpaca.py +727 -63
  63. ccxt/ascendex.py +395 -249
  64. ccxt/async_support/__init__.py +36 -14
  65. ccxt/async_support/ace.py +164 -60
  66. ccxt/async_support/alpaca.py +727 -63
  67. ccxt/async_support/ascendex.py +396 -249
  68. ccxt/async_support/base/exchange.py +531 -155
  69. ccxt/async_support/base/ws/aiohttp_client.py +28 -5
  70. ccxt/async_support/base/ws/cache.py +3 -2
  71. ccxt/async_support/base/ws/client.py +26 -5
  72. ccxt/async_support/base/ws/fast_client.py +4 -3
  73. ccxt/async_support/base/ws/functions.py +1 -1
  74. ccxt/async_support/base/ws/future.py +40 -31
  75. ccxt/async_support/base/ws/order_book_side.py +3 -0
  76. ccxt/async_support/bequant.py +1 -1
  77. ccxt/async_support/bigone.py +329 -202
  78. ccxt/async_support/binance.py +3513 -1511
  79. ccxt/async_support/binancecoinm.py +2 -1
  80. ccxt/async_support/binanceus.py +12 -1
  81. ccxt/async_support/binanceusdm.py +3 -1
  82. ccxt/async_support/bingx.py +3105 -881
  83. ccxt/async_support/bit2c.py +119 -38
  84. ccxt/async_support/bitbank.py +215 -76
  85. ccxt/async_support/bitbns.py +124 -53
  86. ccxt/async_support/bitfinex.py +3236 -1078
  87. ccxt/async_support/bitfinex1.py +1711 -0
  88. ccxt/async_support/bitflyer.py +239 -50
  89. ccxt/async_support/bitget.py +1513 -563
  90. ccxt/async_support/bithumb.py +201 -67
  91. ccxt/async_support/bitmart.py +1320 -435
  92. ccxt/async_support/bitmex.py +308 -111
  93. ccxt/async_support/bitopro.py +256 -96
  94. ccxt/async_support/bitrue.py +365 -233
  95. ccxt/async_support/bitso.py +201 -89
  96. ccxt/async_support/bitstamp.py +438 -269
  97. ccxt/async_support/bitteam.py +179 -73
  98. ccxt/async_support/bitvavo.py +180 -70
  99. ccxt/async_support/bl3p.py +92 -25
  100. ccxt/async_support/blockchaincom.py +193 -79
  101. ccxt/async_support/blofin.py +403 -150
  102. ccxt/async_support/btcalpha.py +161 -55
  103. ccxt/async_support/btcbox.py +250 -34
  104. ccxt/async_support/btcmarkets.py +232 -85
  105. ccxt/async_support/btcturk.py +159 -60
  106. ccxt/async_support/bybit.py +2326 -1255
  107. ccxt/async_support/cex.py +1409 -1329
  108. ccxt/async_support/coinbase.py +1455 -288
  109. ccxt/async_support/coinbaseadvanced.py +17 -0
  110. ccxt/async_support/{coinbasepro.py → coinbaseexchange.py} +233 -99
  111. ccxt/async_support/coinbaseinternational.py +428 -88
  112. ccxt/async_support/coincatch.py +5152 -0
  113. ccxt/async_support/coincheck.py +121 -38
  114. ccxt/async_support/coinex.py +4020 -3339
  115. ccxt/async_support/coinlist.py +273 -116
  116. ccxt/async_support/coinmate.py +204 -97
  117. ccxt/async_support/coinmetro.py +203 -110
  118. ccxt/async_support/coinone.py +142 -68
  119. ccxt/async_support/coinsph.py +206 -89
  120. ccxt/async_support/coinspot.py +137 -62
  121. ccxt/async_support/cryptocom.py +515 -185
  122. ccxt/async_support/currencycom.py +203 -85
  123. ccxt/async_support/defx.py +2066 -0
  124. ccxt/async_support/delta.py +467 -158
  125. ccxt/async_support/deribit.py +558 -324
  126. ccxt/async_support/digifinex.py +340 -223
  127. ccxt/async_support/ellipx.py +1826 -0
  128. ccxt/async_support/exmo.py +259 -128
  129. ccxt/async_support/gate.py +1473 -464
  130. ccxt/async_support/gemini.py +206 -84
  131. ccxt/async_support/hashkey.py +4164 -0
  132. ccxt/async_support/hitbtc.py +334 -178
  133. ccxt/async_support/hollaex.py +134 -83
  134. ccxt/async_support/htx.py +1095 -563
  135. ccxt/async_support/huobijp.py +105 -56
  136. ccxt/async_support/hyperliquid.py +1634 -269
  137. ccxt/async_support/idex.py +148 -95
  138. ccxt/async_support/independentreserve.py +236 -31
  139. ccxt/async_support/indodax.py +165 -62
  140. ccxt/async_support/kraken.py +871 -354
  141. ccxt/async_support/krakenfutures.py +324 -100
  142. ccxt/async_support/kucoin.py +1050 -355
  143. ccxt/async_support/kucoinfutures.py +1004 -149
  144. ccxt/async_support/kuna.py +138 -106
  145. ccxt/async_support/latoken.py +135 -79
  146. ccxt/async_support/lbank.py +290 -113
  147. ccxt/async_support/luno.py +112 -62
  148. ccxt/async_support/lykke.py +104 -55
  149. ccxt/async_support/mercado.py +36 -29
  150. ccxt/async_support/mexc.py +995 -429
  151. ccxt/async_support/myokx.py +43 -0
  152. ccxt/async_support/ndax.py +163 -82
  153. ccxt/async_support/novadax.py +121 -75
  154. ccxt/async_support/oceanex.py +175 -59
  155. ccxt/async_support/okcoin.py +222 -163
  156. ccxt/async_support/okx.py +1777 -455
  157. ccxt/async_support/onetrading.py +132 -414
  158. ccxt/async_support/oxfun.py +2832 -0
  159. ccxt/async_support/p2b.py +79 -51
  160. ccxt/async_support/paradex.py +2017 -0
  161. ccxt/async_support/paymium.py +56 -32
  162. ccxt/async_support/phemex.py +572 -196
  163. ccxt/async_support/poloniex.py +218 -95
  164. ccxt/async_support/poloniexfutures.py +260 -92
  165. ccxt/async_support/probit.py +143 -110
  166. ccxt/async_support/timex.py +123 -70
  167. ccxt/async_support/tokocrypto.py +129 -93
  168. ccxt/async_support/tradeogre.py +39 -25
  169. ccxt/async_support/upbit.py +322 -113
  170. ccxt/async_support/vertex.py +2983 -0
  171. ccxt/async_support/wavesexchange.py +227 -173
  172. ccxt/async_support/wazirx.py +145 -65
  173. ccxt/async_support/whitebit.py +533 -138
  174. ccxt/async_support/woo.py +1155 -295
  175. ccxt/async_support/woofipro.py +2716 -0
  176. ccxt/async_support/xt.py +4628 -0
  177. ccxt/async_support/yobit.py +160 -92
  178. ccxt/async_support/zaif.py +80 -33
  179. ccxt/async_support/zonda.py +140 -69
  180. ccxt/base/errors.py +51 -20
  181. ccxt/base/exchange.py +1729 -482
  182. ccxt/base/precise.py +10 -0
  183. ccxt/base/types.py +223 -4
  184. ccxt/bequant.py +1 -1
  185. ccxt/bigone.py +329 -202
  186. ccxt/binance.py +3513 -1511
  187. ccxt/binancecoinm.py +2 -1
  188. ccxt/binanceus.py +12 -1
  189. ccxt/binanceusdm.py +3 -1
  190. ccxt/bingx.py +3105 -881
  191. ccxt/bit2c.py +119 -38
  192. ccxt/bitbank.py +215 -76
  193. ccxt/bitbns.py +124 -53
  194. ccxt/bitfinex.py +3235 -1078
  195. ccxt/bitfinex1.py +1710 -0
  196. ccxt/bitflyer.py +239 -50
  197. ccxt/bitget.py +1513 -563
  198. ccxt/bithumb.py +200 -67
  199. ccxt/bitmart.py +1320 -435
  200. ccxt/bitmex.py +308 -111
  201. ccxt/bitopro.py +256 -96
  202. ccxt/bitrue.py +365 -233
  203. ccxt/bitso.py +201 -89
  204. ccxt/bitstamp.py +438 -269
  205. ccxt/bitteam.py +179 -73
  206. ccxt/bitvavo.py +180 -70
  207. ccxt/bl3p.py +92 -25
  208. ccxt/blockchaincom.py +193 -79
  209. ccxt/blofin.py +403 -150
  210. ccxt/btcalpha.py +161 -55
  211. ccxt/btcbox.py +250 -34
  212. ccxt/btcmarkets.py +232 -85
  213. ccxt/btcturk.py +159 -60
  214. ccxt/bybit.py +2326 -1255
  215. ccxt/cex.py +1408 -1329
  216. ccxt/coinbase.py +1455 -288
  217. ccxt/coinbaseadvanced.py +17 -0
  218. ccxt/{coinbasepro.py → coinbaseexchange.py} +233 -99
  219. ccxt/coinbaseinternational.py +428 -88
  220. ccxt/coincatch.py +5152 -0
  221. ccxt/coincheck.py +121 -38
  222. ccxt/coinex.py +4020 -3339
  223. ccxt/coinlist.py +273 -116
  224. ccxt/coinmate.py +204 -97
  225. ccxt/coinmetro.py +203 -110
  226. ccxt/coinone.py +142 -68
  227. ccxt/coinsph.py +206 -89
  228. ccxt/coinspot.py +137 -62
  229. ccxt/cryptocom.py +515 -185
  230. ccxt/currencycom.py +203 -85
  231. ccxt/defx.py +2065 -0
  232. ccxt/delta.py +467 -158
  233. ccxt/deribit.py +558 -324
  234. ccxt/digifinex.py +340 -223
  235. ccxt/ellipx.py +1826 -0
  236. ccxt/exmo.py +259 -128
  237. ccxt/gate.py +1473 -464
  238. ccxt/gemini.py +206 -84
  239. ccxt/hashkey.py +4164 -0
  240. ccxt/hitbtc.py +334 -178
  241. ccxt/hollaex.py +134 -83
  242. ccxt/htx.py +1095 -563
  243. ccxt/huobijp.py +105 -56
  244. ccxt/hyperliquid.py +1633 -269
  245. ccxt/idex.py +148 -95
  246. ccxt/independentreserve.py +235 -31
  247. ccxt/indodax.py +165 -62
  248. ccxt/kraken.py +871 -354
  249. ccxt/krakenfutures.py +324 -100
  250. ccxt/kucoin.py +1050 -355
  251. ccxt/kucoinfutures.py +1004 -149
  252. ccxt/kuna.py +138 -106
  253. ccxt/latoken.py +135 -79
  254. ccxt/lbank.py +290 -113
  255. ccxt/luno.py +112 -62
  256. ccxt/lykke.py +104 -55
  257. ccxt/mercado.py +36 -29
  258. ccxt/mexc.py +994 -429
  259. ccxt/myokx.py +43 -0
  260. ccxt/ndax.py +163 -82
  261. ccxt/novadax.py +121 -75
  262. ccxt/oceanex.py +175 -59
  263. ccxt/okcoin.py +222 -163
  264. ccxt/okx.py +1777 -455
  265. ccxt/onetrading.py +132 -414
  266. ccxt/oxfun.py +2831 -0
  267. ccxt/p2b.py +79 -51
  268. ccxt/paradex.py +2017 -0
  269. ccxt/paymium.py +56 -32
  270. ccxt/phemex.py +572 -196
  271. ccxt/poloniex.py +218 -95
  272. ccxt/poloniexfutures.py +260 -92
  273. ccxt/pro/__init__.py +29 -5
  274. ccxt/pro/alpaca.py +32 -17
  275. ccxt/pro/ascendex.py +63 -15
  276. ccxt/pro/bequant.py +4 -0
  277. ccxt/pro/binance.py +1596 -329
  278. ccxt/pro/binancecoinm.py +1 -0
  279. ccxt/pro/binanceus.py +2 -9
  280. ccxt/pro/binanceusdm.py +2 -0
  281. ccxt/pro/bingx.py +527 -134
  282. ccxt/pro/bitcoincom.py +4 -1
  283. ccxt/pro/bitfinex.py +731 -266
  284. ccxt/pro/bitfinex1.py +635 -0
  285. ccxt/pro/bitget.py +726 -357
  286. ccxt/pro/bithumb.py +380 -0
  287. ccxt/pro/bitmart.py +138 -39
  288. ccxt/pro/bitmex.py +199 -40
  289. ccxt/pro/bitopro.py +25 -13
  290. ccxt/pro/bitrue.py +31 -32
  291. ccxt/pro/bitstamp.py +7 -6
  292. ccxt/pro/bitvavo.py +204 -82
  293. ccxt/pro/blockchaincom.py +30 -17
  294. ccxt/pro/blofin.py +692 -0
  295. ccxt/pro/bybit.py +791 -82
  296. ccxt/pro/cex.py +99 -51
  297. ccxt/pro/coinbase.py +220 -30
  298. ccxt/{async_support/hitbtc3.py → pro/coinbaseadvanced.py} +5 -5
  299. ccxt/pro/{coinbasepro.py → coinbaseexchange.py} +19 -19
  300. ccxt/pro/coinbaseinternational.py +193 -30
  301. ccxt/pro/coincatch.py +1464 -0
  302. ccxt/pro/coincheck.py +11 -6
  303. ccxt/pro/coinex.py +967 -661
  304. ccxt/pro/coinone.py +17 -10
  305. ccxt/pro/cryptocom.py +446 -66
  306. ccxt/pro/currencycom.py +11 -10
  307. ccxt/pro/defx.py +832 -0
  308. ccxt/pro/deribit.py +168 -32
  309. ccxt/pro/exmo.py +253 -21
  310. ccxt/pro/gate.py +729 -64
  311. ccxt/pro/gemini.py +44 -26
  312. ccxt/pro/hashkey.py +802 -0
  313. ccxt/pro/hitbtc.py +208 -103
  314. ccxt/pro/hollaex.py +25 -9
  315. ccxt/pro/htx.py +83 -39
  316. ccxt/pro/huobijp.py +17 -16
  317. ccxt/pro/hyperliquid.py +502 -31
  318. ccxt/pro/idex.py +28 -13
  319. ccxt/pro/independentreserve.py +21 -16
  320. ccxt/pro/kraken.py +298 -51
  321. ccxt/pro/krakenfutures.py +166 -75
  322. ccxt/pro/kucoin.py +395 -77
  323. ccxt/pro/kucoinfutures.py +400 -99
  324. ccxt/pro/lbank.py +52 -31
  325. ccxt/pro/luno.py +12 -10
  326. ccxt/pro/mexc.py +400 -50
  327. ccxt/pro/myokx.py +28 -0
  328. ccxt/pro/ndax.py +25 -12
  329. ccxt/pro/okcoin.py +28 -9
  330. ccxt/pro/okx.py +935 -124
  331. ccxt/pro/onetrading.py +41 -24
  332. ccxt/pro/oxfun.py +1054 -0
  333. ccxt/pro/p2b.py +100 -24
  334. ccxt/pro/paradex.py +352 -0
  335. ccxt/pro/phemex.py +93 -34
  336. ccxt/pro/poloniex.py +129 -50
  337. ccxt/pro/poloniexfutures.py +53 -32
  338. ccxt/pro/probit.py +93 -86
  339. ccxt/pro/upbit.py +401 -8
  340. ccxt/pro/vertex.py +943 -0
  341. ccxt/pro/wazirx.py +46 -28
  342. ccxt/pro/whitebit.py +65 -12
  343. ccxt/pro/woo.py +486 -70
  344. ccxt/pro/woofipro.py +1271 -0
  345. ccxt/pro/xt.py +1067 -0
  346. ccxt/probit.py +143 -110
  347. ccxt/static_dependencies/__init__.py +1 -1
  348. ccxt/static_dependencies/lark/__init__.py +38 -0
  349. ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
  350. ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
  351. ccxt/static_dependencies/lark/ast_utils.py +59 -0
  352. ccxt/static_dependencies/lark/common.py +86 -0
  353. ccxt/static_dependencies/lark/exceptions.py +292 -0
  354. ccxt/static_dependencies/lark/grammar.py +130 -0
  355. ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
  356. ccxt/static_dependencies/lark/indenter.py +143 -0
  357. ccxt/static_dependencies/lark/lark.py +658 -0
  358. ccxt/static_dependencies/lark/lexer.py +678 -0
  359. ccxt/static_dependencies/lark/load_grammar.py +1428 -0
  360. ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
  361. ccxt/static_dependencies/lark/parser_frontends.py +257 -0
  362. ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
  363. ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
  364. ccxt/static_dependencies/lark/parsers/earley.py +314 -0
  365. ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
  366. ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
  367. ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
  368. ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
  369. ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
  370. ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
  371. ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
  372. ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
  373. ccxt/static_dependencies/lark/py.typed +0 -0
  374. ccxt/static_dependencies/lark/reconstruct.py +107 -0
  375. ccxt/static_dependencies/lark/tools/__init__.py +70 -0
  376. ccxt/static_dependencies/lark/tools/nearley.py +202 -0
  377. ccxt/static_dependencies/lark/tools/serialize.py +32 -0
  378. ccxt/static_dependencies/lark/tools/standalone.py +196 -0
  379. ccxt/static_dependencies/lark/tree.py +267 -0
  380. ccxt/static_dependencies/lark/tree_matcher.py +186 -0
  381. ccxt/static_dependencies/lark/tree_templates.py +180 -0
  382. ccxt/static_dependencies/lark/utils.py +343 -0
  383. ccxt/static_dependencies/lark/visitors.py +596 -0
  384. ccxt/static_dependencies/marshmallow/__init__.py +81 -0
  385. ccxt/static_dependencies/marshmallow/base.py +65 -0
  386. ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
  387. ccxt/static_dependencies/marshmallow/decorators.py +231 -0
  388. ccxt/static_dependencies/marshmallow/error_store.py +60 -0
  389. ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
  390. ccxt/static_dependencies/marshmallow/fields.py +2114 -0
  391. ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
  392. ccxt/static_dependencies/marshmallow/py.typed +0 -0
  393. ccxt/static_dependencies/marshmallow/schema.py +1228 -0
  394. ccxt/static_dependencies/marshmallow/types.py +12 -0
  395. ccxt/static_dependencies/marshmallow/utils.py +378 -0
  396. ccxt/static_dependencies/marshmallow/validate.py +678 -0
  397. ccxt/static_dependencies/marshmallow/warnings.py +2 -0
  398. ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
  399. ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
  400. ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
  401. ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
  402. ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
  403. ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
  404. ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
  405. ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
  406. ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
  407. ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
  408. ccxt/static_dependencies/starknet/__init__.py +0 -0
  409. ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
  410. ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
  411. ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
  412. ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
  413. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
  414. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
  415. ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
  416. ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
  417. ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
  418. ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
  419. ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
  420. ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
  421. ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
  422. ccxt/static_dependencies/starknet/common.py +15 -0
  423. ccxt/static_dependencies/starknet/constants.py +39 -0
  424. ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
  425. ccxt/static_dependencies/starknet/hash/address.py +79 -0
  426. ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
  427. ccxt/static_dependencies/starknet/hash/selector.py +16 -0
  428. ccxt/static_dependencies/starknet/hash/storage.py +12 -0
  429. ccxt/static_dependencies/starknet/hash/utils.py +78 -0
  430. ccxt/static_dependencies/starknet/models/__init__.py +0 -0
  431. ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
  432. ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
  433. ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
  434. ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
  435. ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
  436. ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
  437. ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
  438. ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
  439. ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
  440. ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
  441. ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
  442. ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
  443. ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
  444. ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
  445. ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
  446. ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
  447. ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
  448. ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
  449. ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
  450. ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
  451. ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
  452. ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
  453. ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
  454. ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
  455. ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
  456. ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
  457. ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
  458. ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
  459. ccxt/static_dependencies/starknet/utils/schema.py +13 -0
  460. ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
  461. ccxt/static_dependencies/starkware/__init__.py +0 -0
  462. ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
  463. ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
  464. ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
  465. ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
  466. ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
  467. ccxt/static_dependencies/sympy/__init__.py +0 -0
  468. ccxt/static_dependencies/sympy/core/__init__.py +0 -0
  469. ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
  470. ccxt/static_dependencies/sympy/external/__init__.py +0 -0
  471. ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
  472. ccxt/static_dependencies/sympy/external/importtools.py +187 -0
  473. ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
  474. ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
  475. ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
  476. ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
  477. ccxt/test/{test_async.py → tests_async.py} +465 -407
  478. ccxt/test/tests_helpers.py +285 -0
  479. ccxt/test/tests_init.py +39 -0
  480. ccxt/test/{test_sync.py → tests_sync.py} +465 -409
  481. ccxt/timex.py +123 -70
  482. ccxt/tokocrypto.py +129 -93
  483. ccxt/tradeogre.py +39 -25
  484. ccxt/upbit.py +322 -113
  485. ccxt/vertex.py +2983 -0
  486. ccxt/wavesexchange.py +227 -173
  487. ccxt/wazirx.py +145 -65
  488. ccxt/whitebit.py +533 -138
  489. ccxt/woo.py +1155 -295
  490. ccxt/woofipro.py +2716 -0
  491. ccxt/xt.py +4627 -0
  492. ccxt/yobit.py +159 -92
  493. ccxt/zaif.py +80 -33
  494. ccxt/zonda.py +140 -69
  495. ccxt-4.4.48.dist-info/LICENSE.txt +21 -0
  496. ccxt-4.4.48.dist-info/METADATA +646 -0
  497. ccxt-4.4.48.dist-info/RECORD +669 -0
  498. {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/WHEEL +1 -1
  499. ccxt/abstract/bitbay.py +0 -47
  500. ccxt/abstract/bitfinex2.py +0 -139
  501. ccxt/abstract/hitbtc3.py +0 -115
  502. ccxt/async_support/bitbay.py +0 -17
  503. ccxt/async_support/bitfinex2.py +0 -3496
  504. ccxt/async_support/flowbtc.py +0 -34
  505. ccxt/bitbay.py +0 -17
  506. ccxt/bitfinex2.py +0 -3496
  507. ccxt/flowbtc.py +0 -34
  508. ccxt/hitbtc3.py +0 -16
  509. ccxt/pro/bitfinex2.py +0 -1081
  510. ccxt/test/base/__init__.py +0 -28
  511. ccxt/test/base/test_account.py +0 -26
  512. ccxt/test/base/test_balance.py +0 -56
  513. ccxt/test/base/test_borrow_interest.py +0 -35
  514. ccxt/test/base/test_borrow_rate.py +0 -32
  515. ccxt/test/base/test_calculate_fee.py +0 -51
  516. ccxt/test/base/test_crypto.py +0 -127
  517. ccxt/test/base/test_currency.py +0 -76
  518. ccxt/test/base/test_datetime.py +0 -103
  519. ccxt/test/base/test_decimal_to_precision.py +0 -392
  520. ccxt/test/base/test_deep_extend.py +0 -68
  521. ccxt/test/base/test_deposit_withdrawal.py +0 -50
  522. ccxt/test/base/test_exchange_datetime_functions.py +0 -76
  523. ccxt/test/base/test_funding_rate_history.py +0 -29
  524. ccxt/test/base/test_last_price.py +0 -32
  525. ccxt/test/base/test_ledger_entry.py +0 -45
  526. ccxt/test/base/test_ledger_item.py +0 -48
  527. ccxt/test/base/test_leverage_tier.py +0 -33
  528. ccxt/test/base/test_margin_mode.py +0 -24
  529. ccxt/test/base/test_margin_modification.py +0 -35
  530. ccxt/test/base/test_market.py +0 -190
  531. ccxt/test/base/test_number.py +0 -411
  532. ccxt/test/base/test_ohlcv.py +0 -32
  533. ccxt/test/base/test_open_interest.py +0 -32
  534. ccxt/test/base/test_order.py +0 -64
  535. ccxt/test/base/test_order_book.py +0 -63
  536. ccxt/test/base/test_position.py +0 -60
  537. ccxt/test/base/test_shared_methods.py +0 -345
  538. ccxt/test/base/test_status.py +0 -24
  539. ccxt/test/base/test_throttle.py +0 -126
  540. ccxt/test/base/test_ticker.py +0 -86
  541. ccxt/test/base/test_trade.py +0 -47
  542. ccxt/test/base/test_trading_fee.py +0 -26
  543. ccxt/test/base/test_transaction.py +0 -39
  544. ccxt-4.2.76.dist-info/METADATA +0 -626
  545. ccxt-4.2.76.dist-info/RECORD +0 -534
  546. {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/top_level.txt +0 -0
@@ -6,9 +6,10 @@
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, FundingRate, FundingRates, Trade, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InsufficientFunds
@@ -17,12 +18,11 @@ from ccxt.base.errors import OrderNotFound
17
18
  from ccxt.base.errors import OrderImmediatelyFillable
18
19
  from ccxt.base.errors import OrderNotFillable
19
20
  from ccxt.base.errors import DuplicateOrderId
21
+ from ccxt.base.errors import ContractUnavailable
20
22
  from ccxt.base.errors import DDoSProtection
21
23
  from ccxt.base.errors import RateLimitExceeded
22
24
  from ccxt.base.errors import ExchangeNotAvailable
23
25
  from ccxt.base.errors import InvalidNonce
24
- from ccxt.base.errors import AuthenticationError
25
- from ccxt.base.errors import ContractUnavailable
26
26
  from ccxt.base.decimal_to_precision import TICK_SIZE
27
27
  from ccxt.base.precise import Precise
28
28
 
@@ -46,10 +46,13 @@ class krakenfutures(Exchange, ImplicitAPI):
46
46
  'future': True,
47
47
  'option': False,
48
48
  'cancelAllOrders': True,
49
+ 'cancelAllOrdersAfter': True,
49
50
  'cancelOrder': True,
50
51
  'cancelOrders': True,
51
52
  'createMarketOrder': False,
52
53
  'createOrder': True,
54
+ 'createStopOrder': True,
55
+ 'createTriggerOrder': True,
53
56
  'editOrder': True,
54
57
  'fetchBalance': True,
55
58
  'fetchBorrowRateHistories': False,
@@ -85,6 +88,7 @@ class krakenfutures(Exchange, ImplicitAPI):
85
88
  'fetchPremiumIndexOHLCV': False,
86
89
  'fetchTickers': True,
87
90
  'fetchTrades': True,
91
+ 'sandbox': True,
88
92
  'setLeverage': True,
89
93
  'setMarginMode': False,
90
94
  'transfer': True,
@@ -94,6 +98,7 @@ class krakenfutures(Exchange, ImplicitAPI):
94
98
  'public': 'https://demo-futures.kraken.com/derivatives/api/',
95
99
  'private': 'https://demo-futures.kraken.com/derivatives/api/',
96
100
  'charts': 'https://demo-futures.kraken.com/api/charts/',
101
+ 'history': 'https://demo-futures.kraken.com/api/history/',
97
102
  'www': 'https://demo-futures.kraken.com',
98
103
  },
99
104
  'logo': 'https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg',
@@ -134,6 +139,8 @@ class krakenfutures(Exchange, ImplicitAPI):
134
139
  'transfers',
135
140
  'leveragepreferences',
136
141
  'pnlpreferences',
142
+ 'assignmentprogram/current',
143
+ 'assignmentprogram/history',
137
144
  ],
138
145
  'post': [
139
146
  'sendorder',
@@ -144,6 +151,8 @@ class krakenfutures(Exchange, ImplicitAPI):
144
151
  'cancelallorders',
145
152
  'cancelallordersafter',
146
153
  'withdrawal', # for futures wallet -> kraken spot wallet
154
+ 'assignmentprogram/add',
155
+ 'assignmentprogram/delete',
147
156
  ],
148
157
  'put': [
149
158
  'leveragepreferences',
@@ -209,7 +218,7 @@ class krakenfutures(Exchange, ImplicitAPI):
209
218
  'invalidAmount': BadRequest,
210
219
  'insufficientFunds': InsufficientFunds,
211
220
  'Bad Request': BadRequest, # The URL contains invalid characters.(Please encode the json URL parameter)
212
- 'Unavailable': InsufficientFunds, # Insufficient funds in Futures account [withdraw]
221
+ 'Unavailable': ExchangeNotAvailable, # https://github.com/ccxt/ccxt/issues/24338
213
222
  'invalidUnit': BadRequest,
214
223
  'Json Parse Error': ExchangeError,
215
224
  'nonceBelowThreshold': InvalidNonce,
@@ -267,6 +276,83 @@ class krakenfutures(Exchange, ImplicitAPI):
267
276
  'method': 'historyGetMarketSymbolExecutions', # historyGetMarketSymbolExecutions, publicGetHistory
268
277
  },
269
278
  },
279
+ 'features': {
280
+ 'default': {
281
+ 'sandbox': True,
282
+ 'createOrder': {
283
+ 'marginMode': False,
284
+ 'triggerPrice': True,
285
+ 'triggerPriceType': {
286
+ 'last': True,
287
+ 'mark': True,
288
+ 'index': True,
289
+ },
290
+ 'triggerDirection': False,
291
+ 'stopLossPrice': True,
292
+ 'takeProfitPrice': True,
293
+ 'attachedStopLossTakeProfit': None,
294
+ 'timeInForce': {
295
+ 'IOC': True,
296
+ 'FOK': True,
297
+ 'PO': True,
298
+ 'GTD': False,
299
+ },
300
+ 'hedged': False,
301
+ 'trailing': False,
302
+ 'leverage': False,
303
+ 'marketBuyByCost': False,
304
+ 'marketBuyRequiresPrice': False,
305
+ 'selfTradePrevention': False,
306
+ 'iceberg': False,
307
+ },
308
+ 'createOrders': {
309
+ 'max': 100,
310
+ },
311
+ 'fetchMyTrades': {
312
+ 'marginMode': False,
313
+ 'limit': None,
314
+ 'daysBack': None,
315
+ 'untilDays': 100000,
316
+ },
317
+ 'fetchOrder': None,
318
+ 'fetchOpenOrders': {
319
+ 'marginMode': False,
320
+ 'limit': None,
321
+ 'trigger': False,
322
+ 'trailing': False,
323
+ },
324
+ 'fetchOrders': None,
325
+ 'fetchClosedOrders': {
326
+ 'marginMode': False,
327
+ 'limit': None,
328
+ 'daysBack': None,
329
+ 'daysBackCanceled': None,
330
+ 'untilDays': None,
331
+ 'trigger': False,
332
+ 'trailing': False,
333
+ },
334
+ 'fetchOHLCV': {
335
+ 'limit': 5000,
336
+ },
337
+ },
338
+ 'spot': None,
339
+ 'swap': {
340
+ 'linear': {
341
+ 'extends': 'default',
342
+ },
343
+ 'inverse': {
344
+ 'extends': 'default',
345
+ },
346
+ },
347
+ 'future': {
348
+ 'linear': {
349
+ 'extends': 'default',
350
+ },
351
+ 'inverse': {
352
+ 'extends': 'default',
353
+ },
354
+ },
355
+ },
270
356
  'timeframes': {
271
357
  '1m': '1m',
272
358
  '5m': '5m',
@@ -280,10 +366,12 @@ class krakenfutures(Exchange, ImplicitAPI):
280
366
  },
281
367
  })
282
368
 
283
- async def fetch_markets(self, params={}):
369
+ async def fetch_markets(self, params={}) -> List[Market]:
284
370
  """
285
371
  Fetches the available trading markets from the exchange, Multi-collateral markets are returned markets, but can be settled in multiple currencies
286
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
372
+
373
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
374
+
287
375
  :param dict [params]: exchange specific params
288
376
  :returns: An array of market structures
289
377
  """
@@ -363,7 +451,8 @@ class krakenfutures(Exchange, ImplicitAPI):
363
451
  # swap == perpetual
364
452
  settle = None
365
453
  settleId = None
366
- amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'contractValueTradePrecision', '0')))
454
+ cvtp = self.safe_string(market, 'contractValueTradePrecision')
455
+ amountPrecision = self.parse_number(self.integer_precision_to_amount(cvtp))
367
456
  pricePrecision = self.safe_number(market, 'tickSize')
368
457
  contract = (swap or future or index)
369
458
  swapOrFutures = (swap or future)
@@ -447,7 +536,9 @@ class krakenfutures(Exchange, ImplicitAPI):
447
536
 
448
537
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
449
538
  """
450
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
539
+
540
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
541
+
451
542
  Fetches a list of open orders in a market
452
543
  :param str symbol: Unified market symbol
453
544
  :param int [limit]: Not used by krakenfutures
@@ -456,7 +547,7 @@ class krakenfutures(Exchange, ImplicitAPI):
456
547
  """
457
548
  await self.load_markets()
458
549
  market = self.market(symbol)
459
- request = {
550
+ request: dict = {
460
551
  'symbol': market['id'],
461
552
  }
462
553
  response = await self.publicGetOrderbook(self.extend(request, params))
@@ -496,7 +587,9 @@ class krakenfutures(Exchange, ImplicitAPI):
496
587
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
497
588
  """
498
589
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
499
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
590
+
591
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
592
+
500
593
  :param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
501
594
  :param dict [params]: extra parameters specific to the exchange API endpoint
502
595
  :returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -535,10 +628,10 @@ class krakenfutures(Exchange, ImplicitAPI):
535
628
  # "serverTime": "2022-02-18T14:16:29.440Z"
536
629
  # }
537
630
  #
538
- tickers = self.safe_value(response, 'tickers')
631
+ tickers = self.safe_list(response, 'tickers')
539
632
  return self.parse_tickers(tickers, symbols)
540
633
 
541
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
634
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
542
635
  #
543
636
  # {
544
637
  # "tag": 'semiannual', # 'month', 'quarter', "perpetual", "semiannual",
@@ -603,12 +696,16 @@ class krakenfutures(Exchange, ImplicitAPI):
603
696
  'average': average,
604
697
  'baseVolume': baseVolume,
605
698
  'quoteVolume': quoteVolume,
699
+ 'markPrice': self.safe_string(ticker, 'markPrice'),
700
+ 'indexPrice': self.safe_string(ticker, 'indexPrice'),
606
701
  'info': ticker,
607
702
  })
608
703
 
609
704
  async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
610
705
  """
611
- :see: https://docs.futures.kraken.com/#http-api-charts-candles
706
+
707
+ https://docs.futures.kraken.com/#http-api-charts-candles
708
+
612
709
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
613
710
  :param str symbol: unified symbol of the market to fetch OHLCV data for
614
711
  :param str timeframe: the length of time each candle represents
@@ -624,7 +721,7 @@ class krakenfutures(Exchange, ImplicitAPI):
624
721
  paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
625
722
  if paginate:
626
723
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000)
627
- request = {
724
+ request: dict = {
628
725
  'symbol': market['id'],
629
726
  'price_type': self.safe_string(params, 'price', 'trade'),
630
727
  'interval': self.timeframes[timeframe],
@@ -635,14 +732,12 @@ class krakenfutures(Exchange, ImplicitAPI):
635
732
  request['from'] = self.parse_to_int(since / 1000)
636
733
  if limit is None:
637
734
  limit = 5000
638
- elif limit > 5000:
639
- raise BadRequest(self.id + ' fetchOHLCV() limit cannot exceed 5000')
735
+ limit = min(limit, 5000)
640
736
  toTimestamp = self.sum(request['from'], limit * duration - 1)
641
737
  currentTimestamp = self.seconds()
642
738
  request['to'] = min(toTimestamp, currentTimestamp)
643
739
  elif limit is not None:
644
- if limit > 5000:
645
- raise BadRequest(self.id + ' fetchOHLCV() limit cannot exceed 5000')
740
+ limit = min(limit, 5000)
646
741
  duration = self.parse_timeframe(timeframe)
647
742
  request['to'] = self.seconds()
648
743
  request['from'] = self.parse_to_int(request['to'] - (duration * limit))
@@ -662,7 +757,7 @@ class krakenfutures(Exchange, ImplicitAPI):
662
757
  # "more_candles": True
663
758
  # }
664
759
  #
665
- candles = self.safe_value(response, 'candles')
760
+ candles = self.safe_list(response, 'candles')
666
761
  return self.parse_ohlcvs(candles, market, timeframe, since, limit)
667
762
 
668
763
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -687,8 +782,10 @@ class krakenfutures(Exchange, ImplicitAPI):
687
782
 
688
783
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
689
784
  """
690
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
691
- :see: https://docs.futures.kraken.com/#http-api-history-market-history-get-public-execution-events
785
+
786
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
787
+ https://docs.futures.kraken.com/#http-api-history-market-history-get-public-execution-events
788
+
692
789
  Fetch a history of filled trades that self account has made
693
790
  :param str symbol: Unified CCXT market symbol
694
791
  :param int [since]: Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
@@ -705,7 +802,7 @@ class krakenfutures(Exchange, ImplicitAPI):
705
802
  if paginate:
706
803
  return await self.fetch_paginated_call_dynamic('fetchTrades', symbol, since, limit, params)
707
804
  market = self.market(symbol)
708
- request = {
805
+ request: dict = {
709
806
  'symbol': market['id'],
710
807
  }
711
808
  method = None
@@ -804,7 +901,7 @@ class krakenfutures(Exchange, ImplicitAPI):
804
901
  rawTrades = self.safe_list(response, 'history', [])
805
902
  return self.parse_trades(rawTrades, market, since, limit)
806
903
 
807
- def parse_trade(self, trade, market: Market = None) -> Trade:
904
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
808
905
  #
809
906
  # fetchTrades(recent trades)
810
907
  #
@@ -949,7 +1046,7 @@ class krakenfutures(Exchange, ImplicitAPI):
949
1046
  type = 'lmt'
950
1047
  elif type == 'market':
951
1048
  type = 'mkt'
952
- request = {
1049
+ request: dict = {
953
1050
  'symbol': market['id'],
954
1051
  'side': side,
955
1052
  'size': self.amount_to_precision(symbol, amount),
@@ -990,12 +1087,15 @@ class krakenfutures(Exchange, ImplicitAPI):
990
1087
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
991
1088
  """
992
1089
  Create an order on the exchange
993
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-send-order
1090
+
1091
+ https://docs.kraken.com/api/docs/futures-api/trading/send-order
1092
+
994
1093
  :param str symbol: unified market symbol
995
1094
  :param str type: 'limit' or 'market'
996
1095
  :param str side: 'buy' or 'sell'
997
1096
  :param float amount: number of contracts
998
1097
  :param float [price]: limit order price
1098
+ :param dict [params]: extra parameters specific to the exchange API endpoint
999
1099
  :param bool [params.reduceOnly]: set if you wish the order to only reduce an existing position, any order which increases an existing position will be rejected, default is False
1000
1100
  :param bool [params.postOnly]: set if you wish to make a postOnly order, default is False
1001
1101
  :param str [params.clientOrderId]: UUID The order identity that is specified from the user, It must be globally unique
@@ -1003,6 +1103,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1003
1103
  :param float [params.stopLossPrice]: the price that a stop loss order is triggered at
1004
1104
  :param float [params.takeProfitPrice]: the price that a take profit order is triggered at
1005
1105
  :param str [params.triggerSignal]: for triggerPrice, stopLossPrice and takeProfitPrice orders, the trigger price type, 'last', 'mark' or 'index', default is 'last'
1106
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1006
1107
  """
1007
1108
  await self.load_markets()
1008
1109
  market = self.market(symbol)
@@ -1046,8 +1147,11 @@ class krakenfutures(Exchange, ImplicitAPI):
1046
1147
  async def create_orders(self, orders: List[OrderRequest], params={}):
1047
1148
  """
1048
1149
  create a list of trade orders
1049
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-batch-order-management
1150
+
1151
+ https://docs.kraken.com/api/docs/futures-api/trading/send-batch-order
1152
+
1050
1153
  :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1154
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1051
1155
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1052
1156
  """
1053
1157
  await self.load_markets()
@@ -1067,7 +1171,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1067
1171
  extendedParams['order'] = 'send'
1068
1172
  orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
1069
1173
  ordersRequests.append(orderRequest)
1070
- request = {
1174
+ request: dict = {
1071
1175
  'batchOrder': ordersRequests,
1072
1176
  }
1073
1177
  response = await self.privatePostBatchorder(self.extend(request, params))
@@ -1087,12 +1191,14 @@ class krakenfutures(Exchange, ImplicitAPI):
1087
1191
  # ]
1088
1192
  # }
1089
1193
  #
1090
- data = self.safe_value(response, 'batchStatus', [])
1194
+ data = self.safe_list(response, 'batchStatus', [])
1091
1195
  return self.parse_orders(data)
1092
1196
 
1093
1197
  async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1094
1198
  """
1095
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
1199
+
1200
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
1201
+
1096
1202
  Edit an open order on the exchange
1097
1203
  :param str id: order id
1098
1204
  :param str symbol: Not used by Krakenfutures
@@ -1104,7 +1210,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1104
1210
  :returns: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1105
1211
  """
1106
1212
  await self.load_markets()
1107
- request = {
1213
+ request: dict = {
1108
1214
  'orderId': id,
1109
1215
  }
1110
1216
  if amount is not None:
@@ -1120,7 +1226,9 @@ class krakenfutures(Exchange, ImplicitAPI):
1120
1226
 
1121
1227
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
1122
1228
  """
1123
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
1229
+
1230
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
1231
+
1124
1232
  Cancel an open order on the exchange
1125
1233
  :param str id: Order id
1126
1234
  :param str symbol: Not used by Krakenfutures
@@ -1131,7 +1239,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1131
1239
  response = await self.privatePostCancelorder(self.extend({'order_id': id}, params))
1132
1240
  status = self.safe_string(self.safe_value(response, 'cancelStatus', {}), 'status')
1133
1241
  self.verify_order_action_success(status, 'cancelOrder')
1134
- order = {}
1242
+ order: dict = {}
1135
1243
  if 'cancelStatus' in response:
1136
1244
  order = self.parse_order(response['cancelStatus'])
1137
1245
  return self.extend({'info': response}, order)
@@ -1139,12 +1247,14 @@ class krakenfutures(Exchange, ImplicitAPI):
1139
1247
  async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
1140
1248
  """
1141
1249
  cancel multiple orders
1142
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-batch-order-management
1250
+
1251
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-batch-order-management
1252
+
1143
1253
  :param str[] ids: order ids
1144
1254
  :param str [symbol]: unified market symbol
1145
1255
  :param dict [params]: extra parameters specific to the exchange API endpoint
1146
- *
1147
- * EXCHANGE SPECIFIC PARAMETERS
1256
+
1257
+ EXCHANGE SPECIFIC PARAMETERS
1148
1258
  :param str[] [params.clientOrderIds]: max length 10 e.g. ["my_id_1","my_id_2"]
1149
1259
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1150
1260
  """
@@ -1158,7 +1268,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1158
1268
  else:
1159
1269
  for i in range(0, len(ids)):
1160
1270
  orders.append({'order': 'cancel', 'order_id': ids[i]})
1161
- request = {
1271
+ request: dict = {
1162
1272
  'batchOrder': orders,
1163
1273
  }
1164
1274
  response = await self.privatePostBatchorder(self.extend(request, params))
@@ -1191,26 +1301,95 @@ class krakenfutures(Exchange, ImplicitAPI):
1191
1301
  # }
1192
1302
  # ]
1193
1303
  # }
1194
- batchStatus = self.safe_value(response, 'batchStatus', [])
1304
+ batchStatus = self.safe_list(response, 'batchStatus', [])
1195
1305
  return self.parse_orders(batchStatus)
1196
1306
 
1197
1307
  async def cancel_all_orders(self, symbol: Str = None, params={}):
1198
1308
  """
1199
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
1309
+
1310
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
1311
+
1200
1312
  Cancels all orders on the exchange, including trigger orders
1201
1313
  :param str symbol: Unified market symbol
1202
1314
  :param dict [params]: Exchange specific params
1203
1315
  :returns: Response from exchange api
1204
1316
  """
1205
- request = {}
1317
+ request: dict = {}
1206
1318
  if symbol is not None:
1207
1319
  request['symbol'] = self.market_id(symbol)
1208
1320
  response = await self.privatePostCancelallorders(self.extend(request, params))
1321
+ #
1322
+ # {
1323
+ # result: 'success',
1324
+ # cancelStatus: {
1325
+ # receivedTime: '2024-06-06T01:12:44.814Z',
1326
+ # cancelOnly: 'PF_XRPUSD',
1327
+ # status: 'cancelled',
1328
+ # cancelledOrders: [{order_id: '272fd0ac-45c0-4003-b84d-d39b9e86bd36'}],
1329
+ # orderEvents: [
1330
+ # {
1331
+ # uid: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
1332
+ # order: {
1333
+ # orderId: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
1334
+ # cliOrdId: null,
1335
+ # type: 'lmt',
1336
+ # symbol: 'PF_XRPUSD',
1337
+ # side: 'buy',
1338
+ # quantity: '10',
1339
+ # filled: '0',
1340
+ # limitPrice: '0.4',
1341
+ # reduceOnly: False,
1342
+ # timestamp: '2024-06-06T01:11:16.045Z',
1343
+ # lastUpdateTimestamp: '2024-06-06T01:11:16.045Z'
1344
+ # },
1345
+ # type: 'CANCEL'
1346
+ # }
1347
+ # ]
1348
+ # },
1349
+ # serverTime: '2024-06-06T01:12:44.814Z'
1350
+ # }
1351
+ #
1352
+ cancelStatus = self.safe_dict(response, 'cancelStatus')
1353
+ orderEvents = self.safe_list(cancelStatus, 'orderEvents', [])
1354
+ orders = []
1355
+ for i in range(0, len(orderEvents)):
1356
+ orderEvent = self.safe_dict(orderEvents, 0)
1357
+ order = self.safe_dict(orderEvent, 'order', {})
1358
+ orders.append(order)
1359
+ return self.parse_orders(orders)
1360
+
1361
+ async def cancel_all_orders_after(self, timeout: Int, params={}):
1362
+ """
1363
+ dead man's switch, cancel all orders after the given timeout
1364
+
1365
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-dead-man-39-s-switch
1366
+
1367
+ :param number timeout: time in milliseconds, 0 represents cancel the timer
1368
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1369
+ :returns dict: the api result
1370
+ """
1371
+ await self.load_markets()
1372
+ request: dict = {
1373
+ 'timeout': (self.parse_to_int(timeout / 1000)) if (timeout > 0) else 0,
1374
+ }
1375
+ response = await self.privatePostCancelallordersafter(self.extend(request, params))
1376
+ #
1377
+ # {
1378
+ # "result": "success",
1379
+ # "serverTime": "2018-06-19T16:51:23.839Z",
1380
+ # "status": {
1381
+ # "currentTime": "2018-06-19T16:51:23.839Z",
1382
+ # "triggerTime": "0"
1383
+ # }
1384
+ # }
1385
+ #
1209
1386
  return response
1210
1387
 
1211
1388
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1212
1389
  """
1213
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
1390
+
1391
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
1392
+
1214
1393
  Gets all open orders, including trigger orders, for an account from the exchange api
1215
1394
  :param str symbol: Unified market symbol
1216
1395
  :param int [since]: Timestamp(ms) of earliest order.(Not used by kraken api but filtered internally by CCXT)
@@ -1223,12 +1402,14 @@ class krakenfutures(Exchange, ImplicitAPI):
1223
1402
  if symbol is not None:
1224
1403
  market = self.market(symbol)
1225
1404
  response = await self.privateGetOpenorders(params)
1226
- orders = self.safe_value(response, 'openOrders', [])
1405
+ orders = self.safe_list(response, 'openOrders', [])
1227
1406
  return self.parse_orders(orders, market, since, limit)
1228
1407
 
1229
1408
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1230
1409
  """
1231
- :see: https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
1410
+
1411
+ https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
1412
+
1232
1413
  Gets all closed orders, including trigger orders, for an account from the exchange api
1233
1414
  :param str symbol: Unified market symbol
1234
1415
  :param int [since]: Timestamp(ms) of earliest order.
@@ -1240,7 +1421,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1240
1421
  market = None
1241
1422
  if symbol is not None:
1242
1423
  market = self.market(symbol)
1243
- request = {}
1424
+ request: dict = {}
1244
1425
  if limit is not None:
1245
1426
  request['count'] = limit
1246
1427
  if since is not None:
@@ -1262,7 +1443,9 @@ class krakenfutures(Exchange, ImplicitAPI):
1262
1443
 
1263
1444
  async def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1264
1445
  """
1265
- :see: https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
1446
+
1447
+ https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
1448
+
1266
1449
  Gets all canceled orders, including trigger orders, for an account from the exchange api
1267
1450
  :param str symbol: Unified market symbol
1268
1451
  :param int [since]: Timestamp(ms) of earliest order.
@@ -1274,7 +1457,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1274
1457
  market = None
1275
1458
  if symbol is not None:
1276
1459
  market = self.market(symbol)
1277
- request = {}
1460
+ request: dict = {}
1278
1461
  if limit is not None:
1279
1462
  request['count'] = limit
1280
1463
  if since is not None:
@@ -1305,7 +1488,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1305
1488
  return self.parse_orders(canceledAndRejected, market, since, limit)
1306
1489
 
1307
1490
  def parse_order_type(self, orderType):
1308
- map = {
1491
+ map: dict = {
1309
1492
  'lmt': 'limit',
1310
1493
  'mkt': 'market',
1311
1494
  'post': 'limit',
@@ -1314,7 +1497,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1314
1497
  return self.safe_string(map, orderType, orderType)
1315
1498
 
1316
1499
  def verify_order_action_success(self, status, method, omit=[]):
1317
- errors = {
1500
+ errors: dict = {
1318
1501
  'invalidOrderType': InvalidOrder,
1319
1502
  'invalidSide': InvalidOrder,
1320
1503
  'invalidSize': InvalidOrder,
@@ -1339,8 +1522,8 @@ class krakenfutures(Exchange, ImplicitAPI):
1339
1522
  if (status in errors) and not self.in_array(status, omit):
1340
1523
  raise errors[status](self.id + ': ' + method + ' failed due to ' + status)
1341
1524
 
1342
- def parse_order_status(self, status):
1343
- statuses = {
1525
+ def parse_order_status(self, status: Str):
1526
+ statuses: dict = {
1344
1527
  'placed': 'open', # the order was placed successfully
1345
1528
  'cancelled': 'canceled', # the order was cancelled successfully
1346
1529
  'invalidOrderType': 'rejected', # the order was not placed because orderType is invalid
@@ -1370,7 +1553,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1370
1553
  }
1371
1554
  return self.safe_string(statuses, status, status)
1372
1555
 
1373
- def parse_order(self, order, market: Market = None) -> Order:
1556
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1374
1557
  #
1375
1558
  # LIMIT
1376
1559
  #
@@ -1525,6 +1708,22 @@ class krakenfutures(Exchange, ImplicitAPI):
1525
1708
  # ]
1526
1709
  # }
1527
1710
  #
1711
+ # cancelAllOrders
1712
+ #
1713
+ # {
1714
+ # "orderId": "85c40002-3f20-4e87-9302-262626c3531b",
1715
+ # "cliOrdId": null,
1716
+ # "type": "lmt",
1717
+ # "symbol": "pi_xbtusd",
1718
+ # "side": "buy",
1719
+ # "quantity": 1000,
1720
+ # "filled": 0,
1721
+ # "limitPrice": 10144,
1722
+ # "stopPrice": null,
1723
+ # "reduceOnly": False,
1724
+ # "timestamp": "2019-08-01T15:26:27.790Z"
1725
+ # }
1726
+ #
1528
1727
  # FETCH OPEN ORDERS
1529
1728
  #
1530
1729
  # {
@@ -1593,16 +1792,17 @@ class krakenfutures(Exchange, ImplicitAPI):
1593
1792
  executions.append(item)
1594
1793
  # Final order(after placement / editing / execution / canceling)
1595
1794
  orderTrigger = self.safe_value(item, 'orderTrigger')
1596
- details = self.safe_value_2(item, 'new', 'order', orderTrigger)
1597
- if details is not None:
1598
- isPrior = False
1599
- fixed = True
1600
- elif not fixed:
1601
- orderPriorExecution = self.safe_value(item, 'orderPriorExecution')
1602
- details = self.safe_value_2(item, 'orderPriorExecution', 'orderPriorEdit')
1603
- price = self.safe_string(orderPriorExecution, 'limitPrice')
1795
+ if details is None:
1796
+ details = self.safe_value_2(item, 'new', 'order', orderTrigger)
1604
1797
  if details is not None:
1605
- isPrior = True
1798
+ isPrior = False
1799
+ fixed = True
1800
+ elif not fixed:
1801
+ orderPriorExecution = self.safe_value(item, 'orderPriorExecution')
1802
+ details = self.safe_value_2(item, 'orderPriorExecution', 'orderPriorEdit')
1803
+ price = self.safe_string(orderPriorExecution, 'limitPrice')
1804
+ if details is not None:
1805
+ isPrior = True
1606
1806
  trades = self.parse_trades(executions)
1607
1807
  statusId = self.safe_string(order, 'status')
1608
1808
  if details is None:
@@ -1678,10 +1878,9 @@ class krakenfutures(Exchange, ImplicitAPI):
1678
1878
  'type': self.parse_order_type(type),
1679
1879
  'timeInForce': timeInForce,
1680
1880
  'postOnly': type == 'post',
1681
- 'reduceOnly': self.safe_value(details, 'reduceOnly'),
1881
+ 'reduceOnly': self.safe_bool_2(details, 'reduceOnly', 'reduce_only'),
1682
1882
  'side': self.safe_string(details, 'side'),
1683
1883
  'price': price,
1684
- 'stopPrice': self.safe_string(details, 'triggerPrice'),
1685
1884
  'triggerPrice': self.safe_string(details, 'triggerPrice'),
1686
1885
  'amount': amount,
1687
1886
  'cost': cost,
@@ -1697,7 +1896,9 @@ class krakenfutures(Exchange, ImplicitAPI):
1697
1896
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1698
1897
  """
1699
1898
  fetch all trades made by the user
1700
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
1899
+
1900
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
1901
+
1701
1902
  :param str symbol: unified market symbol
1702
1903
  :param int [since]: *not used by the api* the earliest time in ms to fetch trades for
1703
1904
  :param int [limit]: the maximum number of trades structures to retrieve
@@ -1709,6 +1910,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1709
1910
  market = None
1710
1911
  if symbol is not None:
1711
1912
  market = self.market(symbol)
1913
+ # todo: lastFillTime: self.iso8601(end)
1712
1914
  response = await self.privateGetFills(params)
1713
1915
  #
1714
1916
  # {
@@ -1734,7 +1936,9 @@ class krakenfutures(Exchange, ImplicitAPI):
1734
1936
 
1735
1937
  async def fetch_balance(self, params={}) -> Balances:
1736
1938
  """
1737
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
1939
+
1940
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
1941
+
1738
1942
  Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
1739
1943
  :param dict [params]: Exchange specific parameters
1740
1944
  :param str [params.type]: The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' *
@@ -1920,7 +2124,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1920
2124
  isFlex = (accountType == 'multiCollateralMarginAccount')
1921
2125
  isCash = (accountType == 'cashAccount')
1922
2126
  balances = self.safe_value_2(response, 'balances', 'currencies', {})
1923
- result = {}
2127
+ result: dict = {}
1924
2128
  currencyIds = list(balances.keys())
1925
2129
  for i in range(0, len(currencyIds)):
1926
2130
  currencyId = currencyIds[i]
@@ -1944,10 +2148,12 @@ class krakenfutures(Exchange, ImplicitAPI):
1944
2148
  result[code] = account
1945
2149
  return self.safe_balance(result)
1946
2150
 
1947
- async def fetch_funding_rates(self, symbols: Strings = None, params={}):
2151
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
1948
2152
  """
1949
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
1950
- fetch the current funding rates
2153
+ fetch the current funding rates for multiple markets
2154
+
2155
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
2156
+
1951
2157
  :param str[] symbols: unified market symbols
1952
2158
  :param dict [params]: extra parameters specific to the exchange API endpoint
1953
2159
  :returns Order[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -1955,7 +2161,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1955
2161
  await self.load_markets()
1956
2162
  marketIds = self.market_ids(symbols)
1957
2163
  response = await self.publicGetTickers(params)
1958
- tickers = self.safe_value(response, 'tickers')
2164
+ tickers = self.safe_list(response, 'tickers', [])
1959
2165
  fundingRates = []
1960
2166
  for i in range(0, len(tickers)):
1961
2167
  entry = tickers[i]
@@ -1968,7 +2174,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1968
2174
  fundingRates.append(parsed)
1969
2175
  return self.index_by(fundingRates, 'symbol')
1970
2176
 
1971
- def parse_funding_rate(self, ticker, market: Market = None):
2177
+ def parse_funding_rate(self, ticker, market: Market = None) -> FundingRate:
1972
2178
  #
1973
2179
  # {"ask": 26.283,
1974
2180
  # "askSize": 4.6,
@@ -2022,12 +2228,15 @@ class krakenfutures(Exchange, ImplicitAPI):
2022
2228
  'previousFundingRate': None,
2023
2229
  'previousFundingTimestamp': None,
2024
2230
  'previousFundingDatetime': None,
2231
+ 'interval': None,
2025
2232
  }
2026
2233
 
2027
2234
  async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2028
2235
  """
2029
2236
  fetches historical funding rate prices
2030
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
2237
+
2238
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
2239
+
2031
2240
  :param str symbol: unified symbol of the market to fetch the funding rate history for
2032
2241
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
2033
2242
  :param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
@@ -2040,7 +2249,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2040
2249
  market = self.market(symbol)
2041
2250
  if not market['swap']:
2042
2251
  raise BadRequest(self.id + ' fetchFundingRateHistory() supports swap contracts only')
2043
- request = {
2252
+ request: dict = {
2044
2253
  'symbol': market['id'].upper(),
2045
2254
  }
2046
2255
  response = await self.publicGetHistoricalfundingrates(self.extend(request, params))
@@ -2073,14 +2282,16 @@ class krakenfutures(Exchange, ImplicitAPI):
2073
2282
 
2074
2283
  async def fetch_positions(self, symbols: Strings = None, params={}):
2075
2284
  """
2076
- :see: https://docs.futures.kraken.com/#websocket-api-private-feeds-open-positions
2285
+
2286
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-open-positions
2287
+
2077
2288
  Fetches current contract trading positions
2078
2289
  :param str[] symbols: List of unified symbols
2079
2290
  :param dict [params]: Not used by krakenfutures
2080
2291
  :returns: Parsed exchange response for positions
2081
2292
  """
2082
2293
  await self.load_markets()
2083
- request = {}
2294
+ request: dict = {}
2084
2295
  response = await self.privateGetOpenpositions(request)
2085
2296
  #
2086
2297
  # {
@@ -2109,7 +2320,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2109
2320
  result.append(position)
2110
2321
  return result
2111
2322
 
2112
- def parse_position(self, position, market: Market = None):
2323
+ def parse_position(self, position: dict, market: Market = None):
2113
2324
  # cross
2114
2325
  # {
2115
2326
  # "side": "long",
@@ -2163,10 +2374,12 @@ class krakenfutures(Exchange, ImplicitAPI):
2163
2374
  'percentage': None,
2164
2375
  }
2165
2376
 
2166
- async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
2377
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
2167
2378
  """
2168
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
2169
2379
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
2380
+
2381
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
2382
+
2170
2383
  :param str[]|None symbols: list of unified market symbols
2171
2384
  :param dict [params]: extra parameters specific to the exchange API endpoint
2172
2385
  :returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
@@ -2217,14 +2430,14 @@ class krakenfutures(Exchange, ImplicitAPI):
2217
2430
  # "serverTime": "2018-07-19T11:32:39.433Z"
2218
2431
  # }
2219
2432
  #
2220
- data = self.safe_value(response, 'instruments')
2433
+ data = self.safe_list(response, 'instruments')
2221
2434
  return self.parse_leverage_tiers(data, symbols, 'symbol')
2222
2435
 
2223
- def parse_market_leverage_tiers(self, info, market: Market = None):
2436
+ def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
2224
2437
  """
2225
- * @ignore
2226
- * @param info Exchange market response for 1 market
2227
- * @param market CCXT market
2438
+ @ignore
2439
+ @param info Exchange market response for 1 market
2440
+ @param market CCXT market
2228
2441
  """
2229
2442
  #
2230
2443
  # {
@@ -2260,29 +2473,32 @@ class krakenfutures(Exchange, ImplicitAPI):
2260
2473
  # }
2261
2474
  #
2262
2475
  marginLevels = self.safe_value(info, 'marginLevels')
2263
- id = self.safe_string(info, 'symbol')
2264
- market = self.safe_market(id, market)
2476
+ marketId = self.safe_string(info, 'symbol')
2477
+ market = self.safe_market(marketId, market)
2265
2478
  tiers = []
2479
+ if marginLevels is None:
2480
+ return tiers
2266
2481
  for i in range(0, len(marginLevels)):
2267
2482
  tier = marginLevels[i]
2268
2483
  initialMargin = self.safe_string(tier, 'initialMargin')
2269
- notionalFloor = self.safe_number(tier, 'contracts')
2484
+ minNotional = self.safe_number(tier, 'numNonContractUnits')
2270
2485
  if i != 0:
2271
2486
  tiersLength = len(tiers)
2272
2487
  previousTier = tiers[tiersLength - 1]
2273
- previousTier['notionalCap'] = notionalFloor
2488
+ previousTier['maxNotional'] = minNotional
2274
2489
  tiers.append({
2275
2490
  'tier': self.sum(i, 1),
2491
+ 'symbol': self.safe_symbol(marketId, market),
2276
2492
  'currency': market['quote'],
2277
- 'notionalFloor': notionalFloor,
2278
- 'notionalCap': None,
2493
+ 'minNotional': minNotional,
2494
+ 'maxNotional': None,
2279
2495
  'maintenanceMarginRate': self.safe_number(tier, 'maintenanceMargin'),
2280
2496
  'maxLeverage': self.parse_number(Precise.string_div('1', initialMargin)),
2281
2497
  'info': tier,
2282
2498
  })
2283
2499
  return tiers
2284
2500
 
2285
- def parse_transfer(self, transfer, currency: Currency = None):
2501
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2286
2502
  #
2287
2503
  # transfer
2288
2504
  #
@@ -2305,7 +2521,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2305
2521
  }
2306
2522
 
2307
2523
  def parse_account(self, account):
2308
- accountByType = {
2524
+ accountByType: dict = {
2309
2525
  'main': 'cash',
2310
2526
  'funding': 'cash',
2311
2527
  'future': 'cash',
@@ -2340,8 +2556,10 @@ class krakenfutures(Exchange, ImplicitAPI):
2340
2556
 
2341
2557
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2342
2558
  """
2343
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
2344
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
2559
+
2560
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
2561
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
2562
+
2345
2563
  transfers currencies between sub-accounts
2346
2564
  :param str code: Unified currency code
2347
2565
  :param float amount: Size of the transfer
@@ -2354,7 +2572,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2354
2572
  currency = self.currency(code)
2355
2573
  if fromAccount == 'spot':
2356
2574
  raise BadRequest(self.id + ' transfer does not yet support transfers from spot')
2357
- request = {
2575
+ request: dict = {
2358
2576
  'amount': amount,
2359
2577
  }
2360
2578
  response = None
@@ -2384,7 +2602,9 @@ class krakenfutures(Exchange, ImplicitAPI):
2384
2602
  async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2385
2603
  """
2386
2604
  set the level of leverage for a market
2387
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-set-the-leverage-setting-for-a-market
2605
+
2606
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-set-the-leverage-setting-for-a-market
2607
+
2388
2608
  :param float leverage: the rate of leverage
2389
2609
  :param str symbol: unified market symbol
2390
2610
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2393,7 +2613,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2393
2613
  if symbol is None:
2394
2614
  raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
2395
2615
  await self.load_markets()
2396
- request = {
2616
+ request: dict = {
2397
2617
  'maxLeverage': leverage,
2398
2618
  'symbol': self.market_id(symbol).upper(),
2399
2619
  }
@@ -2402,10 +2622,12 @@ class krakenfutures(Exchange, ImplicitAPI):
2402
2622
  #
2403
2623
  return await self.privatePutLeveragepreferences(self.extend(request, params))
2404
2624
 
2405
- async def fetch_leverages(self, symbols: List[str] = None, params={}) -> Leverages:
2625
+ async def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
2406
2626
  """
2407
2627
  fetch the set leverage for all contract and margin markets
2408
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
2628
+
2629
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
2630
+
2409
2631
  :param str[] [symbols]: a list of unified market symbols
2410
2632
  :param dict [params]: extra parameters specific to the exchange API endpoint
2411
2633
  :returns dict: a list of `leverage structures <https://docs.ccxt.com/#/?id=leverage-structure>`
@@ -2430,7 +2652,9 @@ class krakenfutures(Exchange, ImplicitAPI):
2430
2652
  async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
2431
2653
  """
2432
2654
  fetch the set leverage for a market
2433
- :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
2655
+
2656
+ https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
2657
+
2434
2658
  :param str symbol: unified market symbol
2435
2659
  :param dict [params]: extra parameters specific to the exchange API endpoint
2436
2660
  :returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
@@ -2439,7 +2663,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2439
2663
  raise ArgumentsRequired(self.id + ' fetchLeverage() requires a symbol argument')
2440
2664
  await self.load_markets()
2441
2665
  market = self.market(symbol)
2442
- request = {
2666
+ request: dict = {
2443
2667
  'symbol': self.market_id(symbol).upper(),
2444
2668
  }
2445
2669
  response = await self.privateGetLeveragepreferences(self.extend(request, params))
@@ -2454,7 +2678,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2454
2678
  data = self.safe_dict(leveragePreferences, 0, {})
2455
2679
  return self.parse_leverage(data, market)
2456
2680
 
2457
- def parse_leverage(self, leverage, market=None) -> Leverage:
2681
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
2458
2682
  marketId = self.safe_string(leverage, 'symbol')
2459
2683
  leverageValue = self.safe_integer(leverage, 'maxLeverage')
2460
2684
  return {
@@ -2465,7 +2689,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2465
2689
  'shortLeverage': leverageValue,
2466
2690
  }
2467
2691
 
2468
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2692
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2469
2693
  if response is None:
2470
2694
  return None
2471
2695
  if code == 429: