ccxt 4.2.77__py2.py3-none-any.whl → 4.4.49__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 +24 -0
  44. ccxt/abstract/kucoinfutures.py +34 -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 +3030 -1087
  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 +3205 -937
  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 +238 -49
  89. ccxt/async_support/bitget.py +1525 -573
  90. ccxt/async_support/bithumb.py +199 -65
  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 +392 -148
  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 +2231 -1193
  107. ccxt/async_support/cex.py +1409 -1329
  108. ccxt/async_support/coinbase.py +1454 -287
  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 +223 -97
  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 +404 -109
  125. ccxt/async_support/deribit.py +639 -323
  126. ccxt/async_support/digifinex.py +465 -233
  127. ccxt/async_support/ellipx.py +1887 -0
  128. ccxt/async_support/exmo.py +317 -128
  129. ccxt/async_support/gate.py +1472 -463
  130. ccxt/async_support/gemini.py +206 -84
  131. ccxt/async_support/hashkey.py +4164 -0
  132. ccxt/async_support/hitbtc.py +433 -178
  133. ccxt/async_support/hollaex.py +207 -83
  134. ccxt/async_support/htx.py +1095 -563
  135. ccxt/async_support/huobijp.py +178 -56
  136. ccxt/async_support/hyperliquid.py +1678 -292
  137. ccxt/async_support/idex.py +219 -95
  138. ccxt/async_support/independentreserve.py +300 -31
  139. ccxt/async_support/indodax.py +226 -62
  140. ccxt/async_support/kraken.py +871 -354
  141. ccxt/async_support/krakenfutures.py +324 -100
  142. ccxt/async_support/kucoin.py +917 -357
  143. ccxt/async_support/kucoinfutures.py +1004 -149
  144. ccxt/async_support/kuna.py +198 -107
  145. ccxt/async_support/latoken.py +199 -79
  146. ccxt/async_support/lbank.py +360 -113
  147. ccxt/async_support/luno.py +185 -62
  148. ccxt/async_support/lykke.py +168 -55
  149. ccxt/async_support/mercado.py +101 -29
  150. ccxt/async_support/mexc.py +995 -429
  151. ccxt/async_support/myokx.py +53 -0
  152. ccxt/async_support/ndax.py +234 -82
  153. ccxt/async_support/novadax.py +195 -75
  154. ccxt/async_support/oceanex.py +244 -59
  155. ccxt/async_support/okcoin.py +301 -165
  156. ccxt/async_support/okx.py +1776 -454
  157. ccxt/async_support/onetrading.py +198 -414
  158. ccxt/async_support/oxfun.py +2898 -0
  159. ccxt/async_support/p2b.py +142 -52
  160. ccxt/async_support/paradex.py +2085 -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 +1137 -296
  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 +1722 -480
  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 +3030 -1087
  187. ccxt/binancecoinm.py +2 -1
  188. ccxt/binanceus.py +12 -1
  189. ccxt/binanceusdm.py +3 -1
  190. ccxt/bingx.py +3205 -937
  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 +238 -49
  197. ccxt/bitget.py +1525 -573
  198. ccxt/bithumb.py +198 -65
  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 +392 -148
  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 +2231 -1193
  215. ccxt/cex.py +1408 -1329
  216. ccxt/coinbase.py +1454 -287
  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 +223 -97
  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 +404 -109
  233. ccxt/deribit.py +639 -323
  234. ccxt/digifinex.py +465 -233
  235. ccxt/ellipx.py +1887 -0
  236. ccxt/exmo.py +317 -128
  237. ccxt/gate.py +1472 -463
  238. ccxt/gemini.py +206 -84
  239. ccxt/hashkey.py +4164 -0
  240. ccxt/hitbtc.py +433 -178
  241. ccxt/hollaex.py +207 -83
  242. ccxt/htx.py +1095 -563
  243. ccxt/huobijp.py +178 -56
  244. ccxt/hyperliquid.py +1677 -292
  245. ccxt/idex.py +219 -95
  246. ccxt/independentreserve.py +299 -31
  247. ccxt/indodax.py +226 -62
  248. ccxt/kraken.py +871 -354
  249. ccxt/krakenfutures.py +324 -100
  250. ccxt/kucoin.py +917 -357
  251. ccxt/kucoinfutures.py +1004 -149
  252. ccxt/kuna.py +198 -107
  253. ccxt/latoken.py +199 -79
  254. ccxt/lbank.py +360 -113
  255. ccxt/luno.py +185 -62
  256. ccxt/lykke.py +168 -55
  257. ccxt/mercado.py +101 -29
  258. ccxt/mexc.py +994 -429
  259. ccxt/myokx.py +53 -0
  260. ccxt/ndax.py +234 -82
  261. ccxt/novadax.py +195 -75
  262. ccxt/oceanex.py +244 -59
  263. ccxt/okcoin.py +301 -165
  264. ccxt/okx.py +1776 -454
  265. ccxt/onetrading.py +198 -414
  266. ccxt/oxfun.py +2897 -0
  267. ccxt/p2b.py +142 -52
  268. ccxt/paradex.py +2085 -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 +62 -14
  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 +143 -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 +203 -81
  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 +965 -665
  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 +167 -31
  309. ccxt/pro/exmo.py +252 -20
  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 +92 -33
  336. ccxt/pro/poloniex.py +128 -49
  337. ccxt/pro/poloniexfutures.py +53 -32
  338. ccxt/pro/probit.py +92 -85
  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 +437 -65
  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} +456 -391
  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} +456 -393
  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 +1137 -296
  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.49.dist-info/LICENSE.txt +21 -0
  496. ccxt-4.4.49.dist-info/METADATA +646 -0
  497. ccxt-4.4.49.dist-info/RECORD +669 -0
  498. {ccxt-4.2.77.dist-info → ccxt-4.4.49.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.77.dist-info/METADATA +0 -626
  545. ccxt-4.2.77.dist-info/RECORD +0 -534
  546. {ccxt-4.2.77.dist-info → ccxt-4.4.49.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.hitbtc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, DepositAddress, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, 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 PermissionDenied
13
14
  from ccxt.base.errors import AccountSuspended
14
15
  from ccxt.base.errors import ArgumentsRequired
@@ -21,7 +22,6 @@ from ccxt.base.errors import NotSupported
21
22
  from ccxt.base.errors import RateLimitExceeded
22
23
  from ccxt.base.errors import ExchangeNotAvailable
23
24
  from ccxt.base.errors import OnMaintenance
24
- from ccxt.base.errors import AuthenticationError
25
25
  from ccxt.base.decimal_to_precision import TICK_SIZE
26
26
  from ccxt.base.precise import Precise
27
27
 
@@ -66,6 +66,8 @@ class hitbtc(Exchange, ImplicitAPI):
66
66
  'fetchCrossBorrowRates': False,
67
67
  'fetchCurrencies': True,
68
68
  'fetchDepositAddress': True,
69
+ 'fetchDepositAddresses': False,
70
+ 'fetchDepositAddressesByNetwork': False,
69
71
  'fetchDeposits': True,
70
72
  'fetchDepositsWithdrawals': True,
71
73
  'fetchDepositWithdrawFee': 'emulated',
@@ -90,6 +92,7 @@ class hitbtc(Exchange, ImplicitAPI):
90
92
  'fetchOHLCV': True,
91
93
  'fetchOpenInterest': True,
92
94
  'fetchOpenInterestHistory': False,
95
+ 'fetchOpenInterests': True,
93
96
  'fetchOpenOrder': True,
94
97
  'fetchOpenOrders': True,
95
98
  'fetchOrder': True,
@@ -108,6 +111,7 @@ class hitbtc(Exchange, ImplicitAPI):
108
111
  'fetchTransactions': 'emulated',
109
112
  'fetchWithdrawals': True,
110
113
  'reduceMargin': True,
114
+ 'sandbox': True,
111
115
  'setLeverage': True,
112
116
  'setMargin': False,
113
117
  'setMarginMode': False,
@@ -300,6 +304,105 @@ class hitbtc(Exchange, ImplicitAPI):
300
304
  },
301
305
  },
302
306
  },
