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
@@ -5,18 +5,20 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.ascendex import ImplicitAPI
8
+ import asyncio
8
9
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Int, Leverage, Leverages, MarginMode, MarginModes, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
11
  from typing import List
11
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
12
14
  from ccxt.base.errors import PermissionDenied
15
+ from ccxt.base.errors import AccountSuspended
13
16
  from ccxt.base.errors import ArgumentsRequired
14
17
  from ccxt.base.errors import BadRequest
15
18
  from ccxt.base.errors import BadSymbol
16
19
  from ccxt.base.errors import InsufficientFunds
17
20
  from ccxt.base.errors import InvalidOrder
18
21
  from ccxt.base.errors import NotSupported
19
- from ccxt.base.errors import AuthenticationError
20
22
  from ccxt.base.decimal_to_precision import TICK_SIZE
21
23
  from ccxt.base.precise import Precise
22
24
 
@@ -101,6 +103,7 @@ class ascendex(Exchange, ImplicitAPI):
101
103
  'fetchWithdrawal': False,
102
104
  'fetchWithdrawals': True,
103
105
  'reduceMargin': True,
106
+ 'sandbox': True,
104
107
  'setLeverage': True,
105
108
  'setMarginMode': True,
106
109
  'setPositionMode': False,
@@ -122,7 +125,7 @@ class ascendex(Exchange, ImplicitAPI):
122
125
  },
123
126
  'version': 'v2',
124
127
  'urls': {
125
- 'logo': 'https://user-images.githubusercontent.com/1294454/112027508-47984600-8b48-11eb-9e17-d26459cc36c6.jpg',
128
+ 'logo': 'https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1',
126
129
  'api': {
127
130
  'rest': 'https://ascendex.com',
128
131
  },
@@ -291,26 +294,111 @@ class ascendex(Exchange, ImplicitAPI):
291
294
  'SOL': 'Solana',
292
295
  'AVAX': 'avalanche C chain',
293
296
  'OMNI': 'Omni',
294
- 'TRC': 'TRC20',
297
+ # 'TRC': 'TRC20',
295
298
  'TRX': 'TRC20',
296
- 'ERC': 'ERC20',
297
- },
298
- 'networksById': {
299
- 'BEP20(BSC)': 'BSC',
300
- 'arbitrum': 'ARB',
301
- 'Solana': 'SOL',
302
- 'avalanche C chain': 'AVAX',
303
- 'Omni': 'OMNI',
304
299
  'TRC20': 'TRC20',
305
300
  'ERC20': 'ERC20',
306
301
  'GO20': 'GO20',
307
302
  'BEP2': 'BEP2',
308
- 'Bitcoin': 'BTC',
309
- 'Bitcoin ABC': 'BCH',
310
- 'Litecoin': 'LTC',
311
- 'Matic Network': 'MATIC',
312
- 'xDai': 'STAKE',
313
- 'Akash': 'AKT',
303
+ 'BTC': 'Bitcoin',
304
+ 'BCH': 'Bitcoin ABC',
305
+ 'LTC': 'Litecoin',
306
+ 'MATIC': 'Matic Network',
307
+ 'AKT': 'Akash',
308
+ },
309
+ },
310
+ 'features': {
311
+ 'default': {
312
+ 'sandbox': True,
313
+ 'createOrder': {
314
+ 'marginMode': True,
315
+ 'triggerPrice': True,
316
+ 'triggerPriceType': None,
317
+ 'triggerDirection': False,
318
+ 'stopLossPrice': False, # todo with triggerprice
319
+ 'takeProfitPrice': False, # todo with triggerprice
320
+ 'attachedStopLossTakeProfit': None,
321
+ 'timeInForce': {
322
+ 'IOC': True,
323
+ 'FOK': True,
324
+ 'PO': True,
325
+ 'GTD': False,
326
+ },
327
+ 'hedged': False,
328
+ 'trailing': False,
329
+ 'leverage': False,
330
+ 'marketBuyRequiresPrice': False,
331
+ 'marketBuyByCost': False,
332
+ 'selfTradePrevention': False,
333
+ 'iceberg': False,
334
+ },
335
+ 'createOrders': {
336
+ 'max': 10,
337
+ },
338
+ 'fetchMyTrades': None,
339
+ 'fetchOrder': {
340
+ 'marginMode': False,
341
+ 'trigger': False,
342
+ 'trailing': False,
343
+ 'marketType': True,
344
+ },
345
+ 'fetchOpenOrders': {
346
+ 'marginMode': False,
347
+ 'limit': None,
348
+ 'trigger': False,
349
+ 'trailing': False,
350
+ 'marketType': True,
351
+ },
352
+ 'fetchOrders': None,
353
+ 'fetchClosedOrders': None,
354
+ 'fetchOHLCV': {
355
+ 'limit': 500,
356
+ },
357
+ },
358
+ 'spot': {
359
+ 'extends': 'default',
360
+ 'fetchClosedOrders': {
361
+ 'marginMode': False,
362
+ 'limit': 1000,
363
+ 'daysBack': 100000,
364
+ 'daysBackCanceled': 1,
365
+ 'untilDays': 100000,
366
+ 'trigger': False,
367
+ 'trailing': False,
368
+ },
369
+ },
370
+ 'forDerivatives': {
371
+ 'extends': 'default',
372
+ 'createOrder': {
373
+ # todo: implementation
374
+ 'attachedStopLossTakeProfit': {
375
+ 'triggerPriceType': {
376
+ 'last': True,
377
+ 'mark': False,
378
+ 'index': False,
379
+ },
380
+ 'price': False,
381
+ },
382
+ },
383
+ 'fetchClosedOrders': {
384
+ 'marginMode': False,
385
+ 'limit': 1000,
386
+ 'daysBack': None,
387
+ 'daysBackCanceled': None,
388
+ 'untilDays': None,
389
+ 'trigger': False,
390
+ 'trailing': False,
391
+ },
392
+ },
393
+ 'swap': {
394
+ 'linear': {
395
+ 'extends': 'forDerivatives',
396
+ },
397
+ 'inverse': None,
398
+ },
399
+ 'future': {
400
+ 'linear': None,
401
+ 'inverse': None,
314
402
  },
315
403
  },
316
404
  'exceptions': {
@@ -368,7 +456,7 @@ class ascendex(Exchange, ImplicitAPI):
368
456
  '300013': InvalidOrder, # INVALID_BATCH_ORDER Some or all orders are invalid in batch order request
369
457
  '300014': InvalidOrder, # {"code":300014,"message":"Order price doesn't conform to the required tick size: 0.1","reason":"TICK_SIZE_VIOLATION"}
370
458
  '300020': InvalidOrder, # TRADING_RESTRICTED There is some trading restriction on account or asset
371
- '300021': InvalidOrder, # TRADING_DISABLED Trading is disabled on account or asset
459
+ '300021': AccountSuspended, # {"code":300021,"message":"Trading disabled for self account.","reason":"TRADING_DISABLED"}
372
460
  '300031': InvalidOrder, # NO_MARKET_PRICE No market price for market type order trading
373
461
  '310001': InsufficientFunds, # INVALID_MARGIN_BALANCE No enough margin balance
374
462
  '310002': InvalidOrder, # INVALID_MARGIN_ACCOUNT Not a valid account for margin trading
@@ -395,13 +483,13 @@ class ascendex(Exchange, ImplicitAPI):
395
483
  lowercaseAccount = account.lower()
396
484
  return self.capitalize(lowercaseAccount)
397
485
 
398
- async def fetch_currencies(self, params={}):
486
+ async def fetch_currencies(self, params={}) -> Currencies:
399
487
  """
400
488
  fetches all available currencies on an exchange
401
489
  :param dict [params]: extra parameters specific to the exchange API endpoint
402
490
  :returns dict: an associative dictionary of currencies
403
491
  """
404
- assets = await self.v1PublicGetAssets(params)
492
+ assetsPromise = self.v1PublicGetAssets(params)
405
493
  #
406
494
  # {
407
495
  # "code":0,
@@ -418,7 +506,7 @@ class ascendex(Exchange, ImplicitAPI):
418
506
  # ]
419
507
  # }
420
508
  #
421
- margin = await self.v1PublicGetMarginAssets(params)
509
+ marginPromise = self.v1PublicGetMarginAssets(params)
422
510
  #
423
511
  # {
424
512
  # "code":0,
@@ -438,7 +526,7 @@ class ascendex(Exchange, ImplicitAPI):
438
526
  # ]
439
527
  # }
440
528
  #
441
- cash = await self.v1PublicGetCashAssets(params)
529
+ cashPromise = self.v1PublicGetCashAssets(params)
442
530
  #
443
531
  # {
444
532
  # "code":0,
@@ -455,15 +543,16 @@ class ascendex(Exchange, ImplicitAPI):
455
543
  # ]
456
544
  # }
457
545
  #
458
- assetsData = self.safe_value(assets, 'data', [])
459
- marginData = self.safe_value(margin, 'data', [])
460
- cashData = self.safe_value(cash, 'data', [])
546
+ assets, margin, cash = await asyncio.gather(*[assetsPromise, marginPromise, cashPromise])
547
+ assetsData = self.safe_list(assets, 'data', [])
548
+ marginData = self.safe_list(margin, 'data', [])
549
+ cashData = self.safe_list(cash, 'data', [])
461
550
  assetsById = self.index_by(assetsData, 'assetCode')
462
551
  marginById = self.index_by(marginData, 'assetCode')
463
552
  cashById = self.index_by(cashData, 'assetCode')
464
553
  dataById = self.deep_extend(assetsById, marginById, cashById)
465
554
  ids = list(dataById.keys())
466
- result = {}
555
+ result: dict = {}
467
556
  for i in range(0, len(ids)):
468
557
  id = ids[i]
469
558
  currency = dataById[id]
@@ -500,13 +589,13 @@ class ascendex(Exchange, ImplicitAPI):
500
589
  }
