ccxt 4.2.77__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 +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 +3104 -880
  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 +1513 -563
  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 +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 +404 -109
  125. ccxt/async_support/deribit.py +557 -323
  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 +1472 -463
  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 +1633 -268
  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 +917 -357
  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 +1776 -454
  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 +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 +3104 -880
  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 +1513 -563
  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 +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 +404 -109
  233. ccxt/deribit.py +557 -323
  234. ccxt/digifinex.py +340 -223
  235. ccxt/ellipx.py +1826 -0
  236. ccxt/exmo.py +259 -128
  237. ccxt/gate.py +1472 -463
  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 +1632 -268
  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 +917 -357
  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 +1776 -454
  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 +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 +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 +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.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.77.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.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.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.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,
@@ -632,6 +636,7 @@ class hitbtc(Exchange, ImplicitAPI):
632
636
  'accountsByType': {
633
637
  'spot': 'spot',
634
638
  'funding': 'wallet',
639
+ 'swap': 'derivatives',
635
640
  'future': 'derivatives',
636
641
  },
637
642
  'withdraw': {
@@ -665,10 +670,12 @@ class hitbtc(Exchange, ImplicitAPI):
665
670
  def nonce(self):
666
671
  return self.milliseconds()
667
672
 
668
- async def fetch_markets(self, params={}):
673
+ async def fetch_markets(self, params={}) -> List[Market]:
669
674
  """
670
675
  retrieves data on all markets for hitbtc
671
- :see: https://api.hitbtc.com/#symbols
676
+
677
+ https://api.hitbtc.com/#symbols
678
+
672
679
  :param dict [params]: extra parameters specific to the exchange API endpoint
673
680
  :returns dict[]: an array of objects representing market data
674
681
  """
@@ -802,10 +809,12 @@ class hitbtc(Exchange, ImplicitAPI):
802
809
  })
803
810
  return result
804
811
 
805
- async def fetch_currencies(self, params={}):
812
+ async def fetch_currencies(self, params={}) -> Currencies:
806
813
  """
807
814
  fetches all available currencies on an exchange
808
- :see: https://api.hitbtc.com/#currencies
815
+
816
+ https://api.hitbtc.com/#currencies
817
+
809
818
  :param dict [params]: extra parameters specific to the exchange API endpoint
810
819
  :returns dict: an associative dictionary of currencies
811
820
  """
@@ -835,7 +844,7 @@ class hitbtc(Exchange, ImplicitAPI):
835
844
  # }
836
845
  # }
837
846
  #
838
- result = {}
847
+ result: dict = {}
839
848
  currencies = list(response.keys())
840
849
  for i in range(0, len(currencies)):
841
850
  currencyId = currencies[i]
@@ -848,18 +857,19 @@ class hitbtc(Exchange, ImplicitAPI):
848
857
  transferEnabled = self.safe_bool(entry, 'transfer_enabled', False)
849
858
  active = payinEnabled and payoutEnabled and transferEnabled
850
859
  rawNetworks = self.safe_value(entry, 'networks', [])
851
- networks = {}
860
+ networks: dict = {}
852
861
  fee = None
853
862
  depositEnabled = None
854
863
  withdrawEnabled = None
855
864
  for j in range(0, len(rawNetworks)):
856
865
  rawNetwork = rawNetworks[j]
857
866
  networkId = self.safe_string_2(rawNetwork, 'protocol', 'network')
858
- network = self.safe_network(networkId)
867
+ networkCode = self.network_id_to_code(networkId)
868
+ networkCode = networkCode.upper() if (networkCode is not None) else None
859
869
  fee = self.safe_number(rawNetwork, 'payout_fee')
860
870
  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)
871
+ payinEnabledNetwork = self.safe_bool(rawNetwork, 'payin_enabled', False)
872
+ payoutEnabledNetwork = self.safe_bool(rawNetwork, 'payout_enabled', False)
863
873
  activeNetwork = payinEnabledNetwork and payoutEnabledNetwork
864
874
  if payinEnabledNetwork and not depositEnabled:
865
875
  depositEnabled = True
@@ -869,10 +879,10 @@ class hitbtc(Exchange, ImplicitAPI):
869
879
  withdrawEnabled = True
870
880
  elif not payoutEnabledNetwork:
871
881
  withdrawEnabled = False