307
+ 'features': {
308
+ 'default': {
309
+ 'sandbox': True,
310
+ 'createOrder': {
311
+ 'marginMode': False,
312
+ 'triggerPrice': True,
313
+ 'triggerPriceType': None,
314
+ 'triggerDirection': False,
315
+ 'stopLossPrice': False, # todo
316
+ 'takeProfitPrice': False, # todo
317
+ 'attachedStopLossTakeProfit': None,
318
+ 'timeInForce': {
319
+ 'IOC': True,
320
+ 'FOK': True,
321
+ 'PO': True,
322
+ 'GTD': True,
323
+ },
324
+ 'hedged': False,
325
+ 'selfTradePrevention': False,
326
+ 'trailing': False,
327
+ 'leverage': False,
328
+ 'marketBuyByCost': False,
329
+ 'marketBuyRequiresPrice': False,
330
+ 'iceberg': True,
331
+ },
332
+ 'createOrders': None,
333
+ 'fetchMyTrades': {
334
+ 'marginMode': True,
335
+ 'limit': 1000,
336
+ 'daysBack': 100000,
337
+ 'untilDays': 100000,
338
+ 'marketType': True,
339
+ },
340
+ 'fetchOrder': {
341
+ 'marginMode': True,
342
+ 'trigger': False,
343
+ 'trailing': False,
344
+ 'marketType': True,
345
+ },
346
+ 'fetchOpenOrders': {
347
+ 'marginMode': True,
348
+ 'limit': 1000,
349
+ 'trigger': False,
350
+ 'trailing': False,
351
+ 'marketType': True,
352
+ },
353
+ 'fetchOrders': None,
354
+ 'fetchClosedOrders': {
355
+ 'marginMode': True,
356
+ 'limit': 1000,
357
+ 'daysBack': 100000, # todo
358
+ 'daysBackCanceled': 1, # todo
359
+ 'untilDays': 100000, # todo
360
+ 'trigger': False,
361
+ 'trailing': False,
362
+ 'marketType': True,
363
+ },
364
+ 'fetchOHLCV': {
365
+ 'limit': 1000,
366
+ },
367
+ },
368
+ 'spot': {
369
+ 'extends': 'default',
370
+ },
371
+ 'forDerivatives': {
372
+ 'extends': 'default',
373
+ 'createOrder': {
374
+ 'marginMode': True,
375
+ },
376
+ 'fetchOrder': {
377
+ 'marginMode': False,
378
+ },
379
+ 'fetchMyTrades': {
380
+ 'marginMode': False,
381
+ },
382
+ 'fetchOpenOrders': {
383
+ 'marginMode': False,
384
+ },
385
+ 'fetchClosedOrders': {
386
+ 'marginMode': False,
387
+ },
388
+ },
389
+ 'swap': {
390
+ 'linear': {
391
+ 'extends': 'forDerivatives',
392
+ },
393
+ 'inverse': {
394
+ 'extends': 'forDerivatives',
395
+ },
396
+ },
397
+ 'future': {
398
+ 'linear': {
399
+ 'extends': 'forDerivatives',
400
+ },
401
+ 'inverse': {
402
+ 'extends': 'forDerivatives',
403
+ },
404
+ },
405
+ },
303
406
  'timeframes': {
304
407
  '1m': 'M1',
305
408
  '3m': 'M3',
@@ -632,6 +735,7 @@ class hitbtc(Exchange, ImplicitAPI):
632
735
  'accountsByType': {
633
736
  'spot': 'spot',
634
737
  'funding': 'wallet',
738
+ 'swap': 'derivatives',
635
739
  'future': 'derivatives',
636
740
  },
637
741
  'withdraw': {
@@ -665,10 +769,12 @@ class hitbtc(Exchange, ImplicitAPI):
665
769
  def nonce(self):
666
770
  return self.milliseconds()
667
771
 
668
- async def fetch_markets(self, params={}):
772
+ async def fetch_markets(self, params={}) -> List[Market]:
669
773
  """
670
774
  retrieves data on all markets for hitbtc
671
- :see: https://api.hitbtc.com/#symbols
775
+
776
+ https://api.hitbtc.com/#symbols
777
+
672
778
  :param dict [params]: extra parameters specific to the exchange API endpoint
673
779
  :returns dict[]: an array of objects representing market data
674
780
  """
@@ -802,10 +908,12 @@ class hitbtc(Exchange, ImplicitAPI):
802
908
  })
803
909
  return result
804
910
 
805
- async def fetch_currencies(self, params={}):
911
+ async def fetch_currencies(self, params={}) -> Currencies:
806
912
  """
807
913
  fetches all available currencies on an exchange
808
- :see: https://api.hitbtc.com/#currencies
914
+
915
+ https://api.hitbtc.com/#currencies
916
+
809
917
  :param dict [params]: extra parameters specific to the exchange API endpoint
810
918
  :returns dict: an associative dictionary of currencies
811
919
  """
@@ -835,7 +943,7 @@ class hitbtc(Exchange, ImplicitAPI):
835
943
  # }
836
944
  # }
837
945
  #
838
- result = {}
946
+ result: dict = {}
839
947
  currencies = list(response.keys())
840
948
  for i in range(0, len(currencies)):
841
949
  currencyId = currencies[i]
@@ -848,18 +956,19 @@ class hitbtc(Exchange, ImplicitAPI):
848
956
  transferEnabled = self.safe_bool(entry, 'transfer_enabled', False)
849
957
  active = payinEnabled and payoutEnabled and transferEnabled
850
958
  rawNetworks = self.safe_value(entry, 'networks', [])
851
- networks = {}
959
+ networks: dict = {}
852
960
  fee = None
853
961
  depositEnabled = None
854
962
  withdrawEnabled = None
855
963
  for j in range(0, len(rawNetworks)):
856
964
  rawNetwork = rawNetworks[j]
857
965
  networkId = self.safe_string_2(rawNetwork, 'protocol', 'network')
858
- network = self.safe_network(networkId)
966
+ networkCode = self.network_id_to_code(networkId)
967
+ networkCode = networkCode.upper() if (networkCode is not None) else None
859
968
  fee = self.safe_number(rawNetwork, 'payout_fee')
860
969
  networkPrecision = self.safe_number(rawNetwork, 'precision_payout')
861
- payinEnabledNetwork = self.safe_bool(entry, 'payin_enabled', False)
862
- payoutEnabledNetwork = self.safe_bool(entry, 'payout_enabled', False)
970
+ payinEnabledNetwork = self.safe_bool(rawNetwork, 'payin_enabled', False)
971
+ payoutEnabledNetwork = self.safe_bool(rawNetwork, 'payout_enabled', False)
863
972
  activeNetwork = payinEnabledNetwork and payoutEnabledNetwork
864
973
  if payinEnabledNetwork and not depositEnabled:
865
974
  depositEnabled = True
@@ -869,10 +978,10 @@ class hitbtc(Exchange, ImplicitAPI):
869
978
  withdrawEnabled = True
870
979
  elif not payoutEnabledNetwork:
871
980
  withdrawEnabled = False