501
590
  return result
502
591
 
503
- async def fetch_markets(self, params={}):
592
+ async def fetch_markets(self, params={}) -> List[Market]:
504
593
  """
505
594
  retrieves data on all markets for ascendex
506
595
  :param dict [params]: extra parameters specific to the exchange API endpoint
507
596
  :returns dict[]: an array of objects representing market data
508
597
  """
509
- products = await self.v1PublicGetProducts(params)
598
+ productsPromise = self.v1PublicGetProducts(params)
510
599
  #
511
600
  # {
512
601
  # "code": 0,
@@ -527,7 +616,7 @@ class ascendex(Exchange, ImplicitAPI):
527
616
  # ]
528
617
  # }
529
618
  #
530
- cash = await self.v1PublicGetCashProducts(params)
619
+ cashPromise = self.v1PublicGetCashProducts(params)
531
620
  #
532
621
  # {
533
622
  # "code": 0,
@@ -557,7 +646,7 @@ class ascendex(Exchange, ImplicitAPI):
557
646
  # ]
558
647
  # }
559
648
  #
560
- perpetuals = await self.v2PublicGetFuturesContract(params)
649
+ perpetualsPromise = self.v2PublicGetFuturesContract(params)
561
650
  #
562
651
  # {
563
652
  # "code": 0,
@@ -595,10 +684,11 @@ class ascendex(Exchange, ImplicitAPI):
595
684
  # ]
596
685
  # }
597
686
  #
598
- productsData = self.safe_value(products, 'data', [])
687
+ products, cash, perpetuals = await asyncio.gather(*[productsPromise, cashPromise, perpetualsPromise])
688
+ productsData = self.safe_list(products, 'data', [])
599
689
  productsById = self.index_by(productsData, 'symbol')
600
- cashData = self.safe_value(cash, 'data', [])
601
- perpetualsData = self.safe_value(perpetuals, 'data', [])
690
+ cashData = self.safe_list(cash, 'data', [])
691
+ perpetualsData = self.safe_list(perpetuals, 'data', [])
602
692
  cashAndPerpetualsData = self.array_concat(cashData, perpetualsData)
603
693
  cashAndPerpetualsById = self.index_by(cashAndPerpetualsData, 'symbol')
604
694
  dataById = self.deep_extend(productsById, cashAndPerpetualsById)
@@ -607,7 +697,7 @@ class ascendex(Exchange, ImplicitAPI):
607
697
  for i in range(0, len(ids)):
608
698
  id = ids[i]
609
699
  market = dataById[id]
610
- settleId = self.safe_value(market, 'settlementAsset')
700
+ settleId = self.safe_string(market, 'settlementAsset')
611
701
  settle = self.safe_currency_code(settleId)
612
702
  status = self.safe_string(market, 'status')
613
703
  domain = self.safe_string(market, 'domain')
@@ -629,10 +719,10 @@ class ascendex(Exchange, ImplicitAPI):
629
719
  quote = self.safe_currency_code(quoteId)
630
720
  symbol = base + '/' + quote
631
721
  if swap:
632
- lotSizeFilter = self.safe_value(market, 'lotSizeFilter')
722
+ lotSizeFilter = self.safe_dict(market, 'lotSizeFilter')
633
723
  minQty = self.safe_number(lotSizeFilter, 'minQty')
634
724
  maxQty = self.safe_number(lotSizeFilter, 'maxQty')
635
- priceFilter = self.safe_value(market, 'priceFilter')
725
+ priceFilter = self.safe_dict(market, 'priceFilter')
636
726
  minPrice = self.safe_number(priceFilter, 'minPrice')
637
727
  maxPrice = self.safe_number(priceFilter, 'maxPrice')
638
728
  symbol = base + '/' + quote + ':' + settle
@@ -697,7 +787,7 @@ class ascendex(Exchange, ImplicitAPI):
697
787
  :param dict [params]: extra parameters specific to the exchange API endpoint
698
788
  :returns int: the current integer timestamp in milliseconds from the ascendex server
699
789
  """
700
- request = {
790
+ request: dict = {
701
791
  'requestTime': self.milliseconds(),
702
792
  }
703
793
  response = await self.v1PublicGetExchangeInfo(self.extend(request, params))
@@ -711,7 +801,7 @@ class ascendex(Exchange, ImplicitAPI):
711
801
  # }
712
802
  # }
713
803
  #
714
- data = self.safe_value(response, 'data')
804
+ data = self.safe_dict(response, 'data', {})
715
805
  return self.safe_integer(data, 'requestReceiveAt')
716
806
 
717
807
  async def fetch_accounts(self, params={}) -> List[Account]:
@@ -740,7 +830,7 @@ class ascendex(Exchange, ImplicitAPI):
740
830
  # }
741
831
  # }
742
832
  #
743
- data = self.safe_value(response, 'data', {})
833
+ data = self.safe_dict(response, 'data', {})
744
834
  accountGroup = self.safe_string(data, 'accountGroup')
745
835
  self.options['account-group'] = accountGroup
746
836
  return [
@@ -753,12 +843,12 @@ class ascendex(Exchange, ImplicitAPI):
753
843
  ]
754
844
 
755
845
  def parse_balance(self, response) -> Balances:
756
- result = {
846
+ result: dict = {
757
847
  'info': response,
758
848
  'timestamp': None,
759
849
  'datetime': None,
760
850
  }
761
- balances = self.safe_value(response, 'data', [])
851
+ balances = self.safe_list(response, 'data', [])
762
852
  for i in range(0, len(balances)):
763
853
  balance = balances[i]
764
854
  code = self.safe_currency_code(self.safe_string(balance, 'asset'))
@@ -769,12 +859,12 @@ class ascendex(Exchange, ImplicitAPI):
769
859
  return self.safe_balance(result)
770
860
 
771
861
  def parse_margin_balance(self, response):
772
- result = {
862
+ result: dict = {
773
863
  'info': response,
774
864
  'timestamp': None,
775
865
  'datetime': None,
776
866
  }
777
- balances = self.safe_value(response, 'data', [])
867
+ balances = self.safe_list(response, 'data', [])
778
868
  for i in range(0, len(balances)):
779
869
  balance = balances[i]
780
870
  code = self.safe_currency_code(self.safe_string(balance, 'asset'))
@@ -788,13 +878,13 @@ class ascendex(Exchange, ImplicitAPI):
788
878
  return self.safe_balance(result)
789
879
 
790
880
  def parse_swap_balance(self, response):
791
- result = {
881
+ result: dict = {
792
882
  'info': response,
793
883
  'timestamp': None,
794
884
  'datetime': None,
795
885
  }
796
- data = self.safe_value(response, 'data', {})
797
- collaterals = self.safe_value(data, 'collaterals', [])
886
+ data = self.safe_dict(response, 'data', {})
887
+ collaterals = self.safe_list(data, 'collaterals', [])
798
888
  for i in range(0, len(collaterals)):
799
889
  balance = collaterals[i]
800
890
  code = self.safe_currency_code(self.safe_string(balance, 'asset'))
@@ -806,9 +896,11 @@ class ascendex(Exchange, ImplicitAPI):
806
896
  async def fetch_balance(self, params={}) -> Balances:
807
897
  """
808
898
  query for balance and get the amount of funds available for trading or funds locked in orders
809
- :see: https://ascendex.github.io/ascendex-pro-api/#cash-account-balance
810
- :see: https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
811
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
899
+
900
+ https://ascendex.github.io/ascendex-pro-api/#cash-account-balance
901
+ https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
902
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
903
+
812
904
  :param dict [params]: extra parameters specific to the exchange API endpoint
813
905
  :param str [params.type]: wallet type, 'spot', 'margin', or 'swap'
814
906
  :param str [params.marginMode]: 'cross' or None, for spot margin trading, value of 'isolated' is invalid
@@ -824,11 +916,11 @@ class ascendex(Exchange, ImplicitAPI):
824
916
  isCross = marginMode == 'cross'
825
917
  marketType = 'margin' if (isMargin or isCross) else marketType
826
918
  params = self.omit(params, 'margin')
827
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
919
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
828
920
  accountCategory = self.safe_string(accountsByType, marketType, 'cash')
829
- account = self.safe_value(self.accounts, 0, {})
921
+ account = self.safe_dict(self.accounts, 0, {})
830
922
  accountGroup = self.safe_string(account, 'id')