872
- networks[network] = {
882
+ networks[networkCode] = {
873
883
  'info': rawNetwork,
874
884
  'id': networkId,
875
- 'network': network,
885
+ 'network': networkCode,
876
886
  'fee': fee,
877
887
  'active': activeNetwork,
878
888
  'deposit': payinEnabledNetwork,
@@ -907,23 +917,19 @@ class hitbtc(Exchange, ImplicitAPI):
907
917
  }
908
918
  return result
909
919
 
910
- def safe_network(self, networkId):
911
- if networkId is None:
912
- return None
913
- else:
914
- return networkId.upper()
915
-
916
920
  async def create_deposit_address(self, code: str, params={}):
917
921
  """
918
922
  create a currency deposit address
919
- :see: https://api.hitbtc.com/#generate-deposit-crypto-address
923
+
924
+ https://api.hitbtc.com/#generate-deposit-crypto-address
925
+
920
926
  :param str code: unified currency code of the currency for the deposit address
921
927
  :param dict [params]: extra parameters specific to the exchange API endpoint
922
928
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
923
929
  """
924
930
  await self.load_markets()
925
931
  currency = self.currency(code)
926
- request = {
932
+ request: dict = {
927
933
  'currency': currency['id'],
928
934
  }
929
935
  network = self.safe_string_upper(params, 'network')
@@ -946,17 +952,19 @@ class hitbtc(Exchange, ImplicitAPI):
946
952
  'info': response,
947
953
  }
948
954
 
949
- async def fetch_deposit_address(self, code: str, params={}):
955
+ async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
950
956
  """
951
957
  fetch the deposit address for a currency associated with self account
952
- :see: https://api.hitbtc.com/#get-deposit-crypto-address
958
+
959
+ https://api.hitbtc.com/#get-deposit-crypto-address
960
+
953
961
  :param str code: unified currency code
954
962
  :param dict [params]: extra parameters specific to the exchange API endpoint
955
963
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
956
964
  """
957
965
  await self.load_markets()
958
966
  currency = self.currency(code)
959
- request = {
967
+ request: dict = {
960
968
  'currency': currency['id'],
961
969
  }
962
970
  network = self.safe_string_upper(params, 'network')
@@ -977,15 +985,14 @@ class hitbtc(Exchange, ImplicitAPI):
977
985
  parsedCode = self.safe_currency_code(currencyId)
978
986
  return {
979
987
  'info': response,
980
- 'address': address,
981
- 'tag': tag,
982
- 'code': parsedCode, # kept here for backward-compatibility, but will be removed soon
983
988
  'currency': parsedCode,
984
989
  'network': None,
990
+ 'address': address,
991
+ 'tag': tag,
985
992
  }
986
993
 
987
994
  def parse_balance(self, response) -> Balances:
988
- result = {'info': response}
995
+ result: dict = {'info': response}
989
996
  for i in range(0, len(response)):
990
997
  entry = response[i]
991
998
  currencyId = self.safe_string(entry, 'currency')
@@ -999,9 +1006,11 @@ class hitbtc(Exchange, ImplicitAPI):
999
1006
  async def fetch_balance(self, params={}) -> Balances:
1000
1007
  """
1001
1008
  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
1009
+
1010
+ https://api.hitbtc.com/#wallet-balance
1011
+ https://api.hitbtc.com/#get-spot-trading-balance
1012
+ https://api.hitbtc.com/#get-trading-balance
1013
+
1005
1014
  :param dict [params]: extra parameters specific to the exchange API endpoint
1006
1015
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1007
1016
  """
@@ -1035,14 +1044,16 @@ class hitbtc(Exchange, ImplicitAPI):
1035
1044
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
1036
1045
  """
1037
1046
  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
1047
+
1048
+ https://api.hitbtc.com/#tickers
1049
+
1039
1050
  :param str symbol: unified symbol of the market to fetch the ticker for
1040
1051
  :param dict [params]: extra parameters specific to the exchange API endpoint
1041
1052
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
1042
1053
  """
1043
1054
  await self.load_markets()
1044
1055
  market = self.market(symbol)
1045
- request = {
1056
+ request: dict = {
1046
1057
  'symbol': market['id'],
1047
1058
  }
1048
1059
  response = await self.publicGetPublicTickerSymbol(self.extend(request, params))
@@ -1064,14 +1075,16 @@ class hitbtc(Exchange, ImplicitAPI):
1064
1075
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1065
1076
  """
1066
1077
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1067
- :see: https://api.hitbtc.com/#tickers
1078
+
1079
+ https://api.hitbtc.com/#tickers
1080
+
1068
1081
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1069
1082
  :param dict [params]: extra parameters specific to the exchange API endpoint
1070
1083
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
1071
1084
  """
1072
1085
  await self.load_markets()
1073
1086
  symbols = self.market_symbols(symbols)
1074
- request = {}
1087
+ request: dict = {}
1075
1088
  if symbols is not None:
1076
1089
  marketIds = self.market_ids(symbols)
1077
1090
  delimited = ','.join(marketIds)
@@ -1092,7 +1105,7 @@ class hitbtc(Exchange, ImplicitAPI):
1092
1105
  # }
1093
1106
  # }
1094
1107
  #
1095
- result = {}
1108
+ result: dict = {}
1096
1109
  keys = list(response.keys())
1097
1110
  for i in range(0, len(keys)):
1098
1111
  marketId = keys[i]
@@ -1102,7 +1115,7 @@ class hitbtc(Exchange, ImplicitAPI):
1102
1115
  result[symbol] = self.parse_ticker(entry, market)
1103
1116
  return self.filter_by_array_tickers(result, 'symbol', symbols)
1104
1117
 
1105
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1118
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
1106
1119
  #
1107
1120
  # {
1108
1121
  # "ask": "62756.01",
@@ -1148,7 +1161,9 @@ class hitbtc(Exchange, ImplicitAPI):
1148
1161
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1149
1162
  """
1150
1163
  get the list of most recent trades for a particular symbol
1151
- :see: https://api.hitbtc.com/#trades
1164
+
1165
+ https://api.hitbtc.com/#trades
1166
+
1152
1167
  :param str symbol: unified symbol of the market to fetch trades for
1153
1168
  :param int [since]: timestamp in ms of the earliest trade to fetch
1154
1169
  :param int [limit]: the maximum amount of trades to fetch
@@ -1157,7 +1172,7 @@ class hitbtc(Exchange, ImplicitAPI):
1157
1172
  """
1158
1173
  await self.load_markets()
1159
1174
  market = None
1160
- request = {}
1175
+ request: dict = {}
1161
1176
  if limit is not None:
1162
1177
  request['limit'] = min(limit, 1000)
1163
1178
  if since is not None:
@@ -1184,9 +1199,11 @@ class hitbtc(Exchange, ImplicitAPI):
1184
1199
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1185
1200
  """
1186
1201
  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
1202
+
1203
+ https://api.hitbtc.com/#spot-trades-history
1204
+ https://api.hitbtc.com/#futures-trades-history
1205
+ https://api.hitbtc.com/#margin-trades-history
1206
+
1190
1207
  :param str symbol: unified market symbol
1191
1208
  :param int [since]: the earliest time in ms to fetch trades for
1192
1209
  :param int [limit]: the maximum number of trades structures to retrieve
@@ -1197,7 +1214,7 @@ class hitbtc(Exchange, ImplicitAPI):
1197
1214
  """
1198
1215
  await self.load_markets()
1199
1216
  market = None
1200
- request = {}
1217
+ request: dict = {}
1201
1218
  if symbol is not None:
1202
1219
  market = self.market(symbol)
1203
1220
  request['symbol'] = market['id']
@@ -1224,7 +1241,7 @@ class hitbtc(Exchange, ImplicitAPI):
1224
1241
  raise NotSupported(self.id + ' fetchMyTrades() not support self market type')
1225
1242
  return self.parse_trades(response, market, since, limit)
1226
1243
 
1227
- def parse_trade(self, trade, market: Market = None) -> Trade:
1244
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1228
1245
  #
1229
1246
  # createOrder(market)
1230
1247
  #
@@ -1327,7 +1344,7 @@ class hitbtc(Exchange, ImplicitAPI):
1327
1344
 
1328
1345
  async def fetch_transactions_helper(self, types, code, since, limit, params):
1329
1346
  await self.load_markets()
1330
- request = {
1347
+ request: dict = {
1331
1348
  'types': types,
1332
1349
  }
1333
1350
  currency = None
@@ -1365,22 +1382,24 @@ class hitbtc(Exchange, ImplicitAPI):
1365
1382
  #
1366
1383
  return self.parse_transactions(response, currency, since, limit, params)
1367
1384
 
1368
- def parse_transaction_status(self, status):
1369
- statuses = {
1385
+ def parse_transaction_status(self, status: Str):
1386
+ statuses: dict = {
1387
+ 'CREATED': 'pending',
1370
1388
  'PENDING': 'pending',
1371
1389
  'FAILED': 'failed',
1390
+ 'ROLLED_BACK': 'failed',
1372
1391
  'SUCCESS': 'ok',
1373
1392
  }
1374
1393
  return self.safe_string(statuses, status, status)
1375
1394
 
1376
1395
  def parse_transaction_type(self, type):
1377
- types = {
1396
+ types: dict = {
1378
1397
  'DEPOSIT': 'deposit',
1379
1398
  'WITHDRAW': 'withdrawal',
1380
1399
  }
1381
1400
  return self.safe_string(types, type, type)
1382
1401
 
1383
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1402
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1384
1403
  #
1385
1404
  # transaction
1386
1405
  #
@@ -1404,15 +1423,16 @@ class hitbtc(Exchange, ImplicitAPI):
1404
1423
  # ],
1405
1424
  # "fee": "1.22" # only for WITHDRAW
1406
1425
  # }
1407
- # }
1408
- #
1426
+ # },
1427
+ # "operation_id": "084cfcd5-06b9-4826-882e-fdb75ec3625d", # only for WITHDRAW
1428
+ # "commit_risk": {}
1409
1429
  # withdraw
1410
1430
  #
1411
1431
  # {
1412
1432
  # "id":"084cfcd5-06b9-4826-882e-fdb75ec3625d"
1413
1433
  # }
1414
1434
  #
1415
- id = self.safe_string(transaction, 'id')
1435
+ id = self.safe_string_2(transaction, 'operation_id', 'id')
1416
1436
  timestamp = self.parse8601(self.safe_string(transaction, 'created_at'))
1417
1437
  updated = self.parse8601(self.safe_string(transaction, 'updated_at'))
1418
1438
  type = self.parse_transaction_type(self.safe_string(transaction, 'type'))
@@ -1466,7 +1486,9 @@ class hitbtc(Exchange, ImplicitAPI):
1466
1486
  async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1467
1487
  """
1468
1488
  fetch history of deposits and withdrawals
1469
- :see: https://api.hitbtc.com/#get-transactions-history
1489
+
1490
+ https://api.hitbtc.com/#get-transactions-history
1491
+
1470
1492
  :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
1471
1493
  :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
1472
1494
  :param int [limit]: max number of deposit/withdrawals to return, default is None
@@ -1478,7 +1500,9 @@ class hitbtc(Exchange, ImplicitAPI):
1478
1500
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1479
1501
  """
1480
1502
  fetch all deposits made to an account
1481
- :see: https://api.hitbtc.com/#get-transactions-history
1503
+
1504
+ https://api.hitbtc.com/#get-transactions-history
1505
+
1482
1506
  :param str code: unified currency code
1483
1507
  :param int [since]: the earliest time in ms to fetch deposits for
1484
1508
  :param int [limit]: the maximum number of deposits structures to retrieve
@@ -1490,7 +1514,9 @@ class hitbtc(Exchange, ImplicitAPI):
1490
1514
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1491
1515
  """
1492
1516
  fetch all withdrawals made from an account
1493
- :see: https://api.hitbtc.com/#get-transactions-history
1517
+
1518
+ https://api.hitbtc.com/#get-transactions-history
1519
+
1494
1520
  :param str code: unified currency code
1495
1521
  :param int [since]: the earliest time in ms to fetch withdrawals for
1496
1522
  :param int [limit]: the maximum number of withdrawals structures to retrieve
@@ -1502,21 +1528,23 @@ class hitbtc(Exchange, ImplicitAPI):
1502
1528
  async def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}):
1503
1529
  """
1504
1530
  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
1531
+
1532
+ https://api.hitbtc.com/#order-books
1533
+
1534
+ :param str[] [symbols]: list of unified market symbols, all symbols fetched if None, default is None
1507
1535
  :param int [limit]: max number of entries per orderbook to return, default is None
1508
1536
  :param dict [params]: extra parameters specific to the exchange API endpoint
1509
1537
  :returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
1510
1538
  """
1511
1539
  await self.load_markets()
1512
- request = {}
1540
+ request: dict = {}
1513
1541
  if symbols is not None:
1514
1542
  marketIdsInner = self.market_ids(symbols)
1515
1543
  request['symbols'] = ','.join(marketIdsInner)
1516
1544
  if limit is not None:
1517
1545
  request['depth'] = limit
1518
1546
  response = await self.publicGetPublicOrderbook(self.extend(request, params))
1519
- result = {}
1547
+ result: dict = {}
1520
1548
  marketIds = list(response.keys())
1521
1549
  for i in range(0, len(marketIds)):
1522
1550
  marketId = marketIds[i]
@@ -1529,7 +1557,9 @@ class hitbtc(Exchange, ImplicitAPI):
1529
1557
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
1530
1558
  """
1531
1559
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
1532
- :see: https://api.hitbtc.com/#order-books
1560
+
1561
+ https://api.hitbtc.com/#order-books
1562
+
1533
1563
  :param str symbol: unified symbol of the market to fetch the order book for
1534
1564
  :param int [limit]: the maximum amount of order book entries to return
1535
1565
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1537,7 +1567,7 @@ class hitbtc(Exchange, ImplicitAPI):
1537
1567
  """
1538
1568
  await self.load_markets()
1539
1569
  market = self.market(symbol)
1540
- request = {
1570
+ request: dict = {
1541
1571
  'symbol': market['id'],
1542
1572
  }
1543
1573
  if limit is not None:
@@ -1546,7 +1576,7 @@ class hitbtc(Exchange, ImplicitAPI):
1546
1576
  timestamp = self.parse8601(self.safe_string(response, 'timestamp'))
1547
1577
  return self.parse_order_book(response, symbol, timestamp, 'bid', 'ask')
1548
1578
 
1549
- def parse_trading_fee(self, fee, market: Market = None):
1579
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1550
1580
  #
1551
1581
  # {
1552
1582
  # "symbol":"ARVUSDT", # returned from fetchTradingFees only
@@ -1563,20 +1593,24 @@ class hitbtc(Exchange, ImplicitAPI):
1563
1593
  'symbol': symbol,
1564
1594
  'taker': taker,
1565
1595
  'maker': maker,
1596
+ 'percentage': None,
1597
+ 'tierBased': None,
1566
1598
  }
1567
1599
 
1568
- async def fetch_trading_fee(self, symbol: str, params={}):
1600
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1569
1601
  """
1570
1602
  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
1603
+
1604
+ https://api.hitbtc.com/#get-trading-commission
1605
+ https://api.hitbtc.com/#get-trading-commission-2
1606
+
1573
1607
  :param str symbol: unified market symbol
1574
1608
  :param dict [params]: extra parameters specific to the exchange API endpoint
1575
1609
  :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
1576
1610
  """
1577
1611
  await self.load_markets()
1578
1612
  market = self.market(symbol)
1579
- request = {
1613
+ request: dict = {
1580
1614
  'symbol': market['id'],
1581
1615
  }
1582
1616
  response = None
@@ -1594,11 +1628,13 @@ class hitbtc(Exchange, ImplicitAPI):
1594
1628
  #
1595
1629
  return self.parse_trading_fee(response, market)
1596
1630
 
1597
- async def fetch_trading_fees(self, params={}):
1631
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
1598
1632
  """
1599
1633
  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
1634
+
1635
+ https://api.hitbtc.com/#get-all-trading-commissions
1636
+ https://api.hitbtc.com/#get-all-trading-commissions-2
1637
+
1602
1638
  :param dict [params]: extra parameters specific to the exchange API endpoint
1603
1639
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
1604
1640
  """
@@ -1620,7 +1656,7 @@ class hitbtc(Exchange, ImplicitAPI):
1620
1656
  # }
1621
1657
  # ]
1622
1658
  #
1623
- result = {}
1659
+ result: dict = {}
1624
1660
  for i in range(0, len(response)):
1625
1661
  fee = self.parse_trading_fee(response[i])
1626
1662
  symbol = fee['symbol']
@@ -1630,10 +1666,12 @@ class hitbtc(Exchange, ImplicitAPI):
1630
1666
  async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1631
1667
  """
1632
1668
  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
1669
+
1670
+ https://api.hitbtc.com/#candles
1671
+ https://api.hitbtc.com/#futures-index-price-candles
1672
+ https://api.hitbtc.com/#futures-mark-price-candles
1673
+ https://api.hitbtc.com/#futures-premium-index-candles
1674
+
1637
1675
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1638
1676
  :param str timeframe: the length of time each candle represents
1639
1677
  :param int [since]: timestamp in ms of the earliest candle to fetch
@@ -1649,15 +1687,15 @@ class hitbtc(Exchange, ImplicitAPI):
1649
1687
  if paginate:
1650
1688
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000)
1651
1689
  market = self.market(symbol)
1652
- request = {
1690
+ request: dict = {
1653
1691
  'symbol': market['id'],
1654
1692
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
1655
1693
  }
1656
1694
  if since is not None:
1657
1695
  request['from'] = self.iso8601(since)
1658
- request, params = self.handle_until_option('till', request, params)
1696
+ request, params = self.handle_until_option('until', request, params)
1659
1697
  if limit is not None:
1660
- request['limit'] = limit
1698
+ request['limit'] = min(limit, 1000)
1661
1699
  price = self.safe_string(params, 'price')
1662
1700
  params = self.omit(params, 'price')
1663
1701
  response = None
@@ -1734,9 +1772,11 @@ class hitbtc(Exchange, ImplicitAPI):
1734
1772
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1735
1773
  """
1736
1774
  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
1775
+
1776
+ https://api.hitbtc.com/#spot-orders-history
1777
+ https://api.hitbtc.com/#futures-orders-history
1778
+ https://api.hitbtc.com/#margin-orders-history
1779
+
1740
1780
  :param str symbol: unified market symbol of the market orders were made in
1741
1781
  :param int [since]: the earliest time in ms to fetch orders for
1742
1782
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1747,7 +1787,7 @@ class hitbtc(Exchange, ImplicitAPI):
1747
1787
  """
1748
1788
  await self.load_markets()
1749
1789
  market = None
1750
- request = {}
1790
+ request: dict = {}
1751
1791
  if symbol is not None:
1752
1792
  market = self.market(symbol)
1753
1793
  request['symbol'] = market['id']
@@ -1778,9 +1818,12 @@ class hitbtc(Exchange, ImplicitAPI):
1778
1818
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1779
1819
  """
1780
1820
  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
1821
+
1822
+ https://api.hitbtc.com/#spot-orders-history
1823
+ https://api.hitbtc.com/#futures-orders-history
1824
+ https://api.hitbtc.com/#margin-orders-history
1825
+
1826
+ :param str id: order id
1784
1827
  :param str symbol: unified symbol of the market the order was made in
1785
1828
  :param dict [params]: extra parameters specific to the exchange API endpoint
1786
1829
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
@@ -1791,7 +1834,7 @@ class hitbtc(Exchange, ImplicitAPI):
1791
1834
  market = None
1792
1835
  if symbol is not None:
1793
1836
  market = self.market(symbol)
1794
- request = {
1837
+ request: dict = {
1795
1838
  'client_order_id': id,
1796
1839
  }
1797
1840
  marketType = None
@@ -1830,15 +1873,17 @@ class hitbtc(Exchange, ImplicitAPI):
1830
1873
  # }
1831
1874
  # ]
1832
1875
  #
1833
- order = self.safe_value(response, 0)
1876
+ order = self.safe_dict(response, 0)
1834
1877
  return self.parse_order(order, market)
1835
1878
 
1836
1879
  async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1837
1880
  """
1838
1881
  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
1882
+
1883
+ https://api.hitbtc.com/#spot-trades-history
1884
+ https://api.hitbtc.com/#futures-trades-history
1885
+ https://api.hitbtc.com/#margin-trades-history
1886
+
1842
1887
  :param str id: order id
1843
1888
  :param str symbol: unified market symbol
1844
1889
  :param int [since]: the earliest time in ms to fetch trades for
@@ -1852,7 +1897,7 @@ class hitbtc(Exchange, ImplicitAPI):
1852
1897
  market = None
1853
1898
  if symbol is not None:
1854
1899
  market = self.market(symbol)
1855
- request = {
1900
+ request: dict = {
1856
1901
  'order_id': id, # exchange assigned order id to the client order id
1857
1902
  }
1858
1903
  marketType = None
@@ -1915,9 +1960,11 @@ class hitbtc(Exchange, ImplicitAPI):
1915
1960
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1916
1961
  """
1917
1962
  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
1963
+
1964
+ https://api.hitbtc.com/#get-all-active-spot-orders
1965
+ https://api.hitbtc.com/#get-active-futures-orders
1966
+ https://api.hitbtc.com/#get-active-margin-orders
1967
+
1921
1968
  :param str symbol: unified market symbol
1922
1969
  :param int [since]: the earliest time in ms to fetch open orders for
1923
1970
  :param int [limit]: the maximum number of open orders structures to retrieve
@@ -1928,7 +1975,7 @@ class hitbtc(Exchange, ImplicitAPI):
1928
1975
  """
1929
1976
  await self.load_markets()
1930
1977
  market = None
1931
- request = {}
1978
+ request: dict = {}
1932
1979
  if symbol is not None:
1933
1980
  market = self.market(symbol)
1934
1981
  request['symbol'] = market['id']
@@ -1973,9 +2020,11 @@ class hitbtc(Exchange, ImplicitAPI):
1973
2020
  async def fetch_open_order(self, id: str, symbol: Str = None, params={}):
1974
2021
  """
1975
2022
  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
2023
+
2024
+ https://api.hitbtc.com/#get-active-spot-order
2025
+ https://api.hitbtc.com/#get-active-futures-order
2026
+ https://api.hitbtc.com/#get-active-margin-order
2027
+
1979
2028
  :param str id: order id
1980
2029
  :param str symbol: unified market symbol, default is None
1981
2030
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1987,7 +2036,7 @@ class hitbtc(Exchange, ImplicitAPI):
1987
2036
  market = None
1988
2037
  if symbol is not None:
1989
2038
  market = self.market(symbol)
1990
- request = {
2039
+ request: dict = {
1991
2040
  'client_order_id': id,
1992
2041
  }
1993
2042
  marketType = None
@@ -2012,9 +2061,11 @@ class hitbtc(Exchange, ImplicitAPI):
2012
2061
  async def cancel_all_orders(self, symbol: Str = None, params={}):
2013
2062
  """
2014
2063
  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
2064
+
2065
+ https://api.hitbtc.com/#cancel-all-spot-orders
2066
+ https://api.hitbtc.com/#cancel-futures-orders
2067
+ https://api.hitbtc.com/#cancel-all-margin-orders
2068
+
2018
2069
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
2019
2070
  :param dict [params]: extra parameters specific to the exchange API endpoint
2020
2071
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
@@ -2023,7 +2074,7 @@ class hitbtc(Exchange, ImplicitAPI):
2023
2074
  """
2024
2075
  await self.load_markets()
2025
2076
  market = None
2026
- request = {}
2077
+ request: dict = {}
2027
2078
  if symbol is not None:
2028
2079
  market = self.market(symbol)
2029
2080
  request['symbol'] = market['id']
@@ -2049,9 +2100,11 @@ class hitbtc(Exchange, ImplicitAPI):
2049
2100
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
2050
2101
  """
2051
2102
  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
2103
+
2104
+ https://api.hitbtc.com/#cancel-spot-order
2105
+ https://api.hitbtc.com/#cancel-futures-order
2106
+ https://api.hitbtc.com/#cancel-margin-order
2107
+
2055
2108
  :param str id: order id
2056
2109
  :param str symbol: unified symbol of the market the order was made in
2057
2110
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2061,7 +2114,7 @@ class hitbtc(Exchange, ImplicitAPI):
2061
2114
  """
2062
2115
  await self.load_markets()
2063
2116
  market = None
2064
- request = {
2117
+ request: dict = {
2065
2118
  'client_order_id': id,
2066
2119
  }
2067
2120
  if symbol is not None:
@@ -2088,7 +2141,7 @@ class hitbtc(Exchange, ImplicitAPI):
2088
2141
  async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
2089
2142
  await self.load_markets()
2090
2143
  market = None
2091
- request = {
2144
+ request: dict = {
2092
2145
  'client_order_id': id,
2093
2146
  'quantity': self.amount_to_precision(symbol, amount),
2094
2147
  }
@@ -2120,14 +2173,16 @@ class hitbtc(Exchange, ImplicitAPI):
2120
2173
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2121
2174
  """
2122
2175
  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
2176
+
2177
+ https://api.hitbtc.com/#create-new-spot-order
2178
+ https://api.hitbtc.com/#create-margin-order
2179
+ https://api.hitbtc.com/#create-futures-order
2180
+
2126
2181
  :param str symbol: unified symbol of the market to create an order in
2127
2182
  :param str type: 'market' or 'limit'
2128
2183
  :param str side: 'buy' or 'sell'
2129
2184
  :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
2185
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2131
2186
  :param dict [params]: extra parameters specific to the exchange API endpoint
2132
2187
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both, default is 'cross'
2133
2188
  :param bool [params.margin]: True for creating a margin order
@@ -2159,7 +2214,7 @@ class hitbtc(Exchange, ImplicitAPI):
2159
2214
  timeInForce = self.safe_string(params, 'timeInForce')
2160
2215
  triggerPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'stop_price'])
2161
2216
  isPostOnly = self.is_post_only(type == 'market', None, params)
2162
- request = {
2217
+ request: dict = {
2163
2218
  'type': type,
2164
2219
  'side': side,
2165
2220
  'quantity': self.amount_to_precision(market['symbol'], amount),
@@ -2200,7 +2255,7 @@ class hitbtc(Exchange, ImplicitAPI):
2200
2255
  elif type == 'market':
2201
2256
  request['type'] = 'stopMarket'
2202
2257
  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')
2258
+ raise ExchangeError(self.id + ' createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders')
2204
2259
  params = self.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly'])
2205
2260
  if marketType == 'swap':
2206
2261
  # set default margin mode to cross
@@ -2209,8 +2264,8 @@ class hitbtc(Exchange, ImplicitAPI):
2209
2264
  request['margin_mode'] = marginMode
2210
2265
  return [request, params]
2211
2266
 
2212
- def parse_order_status(self, status):
2213
- statuses = {
2267
+ def parse_order_status(self, status: Str):
2268
+ statuses: dict = {
2214
2269
  'new': 'open',
2215
2270
  'suspended': 'open',
2216
2271
  'partiallyFilled': 'open',
@@ -2220,7 +2275,7 @@ class hitbtc(Exchange, ImplicitAPI):
2220
2275
  }
2221
2276
  return self.safe_string(statuses, status, status)
2222
2277
 
2223
- def parse_order(self, order, market: Market = None) -> Order:
2278
+ def parse_order(self, order: dict, market: Market = None) -> Order:
2224
2279
  #
2225
2280
  # limit
2226
2281
  # {
@@ -2309,7 +2364,6 @@ class hitbtc(Exchange, ImplicitAPI):
2309
2364
  postOnly = self.safe_value(order, 'post_only')
2310
2365
  timeInForce = self.safe_string(order, 'time_in_force')
2311
2366
  rawTrades = self.safe_value(order, 'trades')
2312
- stopPrice = self.safe_string(order, 'stop_price')
2313
2367
  return self.safe_order({
2314
2368
  'info': order,
2315
2369
  'id': id,
@@ -2333,8 +2387,7 @@ class hitbtc(Exchange, ImplicitAPI):
2333
2387
  'average': average,
2334
2388
  'trades': rawTrades,
2335
2389
  'fee': None,
2336
- 'stopPrice': stopPrice,
2337
- 'triggerPrice': stopPrice,
2390
+ 'triggerPrice': self.safe_string(order, 'stop_price'),
2338
2391
  'takeProfitPrice': None,
2339
2392
  'stopLossPrice': None,
2340
2393
  }, market)
@@ -2342,9 +2395,11 @@ class hitbtc(Exchange, ImplicitAPI):
2342
2395
  async def fetch_margin_modes(self, symbols: List[Str] = None, params={}) -> MarginModes:
2343
2396
  """
2344
2397
  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
2398
+
2399
+ https://api.hitbtc.com/#get-margin-position-parameters
2400
+ https://api.hitbtc.com/#get-futures-position-parameters
2401
+
2402
+ :param str[] symbols: unified market symbols
2348
2403
  :param dict [params]: extra parameters specific to the exchange API endpoint
2349
2404
  :returns dict: a list of `margin mode structures <https://docs.ccxt.com/#/?id=margin-mode-structure>`
2350
2405
  """
@@ -2399,7 +2454,7 @@ class hitbtc(Exchange, ImplicitAPI):
2399
2454
  config = self.safe_list(response, 'config', [])
2400
2455
  return self.parse_margin_modes(config, symbols, 'symbol')
2401
2456
 
2402
- def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
2457
+ def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
2403
2458
  marketId = self.safe_string(marginMode, 'symbol')
2404
2459
  return {
2405
2460
  'info': marginMode,
@@ -2410,7 +2465,9 @@ class hitbtc(Exchange, ImplicitAPI):
2410
2465
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2411
2466
  """
2412
2467
  transfer currency internally between wallets on the same account
2413
- :see: https://api.hitbtc.com/#transfer-between-wallet-and-exchange
2468
+
2469
+ https://api.hitbtc.com/#transfer-between-wallet-and-exchange
2470
+
2414
2471
  :param str code: unified currency code
2415
2472
  :param float amount: amount to transfer
2416
2473
  :param str fromAccount: account to transfer from
@@ -2429,7 +2486,7 @@ class hitbtc(Exchange, ImplicitAPI):
2429
2486
  toId = self.safe_string(accountsByType, toAccount, toAccount)
2430
2487
  if fromId == toId:
2431
2488
  raise BadRequest(self.id + ' transfer() fromAccount and toAccount arguments cannot be the same account')
2432
- request = {
2489
+ request: dict = {
2433
2490
  'currency': currency['id'],
2434
2491
  'amount': requestAmount,
2435
2492
  'source': fromId,
@@ -2443,7 +2500,7 @@ class hitbtc(Exchange, ImplicitAPI):
2443
2500
  #
2444
2501
  return self.parse_transfer(response, currency)
2445
2502
 
2446
- def parse_transfer(self, transfer, currency: Currency = None):
2503
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2447
2504
  #
2448
2505
  # transfer
2449
2506
  #
@@ -2477,7 +2534,7 @@ class hitbtc(Exchange, ImplicitAPI):
2477
2534
  if (fromNetwork is None) or (toNetwork is None):
2478
2535
  keys = list(networks.keys())
2479
2536
  raise ArgumentsRequired(self.id + ' convertCurrencyNetwork() requires a fromNetwork parameter and a toNetwork parameter, supported networks are ' + ', '.join(keys))
2480
- request = {
2537
+ request: dict = {
2481
2538
  'from_currency': fromNetwork,
2482
2539
  'to_currency': toNetwork,
2483
2540
  'amount': self.currency_to_precision(code, amount),
@@ -2488,10 +2545,12 @@ class hitbtc(Exchange, ImplicitAPI):
2488
2545
  'info': response,
2489
2546
  }
2490
2547
 
2491
- async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2548
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
2492
2549
  """
2493
2550
  make a withdrawal
2494
- :see: https://api.hitbtc.com/#withdraw-crypto
2551
+
2552
+ https://api.hitbtc.com/#withdraw-crypto
2553
+
2495
2554
  :param str code: unified currency code
2496
2555
  :param float amount: the amount to withdraw
2497
2556
  :param str address: the address to withdraw to
@@ -2503,7 +2562,7 @@ class hitbtc(Exchange, ImplicitAPI):
2503
2562
  await self.load_markets()
2504
2563
  self.check_address(address)
2505
2564
  currency = self.currency(code)
2506
- request = {
2565
+ request: dict = {
2507
2566
  'currency': currency['id'],
2508
2567
  'amount': amount,
2509
2568
  'address': address,
@@ -2529,17 +2588,19 @@ class hitbtc(Exchange, ImplicitAPI):
2529
2588
  #
2530
2589
  return self.parse_transaction(response, currency)
2531
2590
 
2532
- async def fetch_funding_rates(self, symbols: Strings = None, params={}):
2591
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
2533
2592
  """
2534
2593
  fetches funding rates for multiple markets
2535
- :see: https://api.hitbtc.com/#futures-info
2594
+
2595
+ https://api.hitbtc.com/#futures-info
2596
+
2536
2597
  :param str[] symbols: unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
2537
2598
  :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>`
2599
+ :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
2539
2600
  """
2540
2601
  await self.load_markets()
2541
2602
  market = None
2542
- request = {}
2603
+ request: dict = {}
2543
2604
  if symbols is not None:
2544
2605
  symbols = self.market_symbols(symbols)
2545
2606
  market = self.market(symbols[0])
@@ -2568,7 +2629,7 @@ class hitbtc(Exchange, ImplicitAPI):
2568
2629
  # }
2569
2630
  #
2570
2631
  marketIds = list(response.keys())
2571
- fundingRates = {}
2632
+ fundingRates: dict = {}
2572
2633
  for i in range(0, len(marketIds)):
2573
2634
  marketId = self.safe_string(marketIds, i)
2574
2635
  rawFundingRate = self.safe_value(response, marketId)
@@ -2580,7 +2641,9 @@ class hitbtc(Exchange, ImplicitAPI):
2580
2641
 
2581
2642
  async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2582
2643
  """
2583
- :see: https://api.hitbtc.com/#funding-history
2644
+
2645
+ https://api.hitbtc.com/#funding-history
2646
+
2584
2647
  fetches historical funding rate prices
2585
2648
  :param str symbol: unified symbol of the market to fetch the funding rate history for
2586
2649
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
@@ -2596,16 +2659,16 @@ class hitbtc(Exchange, ImplicitAPI):
2596
2659
  if paginate:
2597
2660
  return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 1000)
2598
2661
  market = None
2599
- request = {
2662
+ request: dict = {
2600
2663
  # all arguments are optional
2601
2664
  # 'symbols': Comma separated list of symbol codes,
2602
2665
  # 'sort': 'DESC' or 'ASC'
2603
2666
  # 'from': 'Datetime or Number',
2604
- # 'till': 'Datetime or Number',
2667
+ # 'until': 'Datetime or Number',
2605
2668
  # 'limit': 100,
2606
2669
  # 'offset': 0,
2607
2670
  }
2608
- request, params = self.handle_until_option('till', request, params)
2671
+ request, params = self.handle_until_option('until', request, params)
2609
2672
  if symbol is not None:
2610
2673
  market = self.market(symbol)
2611
2674
  symbol = market['symbol']
@@ -2654,8 +2717,10 @@ class hitbtc(Exchange, ImplicitAPI):
2654
2717
  async def fetch_positions(self, symbols: Strings = None, params={}):
2655
2718
  """
2656
2719
  fetch all open positions
2657
- :see: https://api.hitbtc.com/#get-futures-margin-accounts
2658
- :see: https://api.hitbtc.com/#get-all-margin-accounts
2720
+
2721
+ https://api.hitbtc.com/#get-futures-margin-accounts
2722
+ https://api.hitbtc.com/#get-all-margin-accounts
2723
+
2659
2724
  :param str[]|None symbols: not used by hitbtc fetchPositions()
2660
2725
  :param dict [params]: extra parameters specific to the exchange API endpoint
2661
2726
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if self is set
@@ -2663,7 +2728,7 @@ class hitbtc(Exchange, ImplicitAPI):
2663
2728
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
2664
2729
  """
2665
2730
  await self.load_markets()
2666
- request = {}
2731
+ request: dict = {}
2667
2732
  marketType = None
2668
2733
  marginMode = None
2669
2734
  marketType, params = self.handle_market_type_and_params('fetchPositions', None, params)
@@ -2721,8 +2786,10 @@ class hitbtc(Exchange, ImplicitAPI):
2721
2786
  async def fetch_position(self, symbol: str, params={}):
2722
2787
  """
2723
2788
  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
2789
+
2790
+ https://api.hitbtc.com/#get-futures-margin-account
2791
+ https://api.hitbtc.com/#get-isolated-margin-account
2792
+
2726
2793
  :param str symbol: unified market symbol of the market the position is held in, default is None
2727
2794
  :param dict [params]: extra parameters specific to the exchange API endpoint
2728
2795
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if self is set
@@ -2731,7 +2798,7 @@ class hitbtc(Exchange, ImplicitAPI):
2731
2798
  """
2732
2799
  await self.load_markets()
2733
2800
  market = self.market(symbol)
2734
- request = {
2801
+ request: dict = {
2735
2802
  'symbol': market['id'],
2736
2803
  }
2737
2804
  marketType = None
@@ -2783,7 +2850,7 @@ class hitbtc(Exchange, ImplicitAPI):
2783
2850
  #
2784
2851
  return self.parse_position(response, market)
2785
2852
 
2786
- def parse_position(self, position, market: Market = None):
2853
+ def parse_position(self, position: dict, market: Market = None):
2787
2854
  #
2788
2855
  # [
2789
2856
  # {
@@ -2886,7 +2953,7 @@ class hitbtc(Exchange, ImplicitAPI):
2886
2953
  datetime = self.safe_string(interest, 'timestamp')
2887
2954
  value = self.safe_number(interest, 'open_interest')
2888
2955
  return self.safe_open_interest({
2889
- 'symbol': market['symbol'],
2956
+ 'symbol': self.safe_symbol(None, market),
2890
2957
  'openInterestAmount': None,
2891
2958
  'openInterestValue': value,
2892
2959
  'timestamp': self.parse8601(datetime),
@@ -2894,10 +2961,55 @@ class hitbtc(Exchange, ImplicitAPI):
2894
2961
  'info': interest,
2895
2962
  }, market)
2896
2963
 
2964
+ async def fetch_open_interests(self, symbols: Strings = None, params={}):
2965
+ """
2966
+ Retrieves the open interest for a list of symbols
2967
+
2968
+ https://api.hitbtc.com/#futures-info
2969
+
2970
+ :param str[] [symbols]: a list of unified CCXT market symbols
2971
+ :param dict [params]: exchange specific parameters
2972
+ :returns dict[]: a list of `open interest structures <https://docs.ccxt.com/#/?id=open-interest-structure>`
2973
+ """
2974
+ await self.load_markets()
2975
+ request: dict = {}
2976
+ symbols = self.market_symbols(symbols)
2977
+ marketIds = None
2978
+ if symbols is not None:
2979
+ marketIds = self.market_ids(symbols)
2980
+ request['symbols'] = ','.join(marketIds)
2981
+ response = await self.publicGetPublicFuturesInfo(self.extend(request, params))
2982
+ #
2983
+ # {
2984
+ # "BTCUSDT_PERP": {
2985
+ # "contract_type": "perpetual",
2986
+ # "mark_price": "97291.83",
2987
+ # "index_price": "97298.61",
2988
+ # "funding_rate": "-0.000183473092423284",
2989
+ # "open_interest": "94.1503",
2990
+ # "next_funding_time": "2024-12-20T08:00:00.000Z",
2991
+ # "indicative_funding_rate": "-0.00027495203277752",
2992
+ # "premium_index": "-0.000789474900583786",
2993
+ # "avg_premium_index": "-0.000683473092423284",
2994
+ # "interest_rate": "0.0001",
2995
+ # "timestamp": "2024-12-20T04:57:33.693Z"
2996
+ # }
2997
+ # }
2998
+ #
2999
+ results = []
3000
+ markets = list(response.keys())
3001
+ for i in range(0, len(markets)):
3002
+ marketId = markets[i]
3003
+ marketInner = self.safe_market(marketId)
3004
+ results.append(self.parse_open_interest(response[marketId], marketInner))
3005
+ return self.filter_by_array(results, 'symbol', symbols)
3006
+
2897
3007
  async def fetch_open_interest(self, symbol: str, params={}):
2898
3008
  """
2899
3009
  Retrieves the open interest of a derivative trading pair
2900
- :see: https://api.hitbtc.com/#futures-info
3010
+
3011
+ https://api.hitbtc.com/#futures-info
3012
+
2901
3013
  :param str symbol: Unified CCXT market symbol
2902
3014
  :param dict [params]: exchange specific parameters
2903
3015
  :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=interest-history-structure:
@@ -2906,7 +3018,7 @@ class hitbtc(Exchange, ImplicitAPI):
2906
3018
  market = self.market(symbol)
2907
3019
  if not market['swap']:
2908
3020
  raise BadSymbol(self.id + ' fetchOpenInterest() supports swap contracts only')
2909
- request = {
3021
+ request: dict = {
2910
3022
  'symbol': market['id'],
2911
3023
  }
2912
3024
  response = await self.publicGetPublicFuturesInfoSymbol(self.extend(request, params))
@@ -2927,10 +3039,12 @@ class hitbtc(Exchange, ImplicitAPI):
2927
3039
  #
2928
3040
  return self.parse_open_interest(response, market)
2929
3041
 
2930
- async def fetch_funding_rate(self, symbol: str, params={}):
3042
+ async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2931
3043
  """
2932
3044
  fetch the current funding rate
2933
- :see: https://api.hitbtc.com/#futures-info
3045
+
3046
+ https://api.hitbtc.com/#futures-info
3047
+
2934
3048
  :param str symbol: unified market symbol
2935
3049
  :param dict [params]: extra parameters specific to the exchange API endpoint
2936
3050
  :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -2939,7 +3053,7 @@ class hitbtc(Exchange, ImplicitAPI):
2939
3053
  market = self.market(symbol)
2940
3054
  if not market['swap']:
2941
3055
  raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
2942
- request = {
3056
+ request: dict = {
2943
3057
  'symbol': market['id'],
2944
3058
  }
2945
3059
  response = await self.publicGetPublicFuturesInfoSymbol(self.extend(request, params))
@@ -2960,7 +3074,7 @@ class hitbtc(Exchange, ImplicitAPI):
2960
3074
  #
2961
3075
  return self.parse_funding_rate(response, market)
2962
3076
 
2963
- def parse_funding_rate(self, contract, market: Market = None):
3077
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2964
3078
  #
2965
3079
  # {
2966
3080
  # "contract_type": "perpetual",
@@ -2996,20 +3110,22 @@ class hitbtc(Exchange, ImplicitAPI):
2996
3110
  'previousFundingRate': None,
2997
3111
  'previousFundingTimestamp': None,
2998
3112
  'previousFundingDatetime': None,
3113
+ 'interval': None,
2999
3114
  }
3000
3115
 
3001
- async def modify_margin_helper(self, symbol: str, amount, type, params={}):
3116
+ async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
3002
3117
  await self.load_markets()
3003
3118
  market = self.market(symbol)
3004
3119
  leverage = self.safe_string(params, 'leverage')
3005
3120
  if market['swap']:
3006
3121
  if leverage is None:
3007
3122
  raise ArgumentsRequired(self.id + ' modifyMarginHelper() requires a leverage parameter for swap markets')
3008
- if amount != 0:
3009
- amount = self.amount_to_precision(symbol, amount)
3123
+ stringAmount = self.number_to_string(amount)
3124
+ if stringAmount != '0':
3125
+ amount = self.amount_to_precision(symbol, stringAmount)
3010
3126
  else:
3011
3127
  amount = '0'
3012
- request = {
3128
+ request: dict = {
3013
3129
  'symbol': market['id'], # swap and margin
3014
3130
  'margin_balance': amount, # swap and margin
3015
3131
  # "leverage": "10", # swap only required
@@ -3051,23 +3167,50 @@ class hitbtc(Exchange, ImplicitAPI):
3051
3167
  'type': type,
3052
3168
  })
3053
3169
 
3054
- def parse_margin_modification(self, data, market: Market = None):
3170
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
3171
+ #
3172
+ # addMargin/reduceMargin
3173
+ #
3174
+ # {
3175
+ # "symbol": "BTCUSDT_PERP",
3176
+ # "type": "isolated",
3177
+ # "leverage": "8.00",
3178
+ # "created_at": "2022-03-30T23:34:27.161Z",
3179
+ # "updated_at": "2022-03-30T23:34:27.161Z",
3180
+ # "currencies": [
3181
+ # {
3182
+ # "code": "USDT",
3183
+ # "margin_balance": "7.000000000000",
3184
+ # "reserved_orders": "0",
3185
+ # "reserved_positions": "0"
3186
+ # }
3187
+ # ],
3188
+ # "positions": null
3189
+ # }
3190
+ #
3055
3191
  currencies = self.safe_value(data, 'currencies', [])
3056
3192
  currencyInfo = self.safe_value(currencies, 0)
3193
+ datetime = self.safe_string(data, 'updated_at')
3057
3194
  return {
3058
3195
  'info': data,
3196
+ 'symbol': market['symbol'],
3059
3197
  'type': None,
3198
+ 'marginMode': 'isolated',
3060
3199
  'amount': None,
3200
+ 'total': None,
3061
3201
  'code': self.safe_string(currencyInfo, 'code'),
3062
- 'symbol': market['symbol'],
3063
3202
  'status': None,
3203
+ 'timestamp': self.parse8601(datetime),
3204
+ 'datetime': datetime,
3064
3205
  }
3065
3206
 
3066
- async def reduce_margin(self, symbol: str, amount, params={}):
3207
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3067
3208
  """
3068
3209
  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
3210
+
3211
+ https://api.hitbtc.com/#create-update-margin-account-2
3212
+ https://api.hitbtc.com/#create-update-margin-account
3213
+
3071
3214
  :param str symbol: unified market symbol
3072
3215
  :param float amount: the amount of margin to remove
3073
3216
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3075,15 +3218,17 @@ class hitbtc(Exchange, ImplicitAPI):
3075
3218
  :param bool [params.margin]: True for reducing spot-margin
3076
3219
  :returns dict: a `margin structure <https://docs.ccxt.com/#/?id=reduce-margin-structure>`
3077
3220
  """
3078
- if amount != 0:
3221
+ if self.number_to_string(amount) != '0':
3079
3222
  raise BadRequest(self.id + ' reduceMargin() on hitbtc requires the amount to be 0 and that will remove the entire margin amount')
3080
3223
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
3081
3224
 
3082
- async def add_margin(self, symbol: str, amount, params={}):
3225
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
3083
3226
  """
3084
3227
  add margin
3085
- :see: https://api.hitbtc.com/#create-update-margin-account-2
3086
- :see: https://api.hitbtc.com/#create-update-margin-account
3228
+
3229
+ https://api.hitbtc.com/#create-update-margin-account-2
3230
+ https://api.hitbtc.com/#create-update-margin-account
3231
+
3087
3232
  :param str symbol: unified market symbol
3088
3233
  :param float amount: amount of margin to add
3089
3234
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3096,8 +3241,10 @@ class hitbtc(Exchange, ImplicitAPI):
3096
3241
  async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
3097
3242
  """
3098
3243
  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
3244
+
3245
+ https://api.hitbtc.com/#get-futures-margin-account
3246
+ https://api.hitbtc.com/#get-isolated-margin-account
3247
+
3101
3248
  :param str symbol: unified market symbol
3102
3249
  :param dict [params]: extra parameters specific to the exchange API endpoint
3103
3250
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if self is set
@@ -3106,7 +3253,7 @@ class hitbtc(Exchange, ImplicitAPI):
3106
3253
  """
3107
3254
  await self.load_markets()
3108
3255
  market = self.market(symbol)
3109
- request = {
3256
+ request: dict = {
3110
3257
  'symbol': market['id'],
3111
3258
  }
3112
3259
  marginMode = None
@@ -3156,7 +3303,7 @@ class hitbtc(Exchange, ImplicitAPI):
3156
3303
  #
3157
3304
  return self.parse_leverage(response, market)
3158
3305
 
3159
- def parse_leverage(self, leverage, market=None) -> Leverage:
3306
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
3160
3307
  marketId = self.safe_string(leverage, 'symbol')
3161
3308
  leverageValue = self.safe_integer(leverage, 'leverage')
3162
3309
  return {
@@ -3170,7 +3317,9 @@ class hitbtc(Exchange, ImplicitAPI):
3170
3317
  async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
3171
3318
  """
3172
3319
  set the level of leverage for a market
3173
- :see: https://api.hitbtc.com/#create-update-margin-account-2
3320
+
3321
+ https://api.hitbtc.com/#create-update-margin-account-2
3322
+
3174
3323
  :param float leverage: the rate of leverage
3175
3324
  :param str symbol: unified market symbol
3176
3325
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3188,7 +3337,7 @@ class hitbtc(Exchange, ImplicitAPI):
3188
3337
  raise BadSymbol(self.id + ' setLeverage() supports swap contracts only')
3189
3338
  if (leverage < 1) or (leverage > maxLeverage):
3190
3339
  raise BadRequest(self.id + ' setLeverage() leverage should be between 1 and ' + str(maxLeverage) + ' for ' + symbol)
3191
- request = {
3340
+ request: dict = {
3192
3341
  'symbol': market['id'],
3193
3342
  'leverage': str(leverage),
3194
3343
  'margin_balance': self.amount_to_precision(symbol, amount),
@@ -3199,7 +3348,9 @@ class hitbtc(Exchange, ImplicitAPI):
3199
3348
  async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
3200
3349
  """
3201
3350
  fetch deposit and withdraw fees
3202
- :see: https://api.hitbtc.com/#currencies
3351
+
3352
+ https://api.hitbtc.com/#currencies
3353
+
3203
3354
  :param str[]|None codes: list of unified currency codes
3204
3355
  :param dict [params]: extra parameters specific to the exchange API endpoint
3205
3356
  :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
@@ -3263,9 +3414,10 @@ class hitbtc(Exchange, ImplicitAPI):
3263
3414
  networkEntry = networks[j]
3264
3415
  networkId = self.safe_string(networkEntry, 'network')
3265
3416
  networkCode = self.network_id_to_code(networkId)
3417
+ networkCode = networkCode.upper() if (networkCode is not None) else None
3266
3418
  withdrawFee = self.safe_number(networkEntry, 'payout_fee')
3267
3419
  isDefault = self.safe_value(networkEntry, 'default')
3268
- withdrawResult = {
3420
+ withdrawResult: dict = {
3269
3421
  'fee': withdrawFee,
3270
3422
  'percentage': False if (withdrawFee is not None) else None,
3271
3423
  }
@@ -3283,7 +3435,11 @@ class hitbtc(Exchange, ImplicitAPI):
3283
3435
  async def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
3284
3436
  """
3285
3437
  closes open positions for a market
3286
- :see: https://api.hitbtc.com/#close-all-futures-margin-positions
3438
+
3439
+ https://api.hitbtc.com/#close-all-futures-margin-positions
3440
+
3441
+ :param str symbol: unified ccxt market symbol
3442
+ :param str side: 'buy' or 'sell'
3287
3443
  :param dict [params]: extra parameters specific to the okx api endpoint
3288
3444
  :param str [params.symbol]: *required* unified market symbol
3289
3445
  :param str [params.marginMode]: 'cross' or 'isolated', default is 'cross'
@@ -3293,7 +3449,7 @@ class hitbtc(Exchange, ImplicitAPI):
3293
3449
  marginMode = None
3294
3450
  marginMode, params = self.handle_margin_mode_and_params('closePosition', params, 'cross')
3295
3451
  market = self.market(symbol)
3296
- request = {
3452
+ request: dict = {
3297
3453
  'symbol': market['id'],
3298
3454
  'margin_mode': marginMode,
3299
3455
  }
@@ -3317,7 +3473,7 @@ class hitbtc(Exchange, ImplicitAPI):
3317
3473
 
3318
3474
  def handle_margin_mode_and_params(self, methodName, params={}, defaultValue=None):
3319
3475
  """
3320
- * @ignore
3476
+ @ignore
3321
3477
  marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
3322
3478
  :param dict [params]: extra parameters specific to the exchange API endpoint
3323
3479
  :returns Array: the marginMode in lowercase
@@ -3331,7 +3487,7 @@ class hitbtc(Exchange, ImplicitAPI):
3331
3487
  marginMode = 'isolated'
3332
3488
  return [marginMode, params]
3333
3489
 
3334
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
3490
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
3335
3491
  #
3336
3492
  # {
3337
3493
  # "error": {