872
- networks[network] = {
981
+ networks[networkCode] = {
873
982
  'info': rawNetwork,
874
983
  'id': networkId,
875
- 'network': network,
984
+ 'network': networkCode,
876
985
  'fee': fee,
877
986
  'active': activeNetwork,
878
987
  'deposit': payinEnabledNetwork,
@@ -907,23 +1016,19 @@ class hitbtc(Exchange, ImplicitAPI):
907
1016
  }
908
1017
  return result
909
1018
 
910
- def safe_network(self, networkId):
911
- if networkId is None:
912
- return None
913
- else:
914
- return networkId.upper()
915
-
916
1019
  async def create_deposit_address(self, code: str, params={}):
917
1020
  """
918
1021
  create a currency deposit address
919
- :see: https://api.hitbtc.com/#generate-deposit-crypto-address
1022
+
1023
+ https://api.hitbtc.com/#generate-deposit-crypto-address
1024
+
920
1025
  :param str code: unified currency code of the currency for the deposit address
921
1026
  :param dict [params]: extra parameters specific to the exchange API endpoint
922
1027
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
923
1028
  """
924
1029
  await self.load_markets()
925
1030
  currency = self.currency(code)
926
- request = {
1031
+ request: dict = {
927
1032
  'currency': currency['id'],
928
1033
  }
929
1034
  network = self.safe_string_upper(params, 'network')
@@ -946,17 +1051,19 @@ class hitbtc(Exchange, ImplicitAPI):
946
1051
  'info': response,
947
1052
  }
948
1053
 
949
- async def fetch_deposit_address(self, code: str, params={}):
1054
+ async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
950
1055
  """
951
1056
  fetch the deposit address for a currency associated with self account
952
- :see: https://api.hitbtc.com/#get-deposit-crypto-address
1057
+
1058
+ https://api.hitbtc.com/#get-deposit-crypto-address
1059
+
953
1060
  :param str code: unified currency code
954
1061
  :param dict [params]: extra parameters specific to the exchange API endpoint
955
1062
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
956
1063
  """
957
1064
  await self.load_markets()
958
1065
  currency = self.currency(code)
959
- request = {
1066
+ request: dict = {
960
1067
  'currency': currency['id'],
961
1068
  }
962
1069
  network = self.safe_string_upper(params, 'network')
@@ -977,15 +1084,14 @@ class hitbtc(Exchange, ImplicitAPI):
977
1084
  parsedCode = self.safe_currency_code(currencyId)
978
1085
  return {
979
1086
  'info': response,
980
- 'address': address,
981
- 'tag': tag,
982
- 'code': parsedCode, # kept here for backward-compatibility, but will be removed soon
983
1087
  'currency': parsedCode,
984
1088
  'network': None,
1089
+ 'address': address,
1090
+ 'tag': tag,
985
1091
  }
986
1092
 
987
1093
  def parse_balance(self, response) -> Balances:
988
- result = {'info': response}
1094
+ result: dict = {'info': response}
989
1095
  for i in range(0, len(response)):
990
1096
  entry = response[i]
991
1097
  currencyId = self.safe_string(entry, 'currency')
@@ -999,9 +1105,11 @@ class hitbtc(Exchange, ImplicitAPI):
999
1105
  async def fetch_balance(self, params={}) -> Balances:
1000
1106
  """
1001
1107
  query for balance and get the amount of funds available for trading or funds locked in orders
1002
- :see: https://api.hitbtc.com/#wallet-balance
1003
- :see: https://api.hitbtc.com/#get-spot-trading-balance
1004
- :see: https://api.hitbtc.com/#get-trading-balance
1108
+
1109
+ https://api.hitbtc.com/#wallet-balance
1110
+ https://api.hitbtc.com/#get-spot-trading-balance
1111
+ https://api.hitbtc.com/#get-trading-balance
1112
+
1005
1113
  :param dict [params]: extra parameters specific to the exchange API endpoint
1006
1114
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1007
1115
  """
@@ -1035,14 +1143,16 @@ class hitbtc(Exchange, ImplicitAPI):
1035
1143
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
1036
1144
  """
1037
1145
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1038
- :see: https://api.hitbtc.com/#tickers
1146
+
1147
+ https://api.hitbtc.com/#tickers
1148
+
1039
1149
  :param str symbol: unified symbol of the market to fetch the ticker for
1040
1150
  :param dict [params]: extra parameters specific to the exchange API endpoint
1041
1151
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
1042
1152
  """
1043
1153
  await self.load_markets()
1044
1154
  market = self.market(symbol)
1045
- request = {
1155
+ request: dict = {
1046
1156
  'symbol': market['id'],
1047
1157
  }
1048
1158
  response = await self.publicGetPublicTickerSymbol(self.extend(request, params))
@@ -1064,14 +1174,16 @@ class hitbtc(Exchange, ImplicitAPI):
1064
1174
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1065
1175
  """
1066
1176
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1067
- :see: https://api.hitbtc.com/#tickers
1177
+
1178
+ https://api.hitbtc.com/#tickers
1179
+
1068
1180
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1069
1181
  :param dict [params]: extra parameters specific to the exchange API endpoint
1070
1182
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
1071
1183
  """
1072
1184
  await self.load_markets()
1073
1185
  symbols = self.market_symbols(symbols)
1074
- request = {}
1186
+ request: dict = {}
1075
1187
  if symbols is not None:
1076
1188
  marketIds = self.market_ids(symbols)
1077
1189
  delimited = ','.join(marketIds)
@@ -1092,7 +1204,7 @@ class hitbtc(Exchange, ImplicitAPI):
1092
1204
  # }
1093
1205
  # }
1094
1206
  #
1095
- result = {}
1207
+ result: dict = {}
1096
1208
  keys = list(response.keys())
1097
1209
  for i in range(0, len(keys)):
1098
1210
  marketId = keys[i]
@@ -1102,7 +1214,7 @@ class hitbtc(Exchange, ImplicitAPI):
1102
1214
  result[symbol] = self.parse_ticker(entry, market)
1103
1215
  return self.filter_by_array_tickers(result, 'symbol', symbols)
1104
1216
 
1105
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1217
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1106
1218
  #
1107
1219
  # {
1108
1220
  # "ask": "62756.01",
@@ -1148,7 +1260,9 @@ class hitbtc(Exchange, ImplicitAPI):
1148
1260
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1149
1261
  """
1150
1262
  get the list of most recent trades for a particular symbol
1151
- :see: https://api.hitbtc.com/#trades
1263
+
1264
+ https://api.hitbtc.com/#trades
1265
+
1152
1266
  :param str symbol: unified symbol of the market to fetch trades for
1153
1267
  :param int [since]: timestamp in ms of the earliest trade to fetch
1154
1268
  :param int [limit]: the maximum amount of trades to fetch
@@ -1157,7 +1271,7 @@ class hitbtc(Exchange, ImplicitAPI):
1157
1271
  """
1158
1272
  await self.load_markets()
1159
1273
  market = None
1160
- request = {}
1274
+ request: dict = {}
1161
1275
  if limit is not None:
1162
1276
  request['limit'] = min(limit, 1000)
1163
1277
  if since is not None:
@@ -1184,9 +1298,11 @@ class hitbtc(Exchange, ImplicitAPI):
1184
1298
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1185
1299
  """
1186
1300
  fetch all trades made by the user
1187
- :see: https://api.hitbtc.com/#spot-trades-history
1188
- :see: https://api.hitbtc.com/#futures-trades-history
1189
- :see: https://api.hitbtc.com/#margin-trades-history
1301
+
1302
+ https://api.hitbtc.com/#spot-trades-history
1303
+ https://api.hitbtc.com/#futures-trades-history
1304
+ https://api.hitbtc.com/#margin-trades-history
1305
+
1190
1306
  :param str symbol: unified market symbol
1191
1307
  :param int [since]: the earliest time in ms to fetch trades for
1192
1308
  :param int [limit]: the maximum number of trades structures to retrieve
@@ -1197,7 +1313,7 @@ class hitbtc(Exchange, ImplicitAPI):
1197
1313
  """
1198
1314
  await self.load_markets()
1199
1315
  market = None
1200
- request = {}
1316
+ request: dict = {}
1201
1317
  if symbol is not None:
1202
1318
  market = self.market(symbol)
1203
1319
  request['symbol'] = market['id']
@@ -1224,7 +1340,7 @@ class hitbtc(Exchange, ImplicitAPI):
1224
1340
  raise NotSupported(self.id + ' fetchMyTrades() not support self market type')
1225
1341
  return self.parse_trades(response, market, since, limit)
1226
1342
 
1227
- def parse_trade(self, trade, market: Market = None) -> Trade:
1343
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1228
1344
  #
1229
1345
  # createOrder(market)
1230
1346
  #
@@ -1327,7 +1443,7 @@ class hitbtc(Exchange, ImplicitAPI):
1327
1443
 
1328
1444
  async def fetch_transactions_helper(self, types, code, since, limit, params):
1329
1445
  await self.load_markets()
1330
- request = {
1446
+ request: dict = {
1331
1447
  'types': types,
1332
1448
  }
1333
1449
  currency = None
@@ -1365,22 +1481,24 @@ class hitbtc(Exchange, ImplicitAPI):
1365
1481
  #
1366
1482
  return self.parse_transactions(response, currency, since, limit, params)
1367
1483
 
1368
- def parse_transaction_status(self, status):
1369
- statuses = {
1484
+ def parse_transaction_status(self, status: Str):
1485
+ statuses: dict = {
1486
+ 'CREATED': 'pending',
1370
1487
  'PENDING': 'pending',
1371
1488
  'FAILED': 'failed',
1489
+ 'ROLLED_BACK': 'failed',
1372
1490
  'SUCCESS': 'ok',
1373
1491
  }
1374
1492
  return self.safe_string(statuses, status, status)
1375
1493
 
1376
1494
  def parse_transaction_type(self, type):
1377
- types = {
1495
+ types: dict = {
1378
1496
  'DEPOSIT': 'deposit',
1379
1497
  'WITHDRAW': 'withdrawal',
1380
1498
  }
1381
1499
  return self.safe_string(types, type, type)
1382
1500
 
1383
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1501
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1384
1502
  #
1385
1503
  # transaction
1386
1504
  #
@@ -1404,15 +1522,16 @@ class hitbtc(Exchange, ImplicitAPI):
1404
1522
  # ],
1405
1523
  # "fee": "1.22" # only for WITHDRAW
1406
1524
  # }
1407
- # }
1408
- #
1525
+ # },
1526
+ # "operation_id": "084cfcd5-06b9-4826-882e-fdb75ec3625d", # only for WITHDRAW
1527
+ # "commit_risk": {}
1409
1528
  # withdraw
1410
1529
  #
1411
1530
  # {
1412
1531
  # "id":"084cfcd5-06b9-4826-882e-fdb75ec3625d"
1413
1532
  # }
1414
1533
  #
1415
- id = self.safe_string(transaction, 'id')
1534
+ id = self.safe_string_2(transaction, 'operation_id', 'id')
1416
1535
  timestamp = self.parse8601(self.safe_string(transaction, 'created_at'))
1417
1536
  updated = self.parse8601(self.safe_string(transaction, 'updated_at'))
1418
1537
  type = self.parse_transaction_type(self.safe_string(transaction, 'type'))
@@ -1466,7 +1585,9 @@ class hitbtc(Exchange, ImplicitAPI):
1466
1585
  async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1467
1586
  """
1468
1587
  fetch history of deposits and withdrawals
1469
- :see: https://api.hitbtc.com/#get-transactions-history
1588
+
1589
+ https://api.hitbtc.com/#get-transactions-history
1590
+
1470
1591
  :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
1471
1592
  :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
1472
1593
  :param int [limit]: max number of deposit/withdrawals to return, default is None
@@ -1478,7 +1599,9 @@ class hitbtc(Exchange, ImplicitAPI):
1478
1599
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1479
1600
  """
1480
1601
  fetch all deposits made to an account
1481
- :see: https://api.hitbtc.com/#get-transactions-history
1602
+
1603
+ https://api.hitbtc.com/#get-transactions-history
1604
+
1482
1605
  :param str code: unified currency code
1483
1606
  :param int [since]: the earliest time in ms to fetch deposits for
1484
1607
  :param int [limit]: the maximum number of deposits structures to retrieve
@@ -1490,7 +1613,9 @@ class hitbtc(Exchange, ImplicitAPI):
1490
1613
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1491
1614
  """
1492
1615
  fetch all withdrawals made from an account
1493
- :see: https://api.hitbtc.com/#get-transactions-history
1616
+
1617
+ https://api.hitbtc.com/#get-transactions-history
1618
+
1494
1619
  :param str code: unified currency code
1495
1620
  :param int [since]: the earliest time in ms to fetch withdrawals for
1496
1621
  :param int [limit]: the maximum number of withdrawals structures to retrieve
@@ -1502,21 +1627,23 @@ class hitbtc(Exchange, ImplicitAPI):
1502
1627
  async def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}):
1503
1628
  """
1504
1629
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data for multiple markets
1505
- :see: https://api.hitbtc.com/#order-books
1506
- :param str[]|None symbols: list of unified market symbols, all symbols fetched if None, default is None
1630
+
1631
+ https://api.hitbtc.com/#order-books
1632
+
1633
+ :param str[] [symbols]: list of unified market symbols, all symbols fetched if None, default is None
1507
1634
  :param int [limit]: max number of entries per orderbook to return, default is None
1508
1635
  :param dict [params]: extra parameters specific to the exchange API endpoint
1509
1636
  :returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
1510
1637
  """
1511
1638
  await self.load_markets()
1512
- request = {}
1639
+ request: dict = {}
1513
1640
  if symbols is not None:
1514
1641
  marketIdsInner = self.market_ids(symbols)
1515
1642
  request['symbols'] = ','.join(marketIdsInner)
1516
1643
  if limit is not None:
1517
1644
  request['depth'] = limit
1518
1645
  response = await self.publicGetPublicOrderbook(self.extend(request, params))
1519
- result = {}
1646
+ result: dict = {}
1520
1647
  marketIds = list(response.keys())
1521
1648
  for i in range(0, len(marketIds)):
1522
1649
  marketId = marketIds[i]
@@ -1529,7 +1656,9 @@ class hitbtc(Exchange, ImplicitAPI):
1529
1656
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
1530
1657
  """
1531
1658
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
1532
- :see: https://api.hitbtc.com/#order-books
1659
+
1660
+ https://api.hitbtc.com/#order-books
1661
+
1533
1662
  :param str symbol: unified symbol of the market to fetch the order book for
1534
1663
  :param int [limit]: the maximum amount of order book entries to return
1535
1664
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1537,7 +1666,7 @@ class hitbtc(Exchange, ImplicitAPI):
1537
1666
  """
1538
1667
  await self.load_markets()
1539
1668
  market = self.market(symbol)
1540
- request = {
1669
+ request: dict = {
1541
1670
  'symbol': market['id'],
1542
1671
  }
1543
1672
  if limit is not None:
@@ -1546,7 +1675,7 @@ class hitbtc(Exchange, ImplicitAPI):
1546
1675
  timestamp = self.parse8601(self.safe_string(response, 'timestamp'))
1547
1676
  return self.parse_order_book(response, symbol, timestamp, 'bid', 'ask')
1548
1677
 
1549
- def parse_trading_fee(self, fee, market: Market = None):
1678
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1550
1679
  #
1551
1680
  # {
1552
1681
  # "symbol":"ARVUSDT", # returned from fetchTradingFees only
@@ -1563,20 +1692,24 @@ class hitbtc(Exchange, ImplicitAPI):
1563
1692
  'symbol': symbol,
1564
1693
  'taker': taker,
1565
1694
  'maker': maker,
1695
+ 'percentage': None,
1696
+ 'tierBased': None,
1566
1697
  }
1567
1698
 
1568
- async def fetch_trading_fee(self, symbol: str, params={}):
1699
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1569
1700
  """
1570
1701
  fetch the trading fees for a market
1571
- :see: https://api.hitbtc.com/#get-trading-commission
1572
- :see: https://api.hitbtc.com/#get-trading-commission-2
1702
+
1703
+ https://api.hitbtc.com/#get-trading-commission
1704
+ https://api.hitbtc.com/#get-trading-commission-2
1705
+
1573
1706
  :param str symbol: unified market symbol
1574
1707
  :param dict [params]: extra parameters specific to the exchange API endpoint
1575
1708
  :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
1576
1709
  """
1577
1710
  await self.load_markets()
1578
1711
  market = self.market(symbol)
1579
- request = {
1712
+ request: dict = {
1580
1713
  'symbol': market['id'],
1581
1714
  }
1582
1715
  response = None
@@ -1594,11 +1727,13 @@ class hitbtc(Exchange, ImplicitAPI):
1594
1727
  #
1595
1728
  return self.parse_trading_fee(response, market)
1596
1729
 
1597
- async def fetch_trading_fees(self, params={}):
1730
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
1598
1731
  """
1599
1732
  fetch the trading fees for multiple markets
1600
- :see: https://api.hitbtc.com/#get-all-trading-commissions
1601
- :see: https://api.hitbtc.com/#get-all-trading-commissions-2
1733
+
1734
+ https://api.hitbtc.com/#get-all-trading-commissions
1735
+ https://api.hitbtc.com/#get-all-trading-commissions-2
1736
+
1602
1737
  :param dict [params]: extra parameters specific to the exchange API endpoint
1603
1738
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
1604
1739
  """
@@ -1620,7 +1755,7 @@ class hitbtc(Exchange, ImplicitAPI):
1620
1755
  # }
1621
1756
  # ]
1622
1757
  #
1623
- result = {}
1758
+ result: dict = {}
1624
1759
  for i in range(0, len(response)):
1625
1760
  fee = self.parse_trading_fee(response[i])
1626
1761
  symbol = fee['symbol']
@@ -1630,10 +1765,12 @@ class hitbtc(Exchange, ImplicitAPI):
1630
1765
  async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1631
1766
  """
1632
1767
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1633
- :see: https://api.hitbtc.com/#candles
1634
- :see: https://api.hitbtc.com/#futures-index-price-candles
1635
- :see: https://api.hitbtc.com/#futures-mark-price-candles
1636
- :see: https://api.hitbtc.com/#futures-premium-index-candles
1768
+
1769
+ https://api.hitbtc.com/#candles
1770
+ https://api.hitbtc.com/#futures-index-price-candles
1771
+ https://api.hitbtc.com/#futures-mark-price-candles
1772
+ https://api.hitbtc.com/#futures-premium-index-candles
1773
+
1637
1774
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1638
1775
  :param str timeframe: the length of time each candle represents
1639
1776
  :param int [since]: timestamp in ms of the earliest candle to fetch
@@ -1649,15 +1786,15 @@ class hitbtc(Exchange, ImplicitAPI):
1649
1786
  if paginate:
1650
1787
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000)
1651
1788
  market = self.market(symbol)
1652
- request = {
1789
+ request: dict = {
1653
1790
  'symbol': market['id'],
1654
1791
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
1655
1792
  }
1656
1793
  if since is not None:
1657
1794
  request['from'] = self.iso8601(since)
1658
- request, params = self.handle_until_option('till', request, params)
1795
+ request, params = self.handle_until_option('until', request, params)
1659
1796
  if limit is not None:
1660
- request['limit'] = limit
1797
+ request['limit'] = min(limit, 1000)
1661
1798
  price = self.safe_string(params, 'price')
1662
1799
  params = self.omit(params, 'price')
1663
1800
  response = None
@@ -1734,9 +1871,11 @@ class hitbtc(Exchange, ImplicitAPI):
1734
1871
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1735
1872
  """
1736
1873
  fetches information on multiple closed orders made by the user
1737
- :see: https://api.hitbtc.com/#spot-orders-history
1738
- :see: https://api.hitbtc.com/#futures-orders-history
1739
- :see: https://api.hitbtc.com/#margin-orders-history
1874
+
1875
+ https://api.hitbtc.com/#spot-orders-history
1876
+ https://api.hitbtc.com/#futures-orders-history
1877
+ https://api.hitbtc.com/#margin-orders-history
1878
+
1740
1879
  :param str symbol: unified market symbol of the market orders were made in
1741
1880
  :param int [since]: the earliest time in ms to fetch orders for
1742
1881
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1747,7 +1886,7 @@ class hitbtc(Exchange, ImplicitAPI):
1747
1886
  """
1748
1887
  await self.load_markets()
1749
1888
  market = None
1750
- request = {}
1889
+ request: dict = {}
1751
1890
  if symbol is not None:
1752
1891
  market = self.market(symbol)
1753
1892
  request['symbol'] = market['id']
@@ -1778,9 +1917,12 @@ class hitbtc(Exchange, ImplicitAPI):
1778
1917
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1779
1918
  """
1780
1919
  fetches information on an order made by the user
1781
- :see: https://api.hitbtc.com/#spot-orders-history
1782
- :see: https://api.hitbtc.com/#futures-orders-history
1783
- :see: https://api.hitbtc.com/#margin-orders-history
1920
+
1921
+ https://api.hitbtc.com/#spot-orders-history
1922
+ https://api.hitbtc.com/#futures-orders-history
1923
+ https://api.hitbtc.com/#margin-orders-history
1924
+
1925
+ :param str id: order id
1784
1926
  :param str symbol: unified symbol of the market the order was made in
1785
1927
  :param dict [params]: extra parameters specific to the exchange API endpoint
1786
1928
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
@@ -1791,7 +1933,7 @@ class hitbtc(Exchange, ImplicitAPI):
1791
1933
  market = None
1792
1934
  if symbol is not None:
1793
1935
  market = self.market(symbol)
1794
- request = {
1936
+ request: dict = {
1795
1937
  'client_order_id': id,
1796
1938
  }
1797
1939
  marketType = None
@@ -1830,15 +1972,17 @@ class hitbtc(Exchange, ImplicitAPI):
1830
1972
  # }
1831
1973
  # ]
1832
1974
  #
1833
- order = self.safe_value(response, 0)
1975
+ order = self.safe_dict(response, 0)
1834
1976
  return self.parse_order(order, market)
1835
1977
 
1836
1978
  async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1837
1979
  """
1838
1980
  fetch all the trades made from a single order
1839
- :see: https://api.hitbtc.com/#spot-trades-history
1840
- :see: https://api.hitbtc.com/#futures-trades-history
1841
- :see: https://api.hitbtc.com/#margin-trades-history
1981
+
1982
+ https://api.hitbtc.com/#spot-trades-history
1983
+ https://api.hitbtc.com/#futures-trades-history
1984
+ https://api.hitbtc.com/#margin-trades-history
1985
+
1842
1986
  :param str id: order id
1843
1987
  :param str symbol: unified market symbol
1844
1988
  :param int [since]: the earliest time in ms to fetch trades for
@@ -1852,7 +1996,7 @@ class hitbtc(Exchange, ImplicitAPI):
1852
1996
  market = None
1853
1997
  if symbol is not None:
1854
1998
  market = self.market(symbol)
1855
- request = {
1999
+ request: dict = {
1856
2000
  'order_id': id, # exchange assigned order id to the client order id
1857
2001
  }
1858
2002
  marketType = None
@@ -1915,9 +2059,11 @@ class hitbtc(Exchange, ImplicitAPI):
1915
2059
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1916
2060
  """
1917
2061
  fetch all unfilled currently open orders
1918
- :see: https://api.hitbtc.com/#get-all-active-spot-orders
1919
- :see: https://api.hitbtc.com/#get-active-futures-orders
1920
- :see: https://api.hitbtc.com/#get-active-margin-orders
2062
+
2063
+ https://api.hitbtc.com/#get-all-active-spot-orders
2064
+ https://api.hitbtc.com/#get-active-futures-orders
2065
+ https://api.hitbtc.com/#get-active-margin-orders
2066
+
1921
2067
  :param str symbol: unified market symbol
1922
2068
  :param int [since]: the earliest time in ms to fetch open orders for
1923
2069
  :param int [limit]: the maximum number of open orders structures to retrieve
@@ -1928,7 +2074,7 @@ class hitbtc(Exchange, ImplicitAPI):
1928
2074
  """
1929
2075
  await self.load_markets()
1930
2076
  market = None
1931
- request = {}
2077
+ request: dict = {}
1932
2078
  if symbol is not None:
1933
2079
  market = self.market(symbol)
1934
2080
  request['symbol'] = market['id']
@@ -1973,9 +2119,11 @@ class hitbtc(Exchange, ImplicitAPI):
1973
2119
  async def fetch_open_order(self, id: str, symbol: Str = None, params={}):
1974
2120
  """
1975
2121
  fetch an open order by it's id
1976
- :see: https://api.hitbtc.com/#get-active-spot-order
1977
- :see: https://api.hitbtc.com/#get-active-futures-order
1978
- :see: https://api.hitbtc.com/#get-active-margin-order
2122
+
2123
+ https://api.hitbtc.com/#get-active-spot-order
2124
+ https://api.hitbtc.com/#get-active-futures-order
2125
+ https://api.hitbtc.com/#get-active-margin-order
2126
+
1979
2127
  :param str id: order id
1980
2128
  :param str symbol: unified market symbol, default is None
1981
2129
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1987,7 +2135,7 @@ class hitbtc(Exchange, ImplicitAPI):
1987
2135
  market = None
1988
2136
  if symbol is not None:
1989
2137
  market = self.market(symbol)
1990
- request = {
2138
+ request: dict = {
1991
2139
  'client_order_id': id,
1992
2140
  }
1993
2141
  marketType = None
@@ -2012,9 +2160,11 @@ class hitbtc(Exchange, ImplicitAPI):
2012
2160
  async def cancel_all_orders(self, symbol: Str = None, params={}):
2013
2161
  """
2014
2162
  cancel all open orders
2015
- :see: https://api.hitbtc.com/#cancel-all-spot-orders
2016
- :see: https://api.hitbtc.com/#cancel-futures-orders
2017
- :see: https://api.hitbtc.com/#cancel-all-margin-orders
2163
+
2164
+ https://api.hitbtc.com/#cancel-all-spot-orders
2165
+ https://api.hitbtc.com/#cancel-futures-orders
2166
+ https://api.hitbtc.com/#cancel-all-margin-orders
2167
+
2018
2168
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
2019
2169
  :param dict [params]: extra parameters specific to the exchange API endpoint
2020
2170
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
@@ -2023,7 +2173,7 @@ class hitbtc(Exchange, ImplicitAPI):
2023
2173
  """
2024
2174
  await self.load_markets()
2025
2175
  market = None
2026
- request = {}
2176
+ request: dict = {}
2027
2177
  if symbol is not None:
2028
2178
  market = self.market(symbol)
2029
2179
  request['symbol'] = market['id']
@@ -2049,9 +2199,11 @@ class hitbtc(Exchange, ImplicitAPI):
2049
2199
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
2050
2200
  """
2051
2201
  cancels an open order
2052
- :see: https://api.hitbtc.com/#cancel-spot-order
2053
- :see: https://api.hitbtc.com/#cancel-futures-order
2054
- :see: https://api.hitbtc.com/#cancel-margin-order
2202
+
2203
+ https://api.hitbtc.com/#cancel-spot-order
2204
+ https://api.hitbtc.com/#cancel-futures-order
2205
+ https://api.hitbtc.com/#cancel-margin-order
2206
+
2055
2207
  :param str id: order id
2056
2208
  :param str symbol: unified symbol of the market the order was made in
2057
2209
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2061,7 +2213,7 @@ class hitbtc(Exchange, ImplicitAPI):
2061
2213
  """
2062
2214
  await self.load_markets()
2063
2215
  market = None
2064
- request = {
2216
+ request: dict = {
2065
2217
  'client_order_id': id,
2066
2218
  }
2067
2219
  if symbol is not None:
@@ -2088,7 +2240,7 @@ class hitbtc(Exchange, ImplicitAPI):
2088
2240
  async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
2089
2241
  await self.load_markets()
2090
2242
  market = None
2091
- request = {
2243
+ request: dict = {
2092
2244
  'client_order_id': id,
2093
2245
  'quantity': self.amount_to_precision(symbol, amount),
2094
2246
  }
@@ -2120,14 +2272,16 @@ class hitbtc(Exchange, ImplicitAPI):
2120
2272
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2121
2273
  """
2122
2274
  create a trade order
2123
- :see: https://api.hitbtc.com/#create-new-spot-order
2124
- :see: https://api.hitbtc.com/#create-margin-order
2125
- :see: https://api.hitbtc.com/#create-futures-order
2275
+
2276
+ https://api.hitbtc.com/#create-new-spot-order
2277
+ https://api.hitbtc.com/#create-margin-order
2278
+ https://api.hitbtc.com/#create-futures-order
2279
+
2126
2280
  :param str symbol: unified symbol of the market to create an order in
2127
2281
  :param str type: 'market' or 'limit'
2128
2282
  :param str side: 'buy' or 'sell'
2129
2283
  :param float amount: how much of currency you want to trade in units of base currency
2130
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
2284
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2131
2285
  :param dict [params]: extra parameters specific to the exchange API endpoint
2132
2286
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both, default is 'cross'
2133
2287
  :param bool [params.margin]: True for creating a margin order
@@ -2159,7 +2313,7 @@ class hitbtc(Exchange, ImplicitAPI):
2159
2313
  timeInForce = self.safe_string(params, 'timeInForce')
2160
2314
  triggerPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'stop_price'])
2161
2315
  isPostOnly = self.is_post_only(type == 'market', None, params)
2162
- request = {
2316
+ request: dict = {
2163
2317
  'type': type,
2164
2318
  'side': side,
2165
2319
  'quantity': self.amount_to_precision(market['symbol'], amount),
@@ -2200,7 +2354,7 @@ class hitbtc(Exchange, ImplicitAPI):
2200
2354
  elif type == 'market':
2201
2355
  request['type'] = 'stopMarket'
2202
2356
  elif (type == 'stopLimit') or (type == 'stopMarket') or (type == 'takeProfitLimit') or (type == 'takeProfitMarket'):
2203
- raise ExchangeError(self.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders')
2357
+ raise ExchangeError(self.id + ' createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders')
2204
2358
  params = self.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly'])
2205
2359
  if marketType == 'swap':
2206
2360
  # set default margin mode to cross
@@ -2209,8 +2363,8 @@ class hitbtc(Exchange, ImplicitAPI):
2209
2363
  request['margin_mode'] = marginMode
2210
2364
  return [request, params]
2211
2365
 
2212
- def parse_order_status(self, status):
2213
- statuses = {
2366
+ def parse_order_status(self, status: Str):
2367
+ statuses: dict = {
2214
2368
  'new': 'open',
2215
2369
  'suspended': 'open',
2216
2370
  'partiallyFilled': 'open',
@@ -2220,7 +2374,7 @@ class hitbtc(Exchange, ImplicitAPI):
2220
2374
  }
2221
2375
  return self.safe_string(statuses, status, status)
2222
2376
 
2223
- def parse_order(self, order, market: Market = None) -> Order:
2377
+ def parse_order(self, order: dict, market: Market = None) -> Order:
2224
2378
  #
2225
2379
  # limit
2226
2380
  # {
@@ -2309,7 +2463,6 @@ class hitbtc(Exchange, ImplicitAPI):
2309
2463
  postOnly = self.safe_value(order, 'post_only')
2310
2464
  timeInForce = self.safe_string(order, 'time_in_force')
2311
2465
  rawTrades = self.safe_value(order, 'trades')
2312
- stopPrice = self.safe_string(order, 'stop_price')
2313
2466
  return self.safe_order({
2314
2467
  'info': order,
2315
2468
  'id': id,
@@ -2333,8 +2486,7 @@ class hitbtc(Exchange, ImplicitAPI):
2333
2486
  'average': average,
2334
2487
  'trades': rawTrades,
2335
2488
  'fee': None,
2336
- 'stopPrice': stopPrice,
2337
- 'triggerPrice': stopPrice,
2489
+ 'triggerPrice': self.safe_string(order, 'stop_price'),
2338
2490
  'takeProfitPrice': None,
2339
2491
  'stopLossPrice': None,
2340
2492
  }, market)
@@ -2342,9 +2494,11 @@ class hitbtc(Exchange, ImplicitAPI):
2342
2494
  async def fetch_margin_modes(self, symbols: List[Str] = None, params={}) -> MarginModes:
2343
2495
  """
2344
2496
  fetches margin mode of the user
2345
- :see: https://api.hitbtc.com/#get-margin-position-parameters
2346
- :see: https://api.hitbtc.com/#get-futures-position-parameters
2347
- :param str symbol: unified symbol of the market the order was made in
2497
+
2498
+ https://api.hitbtc.com/#get-margin-position-parameters
2499
+ https://api.hitbtc.com/#get-futures-position-parameters
2500
+
2501
+ :param str[] symbols: unified market symbols
2348
2502
  :param dict [params]: extra parameters specific to the exchange API endpoint
2349
2503
  :returns dict: a list of `margin mode structures <https://docs.ccxt.com/#/?id=margin-mode-structure>`
2350
2504
  """
@@ -2399,7 +2553,7 @@ class hitbtc(Exchange, ImplicitAPI):
2399
2553
  config = self.safe_list(response, 'config', [])
2400
2554
  return self.parse_margin_modes(config, symbols, 'symbol')
2401
2555
 
2402
- def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
2556
+ def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
2403
2557
  marketId = self.safe_string(marginMode, 'symbol')
2404
2558
  return {
2405
2559
  'info': marginMode,
@@ -2410,7 +2564,9 @@ class hitbtc(Exchange, ImplicitAPI):
2410
2564
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2411
2565
  """
2412
2566
  transfer currency internally between wallets on the same account
2413
- :see: https://api.hitbtc.com/#transfer-between-wallet-and-exchange
2567
+
2568
+ https://api.hitbtc.com/#transfer-between-wallet-and-exchange
2569
+
2414
2570
  :param str code: unified currency code
2415
2571
  :param float amount: amount to transfer
2416
2572
  :param str fromAccount: account to transfer from
@@ -2429,7 +2585,7 @@ class hitbtc(Exchange, ImplicitAPI):
2429
2585
  toId = self.safe_string(accountsByType, toAccount, toAccount)
2430
2586
  if fromId == toId:
2431
2587
  raise BadRequest(self.id + ' transfer() fromAccount and toAccount arguments cannot be the same account')
2432
- request = {
2588
+ request: dict = {
2433
2589
  'currency': currency['id'],
2434
2590
  'amount': requestAmount,
2435
2591
  'source': fromId,
@@ -2443,7 +2599,7 @@ class hitbtc(Exchange, ImplicitAPI):
2443
2599
  #
2444
2600
  return self.parse_transfer(response, currency)
2445
2601
 
2446
- def parse_transfer(self, transfer, currency: Currency = None):
2602
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2447
2603
  #
2448
2604
  # transfer
2449
2605
  #
@@ -2477,7 +2633,7 @@ class hitbtc(Exchange, ImplicitAPI):
2477
2633
  if (fromNetwork is None) or (toNetwork is None):
2478
2634
  keys = list(networks.keys())
2479
2635
  raise ArgumentsRequired(self.id + ' convertCurrencyNetwork() requires a fromNetwork parameter and a toNetwork parameter, supported networks are ' + ', '.join(keys))
2480
- request = {
2636
+ request: dict = {
2481
2637
  'from_currency': fromNetwork,
2482
2638
  'to_currency': toNetwork,
2483
2639
  'amount': self.currency_to_precision(code, amount),
@@ -2488,10 +2644,12 @@ class hitbtc(Exchange, ImplicitAPI):
2488
2644
  'info': response,
2489
2645
  }
2490
2646
 
2491
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2647
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2492
2648
  """
2493
2649
  make a withdrawal
2494
- :see: https://api.hitbtc.com/#withdraw-crypto
2650
+
2651
+ https://api.hitbtc.com/#withdraw-crypto
2652
+
2495
2653
  :param str code: unified currency code
2496
2654
  :param float amount: the amount to withdraw
2497
2655
  :param str address: the address to withdraw to
@@ -2503,7 +2661,7 @@ class hitbtc(Exchange, ImplicitAPI):
2503
2661
  await self.load_markets()
2504
2662
  self.check_address(address)
2505
2663
  currency = self.currency(code)
2506
- request = {
2664
+ request: dict = {
2507
2665
  'currency': currency['id'],
2508
2666
  'amount': amount,
2509
2667
  'address': address,
@@ -2529,17 +2687,19 @@ class hitbtc(Exchange, ImplicitAPI):
2529
2687
  #
2530
2688
  return self.parse_transaction(response, currency)
2531
2689
 
2532
- async def fetch_funding_rates(self, symbols: Strings = None, params={}):
2690
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
2533
2691
  """
2534
2692
  fetches funding rates for multiple markets
2535
- :see: https://api.hitbtc.com/#futures-info
2693
+
2694
+ https://api.hitbtc.com/#futures-info
2695
+
2536
2696
  :param str[] symbols: unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
2537
2697
  :param dict [params]: extra parameters specific to the exchange API endpoint
2538
- :returns dict: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
2698
+ :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
2539
2699
  """
2540
2700
  await self.load_markets()
2541
2701
  market = None
2542
- request = {}
2702
+ request: dict = {}
2543
2703
  if symbols is not None:
2544
2704
  symbols = self.market_symbols(symbols)
2545
2705
  market = self.market(symbols[0])
@@ -2568,7 +2728,7 @@ class hitbtc(Exchange, ImplicitAPI):
2568
2728
  # }
2569
2729
  #
2570
2730
  marketIds = list(response.keys())
2571
- fundingRates = {}
2731
+ fundingRates: dict = {}
2572
2732
  for i in range(0, len(marketIds)):
2573
2733
  marketId = self.safe_string(marketIds, i)
2574
2734
  rawFundingRate = self.safe_value(response, marketId)
@@ -2580,7 +2740,9 @@ class hitbtc(Exchange, ImplicitAPI):
2580
2740
 
2581
2741
  async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2582
2742
  """
2583
- :see: https://api.hitbtc.com/#funding-history
2743
+
2744
+ https://api.hitbtc.com/#funding-history
2745
+
2584
2746
  fetches historical funding rate prices
2585
2747
  :param str symbol: unified symbol of the market to fetch the funding rate history for
2586
2748
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
@@ -2596,16 +2758,16 @@ class hitbtc(Exchange, ImplicitAPI):
2596
2758
  if paginate:
2597
2759
  return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 1000)
2598
2760
  market = None
2599
- request = {
2761
+ request: dict = {
2600
2762
  # all arguments are optional
2601
2763
  # 'symbols': Comma separated list of symbol codes,
2602
2764
  # 'sort': 'DESC' or 'ASC'
2603
2765
  # 'from': 'Datetime or Number',
2604
- # 'till': 'Datetime or Number',
2766
+ # 'until': 'Datetime or Number',
2605
2767
  # 'limit': 100,
2606
2768
  # 'offset': 0,
2607
2769
  }
2608
- request, params = self.handle_until_option('till', request, params)
2770
+ request, params = self.handle_until_option('until', request, params)
2609
2771
  if symbol is not None:
2610
2772
  market = self.market(symbol)
2611
2773
  symbol = market['symbol']
@@ -2654,8 +2816,10 @@ class hitbtc(Exchange, ImplicitAPI):
2654
2816
  async def fetch_positions(self, symbols: Strings = None, params={}):
2655
2817
  """
2656
2818
  fetch all open positions
2657
- :see: https://api.hitbtc.com/#get-futures-margin-accounts
2658
- :see: https://api.hitbtc.com/#get-all-margin-accounts
2819
+
2820
+ https://api.hitbtc.com/#get-futures-margin-accounts
2821
+ https://api.hitbtc.com/#get-all-margin-accounts
2822
+
2659
2823
  :param str[]|None symbols: not used by hitbtc fetchPositions()
2660
2824
  :param dict [params]: extra parameters specific to the exchange API endpoint
2661
2825
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if self is set
@@ -2663,7 +2827,7 @@ class hitbtc(Exchange, ImplicitAPI):
2663
2827
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
2664
2828
  """
2665
2829
  await self.load_markets()
2666
- request = {}
2830
+ request: dict = {}
2667
2831
  marketType = None
2668
2832
  marginMode = None
2669
2833
  marketType, params = self.handle_market_type_and_params('fetchPositions', None, params)
@@ -2721,8 +2885,10 @@ class hitbtc(Exchange, ImplicitAPI):
2721
2885
  async def fetch_position(self, symbol: str, params={}):
2722
2886
  """
2723
2887
  fetch data on a single open contract trade position
2724
- :see: https://api.hitbtc.com/#get-futures-margin-account
2725
- :see: https://api.hitbtc.com/#get-isolated-margin-account
2888
+
2889
+ https://api.hitbtc.com/#get-futures-margin-account
2890
+ https://api.hitbtc.com/#get-isolated-margin-account
2891
+
2726
2892
  :param str symbol: unified market symbol of the market the position is held in, default is None
2727
2893
  :param dict [params]: extra parameters specific to the exchange API endpoint
2728
2894
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if self is set
@@ -2731,7 +2897,7 @@ class hitbtc(Exchange, ImplicitAPI):
2731
2897
  """
2732
2898
  await self.load_markets()
2733
2899
  market = self.market(symbol)
2734
- request = {
2900
+ request: dict = {
2735
2901
  'symbol': market['id'],
2736
2902
  }
2737
2903
  marketType = None
@@ -2783,7 +2949,7 @@ class hitbtc(Exchange, ImplicitAPI):
2783
2949
  #
2784
2950
  return self.parse_position(response, market)
2785
2951
 
2786
- def parse_position(self, position, market: Market = None):
2952
+ def parse_position(self, position: dict, market: Market = None):
2787
2953
  #
2788
2954
  # [
2789
2955
  # {
@@ -2886,7 +3052,7 @@ class hitbtc(Exchange, ImplicitAPI):
2886
3052
  datetime = self.safe_string(interest, 'timestamp')
2887
3053
  value = self.safe_number(interest, 'open_interest')
2888
3054
  return self.safe_open_interest({
2889
- 'symbol': market['symbol'],
3055
+ 'symbol': self.safe_symbol(None, market),
2890
3056
  'openInterestAmount': None,
2891
3057
  'openInterestValue': value,
2892
3058
  'timestamp': self.parse8601(datetime),
@@ -2894,10 +3060,55 @@ class hitbtc(Exchange, ImplicitAPI):
2894
3060
  'info': interest,
2895
3061
  }, market)
2896
3062
 
3063
+ async def fetch_open_interests(self, symbols: Strings = None, params={}):
3064
+ """
3065
+ Retrieves the open interest for a list of symbols
3066
+
3067
+ https://api.hitbtc.com/#futures-info
3068
+
3069
+ :param str[] [symbols]: a list of unified CCXT market symbols
3070
+ :param dict [params]: exchange specific parameters
3071
+ :returns dict[]: a list of `open interest structures <https://docs.ccxt.com/#/?id=open-interest-structure>`
3072
+ """
3073
+ await self.load_markets()
3074
+ request: dict = {}
3075
+ symbols = self.market_symbols(symbols)
3076
+ marketIds = None
3077
+ if symbols is not None:
3078
+ marketIds = self.market_ids(symbols)
3079
+ request['symbols'] = ','.join(marketIds)
3080
+ response = await self.publicGetPublicFuturesInfo(self.extend(request, params))
3081
+ #
3082
+ # {
3083
+ # "BTCUSDT_PERP": {
3084
+ # "contract_type": "perpetual",
3085
+ # "mark_price": "97291.83",
3086
+ # "index_price": "97298.61",
3087
+ # "funding_rate": "-0.000183473092423284",
3088
+ # "open_interest": "94.1503",
3089
+ # "next_funding_time": "2024-12-20T08:00:00.000Z",
3090
+ # "indicative_funding_rate": "-0.00027495203277752",
3091
+ # "premium_index": "-0.000789474900583786",
3092
+ # "avg_premium_index": "-0.000683473092423284",
3093
+ # "interest_rate": "0.0001",
3094
+ # "timestamp": "2024-12-20T04:57:33.693Z"
3095
+ # }
3096
+ # }
3097
+ #
3098
+ results = []
3099
+ markets = list(response.keys())
3100
+ for i in range(0, len(markets)):
3101
+ marketId = markets[i]
3102
+ marketInner = self.safe_market(marketId)
3103
+ results.append(self.parse_open_interest(response[marketId], marketInner))
3104
+ return self.filter_by_array(results, 'symbol', symbols)
3105
+
2897
3106
  async def fetch_open_interest(self, symbol: str, params={}):
2898
3107
  """
2899
3108
  Retrieves the open interest of a derivative trading pair
2900
- :see: https://api.hitbtc.com/#futures-info
3109
+
3110
+ https://api.hitbtc.com/#futures-info
3111
+
2901
3112
  :param str symbol: Unified CCXT market symbol
2902
3113
  :param dict [params]: exchange specific parameters
2903
3114
  :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=interest-history-structure:
@@ -2906,7 +3117,7 @@ class hitbtc(Exchange, ImplicitAPI):
2906
3117
  market = self.market(symbol)
2907
3118
  if not market['swap']:
2908
3119
  raise BadSymbol(self.id + ' fetchOpenInterest() supports swap contracts only')
2909
- request = {
3120
+ request: dict = {
2910
3121
  'symbol': market['id'],
2911
3122
  }
2912
3123
  response = await self.publicGetPublicFuturesInfoSymbol(self.extend(request, params))
@@ -2927,10 +3138,12 @@ class hitbtc(Exchange, ImplicitAPI):
2927
3138
  #
2928
3139
  return self.parse_open_interest(response, market)
2929
3140
 
2930
- async def fetch_funding_rate(self, symbol: str, params={}):
3141
+ async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2931
3142
  """
2932
3143
  fetch the current funding rate
2933
- :see: https://api.hitbtc.com/#futures-info
3144
+
3145
+ https://api.hitbtc.com/#futures-info
3146
+
2934
3147
  :param str symbol: unified market symbol
2935
3148
  :param dict [params]: extra parameters specific to the exchange API endpoint
2936
3149
  :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -2939,7 +3152,7 @@ class hitbtc(Exchange, ImplicitAPI):
2939
3152
  market = self.market(symbol)
2940
3153
  if not market['swap']:
2941
3154
  raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
2942
- request = {
3155
+ request: dict = {
2943
3156
  'symbol': market['id'],
2944
3157
  }
2945
3158
  response = await self.publicGetPublicFuturesInfoSymbol(self.extend(request, params))
@@ -2960,7 +3173,7 @@ class hitbtc(Exchange, ImplicitAPI):
2960
3173
  #
2961
3174
  return self.parse_funding_rate(response, market)
2962
3175
 
2963
- def parse_funding_rate(self, contract, market: Market = None):
3176
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2964
3177
  #
2965
3178
  # {
2966
3179
  # "contract_type": "perpetual",
@@ -2996,20 +3209,22 @@ class hitbtc(Exchange, ImplicitAPI):
2996
3209
  'previousFundingRate': None,
2997
3210
  'previousFundingTimestamp': None,
2998
3211
  'previousFundingDatetime': None,
3212
+ 'interval': None,
2999
3213
  }
3000
3214
 
3001
- async def modify_margin_helper(self, symbol: str, amount, type, params={}):
3215
+ async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
3002
3216
  await self.load_markets()
3003
3217
  market = self.market(symbol)
3004
3218
  leverage = self.safe_string(params, 'leverage')
3005
3219
  if market['swap']:
3006
3220
  if leverage is None:
3007
3221
  raise ArgumentsRequired(self.id + ' modifyMarginHelper() requires a leverage parameter for swap markets')
3008
- if amount != 0:
3009
- amount = self.amount_to_precision(symbol, amount)
3222
+ stringAmount = self.number_to_string(amount)
3223
+ if stringAmount != '0':
3224
+ amount = self.amount_to_precision(symbol, stringAmount)
3010
3225
  else:
3011
3226
  amount = '0'
3012
- request = {
3227
+ request: dict = {
3013
3228
  'symbol': market['id'], # swap and margin
3014
3229
  'margin_balance': amount, # swap and margin
3015
3230
  # "leverage": "10", # swap only required
@@ -3051,23 +3266,50 @@ class hitbtc(Exchange, ImplicitAPI):
3051
3266
  'type': type,
3052
3267
  })
3053
3268
 
3054
- def parse_margin_modification(self, data, market: Market = None):
3269
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
3270
+ #
3271
+ # addMargin/reduceMargin
3272
+ #
3273
+ # {
3274
+ # "symbol": "BTCUSDT_PERP",
3275
+ # "type": "isolated",
3276
+ # "leverage": "8.00",
3277
+ # "created_at": "2022-03-30T23:34:27.161Z",
3278
+ # "updated_at": "2022-03-30T23:34:27.161Z",
3279
+ # "currencies": [
3280
+ # {
3281
+ # "code": "USDT",
3282
+ # "margin_balance": "7.000000000000",
3283
+ # "reserved_orders": "0",
3284
+ # "reserved_positions": "0"
3285
+ # }
3286
+ # ],
3287
+ # "positions": null
3288
+ # }
3289
+ #
3055
3290
  currencies = self.safe_value(data, 'currencies', [])
3056
3291
  currencyInfo = self.safe_value(currencies, 0)
3292
+ datetime = self.safe_string(data, 'updated_at')
3057
3293
  return {
3058
3294
  'info': data,
3295
+ 'symbol': market['symbol'],
3059
3296
  'type': None,
3297
+ 'marginMode': 'isolated',
3060
3298
  'amount': None,
3299
+ 'total': None,
3061
3300
  'code': self.safe_string(currencyInfo, 'code'),
3062
- 'symbol': market['symbol'],
3063
3301
  'status': None,
3302
+ 'timestamp': self.parse8601(datetime),
3303
+ 'datetime': datetime,
3064
3304
  }
3065
3305
 
3066
- async def reduce_margin(self, symbol: str, amount, params={}):
3306
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3067
3307
  """
3068
3308
  remove margin from a position
3069
- :see: https://api.hitbtc.com/#create-update-margin-account-2
3070
- :see: https://api.hitbtc.com/#create-update-margin-account
3309
+
3310
+ https://api.hitbtc.com/#create-update-margin-account-2
3311
+ https://api.hitbtc.com/#create-update-margin-account
3312
+
3071
3313
  :param str symbol: unified market symbol
3072
3314
  :param float amount: the amount of margin to remove
3073
3315
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3075,15 +3317,17 @@ class hitbtc(Exchange, ImplicitAPI):
3075
3317
  :param bool [params.margin]: True for reducing spot-margin
3076
3318
  :returns dict: a `margin structure <https://docs.ccxt.com/#/?id=reduce-margin-structure>`
3077
3319
  """
3078
- if amount != 0:
3320
+ if self.number_to_string(amount) != '0':
3079
3321
  raise BadRequest(self.id + ' reduceMargin() on hitbtc requires the amount to be 0 and that will remove the entire margin amount')
3080
3322
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
3081
3323
 
3082
- async def add_margin(self, symbol: str, amount, params={}):
3324
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3083
3325
  """
3084
3326
  add margin
3085
- :see: https://api.hitbtc.com/#create-update-margin-account-2
3086
- :see: https://api.hitbtc.com/#create-update-margin-account
3327
+
3328
+ https://api.hitbtc.com/#create-update-margin-account-2
3329
+ https://api.hitbtc.com/#create-update-margin-account
3330
+
3087
3331
  :param str symbol: unified market symbol
3088
3332
  :param float amount: amount of margin to add
3089
3333
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3096,8 +3340,10 @@ class hitbtc(Exchange, ImplicitAPI):
3096
3340
  async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
3097
3341
  """
3098
3342
  fetch the set leverage for a market
3099
- :see: https://api.hitbtc.com/#get-futures-margin-account
3100
- :see: https://api.hitbtc.com/#get-isolated-margin-account
3343
+
3344
+ https://api.hitbtc.com/#get-futures-margin-account
3345
+ https://api.hitbtc.com/#get-isolated-margin-account
3346
+
3101
3347
  :param str symbol: unified market symbol
3102
3348
  :param dict [params]: extra parameters specific to the exchange API endpoint
3103
3349
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if self is set
@@ -3106,7 +3352,7 @@ class hitbtc(Exchange, ImplicitAPI):
3106
3352
  """
3107
3353
  await self.load_markets()
3108
3354
  market = self.market(symbol)
3109
- request = {
3355
+ request: dict = {
3110
3356
  'symbol': market['id'],
3111
3357
  }
3112
3358
  marginMode = None
@@ -3156,7 +3402,7 @@ class hitbtc(Exchange, ImplicitAPI):
3156
3402
  #
3157
3403
  return self.parse_leverage(response, market)
3158
3404
 
3159
- def parse_leverage(self, leverage, market=None) -> Leverage:
3405
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
3160
3406
  marketId = self.safe_string(leverage, 'symbol')
3161
3407
  leverageValue = self.safe_integer(leverage, 'leverage')
3162
3408
  return {
@@ -3170,7 +3416,9 @@ class hitbtc(Exchange, ImplicitAPI):
3170
3416
  async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
3171
3417
  """
3172
3418
  set the level of leverage for a market
3173
- :see: https://api.hitbtc.com/#create-update-margin-account-2
3419
+
3420
+ https://api.hitbtc.com/#create-update-margin-account-2
3421
+
3174
3422
  :param float leverage: the rate of leverage
3175
3423
  :param str symbol: unified market symbol
3176
3424
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3188,7 +3436,7 @@ class hitbtc(Exchange, ImplicitAPI):
3188
3436
  raise BadSymbol(self.id + ' setLeverage() supports swap contracts only')
3189
3437
  if (leverage < 1) or (leverage > maxLeverage):
3190
3438
  raise BadRequest(self.id + ' setLeverage() leverage should be between 1 and ' + str(maxLeverage) + ' for ' + symbol)
3191
- request = {
3439
+ request: dict = {
3192
3440
  'symbol': market['id'],
3193
3441
  'leverage': str(leverage),
3194
3442
  'margin_balance': self.amount_to_precision(symbol, amount),
@@ -3199,7 +3447,9 @@ class hitbtc(Exchange, ImplicitAPI):
3199
3447
  async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
3200
3448
  """
3201
3449
  fetch deposit and withdraw fees
3202
- :see: https://api.hitbtc.com/#currencies
3450
+
3451
+ https://api.hitbtc.com/#currencies
3452
+
3203
3453
  :param str[]|None codes: list of unified currency codes
3204
3454
  :param dict [params]: extra parameters specific to the exchange API endpoint
3205
3455
  :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
@@ -3263,9 +3513,10 @@ class hitbtc(Exchange, ImplicitAPI):
3263
3513
  networkEntry = networks[j]
3264
3514
  networkId = self.safe_string(networkEntry, 'network')
3265
3515
  networkCode = self.network_id_to_code(networkId)
3516
+ networkCode = networkCode.upper() if (networkCode is not None) else None
3266
3517
  withdrawFee = self.safe_number(networkEntry, 'payout_fee')
3267
3518
  isDefault = self.safe_value(networkEntry, 'default')
3268
- withdrawResult = {
3519
+ withdrawResult: dict = {
3269
3520
  'fee': withdrawFee,
3270
3521
  'percentage': False if (withdrawFee is not None) else None,
3271
3522
  }
@@ -3283,7 +3534,11 @@ class hitbtc(Exchange, ImplicitAPI):
3283
3534
  async def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
3284
3535
  """
3285
3536
  closes open positions for a market
3286
- :see: https://api.hitbtc.com/#close-all-futures-margin-positions
3537
+
3538
+ https://api.hitbtc.com/#close-all-futures-margin-positions
3539
+
3540
+ :param str symbol: unified ccxt market symbol
3541
+ :param str side: 'buy' or 'sell'
3287
3542
  :param dict [params]: extra parameters specific to the okx api endpoint
3288
3543
  :param str [params.symbol]: *required* unified market symbol
3289
3544
  :param str [params.marginMode]: 'cross' or 'isolated', default is 'cross'
@@ -3293,7 +3548,7 @@ class hitbtc(Exchange, ImplicitAPI):
3293
3548
  marginMode = None
3294
3549
  marginMode, params = self.handle_margin_mode_and_params('closePosition', params, 'cross')
3295
3550
  market = self.market(symbol)
3296
- request = {
3551
+ request: dict = {
3297
3552
  'symbol': market['id'],
3298
3553
  'margin_mode': marginMode,
3299
3554
  }
@@ -3317,7 +3572,7 @@ class hitbtc(Exchange, ImplicitAPI):
3317
3572
 
3318
3573
  def handle_margin_mode_and_params(self, methodName, params={}, defaultValue=None):
3319
3574
  """
3320
- * @ignore
3575
+ @ignore
3321
3576
  marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
3322
3577
  :param dict [params]: extra parameters specific to the exchange API endpoint
3323
3578
  :returns Array: the marginMode in lowercase
@@ -3331,7 +3586,7 @@ class hitbtc(Exchange, ImplicitAPI):
3331
3586
  marginMode = 'isolated'
3332
3587
  return [marginMode, params]
3333
3588
 
3334
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
3589
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
3335
3590
  #
3336
3591
  # {
3337
3592
  # "error": {