831
- request = {
923
+ request: dict = {
832
924
  'account-group': accountGroup,
833
925
  }
834
926
  if (marginMode == 'isolated') and (marketType != 'swap'):
@@ -902,7 +994,7 @@ class ascendex(Exchange, ImplicitAPI):
902
994
  """
903
995
  await self.load_markets()
904
996
  market = self.market(symbol)
905
- request = {
997
+ request: dict = {
906
998
  'symbol': market['id'],
907
999
  }
908
1000
  response = await self.v1PublicGetDepth(self.extend(request, params))
@@ -929,14 +1021,14 @@ class ascendex(Exchange, ImplicitAPI):
929
1021
  # }
930
1022
  # }
931
1023
  #
932
- data = self.safe_value(response, 'data', {})
933
- orderbook = self.safe_value(data, 'data', {})
1024
+ data = self.safe_dict(response, 'data', {})
1025
+ orderbook = self.safe_dict(data, 'data', {})
934
1026
  timestamp = self.safe_integer(orderbook, 'ts')
935
1027
  result = self.parse_order_book(orderbook, symbol, timestamp)
936
1028
  result['nonce'] = self.safe_integer(orderbook, 'seqnum')
937
1029
  return result
938
1030
 
939
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
1031
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
940
1032
  #
941
1033
  # {
942
1034
  # "symbol":"QTUM/BTC",
@@ -956,8 +1048,8 @@ class ascendex(Exchange, ImplicitAPI):
956
1048
  delimiter = '/' if (type == 'spot') else None
957
1049
  symbol = self.safe_symbol(marketId, market, delimiter)
958
1050
  close = self.safe_string(ticker, 'close')
959
- bid = self.safe_value(ticker, 'bid', [])
960
- ask = self.safe_value(ticker, 'ask', [])
1051
+ bid = self.safe_list(ticker, 'bid', [])
1052
+ ask = self.safe_list(ticker, 'ask', [])
961
1053
  open = self.safe_string(ticker, 'open')
962
1054
  return self.safe_ticker({
963
1055
  'symbol': symbol,
@@ -991,7 +1083,7 @@ class ascendex(Exchange, ImplicitAPI):
991
1083
  """
992
1084
  await self.load_markets()
993
1085
  market = self.market(symbol)
994
- request = {
1086
+ request: dict = {
995
1087
  'symbol': market['id'],
996
1088
  }
997
1089
  response = await self.v1PublicGetTicker(self.extend(request, params))
@@ -1011,23 +1103,25 @@ class ascendex(Exchange, ImplicitAPI):
1011
1103
  # }
1012
1104
  # }
1013
1105
  #
1014
- data = self.safe_value(response, 'data', {})
1106
+ data = self.safe_dict(response, 'data', {})
1015
1107
  return self.parse_ticker(data, market)
1016
1108
 
1017
1109
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1018
1110
  """
1019
1111
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1020
- :see: https://ascendex.github.io/ascendex-pro-api/#ticker
1021
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#ticker
1112
+
1113
+ https://ascendex.github.io/ascendex-pro-api/#ticker
1114
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#ticker
1115
+
1022
1116
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1023
1117
  :param dict [params]: extra parameters specific to the exchange API endpoint
1024
1118
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
1025
1119
  """
1026
1120
  await self.load_markets()
1027
- request = {}
1121
+ request: dict = {}
1028
1122
  market = None
1029
1123
  if symbols is not None:
1030
- symbol = self.safe_value(symbols, 0)
1124
+ symbol = self.safe_string(symbols, 0)
1031
1125
  market = self.market(symbol)
1032
1126
  marketIds = self.market_ids(symbols)
1033
1127
  request['symbol'] = ','.join(marketIds)
@@ -1041,22 +1135,20 @@ class ascendex(Exchange, ImplicitAPI):
1041
1135
  #
1042
1136
  # {
1043
1137
  # "code":0,
1044
- # "data":[
1045
- # {
1046
- # "symbol":"QTUM/BTC",
1047
- # "open":"0.00016537",
1048
- # "close":"0.00019077",
1049
- # "high":"0.000192",
1050
- # "low":"0.00016537",
1051
- # "volume":"846.6",
1052
- # "ask":["0.00018698","26.2"],
1053
- # "bid":["0.00018408","503.7"],
1054
- # "type":"spot"
1055
- # }
1056
- # ]
1138
+ # "data": {
1139
+ # "symbol":"QTUM/BTC",
1140
+ # "open":"0.00016537",
1141
+ # "close":"0.00019077",
1142
+ # "high":"0.000192",
1143
+ # "low":"0.00016537",
1144
+ # "volume":"846.6",
1145
+ # "ask":["0.00018698","26.2"],
1146
+ # "bid":["0.00018408","503.7"],
1147
+ # "type":"spot"
1148
+ # }
1057
1149
  # }
1058
1150
  #
1059
- data = self.safe_value(response, 'data', [])
1151
+ data = self.safe_list(response, 'data', [])
1060
1152
  if not isinstance(data, list):
1061
1153
  return self.parse_tickers([data], symbols)
1062
1154
  return self.parse_tickers(data, symbols)
@@ -1077,7 +1169,7 @@ class ascendex(Exchange, ImplicitAPI):
1077
1169
  # }
1078
1170
  # }
1079
1171
  #
1080
- data = self.safe_value(ohlcv, 'data', {})
1172
+ data = self.safe_dict(ohlcv, 'data', {})
1081
1173
  return [
1082
1174
  self.safe_integer(data, 'ts'),
1083
1175
  self.safe_number(data, 'o'),
@@ -1095,28 +1187,42 @@ class ascendex(Exchange, ImplicitAPI):
1095
1187
  :param int [since]: timestamp in ms of the earliest candle to fetch
1096
1188
  :param int [limit]: the maximum amount of candles to fetch
1097
1189
  :param dict [params]: extra parameters specific to the exchange API endpoint
1190
+ :param int [params.until]: timestamp in ms of the latest candle to fetch
1098
1191
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
1099
1192
  """
1100
1193
  await self.load_markets()
1101
1194
  market = self.market(symbol)
1102
- request = {
1195
+ request: dict = {
1103
1196
  'symbol': market['id'],
1104
1197
  'interval': self.safe_string(self.timeframes, timeframe, timeframe),
1105
1198
  }
1106
1199
  # if since and limit are not specified
1107
1200
  # the exchange will return just 1 last candle by default
1108
1201
  duration = self.parse_timeframe(timeframe)
1109
- options = self.safe_value(self.options, 'fetchOHLCV', {})
1202
+ options = self.safe_dict(self.options, 'fetchOHLCV', {})
1110
1203
  defaultLimit = self.safe_integer(options, 'limit', 500)
1204
+ until = self.safe_integer(params, 'until')
1111
1205
  if since is not None:
1112
1206
  request['from'] = since
1113
1207
  if limit is None:
1114
1208
  limit = defaultLimit
1115
1209
  else:
1116
1210
  limit = min(limit, defaultLimit)
1117
- request['to'] = self.sum(since, limit * duration * 1000, 1)
1211
+ toWithLimit = self.sum(since, limit * duration * 1000, 1)
1212
+ if until is not None:
1213
+ request['to'] = min(toWithLimit, until + 1)
1214
+ else:
1215
+ request['to'] = toWithLimit
1216
+ elif until is not None:
1217
+ request['to'] = until + 1
1218
+ if limit is None:
1219
+ limit = defaultLimit
1220
+ else:
1221
+ limit = min(limit, defaultLimit)
1222
+ request['from'] = until - (limit * duration * 1000)
1118
1223
  elif limit is not None:
1119
1224
  request['n'] = limit # max 500
1225
+ params = self.omit(params, 'until')
1120
1226
  response = await self.v1PublicGetBarhist(self.extend(request, params))
1121
1227
  #
1122
1228
  # {
@@ -1138,10 +1244,10 @@ class ascendex(Exchange, ImplicitAPI):
1138
1244
  # ]
1139
1245
  # }
1140
1246
  #
1141
- data = self.safe_value(response, 'data', [])
1247
+ data = self.safe_list(response, 'data', [])
1142
1248
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
1143
1249
 
1144
- def parse_trade(self, trade, market: Market = None) -> Trade:
1250
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1145
1251
  #
1146
1252
  # public fetchTrades
1147
1253
  #
@@ -1178,7 +1284,9 @@ class ascendex(Exchange, ImplicitAPI):
1178
1284
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1179
1285
  """
1180
1286
  get the list of most recent trades for a particular symbol
1181
- :see: https://ascendex.github.io/ascendex-pro-api/#market-trades
1287
+
1288
+ https://ascendex.github.io/ascendex-pro-api/#market-trades
1289
+
1182
1290
  :param str symbol: unified symbol of the market to fetch trades for
1183
1291
  :param int [since]: timestamp in ms of the earliest trade to fetch
1184
1292
  :param int [limit]: the maximum amount of trades to fetch
@@ -1187,7 +1295,7 @@ class ascendex(Exchange, ImplicitAPI):
1187
1295
  """
1188
1296
  await self.load_markets()
1189
1297
  market = self.market(symbol)
1190
- request = {
1298
+ request: dict = {
1191
1299
  'symbol': market['id'],
1192
1300
  }
1193
1301
  if limit is not None:
@@ -1207,12 +1315,12 @@ class ascendex(Exchange, ImplicitAPI):
1207
1315
  # }
1208
1316
  # }
1209
1317
  #
1210
- records = self.safe_value(response, 'data', [])
1211
- trades = self.safe_value(records, 'data', [])
1318
+ records = self.safe_dict(response, 'data', {})
1319
+ trades = self.safe_list(records, 'data', [])
1212
1320
  return self.parse_trades(trades, market, since, limit)
1213
1321
 
1214
- def parse_order_status(self, status):
1215
- statuses = {
1322
+ def parse_order_status(self, status: Str):
1323
+ statuses: dict = {
1216
1324
  'PendingNew': 'open',
1217
1325
  'New': 'open',
1218
1326
  'PartiallyFilled': 'open',
@@ -1222,7 +1330,7 @@ class ascendex(Exchange, ImplicitAPI):
1222
1330
  }
1223
1331
  return self.safe_string(statuses, status, status)
1224
1332
 
1225
- def parse_order(self, order, market: Market = None) -> Order:
1333
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1226
1334
  #
1227
1335
  # createOrder
1228
1336
  #
@@ -1360,7 +1468,7 @@ class ascendex(Exchange, ImplicitAPI):
1360
1468
  'cost': feeCost,
1361
1469
  'currency': feeCurrencyCode,
1362
1470
  }
1363
- stopPrice = self.safe_number(order, 'stopPrice')
1471
+ triggerPrice = self.omit_zero(self.safe_string(order, 'stopPrice'))
1364
1472
  reduceOnly = None
1365
1473
  execInst = self.safe_string(order, 'execInst')
1366
1474
  if execInst == 'reduceOnly':
@@ -1382,8 +1490,7 @@ class ascendex(Exchange, ImplicitAPI):
1382
1490
  'reduceOnly': reduceOnly,
1383
1491
  'side': side,
1384
1492
  'price': price,
1385
- 'stopPrice': stopPrice,
1386
- 'triggerPrice': stopPrice,
1493
+ 'triggerPrice': triggerPrice,
1387
1494
  'amount': amount,
1388
1495
  'cost': None,
1389
1496
  'average': average,
@@ -1394,7 +1501,7 @@ class ascendex(Exchange, ImplicitAPI):
1394
1501
  'trades': None,
1395
1502
  }, market)
1396
1503
 
1397
- async def fetch_trading_fees(self, params={}):
1504
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
1398
1505
  """
1399
1506
  fetch the trading fees for multiple markets
1400
1507
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1402,9 +1509,9 @@ class ascendex(Exchange, ImplicitAPI):
1402
1509
  """
1403
1510
  await self.load_markets()
1404
1511
  await self.load_accounts()
1405
- account = self.safe_value(self.accounts, 0, {})
1512
+ account = self.safe_dict(self.accounts, 0, {})
1406
1513
  accountGroup = self.safe_string(account, 'id')
1407
- request = {
1514
+ request: dict = {
1408
1515
  'account-group': accountGroup,
1409
1516
  }
1410
1517
  response = await self.v1PrivateAccountGroupGetSpotFee(self.extend(request, params))
@@ -1424,35 +1531,37 @@ class ascendex(Exchange, ImplicitAPI):
1424
1531
  # }
1425
1532
  # }
1426
1533
  #
1427
- data = self.safe_value(response, 'data', {})
1428
- fees = self.safe_value(data, 'fees', [])
1429
- result = {}
1534
+ data = self.safe_dict(response, 'data', {})
1535
+ fees = self.safe_list(data, 'fees', [])
1536
+ result: dict = {}
1430
1537
  for i in range(0, len(fees)):
1431
1538
  fee = fees[i]
1432
1539
  marketId = self.safe_string(fee, 'symbol')
1433
1540
  symbol = self.safe_symbol(marketId, None, '/')
1434
- takerMaker = self.safe_value(fee, 'fee', {})
1541
+ takerMaker = self.safe_dict(fee, 'fee', {})
1435
1542
  result[symbol] = {
1436
1543
  'info': fee,
1437
1544
  'symbol': symbol,
1438
1545
  'maker': self.safe_number(takerMaker, 'maker'),
1439
1546
  'taker': self.safe_number(takerMaker, 'taker'),
1547
+ 'percentage': None,
1548
+ 'tierBased': None,
1440
1549
  }
1441
1550
  return result
1442
1551
 
1443
1552
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1444
1553
  """
1445
- * @ignore
1554
+ @ignore
1446
1555
  helper function to build request
1447
1556
  :param str symbol: unified symbol of the market to create an order in
1448
1557
  :param str type: 'market' or 'limit'
1449
1558
  :param str side: 'buy' or 'sell'
1450
1559
  :param float amount: how much you want to trade in units of the base currency
1451
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1560
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1452
1561
  :param dict [params]: extra parameters specific to the exchange API endpoint
1453
1562
  :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
1454
1563
  :param bool [params.postOnly]: True or False
1455
- :param float [params.stopPrice]: the price at which a trigger order is triggered at
1564
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1456
1565
  :returns dict: request to be sent to the exchange
1457
1566
  """
1458
1567
  market = self.market(symbol)
@@ -1460,14 +1569,14 @@ class ascendex(Exchange, ImplicitAPI):
1460
1569
  marketType = None
1461
1570
  marginMode, params = self.handle_margin_mode_and_params('createOrderRequest', params)
1462
1571
  marketType, params = self.handle_market_type_and_params('createOrderRequest', market, params)
1463
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
1572
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1464
1573
  accountCategory = self.safe_string(accountsByType, marketType, 'cash')
1465
1574
  if marginMode is not None:
1466
1575
  accountCategory = 'margin'
1467
- account = self.safe_value(self.accounts, 0, {})
1468
- accountGroup = self.safe_value(account, 'id')
1576
+ account = self.safe_dict(self.accounts, 0, {})
1577
+ accountGroup = self.safe_string(account, 'id')
1469
1578
  clientOrderId = self.safe_string_2(params, 'clientOrderId', 'id')
1470
- request = {
1579
+ request: dict = {
1471
1580
  'account-group': accountGroup,
1472
1581
  'account-category': accountCategory,
1473
1582
  'symbol': market['id'],
@@ -1483,7 +1592,7 @@ class ascendex(Exchange, ImplicitAPI):
1483
1592
  timeInForce = self.safe_string(params, 'timeInForce')
1484
1593
  postOnly = self.is_post_only(isMarketOrder, False, params)
1485
1594
  reduceOnly = self.safe_bool(params, 'reduceOnly', False)
1486
- stopPrice = self.safe_value_2(params, 'triggerPrice', 'stopPrice')
1595
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1487
1596
  if isLimitOrder:
1488
1597
  request['orderPrice'] = self.price_to_precision(symbol, price)
1489
1598
  if timeInForce == 'IOC':
@@ -1492,8 +1601,8 @@ class ascendex(Exchange, ImplicitAPI):
1492
1601
  request['timeInForce'] = 'FOK'
1493
1602
  if postOnly:
1494
1603
  request['postOnly'] = True
1495
- if stopPrice is not None:
1496
- request['stopPrice'] = self.price_to_precision(symbol, stopPrice)
1604
+ if triggerPrice is not None:
1605
+ request['stopPrice'] = self.price_to_precision(symbol, triggerPrice)
1497
1606
  if isLimitOrder:
1498
1607
  request['orderType'] = 'stop_limit'
1499
1608
  elif isMarketOrder:
@@ -1515,17 +1624,19 @@ class ascendex(Exchange, ImplicitAPI):
1515
1624
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1516
1625
  """
1517
1626
  create a trade order on the exchange
1518
- :see: https://ascendex.github.io/ascendex-pro-api/#place-order
1519
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order
1627
+
1628
+ https://ascendex.github.io/ascendex-pro-api/#place-order
1629
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order
1630
+
1520
1631
  :param str symbol: unified CCXT market symbol
1521
1632
  :param str type: "limit" or "market"
1522
1633
  :param str side: "buy" or "sell"
1523
1634
  :param float amount: the amount of currency to trade
1524
- :param float [price]: *ignored in "market" orders* the price at which the order is to be fullfilled at in units of the quote currency
1635
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1525
1636
  :param dict [params]: extra parameters specific to the exchange API endpoint
1526
1637
  :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
1527
1638
  :param bool [params.postOnly]: True or False
1528
- :param float [params.stopPrice]: the price at which a trigger order is triggered at
1639
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1529
1640
  :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered(perpetual swap markets only)
1530
1641
  :param float [params.takeProfit.triggerPrice]: *swap only* take profit trigger price
1531
1642
  :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered(perpetual swap markets only)
@@ -1604,20 +1715,22 @@ class ascendex(Exchange, ImplicitAPI):
1604
1715
  # }
1605
1716
  # }
1606
1717
  #
1607
- data = self.safe_value(response, 'data', {})
1608
- order = self.safe_value_2(data, 'order', 'info', {})
1718
+ data = self.safe_dict(response, 'data', {})
1719
+ order = self.safe_dict_2(data, 'order', 'info', {})
1609
1720
  return self.parse_order(order, market)
1610
1721
 
1611
1722
  async def create_orders(self, orders: List[OrderRequest], params={}):
1612
1723
  """
1613
1724
  create a list of trade orders
1614
- :see: https://ascendex.github.io/ascendex-pro-api/#place-batch-orders
1615
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#place-batch-orders
1725
+
1726
+ https://ascendex.github.io/ascendex-pro-api/#place-batch-orders
1727
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#place-batch-orders
1728
+
1616
1729
  :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1617
1730
  :param dict [params]: extra parameters specific to the exchange API endpoint
1618
1731
  :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
1619
1732
  :param bool [params.postOnly]: True or False
1620
- :param float [params.stopPrice]: the price at which a trigger order is triggered at
1733
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1621
1734
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1622
1735
  """
1623
1736
  await self.load_markets()
@@ -1635,9 +1748,9 @@ class ascendex(Exchange, ImplicitAPI):
1635
1748
  raise BadRequest(self.id + ' createOrders() requires all orders to have the same symbol')
1636
1749
  type = self.safe_string(rawOrder, 'type')
1637
1750
  side = self.safe_string(rawOrder, 'side')
1638
- amount = self.safe_value(rawOrder, 'amount')
1639
- price = self.safe_value(rawOrder, 'price')
1640
- orderParams = self.safe_value(rawOrder, 'params', {})
1751
+ amount = self.safe_number(rawOrder, 'amount')
1752
+ price = self.safe_number(rawOrder, 'price')
1753
+ orderParams = self.safe_dict(rawOrder, 'params', {})
1641
1754
  marginResult = self.handle_margin_mode_and_params('createOrders', orderParams)
1642
1755
  currentMarginMode = marginResult[0]
1643
1756
  if currentMarginMode is not None:
@@ -1649,13 +1762,13 @@ class ascendex(Exchange, ImplicitAPI):
1649
1762
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
1650
1763
  ordersRequests.append(orderRequest)
1651
1764
  market = self.market(symbol)
1652
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
1765
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1653
1766
  accountCategory = self.safe_string(accountsByType, market['type'], 'cash')
1654
1767
  if marginMode is not None:
1655
1768
  accountCategory = 'margin'
1656
- account = self.safe_value(self.accounts, 0, {})
1657
- accountGroup = self.safe_value(account, 'id')
1658
- request = {}
1769
+ account = self.safe_dict(self.accounts, 0, {})
1770
+ accountGroup = self.safe_string(account, 'id')
1771
+ request: dict = {}
1659
1772
  response = None
1660
1773
  if market['swap']:
1661
1774
  raise NotSupported(self.id + ' createOrders() is not currently supported for swap markets on ascendex')
@@ -1690,15 +1803,18 @@ class ascendex(Exchange, ImplicitAPI):
1690
1803
  # }
1691
1804
  # }
1692
1805
  #
1693
- data = self.safe_value(response, 'data', {})
1694
- info = self.safe_value(data, 'info', [])
1806
+ data = self.safe_dict(response, 'data', {})
1807
+ info = self.safe_list(data, 'info', [])
1695
1808
  return self.parse_orders(info, market)
1696
1809
 
1697
1810
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1698
1811
  """
1699
1812
  fetches information on an order made by the user
1700
- :see: https://ascendex.github.io/ascendex-pro-api/#query-order
1701
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
1813
+
1814
+ https://ascendex.github.io/ascendex-pro-api/#query-order
1815
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
1816
+
1817
+ :param str id: the order id
1702
1818
  :param str symbol: unified symbol of the market the order was made in
1703
1819
  :param dict [params]: extra parameters specific to the exchange API endpoint
1704
1820
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -1709,11 +1825,11 @@ class ascendex(Exchange, ImplicitAPI):
1709
1825
  if symbol is not None:
1710
1826
  market = self.market(symbol)
1711
1827
  type, query = self.handle_market_type_and_params('fetchOrder', market, params)
1712
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
1828
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1713
1829
  accountCategory = self.safe_string(accountsByType, type, 'cash')
1714
- account = self.safe_value(self.accounts, 0, {})
1715
- accountGroup = self.safe_value(account, 'id')
1716
- request = {
1830
+ account = self.safe_dict(self.accounts, 0, {})
1831
+ accountGroup = self.safe_string(account, 'id')
1832
+ request: dict = {
1717
1833
  'account-group': accountGroup,
1718
1834
  'account-category': accountCategory,
1719
1835
  'orderId': id,
@@ -1793,14 +1909,16 @@ class ascendex(Exchange, ImplicitAPI):
1793
1909
  # }
1794
1910
  # }
1795
1911
  #
1796
- data = self.safe_value(response, 'data', {})
1912
+ data = self.safe_dict(response, 'data', {})
1797
1913
  return self.parse_order(data, market)
1798
1914
 
1799
1915
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1800
1916
  """
1801
1917
  fetch all unfilled currently open orders
1802
- :see: https://ascendex.github.io/ascendex-pro-api/#list-open-orders
1803
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders
1918
+
1919
+ https://ascendex.github.io/ascendex-pro-api/#list-open-orders
1920
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders
1921
+
1804
1922
  :param str symbol: unified market symbol
1805
1923
  :param int [since]: the earliest time in ms to fetch open orders for
1806
1924
  :param int [limit]: the maximum number of open orders structures to retrieve
@@ -1813,12 +1931,12 @@ class ascendex(Exchange, ImplicitAPI):
1813
1931
  if symbol is not None:
1814
1932
  market = self.market(symbol)
1815
1933
  symbol = market['symbol']
1816
- account = self.safe_value(self.accounts, 0, {})
1817
- accountGroup = self.safe_value(account, 'id')
1934
+ account = self.safe_dict(self.accounts, 0, {})
1935
+ accountGroup = self.safe_string(account, 'id')
1818
1936
  type, query = self.handle_market_type_and_params('fetchOpenOrders', market, params)
1819
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
1937
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1820
1938
  accountCategory = self.safe_string(accountsByType, type, 'cash')
1821
- request = {
1939
+ request: dict = {
1822
1940
  'account-group': accountGroup,
1823
1941
  'account-category': accountCategory,
1824
1942
  }
@@ -1897,7 +2015,7 @@ class ascendex(Exchange, ImplicitAPI):
1897
2015
  # ]
1898
2016
  # }
1899
2017
  #
1900
- data = self.safe_value(response, 'data', [])
2018
+ data = self.safe_list(response, 'data', [])
1901
2019
  if accountCategory == 'futures':
1902
2020
  return self.parse_orders(data, market, since, limit)
1903
2021
  # a workaround for https://github.com/ccxt/ccxt/issues/7187
@@ -1910,8 +2028,10 @@ class ascendex(Exchange, ImplicitAPI):
1910
2028
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1911
2029
  """
1912
2030
  fetches information on multiple closed orders made by the user
1913
- :see: https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2
1914
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders
2031
+
2032
+ https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2
2033
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders
2034
+
1915
2035
  :param str symbol: unified market symbol of the market orders were made in
1916
2036
  :param int [since]: the earliest time in ms to fetch orders for
1917
2037
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1921,9 +2041,9 @@ class ascendex(Exchange, ImplicitAPI):
1921
2041
  """
1922
2042
  await self.load_markets()
1923
2043
  await self.load_accounts()
1924
- account = self.safe_value(self.accounts, 0, {})
1925
- accountGroup = self.safe_value(account, 'id')
1926
- request = {
2044
+ account = self.safe_dict(self.accounts, 0, {})
2045
+ accountGroup = self.safe_string(account, 'id')
2046
+ request: dict = {
1927
2047
  # 'category': accountCategory,
1928
2048
  # 'symbol': market['id'],
1929
2049
  # 'orderType': 'market', # optional, string
@@ -1939,7 +2059,7 @@ class ascendex(Exchange, ImplicitAPI):
1939
2059
  market = self.market(symbol)
1940
2060
  request['symbol'] = market['id']
1941
2061
  type, query = self.handle_market_type_and_params('fetchClosedOrders', market, params)
1942
- options = self.safe_value(self.options, 'fetchClosedOrders', {})
2062
+ options = self.safe_dict(self.options, 'fetchClosedOrders', {})
1943
2063
  defaultMethod = self.safe_string(options, 'method', 'v2PrivateDataGetOrderHist')
1944
2064
  method = self.get_supported_mapping(type, {
1945
2065
  'spot': defaultMethod,
@@ -1951,7 +2071,7 @@ class ascendex(Exchange, ImplicitAPI):
1951
2071
  until = self.safe_string(params, 'until')
1952
2072
  if until is not None:
1953
2073
  request['endTime'] = until
1954
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
2074
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1955
2075
  accountCategory = self.safe_string(accountsByType, type, 'cash') # margin, futures
1956
2076
  response = None
1957
2077
  if method == 'v1PrivateAccountCategoryGetOrderHistCurrent':
@@ -2064,17 +2184,19 @@ class ascendex(Exchange, ImplicitAPI):
2064
2184
  # ]
2065
2185
  # }
2066
2186
  #
2067
- data = self.safe_value(response, 'data')
2187
+ data = self.safe_list(response, 'data', [])
2068
2188
  isArray = isinstance(data, list)
2069
2189
  if not isArray:
2070
- data = self.safe_value(data, 'data', [])
2190
+ data = self.safe_list(data, 'data', [])
2071
2191
  return self.parse_orders(data, market, since, limit)
2072
2192
 
2073
2193
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
2074
2194
  """
2075
2195
  cancels an open order
2076
- :see: https://ascendex.github.io/ascendex-pro-api/#cancel-order
2077
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-order
2196
+
2197
+ https://ascendex.github.io/ascendex-pro-api/#cancel-order
2198
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-order
2199
+
2078
2200
  :param str id: order id
2079
2201
  :param str symbol: unified symbol of the market the order was made in
2080
2202
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2086,11 +2208,11 @@ class ascendex(Exchange, ImplicitAPI):
2086
2208
  await self.load_accounts()
2087
2209
  market = self.market(symbol)
2088
2210
  type, query = self.handle_market_type_and_params('cancelOrder', market, params)
2089
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
2211
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
2090
2212
  accountCategory = self.safe_string(accountsByType, type, 'cash')
2091
- account = self.safe_value(self.accounts, 0, {})
2092
- accountGroup = self.safe_value(account, 'id')
2093
- request = {
2213
+ account = self.safe_dict(self.accounts, 0, {})
2214
+ accountGroup = self.safe_string(account, 'id')
2215
+ request: dict = {
2094
2216
  'account-group': accountGroup,
2095
2217
  'account-category': accountCategory,
2096
2218
  'symbol': market['id'],
@@ -2174,18 +2296,20 @@ class ascendex(Exchange, ImplicitAPI):
2174
2296
  # }
2175
2297
  # }
2176
2298
  #
2177
- data = self.safe_value(response, 'data', {})
2178
- order = self.safe_value_2(data, 'order', 'info', {})
2299
+ data = self.safe_dict(response, 'data', {})
2300
+ order = self.safe_dict_2(data, 'order', 'info', {})
2179
2301
  return self.parse_order(order, market)
2180
2302
 
2181
2303
  async def cancel_all_orders(self, symbol: Str = None, params={}):
2182
2304
  """
2183
2305
  cancel all open orders
2184
- :see: https://ascendex.github.io/ascendex-pro-api/#cancel-all-orders
2185
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-all-open-orders
2306
+
2307
+ https://ascendex.github.io/ascendex-pro-api/#cancel-all-orders
2308
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-all-open-orders
2309
+
2186
2310
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
2187
2311
  :param dict [params]: extra parameters specific to the exchange API endpoint
2188
- :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2312
+ :returns dict[]: a list with a single `order structure <https://docs.ccxt.com/#/?id=order-structure>` with the response assigned to the info property
2189
2313
  """
2190
2314
  await self.load_markets()
2191
2315
  await self.load_accounts()
@@ -2193,11 +2317,11 @@ class ascendex(Exchange, ImplicitAPI):
2193
2317
  if symbol is not None:
2194
2318
  market = self.market(symbol)
2195
2319
  type, query = self.handle_market_type_and_params('cancelAllOrders', market, params)
2196
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
2320
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
2197
2321
  accountCategory = self.safe_string(accountsByType, type, 'cash')
2198
- account = self.safe_value(self.accounts, 0, {})
2199
- accountGroup = self.safe_value(account, 'id')
2200
- request = {
2322
+ account = self.safe_dict(self.accounts, 0, {})
2323
+ accountGroup = self.safe_string(account, 'id')
2324
+ request: dict = {
2201
2325
  'account-group': accountGroup,
2202
2326
  'account-category': accountCategory,
2203
2327
  'time': self.milliseconds(),
@@ -2246,9 +2370,11 @@ class ascendex(Exchange, ImplicitAPI):
2246
2370
  # }
2247
2371
  # }
2248
2372
  #
2249
- return response
2373
+ return self.safe_order({
2374
+ 'info': response,
2375
+ })
2250
2376
 
2251
- def parse_deposit_address(self, depositAddress, currency: Currency = None):
2377
+ def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
2252
2378
  #
2253
2379
  # {
2254
2380
  # "address": "0xe7c70b4e73b6b450ee46c3b5c0f5fb127ca55722",
@@ -2270,21 +2396,19 @@ class ascendex(Exchange, ImplicitAPI):
2270
2396
  chainName = self.safe_string(depositAddress, 'blockchain')
2271
2397
  network = self.network_id_to_code(chainName, code)
2272
2398
  return {
2399
+ 'info': depositAddress,
2273
2400
  'currency': code,
2401
+ 'network': network,
2274
2402
  'address': address,
2275
2403
  'tag': tag,
2276
- 'network': network,
2277
- 'info': depositAddress,
2278
2404
  }
2279
2405
 
2280
- def safe_network(self, networkId):
2281
- networksById = self.safe_dict(self.options, 'networksById')
2282
- return self.safe_string(networksById, networkId, networkId)
2283
-
2284
- async def fetch_deposit_address(self, code: str, params={}):
2406
+ async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
2285
2407
  """
2286
2408
  fetch the deposit address for a currency associated with self account
2287
- :see: https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
2409
+
2410
+ https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
2411
+
2288
2412
  :param str code: unified currency code
2289
2413
  :param dict [params]: extra parameters specific to the exchange API endpoint
2290
2414
  :param str [params.network]: unified network code for deposit chain
@@ -2295,7 +2419,7 @@ class ascendex(Exchange, ImplicitAPI):
2295
2419
  networkCode = self.safe_string_2(params, 'network', 'chainName')
2296
2420
  networkId = self.network_code_to_id(networkCode)
2297
2421
  params = self.omit(params, ['chainName'])
2298
- request = {
2422
+ request: dict = {
2299
2423
  'asset': currency['id'],
2300
2424
  'blockchain': networkId,
2301
2425
  }
@@ -2361,7 +2485,7 @@ class ascendex(Exchange, ImplicitAPI):
2361
2485
  :param dict [params]: extra parameters specific to the exchange API endpoint
2362
2486
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
2363
2487
  """
2364
- request = {
2488
+ request: dict = {
2365
2489
  'txType': 'deposit',
2366
2490
  }
2367
2491
  return await self.fetch_transactions(code, since, limit, self.extend(request, params))
@@ -2375,7 +2499,7 @@ class ascendex(Exchange, ImplicitAPI):
2375
2499
  :param dict [params]: extra parameters specific to the exchange API endpoint
2376
2500
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
2377
2501
  """
2378
- request = {
2502
+ request: dict = {
2379
2503
  'txType': 'withdrawal',
2380
2504
  }
2381
2505
  return await self.fetch_transactions(code, since, limit, self.extend(request, params))
@@ -2390,7 +2514,7 @@ class ascendex(Exchange, ImplicitAPI):
2390
2514
  :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
2391
2515
  """
2392
2516
  await self.load_markets()
2393
- request = {
2517
+ request: dict = {
2394
2518
  # 'asset': currency['id'],
2395
2519
  # 'page': 1,
2396
2520
  # 'pageSize': 20,
@@ -2432,12 +2556,12 @@ class ascendex(Exchange, ImplicitAPI):
2432
2556
  # }
2433
2557
  # }
2434
2558
  #
2435
- data = self.safe_value(response, 'data', {})
2436
- transactions = self.safe_value(data, 'data', [])
2559
+ data = self.safe_dict(response, 'data', {})
2560
+ transactions = self.safe_list(data, 'data', [])
2437
2561
  return self.parse_transactions(transactions, currency, since, limit)
2438
2562
 
2439
- def parse_transaction_status(self, status):
2440
- statuses = {
2563
+ def parse_transaction_status(self, status: Str):
2564
+ statuses: dict = {
2441
2565
  'reviewing': 'pending',
2442
2566
  'pending': 'pending',
2443
2567
  'confirmed': 'ok',
@@ -2445,7 +2569,7 @@ class ascendex(Exchange, ImplicitAPI):
2445
2569
  }
2446
2570
  return self.safe_string(statuses, status, status)
2447
2571
 
2448
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
2572
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2449
2573
  #
2450
2574
  # {
2451
2575
  # "requestId": "wuzd1Ojsqtz4bCA3UXwtUnnJDmU8PiyB",
@@ -2464,7 +2588,7 @@ class ascendex(Exchange, ImplicitAPI):
2464
2588
  # }
2465
2589
  # }
2466
2590
  #
2467
- destAddress = self.safe_value(transaction, 'destAddress', {})
2591
+ destAddress = self.safe_dict(transaction, 'destAddress', {})
2468
2592
  address = self.safe_string(destAddress, 'address')
2469
2593
  tag = self.safe_string(destAddress, 'destTag')
2470
2594
  timestamp = self.safe_integer(transaction, 'time')
@@ -2509,9 +2633,9 @@ class ascendex(Exchange, ImplicitAPI):
2509
2633
  """
2510
2634
  await self.load_markets()
2511
2635
  await self.load_accounts()
2512
- account = self.safe_value(self.accounts, 0, {})
2636
+ account = self.safe_dict(self.accounts, 0, {})
2513
2637
  accountGroup = self.safe_string(account, 'id')
2514
- request = {
2638
+ request: dict = {
2515
2639
  'account-group': accountGroup,
2516
2640
  }
2517
2641
  response = await self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
@@ -2554,15 +2678,15 @@ class ascendex(Exchange, ImplicitAPI):
2554
2678
  # }
2555
2679
  # }
2556
2680
  #
2557
- data = self.safe_value(response, 'data', {})
2558
- position = self.safe_value(data, 'contracts', [])
2681
+ data = self.safe_dict(response, 'data', {})
2682
+ position = self.safe_list(data, 'contracts', [])
2559
2683
  result = []
2560
2684
  for i in range(0, len(position)):
2561
2685
  result.append(self.parse_position(position[i]))
2562
2686
  symbols = self.market_symbols(symbols)
2563
2687
  return self.filter_by_array_positions(result, 'symbol', symbols, False)
2564
2688
 
2565
- def parse_position(self, position, market: Market = None):
2689
+ def parse_position(self, position: dict, market: Market = None):
2566
2690
  #
2567
2691
  # {
2568
2692
  # "symbol": "BTC-PERP",
@@ -2625,7 +2749,7 @@ class ascendex(Exchange, ImplicitAPI):
2625
2749
  'takeProfitPrice': self.safe_number(position, 'takeProfitPrice'),
2626
2750
  })
2627
2751
 
2628
- def parse_funding_rate(self, contract, market: Market = None):
2752
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2629
2753
  #
2630
2754
  # {
2631
2755
  # "time": 1640061364830,
@@ -2660,14 +2784,15 @@ class ascendex(Exchange, ImplicitAPI):
2660
2784
  'fundingRate': nextFundingRate,
2661
2785
  'fundingTimestamp': nextFundingRateTimestamp,
2662
2786
  'fundingDatetime': self.iso8601(nextFundingRateTimestamp),
2787
+ 'interval': None,
2663
2788
  }
2664
2789
 
2665
- async def fetch_funding_rates(self, symbols: Strings = None, params={}):
2790
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
2666
2791
  """
2667
2792
  fetch the funding rate for multiple markets
2668
2793
  :param str[]|None symbols: list of unified market symbols
2669
2794
  :param dict [params]: extra parameters specific to the exchange API endpoint
2670
- :returns dict: a dictionary of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
2795
+ :returns dict[]: a list of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
2671
2796
  """
2672
2797
  await self.load_markets()
2673
2798
  symbols = self.market_symbols(symbols)
@@ -2696,19 +2821,18 @@ class ascendex(Exchange, ImplicitAPI):
2696
2821
  # }
2697
2822
  # }
2698
2823
  #
2699
- data = self.safe_value(response, 'data', {})
2700
- contracts = self.safe_value(data, 'contracts', [])
2701
- result = self.parse_funding_rates(contracts)
2702
- return self.filter_by_array(result, 'symbol', symbols)
2824
+ data = self.safe_dict(response, 'data', {})
2825
+ contracts = self.safe_list(data, 'contracts', [])
2826
+ return self.parse_funding_rates(contracts, symbols)
2703
2827
 
2704
- async def modify_margin_helper(self, symbol: str, amount, type, params={}):
2828
+ async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
2705
2829
  await self.load_markets()
2706
2830
  await self.load_accounts()
2707
2831
  market = self.market(symbol)
2708
- account = self.safe_value(self.accounts, 0, {})
2832
+ account = self.safe_dict(self.accounts, 0, {})
2709
2833
  accountGroup = self.safe_string(account, 'id')
2710
2834
  amount = self.amount_to_precision(symbol, amount)
2711
- request = {
2835
+ request: dict = {
2712
2836
  'account-group': accountGroup,
2713
2837
  'symbol': market['id'],
2714
2838
  'amount': amount, # positive value for adding margin, negative for reducing
@@ -2728,19 +2852,30 @@ class ascendex(Exchange, ImplicitAPI):
2728
2852
  'type': type,
2729
2853
  })
2730
2854
 
2731
- def parse_margin_modification(self, data, market: Market = None):
2855
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
2856
+ #
2857
+ # addMargin/reduceMargin
2858
+ #
2859
+ # {
2860
+ # "code": 0
2861
+ # }
2862
+ #
2732
2863
  errorCode = self.safe_string(data, 'code')
2733
2864
  status = 'ok' if (errorCode == '0') else 'failed'
2734
2865
  return {
2735
2866
  'info': data,
2867
+ 'symbol': market['symbol'],
2736
2868
  'type': None,
2869
+ 'marginMode': 'isolated',
2737
2870
  'amount': None,
2871
+ 'total': None,
2738
2872
  'code': market['quote'],
2739
- 'symbol': market['symbol'],
2740
2873
  'status': status,
2874
+ 'timestamp': None,
2875
+ 'datetime': None,
2741
2876
  }
2742
2877
 
2743
- async def reduce_margin(self, symbol: str, amount, params={}):
2878
+ async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2744
2879
  """
2745
2880
  remove margin from a position
2746
2881
  :param str symbol: unified market symbol
@@ -2750,7 +2885,7 @@ class ascendex(Exchange, ImplicitAPI):
2750
2885
  """
2751
2886
  return await self.modify_margin_helper(symbol, -amount, 'reduce', params)
2752
2887
 
2753
- async def add_margin(self, symbol: str, amount, params={}):
2888
+ async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2754
2889
  """
2755
2890
  add margin
2756
2891
  :param str symbol: unified market symbol
@@ -2763,7 +2898,9 @@ class ascendex(Exchange, ImplicitAPI):
2763
2898
  async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2764
2899
  """
2765
2900
  set the level of leverage for a market
2766
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage
2901
+
2902
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage
2903
+
2767
2904
  :param float leverage: the rate of leverage
2768
2905
  :param str symbol: unified market symbol
2769
2906
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2778,9 +2915,9 @@ class ascendex(Exchange, ImplicitAPI):
2778
2915
  market = self.market(symbol)
2779
2916
  if not market['swap']:
2780
2917
  raise BadSymbol(self.id + ' setLeverage() supports swap contracts only')
2781
- account = self.safe_value(self.accounts, 0, {})
2918
+ account = self.safe_dict(self.accounts, 0, {})
2782
2919
  accountGroup = self.safe_string(account, 'id')
2783
- request = {
2920
+ request: dict = {
2784
2921
  'account-group': accountGroup,
2785
2922
  'symbol': market['id'],
2786
2923
  'leverage': leverage,
@@ -2790,7 +2927,9 @@ class ascendex(Exchange, ImplicitAPI):
2790
2927
  async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
2791
2928
  """
2792
2929
  set margin mode to 'cross' or 'isolated'
2793
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-margin-type
2930
+
2931
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-margin-type
2932
+
2794
2933
  :param str marginMode: 'cross' or 'isolated'
2795
2934
  :param str symbol: unified market symbol
2796
2935
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2806,9 +2945,9 @@ class ascendex(Exchange, ImplicitAPI):
2806
2945
  await self.load_markets()
2807
2946
  await self.load_accounts()
2808
2947
  market = self.market(symbol)
2809
- account = self.safe_value(self.accounts, 0, {})
2948
+ account = self.safe_dict(self.accounts, 0, {})
2810
2949
  accountGroup = self.safe_string(account, 'id')
2811
- request = {
2950
+ request: dict = {
2812
2951
  'account-group': accountGroup,
2813
2952
  'symbol': market['id'],
2814
2953
  'marginType': marginMode,
@@ -2817,7 +2956,7 @@ class ascendex(Exchange, ImplicitAPI):
2817
2956
  raise BadSymbol(self.id + ' setMarginMode() supports swap contracts only')
2818
2957
  return await self.v2PrivateAccountGroupPostFuturesMarginType(self.extend(request, params))
2819
2958
 
2820
- async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
2959
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
2821
2960
  """
2822
2961
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
2823
2962
  :param str[]|None symbols: list of unified market symbols
@@ -2854,11 +2993,11 @@ class ascendex(Exchange, ImplicitAPI):
2854
2993
  # ]
2855
2994
  # }
2856
2995
  #
2857
- data = self.safe_value(response, 'data')
2996
+ data = self.safe_list(response, 'data', [])
2858
2997
  symbols = self.market_symbols(symbols)
2859
2998
  return self.parse_leverage_tiers(data, symbols, 'symbol')
2860
2999
 
2861
- def parse_market_leverage_tiers(self, info, market: Market = None):
3000
+ def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
2862
3001
  """
2863
3002
  :param dict info: Exchange market response for 1 market
2864
3003
  :param dict market: CCXT market
@@ -2886,15 +3025,16 @@ class ascendex(Exchange, ImplicitAPI):
2886
3025
  # ]
2887
3026
  # }
2888
3027
  #
2889
- marginRequirements = self.safe_value(info, 'marginRequirements', [])
2890
- id = self.safe_string(info, 'symbol')
2891
- market = self.safe_market(id, market)
3028
+ marginRequirements = self.safe_list(info, 'marginRequirements', [])
3029
+ marketId = self.safe_string(info, 'symbol')
3030
+ market = self.safe_market(marketId, market)
2892
3031
  tiers = []
2893
3032
  for i in range(0, len(marginRequirements)):
2894
3033
  tier = marginRequirements[i]
2895
3034
  initialMarginRate = self.safe_string(tier, 'initialMarginRate')
2896
3035
  tiers.append({
2897
3036
  'tier': self.sum(i, 1),
3037
+ 'symbol': self.safe_symbol(marketId, market, None, 'contract'),
2898
3038
  'currency': market['quote'],
2899
3039
  'minNotional': self.safe_number(tier, 'positionNotionalLowerBound'),
2900
3040
  'maxNotional': self.safe_number(tier, 'positionNotionalUpperBound'),
@@ -2924,9 +3064,9 @@ class ascendex(Exchange, ImplicitAPI):
2924
3064
  # ]
2925
3065
  # }
2926
3066
  #
2927
- blockChains = self.safe_value(fee, 'blockChain', [])
3067
+ blockChains = self.safe_list(fee, 'blockChain', [])
2928
3068
  blockChainsLength = len(blockChains)
2929
- result = {
3069
+ result: dict = {
2930
3070
  'info': fee,
2931
3071
  'withdraw': {
2932
3072
  'fee': None,
@@ -2955,14 +3095,16 @@ class ascendex(Exchange, ImplicitAPI):
2955
3095
  async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
2956
3096
  """
2957
3097
  fetch deposit and withdraw fees
2958
- :see: https://ascendex.github.io/ascendex-pro-api/#list-all-assets
3098
+
3099
+ https://ascendex.github.io/ascendex-pro-api/#list-all-assets
3100
+
2959
3101
  :param str[]|None codes: list of unified currency codes
2960
3102
  :param dict [params]: extra parameters specific to the exchange API endpoint
2961
3103
  :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
2962
3104
  """
2963
3105
  await self.load_markets()
2964
3106
  response = await self.v2PublicGetAssets(params)
2965
- data = self.safe_value(response, 'data')
3107
+ data = self.safe_list(response, 'data')
2966
3108
  return self.parse_deposit_withdraw_fees(data, codes, 'assetCode')
2967
3109
 
2968
3110
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
@@ -2977,18 +3119,17 @@ class ascendex(Exchange, ImplicitAPI):
2977
3119
  """
2978
3120
  await self.load_markets()
2979
3121
  await self.load_accounts()
2980
- account = self.safe_value(self.accounts, 0, {})
3122
+ account = self.safe_dict(self.accounts, 0, {})
2981
3123
  accountGroup = self.safe_string(account, 'id')
2982
3124
  currency = self.currency(code)
2983
- amount = self.currency_to_precision(code, amount)
2984
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
3125
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
2985
3126
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
2986
3127
  toId = self.safe_string(accountsByType, toAccount, toAccount)
2987
3128
  if fromId != 'cash' and toId != 'cash':
2988
3129
  raise ExchangeError(self.id + ' transfer() only supports direct balance transfer between spot and swap, spot and margin')
2989
- request = {
3130
+ request: dict = {
2990
3131
  'account-group': accountGroup,
2991
- 'amount': amount,
3132
+ 'amount': self.currency_to_precision(code, amount),
2992
3133
  'asset': currency['id'],
2993
3134
  'fromAccount': fromId,
2994
3135
  'toAccount': toId,
@@ -2997,7 +3138,7 @@ class ascendex(Exchange, ImplicitAPI):
2997
3138
  #
2998
3139
  # {"code": "0"}
2999
3140
  #
3000
- transferOptions = self.safe_value(self.options, 'transfer', {})
3141
+ transferOptions = self.safe_dict(self.options, 'transfer', {})
3001
3142
  fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
3002
3143
  transfer = self.parse_transfer(response, currency)
3003
3144
  if fillResponseFromRequest:
@@ -3007,11 +3148,11 @@ class ascendex(Exchange, ImplicitAPI):
3007
3148
  transfer['currency'] = code
3008
3149
  return transfer
3009
3150
 
3010
- def parse_transfer(self, transfer, currency: Currency = None):
3151
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
3011
3152
  #
3012
3153
  # {"code": "0"}
3013
3154
  #
3014
- status = self.safe_integer(transfer, 'code')
3155
+ status = self.safe_string(transfer, 'code')
3015
3156
  currencyCode = self.safe_currency_code(None, currency)
3016
3157
  return {
3017
3158
  'info': transfer,
@@ -3025,15 +3166,17 @@ class ascendex(Exchange, ImplicitAPI):
3025
3166
  'status': self.parse_transfer_status(status),
3026
3167
  }
3027
3168
 
3028
- def parse_transfer_status(self, status):
3029
- if status == 0:
3169
+ def parse_transfer_status(self, status: Str) -> Str:
3170
+ if status == '0':
3030
3171
  return 'ok'
3031
3172
  return 'failed'
3032
3173
 
3033
3174
  async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
3034
3175
  """
3035
3176
  fetch the history of funding payments paid and received on self account
3036
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#funding-payment-history
3177
+
3178
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#funding-payment-history
3179
+
3037
3180
  :param str [symbol]: unified market symbol
3038
3181
  :param int [since]: the earliest time in ms to fetch funding history for
3039
3182
  :param int [limit]: the maximum number of funding history structures to retrieve
@@ -3047,9 +3190,9 @@ class ascendex(Exchange, ImplicitAPI):
3047
3190
  paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
3048
3191
  if paginate:
3049
3192
  return await self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25)
3050
- account = self.safe_value(self.accounts, 0, {})
3193
+ account = self.safe_dict(self.accounts, 0, {})
3051
3194
  accountGroup = self.safe_string(account, 'id')
3052
- request = {
3195
+ request: dict = {
3053
3196
  'account-group': accountGroup,
3054
3197
  }
3055
3198
  market = None
@@ -3077,8 +3220,8 @@ class ascendex(Exchange, ImplicitAPI):
3077
3220
  # }
3078
3221
  # }
3079
3222
  #
3080
- data = self.safe_value(response, 'data', {})
3081
- rows = self.safe_value(data, 'data', [])
3223
+ data = self.safe_dict(response, 'data', {})
3224
+ rows = self.safe_list(data, 'data', [])
3082
3225
  return self.parse_incomes(rows, market, since, limit)
3083
3226
 
3084
3227
  def parse_income(self, income, market: Market = None):
@@ -3102,19 +3245,21 @@ class ascendex(Exchange, ImplicitAPI):
3102
3245
  'amount': self.safe_number(income, 'paymentInUSDT'),
3103
3246
  }
3104
3247
 
3105
- async def fetch_margin_modes(self, symbols: List[str] = None, params={}) -> MarginModes:
3248
+ async def fetch_margin_modes(self, symbols: Strings = None, params={}) -> MarginModes:
3106
3249
  """
3107
3250
  fetches the set margin mode of the user
3108
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3251
+
3252
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3253
+
3109
3254
  :param str[] [symbols]: a list of unified market symbols
3110
3255
  :param dict [params]: extra parameters specific to the exchange API endpoint
3111
3256
  :returns dict: a list of `margin mode structures <https://docs.ccxt.com/#/?id=margin-mode-structure>`
3112
3257
  """
3113
3258
  await self.load_markets()
3114
3259
  await self.load_accounts()
3115
- account = self.safe_value(self.accounts, 0, {})
3260
+ account = self.safe_dict(self.accounts, 0, {})
3116
3261
  accountGroup = self.safe_string(account, 'id')
3117
- request = {
3262
+ request: dict = {
3118
3263
  'account-group': accountGroup,
3119
3264
  }
3120
3265
  response = await self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
@@ -3161,7 +3306,7 @@ class ascendex(Exchange, ImplicitAPI):
3161
3306
  marginModes = self.safe_list(data, 'contracts', [])
3162
3307
  return self.parse_margin_modes(marginModes, symbols, 'symbol')
3163
3308
 
3164
- def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
3309
+ def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
3165
3310
  marketId = self.safe_string(marginMode, 'symbol')
3166
3311
  marginType = self.safe_string(marginMode, 'marginType')
3167
3312
  margin = 'cross' if (marginType == 'crossed') else 'isolated'
@@ -3171,19 +3316,21 @@ class ascendex(Exchange, ImplicitAPI):
3171
3316
  'marginMode': margin,
3172
3317
  }
3173
3318
 
3174
- async def fetch_leverages(self, symbols: List[str] = None, params={}) -> Leverages:
3319
+ async def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
3175
3320
  """
3176
3321
  fetch the set leverage for all contract markets
3177
- :see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3322
+
3323
+ https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
3324
+
3178
3325
  :param str[] [symbols]: a list of unified market symbols
3179
3326
  :param dict [params]: extra parameters specific to the exchange API endpoint
3180
3327
  :returns dict: a list of `leverage structures <https://docs.ccxt.com/#/?id=leverage-structure>`
3181
3328
  """
3182
3329
  await self.load_markets()
3183
3330
  await self.load_accounts()
3184
- account = self.safe_value(self.accounts, 0, {})
3331
+ account = self.safe_dict(self.accounts, 0, {})
3185
3332
  accountGroup = self.safe_string(account, 'id')
3186
- request = {
3333
+ request: dict = {
3187
3334
  'account-group': accountGroup,
3188
3335
  }
3189
3336
  response = await self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
@@ -3230,7 +3377,7 @@ class ascendex(Exchange, ImplicitAPI):
3230
3377
  leverages = self.safe_list(data, 'contracts', [])
3231
3378
  return self.parse_leverages(leverages, symbols, 'symbol')
3232
3379
 
3233
- def parse_leverage(self, leverage, market=None) -> Leverage:
3380
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
3234
3381
  marketId = self.safe_string(leverage, 'symbol')
3235
3382
  leverageValue = self.safe_integer(leverage, 'leverage')
3236
3383
  marginType = self.safe_string(leverage, 'marginType')
@@ -3295,7 +3442,7 @@ class ascendex(Exchange, ImplicitAPI):
3295
3442
  url = self.urls['api']['rest'] + url
3296
3443
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3297
3444
 
3298
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
3445
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
3299
3446
  if response is None:
3300
3447
  return None # fallback to default error handler
3301
3448
  #