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
ccxt/delta.py CHANGED
@@ -6,9 +6,10 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.delta import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, MarginMode, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import BadSymbol
@@ -16,7 +17,6 @@ from ccxt.base.errors import InsufficientFunds
16
17
  from ccxt.base.errors import InvalidOrder
17
18
  from ccxt.base.errors import OrderNotFound
18
19
  from ccxt.base.errors import ExchangeNotAvailable
19
- from ccxt.base.errors import AuthenticationError
20
20
  from ccxt.base.decimal_to_precision import TICK_SIZE
21
21
  from ccxt.base.precise import Precise
22
22
 
@@ -51,6 +51,8 @@ class delta(Exchange, ImplicitAPI):
51
51
  'fetchCurrencies': True,
52
52
  'fetchDeposit': None,
53
53
  'fetchDepositAddress': True,
54
+ 'fetchDepositAddresses': False,
55
+ 'fetchDepositAddressesByNetwork': False,
54
56
  'fetchDeposits': None,
55
57
  'fetchFundingHistory': False,
56
58
  'fetchFundingRate': True,
@@ -71,6 +73,8 @@ class delta(Exchange, ImplicitAPI):
71
73
  'fetchOHLCV': True,
72
74
  'fetchOpenInterest': True,
73
75
  'fetchOpenOrders': True,
76
+ 'fetchOption': True,
77
+ 'fetchOptionChain': False,
74
78
  'fetchOrderBook': True,
75
79
  'fetchPosition': True,
76
80
  'fetchPositionMode': False,
@@ -225,6 +229,88 @@ class delta(Exchange, ImplicitAPI):
225
229
  'BEP20': 'BEP20(BSC)',
226
230
  },
227
231
  },
232
+ 'features': {
233
+ 'default': {
234
+ 'sandbox': True,
235
+ 'createOrder': {
236
+ 'marginMode': False,
237
+ 'triggerPrice': True, # todo implement
238
+ # todo implement
239
+ 'triggerPriceType': {
240
+ 'last': True,
241
+ 'mark': True,
242
+ 'index': True,
243
+ },
244
+ 'triggerDirection': False,
245
+ 'stopLossPrice': False, # todo
246
+ 'takeProfitPrice': False, # todo
247
+ 'attachedStopLossTakeProfit': {
248
+ 'triggerPriceType': None,
249
+ 'price': True,
250
+ },
251
+ # todo implementation
252
+ 'timeInForce': {
253
+ 'IOC': True,
254
+ 'FOK': True,
255
+ 'PO': True,
256
+ 'GTD': False,
257
+ },
258
+ 'hedged': False,
259
+ 'selfTradePrevention': False,
260
+ 'trailing': False, # todo: implement
261
+ 'iceberg': False,
262
+ 'leverage': False,
263
+ 'marketBuyByCost': False,
264
+ 'marketBuyRequiresPrice': False,
265
+ },
266
+ 'createOrders': None, # todo: implement
267
+ 'fetchMyTrades': {
268
+ 'marginMode': False,
269
+ 'limit': 100, # todo: revise
270
+ 'daysBack': 100000,
271
+ 'untilDays': 100000,
272
+ },
273
+ 'fetchOrder': None,
274
+ 'fetchOpenOrders': {
275
+ 'marginMode': False,
276
+ 'limit': 100, # todo: revise
277
+ 'trigger': False,
278
+ 'trailing': False,
279
+ },
280
+ 'fetchOrders': None,
281
+ 'fetchClosedOrders': {
282
+ 'marginMode': False,
283
+ 'limit': 500,
284
+ 'daysBack': 100000,
285
+ 'daysBackCanceled': 1,
286
+ 'untilDays': 100000,
287
+ 'trigger': False,
288
+ 'trailing': False,
289
+ },
290
+ 'fetchOHLCV': {
291
+ 'limit': 2000, # todo: recheck
292
+ },
293
+ },
294
+ 'spot': {
295
+ 'extends': 'default',
296
+ },
297
+ 'swap': {
298
+ 'linear': {
299
+ 'extends': 'default',
300
+ },
301
+ 'inverse': {
302
+ 'extends': 'default',
303
+ },
304
+ },
305
+ 'future': {
306
+ 'linear': {
307
+ 'extends': 'default',
308
+ },
309
+ 'inverse': {
310
+ 'extends': 'default',
311
+ },
312
+ },
313
+ },
228
314
  'precisionMode': TICK_SIZE,
229
315
  'requiredCredentials': {
230
316
  'apiKey': True,
@@ -252,14 +338,6 @@ class delta(Exchange, ImplicitAPI):
252
338
  },
253
339
  })
254
340
 
255
- def convert_expire_date(self, date):
256
- # parse YYMMDD to timestamp
257
- year = date[0:2]
258
- month = date[2:4]
259
- day = date[4:6]
260
- reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
261
- return reconstructedDate
262
-
263
341
  def create_expired_option_market(self, symbol: str):
264
342
  # support expired option contracts
265
343
  quote = 'USDT'
@@ -415,10 +493,12 @@ class delta(Exchange, ImplicitAPI):
415
493
  'info': response,
416
494
  }
417
495
 
418
- def fetch_currencies(self, params={}):
496
+ def fetch_currencies(self, params={}) -> Currencies:
419
497
  """
420
498
  fetches all available currencies on an exchange
421
- :see: https://docs.delta.exchange/#get-list-of-all-assets
499
+
500
+ https://docs.delta.exchange/#get-list-of-all-assets
501
+
422
502
  :param dict [params]: extra parameters specific to the exchange API endpoint
423
503
  :returns dict: an associative dictionary of currencies
424
504
  """
@@ -454,7 +534,7 @@ class delta(Exchange, ImplicitAPI):
454
534
  # }
455
535
  #
456
536
  currencies = self.safe_list(response, 'result', [])
457
- result = {}
537
+ result: dict = {}
458
538
  for i in range(0, len(currencies)):
459
539
  currency = currencies[i]
460
540
  id = self.safe_string(currency, 'symbol')
@@ -498,7 +578,7 @@ class delta(Exchange, ImplicitAPI):
498
578
  return markets
499
579
 
500
580
  def index_by_stringified_numeric_id(self, input):
501
- result = {}
581
+ result: dict = {}
502
582
  if input is None:
503
583
  return None
504
584
  keys = list(input.keys())
@@ -511,10 +591,12 @@ class delta(Exchange, ImplicitAPI):
511
591
  result[numericIdString] = item
512
592
  return result
513
593
 
514
- def fetch_markets(self, params={}):
594
+ def fetch_markets(self, params={}) -> List[Market]:
515
595
  """
516
596
  retrieves data on all markets for delta
517
- :see: https://docs.delta.exchange/#get-list-of-products
597
+
598
+ https://docs.delta.exchange/#get-list-of-products
599
+
518
600
  :param dict [params]: extra parameters specific to the exchange API endpoint
519
601
  :returns dict[]: an array of objects representing market data
520
602
  """
@@ -734,7 +816,7 @@ class delta(Exchange, ImplicitAPI):
734
816
  else:
735
817
  # other markets(swap, futures, move, spread, irs) seem to use the step of '1' contract
736
818
  amountPrecision = self.parse_number('1')
737
- linear = (settle == base)
819
+ linear = (settle == quote)
738
820
  optionType = None
739
821
  symbol = base + '/' + quote
740
822
  if swap or future or option:
@@ -811,7 +893,7 @@ class delta(Exchange, ImplicitAPI):
811
893
  })
812
894
  return result
813
895
 
814
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
896
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
815
897
  #
816
898
  # spot: fetchTicker, fetchTickers
817
899
  #
@@ -952,20 +1034,24 @@ class delta(Exchange, ImplicitAPI):
952
1034
  'average': None,
953
1035
  'baseVolume': self.safe_number(ticker, 'volume'),
954
1036
  'quoteVolume': self.safe_number(ticker, 'turnover'),
1037
+ 'markPrice': self.safe_number(ticker, 'mark_price'),
1038
+ 'indexPrice': self.safe_number(ticker, 'spot_price'),
955
1039
  'info': ticker,
956
1040
  }, market)
957
1041
 
958
1042
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
959
1043
  """
960
1044
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
961
- :see: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
1045
+
1046
+ https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
1047
+
962
1048
  :param str symbol: unified symbol of the market to fetch the ticker for
963
1049
  :param dict [params]: extra parameters specific to the exchange API endpoint
964
1050
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
965
1051
  """
966
1052
  self.load_markets()
967
1053
  market = self.market(symbol)
968
- request = {
1054
+ request: dict = {
969
1055
  'symbol': market['id'],
970
1056
  }
971
1057
  response = self.publicGetTickersSymbol(self.extend(request, params))
@@ -1099,7 +1185,9 @@ class delta(Exchange, ImplicitAPI):
1099
1185
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
1100
1186
  """
1101
1187
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1102
- :see: https://docs.delta.exchange/#get-tickers-for-products
1188
+
1189
+ https://docs.delta.exchange/#get-tickers-for-products
1190
+
1103
1191
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1104
1192
  :param dict [params]: extra parameters specific to the exchange API endpoint
1105
1193
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -1238,7 +1326,7 @@ class delta(Exchange, ImplicitAPI):
1238
1326
  # }
1239
1327
  #
1240
1328
  tickers = self.safe_list(response, 'result', [])
1241
- result = {}
1329
+ result: dict = {}
1242
1330
  for i in range(0, len(tickers)):
1243
1331
  ticker = self.parse_ticker(tickers[i])
1244
1332
  symbol = ticker['symbol']
@@ -1248,7 +1336,9 @@ class delta(Exchange, ImplicitAPI):
1248
1336
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
1249
1337
  """
1250
1338
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
1251
- :see: https://docs.delta.exchange/#get-l2-orderbook
1339
+
1340
+ https://docs.delta.exchange/#get-l2-orderbook
1341
+
1252
1342
  :param str symbol: unified symbol of the market to fetch the order book for
1253
1343
  :param int [limit]: the maximum amount of order book entries to return
1254
1344
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1256,7 +1346,7 @@ class delta(Exchange, ImplicitAPI):
1256
1346
  """
1257
1347
  self.load_markets()
1258
1348
  market = self.market(symbol)
1259
- request = {
1349
+ request: dict = {
1260
1350
  'symbol': market['id'],
1261
1351
  }
1262
1352
  if limit is not None:
@@ -1283,7 +1373,7 @@ class delta(Exchange, ImplicitAPI):
1283
1373
  result = self.safe_dict(response, 'result', {})
1284
1374
  return self.parse_order_book(result, market['symbol'], None, 'buy', 'sell', 'price', 'size')
1285
1375
 
1286
- def parse_trade(self, trade, market: Market = None) -> Trade:
1376
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1287
1377
  #
1288
1378
  # public fetchTrades
1289
1379
  #
@@ -1381,7 +1471,9 @@ class delta(Exchange, ImplicitAPI):
1381
1471
  def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1382
1472
  """
1383
1473
  get the list of most recent trades for a particular symbol
1384
- :see: https://docs.delta.exchange/#get-public-trades
1474
+
1475
+ https://docs.delta.exchange/#get-public-trades
1476
+
1385
1477
  :param str symbol: unified symbol of the market to fetch trades for
1386
1478
  :param int [since]: timestamp in ms of the earliest trade to fetch
1387
1479
  :param int [limit]: the maximum amount of trades to fetch
@@ -1390,7 +1482,7 @@ class delta(Exchange, ImplicitAPI):
1390
1482
  """
1391
1483
  self.load_markets()
1392
1484
  market = self.market(symbol)
1393
- request = {
1485
+ request: dict = {
1394
1486
  'symbol': market['id'],
1395
1487
  }
1396
1488
  response = self.publicGetTradesSymbol(self.extend(request, params))
@@ -1435,29 +1527,36 @@ class delta(Exchange, ImplicitAPI):
1435
1527
  def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1436
1528
  """
1437
1529
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1438
- :see: https://docs.delta.exchange/#get-ohlc-candles
1530
+
1531
+ https://docs.delta.exchange/#delta-exchange-api-v2-historical-ohlc-candles-sparklines
1532
+
1439
1533
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1440
1534
  :param str timeframe: the length of time each candle represents
1441
1535
  :param int [since]: timestamp in ms of the earliest candle to fetch
1442
1536
  :param int [limit]: the maximum amount of candles to fetch
1443
1537
  :param dict [params]: extra parameters specific to the exchange API endpoint
1538
+ :param str [params.until]: timestamp in ms of the latest candle to fetch
1444
1539
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
1445
1540
  """
1446
1541
  self.load_markets()
1447
1542
  market = self.market(symbol)
1448
- request = {
1543
+ request: dict = {
1449
1544
  'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
1450
1545
  }
1451
1546
  duration = self.parse_timeframe(timeframe)
1452
1547
  limit = limit if limit else 2000 # max 2000
1548
+ until = self.safe_integer_product(params, 'until', 0.001)
1549
+ untilIsDefined = (until is not None)
1550
+ if untilIsDefined:
1551
+ until = self.parse_to_int(until)
1453
1552
  if since is None:
1454
- end = self.seconds()
1553
+ end = until if untilIsDefined else self.seconds()
1455
1554
  request['end'] = end
1456
1555
  request['start'] = end - limit * duration
1457
1556
  else:
1458
1557
  start = self.parse_to_int(since / 1000)
1459
1558
  request['start'] = start
1460
- request['end'] = self.sum(start, limit * duration)
1559
+ request['end'] = until if untilIsDefined else self.sum(start, limit * duration)
1461
1560
  price = self.safe_string(params, 'price')
1462
1561
  if price == 'mark':
1463
1562
  request['symbol'] = 'MARK:' + market['id']
@@ -1465,7 +1564,7 @@ class delta(Exchange, ImplicitAPI):
1465
1564
  request['symbol'] = market['info']['spot_index']['symbol']
1466
1565
  else:
1467
1566
  request['symbol'] = market['id']
1468
- params = self.omit(params, 'price')
1567
+ params = self.omit(params, ['price', 'until'])
1469
1568
  response = self.publicGetHistoryCandles(self.extend(request, params))
1470
1569
  #
1471
1570
  # {
@@ -1482,7 +1581,7 @@ class delta(Exchange, ImplicitAPI):
1482
1581
 
1483
1582
  def parse_balance(self, response) -> Balances:
1484
1583
  balances = self.safe_list(response, 'result', [])
1485
- result = {'info': response}
1584
+ result: dict = {'info': response}
1486
1585
  currenciesByNumericId = self.safe_dict(self.options, 'currenciesByNumericId', {})
1487
1586
  for i in range(0, len(balances)):
1488
1587
  balance = balances[i]
@@ -1498,7 +1597,9 @@ class delta(Exchange, ImplicitAPI):
1498
1597
  def fetch_balance(self, params={}) -> Balances:
1499
1598
  """
1500
1599
  query for balance and get the amount of funds available for trading or funds locked in orders
1501
- :see: https://docs.delta.exchange/#get-wallet-balances
1600
+
1601
+ https://docs.delta.exchange/#get-wallet-balances
1602
+
1502
1603
  :param dict [params]: extra parameters specific to the exchange API endpoint
1503
1604
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1504
1605
  """
@@ -1530,14 +1631,16 @@ class delta(Exchange, ImplicitAPI):
1530
1631
  def fetch_position(self, symbol: str, params={}):
1531
1632
  """
1532
1633
  fetch data on a single open contract trade position
1533
- :see: https://docs.delta.exchange/#get-position
1634
+
1635
+ https://docs.delta.exchange/#get-position
1636
+
1534
1637
  :param str symbol: unified market symbol of the market the position is held in, default is None
1535
1638
  :param dict [params]: extra parameters specific to the exchange API endpoint
1536
1639
  :returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
1537
1640
  """
1538
1641
  self.load_markets()
1539
1642
  market = self.market(symbol)
1540
- request = {
1643
+ request: dict = {
1541
1644
  'product_id': market['numericId'],
1542
1645
  }
1543
1646
  response = self.privateGetPositions(self.extend(request, params))
@@ -1557,7 +1660,9 @@ class delta(Exchange, ImplicitAPI):
1557
1660
  def fetch_positions(self, symbols: Strings = None, params={}):
1558
1661
  """
1559
1662
  fetch all open positions
1560
- :see: https://docs.delta.exchange/#get-margined-positions
1663
+
1664
+ https://docs.delta.exchange/#get-margined-positions
1665
+
1561
1666
  :param str[]|None symbols: list of unified market symbols
1562
1667
  :param dict [params]: extra parameters specific to the exchange API endpoint
1563
1668
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
@@ -1588,7 +1693,7 @@ class delta(Exchange, ImplicitAPI):
1588
1693
  result = self.safe_list(response, 'result', [])
1589
1694
  return self.parse_positions(result, symbols)
1590
1695
 
1591
- def parse_position(self, position, market: Market = None):
1696
+ def parse_position(self, position: dict, market: Market = None):
1592
1697
  #
1593
1698
  # fetchPosition
1594
1699
  #
@@ -1655,8 +1760,8 @@ class delta(Exchange, ImplicitAPI):
1655
1760
  'takeProfitPrice': None,
1656
1761
  })
1657
1762
 
1658
- def parse_order_status(self, status):
1659
- statuses = {
1763
+ def parse_order_status(self, status: Str):
1764
+ statuses: dict = {
1660
1765
  'open': 'open',
1661
1766
  'pending': 'open',
1662
1767
  'closed': 'closed',
@@ -1664,7 +1769,7 @@ class delta(Exchange, ImplicitAPI):
1664
1769
  }
1665
1770
  return self.safe_string(statuses, status, status)
1666
1771
 
1667
- def parse_order(self, order, market: Market = None) -> Order:
1772
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1668
1773
  #
1669
1774
  # createOrder, cancelOrder, editOrder, fetchOpenOrders, fetchClosedOrders
1670
1775
  #
@@ -1751,12 +1856,14 @@ class delta(Exchange, ImplicitAPI):
1751
1856
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1752
1857
  """
1753
1858
  create a trade order
1754
- :see: https://docs.delta.exchange/#place-order
1859
+
1860
+ https://docs.delta.exchange/#place-order
1861
+
1755
1862
  :param str symbol: unified symbol of the market to create an order in
1756
1863
  :param str type: 'market' or 'limit'
1757
1864
  :param str side: 'buy' or 'sell'
1758
1865
  :param float amount: how much of currency you want to trade in units of base currency
1759
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1866
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1760
1867
  :param dict [params]: extra parameters specific to the exchange API endpoint
1761
1868
  :param bool [params.reduceOnly]: *contract only* indicates if self order is to reduce the size of a position
1762
1869
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -1764,7 +1871,7 @@ class delta(Exchange, ImplicitAPI):
1764
1871
  self.load_markets()
1765
1872
  orderType = type + '_order'
1766
1873
  market = self.market(symbol)
1767
- request = {
1874
+ request: dict = {
1768
1875
  'product_id': market['numericId'],
1769
1876
  # 'limit_price': self.price_to_precision(market['symbol'], price),
1770
1877
  'size': self.amount_to_precision(market['symbol'], amount),
@@ -1828,19 +1935,21 @@ class delta(Exchange, ImplicitAPI):
1828
1935
  def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1829
1936
  """
1830
1937
  edit a trade order
1831
- :see: https://docs.delta.exchange/#edit-order
1938
+
1939
+ https://docs.delta.exchange/#edit-order
1940
+
1832
1941
  :param str id: order id
1833
1942
  :param str symbol: unified symbol of the market to create an order in
1834
1943
  :param str type: 'market' or 'limit'
1835
1944
  :param str side: 'buy' or 'sell'
1836
1945
  :param float amount: how much of the currency you want to trade in units of the base currency
1837
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency
1946
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency
1838
1947
  :param dict [params]: extra parameters specific to the exchange API endpoint
1839
1948
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1840
1949
  """
1841
1950
  self.load_markets()
1842
1951
  market = self.market(symbol)
1843
- request = {
1952
+ request: dict = {
1844
1953
  'id': int(id),
1845
1954
  'product_id': market['numericId'],
1846
1955
  # "limit_price": self.price_to_precision(symbol, price),
@@ -1874,7 +1983,9 @@ class delta(Exchange, ImplicitAPI):
1874
1983
  def cancel_order(self, id: str, symbol: Str = None, params={}):
1875
1984
  """
1876
1985
  cancels an open order
1877
- :see: https://docs.delta.exchange/#cancel-order
1986
+
1987
+ https://docs.delta.exchange/#cancel-order
1988
+
1878
1989
  :param str id: order id
1879
1990
  :param str symbol: unified symbol of the market the order was made in
1880
1991
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1884,7 +1995,7 @@ class delta(Exchange, ImplicitAPI):
1884
1995
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
1885
1996
  self.load_markets()
1886
1997
  market = self.market(symbol)
1887
- request = {
1998
+ request: dict = {
1888
1999
  'id': int(id),
1889
2000
  'product_id': market['numericId'],
1890
2001
  }
@@ -1931,7 +2042,9 @@ class delta(Exchange, ImplicitAPI):
1931
2042
  def cancel_all_orders(self, symbol: Str = None, params={}):
1932
2043
  """
1933
2044
  cancel all open orders in a market
1934
- :see: https://docs.delta.exchange/#cancel-all-open-orders
2045
+
2046
+ https://docs.delta.exchange/#cancel-all-open-orders
2047
+
1935
2048
  :param str symbol: unified market symbol of the market to cancel orders in
1936
2049
  :param dict [params]: extra parameters specific to the exchange API endpoint
1937
2050
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -1940,7 +2053,7 @@ class delta(Exchange, ImplicitAPI):
1940
2053
  raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
1941
2054
  self.load_markets()
1942
2055
  market = self.market(symbol)
1943
- request = {
2056
+ request: dict = {
1944
2057
  'product_id': market['numericId'],
1945
2058
  # 'cancel_limit_orders': 'true',
1946
2059
  # 'cancel_stop_orders': 'true',
@@ -1952,12 +2065,18 @@ class delta(Exchange, ImplicitAPI):
1952
2065
  # "success":true
1953
2066
  # }
1954
2067
  #
1955
- return response
2068
+ return [
2069
+ self.safe_order({
2070
+ 'info': response,
2071
+ }),
2072
+ ]
1956
2073
 
1957
2074
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1958
2075
  """
1959
2076
  fetch all unfilled currently open orders
1960
- :see: https://docs.delta.exchange/#get-active-orders
2077
+
2078
+ https://docs.delta.exchange/#get-active-orders
2079
+
1961
2080
  :param str symbol: unified market symbol
1962
2081
  :param int [since]: the earliest time in ms to fetch open orders for
1963
2082
  :param int [limit]: the maximum number of open order structures to retrieve
@@ -1969,7 +2088,9 @@ class delta(Exchange, ImplicitAPI):
1969
2088
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1970
2089
  """
1971
2090
  fetches information on multiple closed orders made by the user
1972
- :see: https://docs.delta.exchange/#get-order-history-cancelled-and-closed
2091
+
2092
+ https://docs.delta.exchange/#get-order-history-cancelled-and-closed
2093
+
1973
2094
  :param str symbol: unified market symbol of the market orders were made in
1974
2095
  :param int [since]: the earliest time in ms to fetch orders for
1975
2096
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1980,7 +2101,7 @@ class delta(Exchange, ImplicitAPI):
1980
2101
 
1981
2102
  def fetch_orders_with_method(self, method, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1982
2103
  self.load_markets()
1983
- request = {
2104
+ request: dict = {
1984
2105
  # 'product_ids': market['id'], # comma-separated
1985
2106
  # 'contract_types': types, # comma-separated, futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads
1986
2107
  # 'order_types': types, # comma-separated, market, limit, stop_market, stop_limit, all_stop
@@ -2032,7 +2153,9 @@ class delta(Exchange, ImplicitAPI):
2032
2153
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2033
2154
  """
2034
2155
  fetch all trades made by the user
2035
- :see: https://docs.delta.exchange/#get-user-fills-by-filters
2156
+
2157
+ https://docs.delta.exchange/#get-user-fills-by-filters
2158
+
2036
2159
  :param str symbol: unified market symbol
2037
2160
  :param int [since]: the earliest time in ms to fetch trades for
2038
2161
  :param int [limit]: the maximum number of trades structures to retrieve
@@ -2040,7 +2163,7 @@ class delta(Exchange, ImplicitAPI):
2040
2163
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
2041
2164
  """
2042
2165
  self.load_markets()
2043
- request = {
2166
+ request: dict = {
2044
2167
  # 'product_ids': market['id'], # comma-separated
2045
2168
  # 'contract_types': types, # comma-separated, futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads
2046
2169
  # 'start_time': since * 1000,
@@ -2106,18 +2229,20 @@ class delta(Exchange, ImplicitAPI):
2106
2229
  result = self.safe_list(response, 'result', [])
2107
2230
  return self.parse_trades(result, market, since, limit)
2108
2231
 
2109
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2232
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2110
2233
  """
2111
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2112
- :see: https://docs.delta.exchange/#get-wallet-transactions
2113
- :param str code: unified currency code, default is None
2234
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2235
+
2236
+ https://docs.delta.exchange/#get-wallet-transactions
2237
+
2238
+ :param str [code]: unified currency code, default is None
2114
2239
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2115
- :param int [limit]: max number of ledger entrys to return, default is None
2240
+ :param int [limit]: max number of ledger entries to return, default is None
2116
2241
  :param dict [params]: extra parameters specific to the exchange API endpoint
2117
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2242
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2118
2243
  """
2119
2244
  self.load_markets()
2120
- request = {
2245
+ request: dict = {
2121
2246
  # 'asset_id': currency['numericId'],
2122
2247
  # 'end_time': self.seconds(),
2123
2248
  # 'after': 'string', # after cursor for pagination
@@ -2156,7 +2281,7 @@ class delta(Exchange, ImplicitAPI):
2156
2281
  return self.parse_ledger(result, currency, since, limit)
2157
2282
 
2158
2283
  def parse_ledger_entry_type(self, type):
2159
- types = {
2284
+ types: dict = {
2160
2285
  'pnl': 'pnl',
2161
2286
  'deposit': 'transaction',
2162
2287
  'withdrawal': 'transaction',
@@ -2170,7 +2295,7 @@ class delta(Exchange, ImplicitAPI):
2170
2295
  }
2171
2296
  return self.safe_string(types, type, type)
2172
2297
 
2173
- def parse_ledger_entry(self, item, currency: Currency = None):
2298
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2174
2299
  #
2175
2300
  # {
2176
2301
  # "amount":"29.889184",
@@ -2207,7 +2332,7 @@ class delta(Exchange, ImplicitAPI):
2207
2332
  after = self.safe_string(item, 'balance')
2208
2333
  before = Precise.string_max('0', Precise.string_sub(after, amount))
2209
2334
  status = 'ok'
2210
- return {
2335
+ return self.safe_ledger_entry({
2211
2336
  'info': item,
2212
2337
  'id': id,
2213
2338
  'direction': direction,
@@ -2223,9 +2348,9 @@ class delta(Exchange, ImplicitAPI):
2223
2348
  'timestamp': timestamp,
2224
2349
  'datetime': self.iso8601(timestamp),
2225
2350
  'fee': None,
2226
- }
2351
+ }, currency)
2227
2352
 
2228
- def fetch_deposit_address(self, code: str, params={}):
2353
+ def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
2229
2354
  """
2230
2355
  fetch the deposit address for a currency associated with self account
2231
2356
  :param str code: unified currency code
@@ -2235,7 +2360,7 @@ class delta(Exchange, ImplicitAPI):
2235
2360
  """
2236
2361
  self.load_markets()
2237
2362
  currency = self.currency(code)
2238
- request = {
2363
+ request: dict = {
2239
2364
  'asset_symbol': currency['id'],
2240
2365
  }
2241
2366
  networkCode = self.safe_string_upper(params, 'network')
@@ -2263,7 +2388,7 @@ class delta(Exchange, ImplicitAPI):
2263
2388
  result = self.safe_dict(response, 'result', {})
2264
2389
  return self.parse_deposit_address(result, currency)
2265
2390
 
2266
- def parse_deposit_address(self, depositAddress, currency: Currency = None):
2391
+ def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
2267
2392
  #
2268
2393
  # {
2269
2394
  # "id": 1915615,
@@ -2283,17 +2408,19 @@ class delta(Exchange, ImplicitAPI):
2283
2408
  networkId = self.safe_string(depositAddress, 'network')
2284
2409
  self.check_address(address)
2285
2410
  return {
2411
+ 'info': depositAddress,
2286
2412
  'currency': self.safe_currency_code(marketId, currency),
2413
+ 'network': self.network_id_to_code(networkId),
2287
2414
  'address': address,
2288
2415
  'tag': self.safe_string(depositAddress, 'memo'),
2289
- 'network': self.network_id_to_code(networkId),
2290
- 'info': depositAddress,
2291
2416
  }
2292
2417
 
2293
- def fetch_funding_rate(self, symbol: str, params={}):
2418
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2294
2419
  """
2295
2420
  fetch the current funding rate
2296
- :see: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
2421
+
2422
+ https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
2423
+
2297
2424
  :param str symbol: unified market symbol
2298
2425
  :param dict [params]: extra parameters specific to the exchange API endpoint
2299
2426
  :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -2302,7 +2429,7 @@ class delta(Exchange, ImplicitAPI):
2302
2429
  market = self.market(symbol)
2303
2430
  if not market['swap']:
2304
2431
  raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
2305
- request = {
2432
+ request: dict = {
2306
2433
  'symbol': market['id'],
2307
2434
  }
2308
2435
  response = self.publicGetTickersSymbol(self.extend(request, params))
@@ -2354,17 +2481,19 @@ class delta(Exchange, ImplicitAPI):
2354
2481
  result = self.safe_dict(response, 'result', {})
2355
2482
  return self.parse_funding_rate(result, market)
2356
2483
 
2357
- def fetch_funding_rates(self, symbols: Strings = None, params={}):
2484
+ def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
2358
2485
  """
2359
2486
  fetch the funding rate for multiple markets
2360
- :see: https://docs.delta.exchange/#get-tickers-for-products
2487
+
2488
+ https://docs.delta.exchange/#get-tickers-for-products
2489
+
2361
2490
  :param str[]|None symbols: list of unified market symbols
2362
2491
  :param dict [params]: extra parameters specific to the exchange API endpoint
2363
- :returns dict: a dictionary of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
2492
+ :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
2364
2493
  """
2365
2494
  self.load_markets()
2366
2495
  symbols = self.market_symbols(symbols)
2367
- request = {
2496
+ request: dict = {
2368
2497
  'contract_types': 'perpetual_futures',
2369
2498
  }
2370
2499
  response = self.publicGetTickers(self.extend(request, params))
@@ -2416,10 +2545,9 @@ class delta(Exchange, ImplicitAPI):
2416
2545
  # }
2417
2546
  #
2418
2547
  rates = self.safe_list(response, 'result', [])
2419
- result = self.parse_funding_rates(rates)
2420
- return self.filter_by_array(result, 'symbol', symbols)
2548
+ return self.parse_funding_rates(rates, symbols)
2421
2549
 
2422
- def parse_funding_rate(self, contract, market: Market = None):
2550
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2423
2551
  #
2424
2552
  # {
2425
2553
  # "close": 30600.5,
@@ -2484,12 +2612,15 @@ class delta(Exchange, ImplicitAPI):
2484
2612
  'previousFundingRate': None,
2485
2613
  'previousFundingTimestamp': None,
2486
2614
  'previousFundingDatetime': None,
2615
+ 'interval': None,
2487
2616
  }
2488
2617
 
2489
- def add_margin(self, symbol: str, amount, params={}):
2618
+ def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2490
2619
  """
2491
2620
  add margin
2492
- :see: https://docs.delta.exchange/#add-remove-position-margin
2621
+
2622
+ https://docs.delta.exchange/#add-remove-position-margin
2623
+
2493
2624
  :param str symbol: unified market symbol
2494
2625
  :param float amount: amount of margin to add
2495
2626
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2497,10 +2628,12 @@ class delta(Exchange, ImplicitAPI):
2497
2628
  """
2498
2629
  return self.modify_margin_helper(symbol, amount, 'add', params)
2499
2630
 
2500
- def reduce_margin(self, symbol: str, amount, params={}):
2631
+ def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
2501
2632
  """
2502
2633
  remove margin from a position
2503
- :see: https://docs.delta.exchange/#add-remove-position-margin
2634
+
2635
+ https://docs.delta.exchange/#add-remove-position-margin
2636
+
2504
2637
  :param str symbol: unified market symbol
2505
2638
  :param float amount: the amount of margin to remove
2506
2639
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2508,13 +2641,13 @@ class delta(Exchange, ImplicitAPI):
2508
2641
  """
2509
2642
  return self.modify_margin_helper(symbol, amount, 'reduce', params)
2510
2643
 
2511
- def modify_margin_helper(self, symbol: str, amount, type, params={}):
2644
+ def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
2512
2645
  self.load_markets()
2513
2646
  market = self.market(symbol)
2514
2647
  amount = str(amount)
2515
2648
  if type == 'reduce':
2516
2649
  amount = Precise.string_mul(amount, '-1')
2517
- request = {
2650
+ request: dict = {
2518
2651
  'product_id': market['numericId'],
2519
2652
  'delta_margin': amount,
2520
2653
  }
@@ -2545,7 +2678,7 @@ class delta(Exchange, ImplicitAPI):
2545
2678
  result = self.safe_dict(response, 'result', {})
2546
2679
  return self.parse_margin_modification(result, market)
2547
2680
 
2548
- def parse_margin_modification(self, data, market: Market = None):
2681
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
2549
2682
  #
2550
2683
  # {
2551
2684
  # "auto_topup": False,
@@ -2570,18 +2703,23 @@ class delta(Exchange, ImplicitAPI):
2570
2703
  market = self.safe_market(marketId, market)
2571
2704
  return {
2572
2705
  'info': data,
2706
+ 'symbol': market['symbol'],
2573
2707
  'type': None,
2708
+ 'marginMode': 'isolated',
2574
2709
  'amount': None,
2575
2710
  'total': self.safe_number(data, 'margin'),
2576
2711
  'code': None,
2577
- 'symbol': market['symbol'],
2578
2712
  'status': None,
2713
+ 'timestamp': None,
2714
+ 'datetime': None,
2579
2715
  }
2580
2716
 
2581
2717
  def fetch_open_interest(self, symbol: str, params={}):
2582
2718
  """
2583
2719
  retrieves the open interest of a derivative market
2584
- :see: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
2720
+
2721
+ https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
2722
+
2585
2723
  :param str symbol: unified market symbol
2586
2724
  :param dict [params]: exchange specific parameters
2587
2725
  :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
@@ -2590,7 +2728,7 @@ class delta(Exchange, ImplicitAPI):
2590
2728
  market = self.market(symbol)
2591
2729
  if not market['contract']:
2592
2730
  raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
2593
- request = {
2731
+ request: dict = {
2594
2732
  'symbol': market['id'],
2595
2733
  }
2596
2734
  response = self.publicGetTickersSymbol(self.extend(request, params))
@@ -2715,14 +2853,16 @@ class delta(Exchange, ImplicitAPI):
2715
2853
  def fetch_leverage(self, symbol: str, params={}) -> Leverage:
2716
2854
  """
2717
2855
  fetch the set leverage for a market
2718
- :see: https://docs.delta.exchange/#get-order-leverage
2856
+
2857
+ https://docs.delta.exchange/#get-order-leverage
2858
+
2719
2859
  :param str symbol: unified market symbol
2720
2860
  :param dict [params]: extra parameters specific to the exchange API endpoint
2721
2861
  :returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
2722
2862
  """
2723
2863
  self.load_markets()
2724
2864
  market = self.market(symbol)
2725
- request = {
2865
+ request: dict = {
2726
2866
  'product_id': market['numericId'],
2727
2867
  }
2728
2868
  response = self.privateGetProductsProductIdOrdersLeverage(self.extend(request, params))
@@ -2742,7 +2882,7 @@ class delta(Exchange, ImplicitAPI):
2742
2882
  result = self.safe_dict(response, 'result', {})
2743
2883
  return self.parse_leverage(result, market)
2744
2884
 
2745
- def parse_leverage(self, leverage, market=None) -> Leverage:
2885
+ def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
2746
2886
  marketId = self.safe_string(leverage, 'index_symbol')
2747
2887
  leverageValue = self.safe_integer(leverage, 'leverage')
2748
2888
  return {
@@ -2756,7 +2896,9 @@ class delta(Exchange, ImplicitAPI):
2756
2896
  def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2757
2897
  """
2758
2898
  set the level of leverage for a market
2759
- :see: https://docs.delta.exchange/#change-order-leverage
2899
+
2900
+ https://docs.delta.exchange/#change-order-leverage
2901
+
2760
2902
  :param float leverage: the rate of leverage
2761
2903
  :param str symbol: unified market symbol
2762
2904
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2766,7 +2908,7 @@ class delta(Exchange, ImplicitAPI):
2766
2908
  raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
2767
2909
  self.load_markets()
2768
2910
  market = self.market(symbol)
2769
- request = {
2911
+ request: dict = {
2770
2912
  'product_id': market['numericId'],
2771
2913
  'leverage': leverage,
2772
2914
  }
@@ -2786,7 +2928,9 @@ class delta(Exchange, ImplicitAPI):
2786
2928
  def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2787
2929
  """
2788
2930
  fetches historical settlement records
2789
- :see: https://docs.delta.exchange/#get-product-settlement-prices
2931
+
2932
+ https://docs.delta.exchange/#get-product-settlement-prices
2933
+
2790
2934
  :param str symbol: unified market symbol of the settlement history
2791
2935
  :param int [since]: timestamp in ms
2792
2936
  :param int [limit]: number of records
@@ -2797,7 +2941,7 @@ class delta(Exchange, ImplicitAPI):
2797
2941
  market = None
2798
2942
  if symbol is not None:
2799
2943
  market = self.market(symbol)
2800
- request = {
2944
+ request: dict = {
2801
2945
  'states': 'expired',
2802
2946
  }
2803
2947
  if limit is not None:
@@ -2939,14 +3083,16 @@ class delta(Exchange, ImplicitAPI):
2939
3083
  def fetch_greeks(self, symbol: str, params={}) -> Greeks:
2940
3084
  """
2941
3085
  fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
2942
- :see: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
3086
+
3087
+ https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
3088
+
2943
3089
  :param str symbol: unified symbol of the market to fetch greeks for
2944
3090
  :param dict [params]: extra parameters specific to the exchange API endpoint
2945
3091
  :returns dict: a `greeks structure <https://docs.ccxt.com/#/?id=greeks-structure>`
2946
3092
  """
2947
3093
  self.load_markets()
2948
3094
  market = self.market(symbol)
2949
- request = {
3095
+ request: dict = {
2950
3096
  'symbol': market['id'],
2951
3097
  }
2952
3098
  response = self.publicGetTickersSymbol(self.extend(request, params))
@@ -3005,7 +3151,7 @@ class delta(Exchange, ImplicitAPI):
3005
3151
  result = self.safe_dict(response, 'result', {})
3006
3152
  return self.parse_greeks(result, market)
3007
3153
 
3008
- def parse_greeks(self, greeks, market: Market = None):
3154
+ def parse_greeks(self, greeks: dict, market: Market = None) -> Greeks:
3009
3155
  #
3010
3156
  # {
3011
3157
  # "close": 6793.0,
@@ -3085,13 +3231,15 @@ class delta(Exchange, ImplicitAPI):
3085
3231
  def close_all_positions(self, params={}) -> List[Position]:
3086
3232
  """
3087
3233
  closes all open positions for a market type
3088
- :see: https://docs.delta.exchange/#close-all-positions
3234
+
3235
+ https://docs.delta.exchange/#close-all-positions
3236
+
3089
3237
  :param dict [params]: extra parameters specific to the exchange API endpoint
3090
3238
  :param int [params.user_id]: the users id
3091
3239
  :returns dict[]: A list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
3092
3240
  """
3093
3241
  self.load_markets()
3094
- request = {
3242
+ request: dict = {
3095
3243
  'close_all_portfolio': True,
3096
3244
  'close_all_isolated': True,
3097
3245
  # 'user_id': 12345,
@@ -3106,7 +3254,9 @@ class delta(Exchange, ImplicitAPI):
3106
3254
  def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
3107
3255
  """
3108
3256
  fetches the margin mode of a trading pair
3109
- :see: https://docs.delta.exchange/#get-user
3257
+
3258
+ https://docs.delta.exchange/#get-user
3259
+
3110
3260
  :param str symbol: unified symbol of the market to fetch the margin mode for
3111
3261
  :param dict [params]: extra parameters specific to the exchange API endpoint
3112
3262
  :returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
@@ -3182,7 +3332,7 @@ class delta(Exchange, ImplicitAPI):
3182
3332
  result = self.safe_dict(response, 'result', {})
3183
3333
  return self.parse_margin_mode(result, market)
3184
3334
 
3185
- def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
3335
+ def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
3186
3336
  symbol = None
3187
3337
  if market is not None:
3188
3338
  symbol = market['symbol']
@@ -3192,6 +3342,151 @@ class delta(Exchange, ImplicitAPI):
3192
3342
  'marginMode': self.safe_string(marginMode, 'margin_mode'),
3193
3343
  }
3194
3344
 
3345
+ def fetch_option(self, symbol: str, params={}) -> Option:
3346
+ """
3347
+ fetches option data that is commonly found in an option chain
3348
+
3349
+ https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
3350
+
3351
+ :param str symbol: unified market symbol
3352
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3353
+ :returns dict: an `option chain structure <https://docs.ccxt.com/#/?id=option-chain-structure>`
3354
+ """
3355
+ self.load_markets()
3356
+ market = self.market(symbol)
3357
+ request: dict = {
3358
+ 'symbol': market['id'],
3359
+ }
3360
+ response = self.publicGetTickersSymbol(self.extend(request, params))
3361
+ #
3362
+ # {
3363
+ # "result": {
3364
+ # "close": 6793.0,
3365
+ # "contract_type": "call_options",
3366
+ # "greeks": {
3367
+ # "delta": "0.94739174",
3368
+ # "gamma": "0.00002206",
3369
+ # "rho": "11.00890725",
3370
+ # "spot": "36839.58124652",
3371
+ # "theta": "-18.18365310",
3372
+ # "vega": "7.85209698"
3373
+ # },
3374
+ # "high": 7556.0,
3375
+ # "low": 6793.0,
3376
+ # "mark_price": "6955.70698909",
3377
+ # "mark_vol": "0.66916863",
3378
+ # "oi": "1.8980",
3379
+ # "oi_change_usd_6h": "110.4600",
3380
+ # "oi_contracts": "1898",
3381
+ # "oi_value": "1.8980",
3382
+ # "oi_value_symbol": "BTC",
3383
+ # "oi_value_usd": "69940.7319",
3384
+ # "open": 7.2e3,
3385
+ # "price_band": {
3386
+ # "lower_limit": "5533.89814767",
3387
+ # "upper_limit": "11691.37688371"
3388
+ # },
3389
+ # "product_id": 129508,
3390
+ # "quotes": {
3391
+ # "ask_iv": "0.90180438",
3392
+ # "ask_size": "1898",
3393
+ # "best_ask": "7210",
3394
+ # "best_bid": "6913",
3395
+ # "bid_iv": "0.60881706",
3396
+ # "bid_size": "3163",
3397
+ # "impact_mid_price": null,
3398
+ # "mark_iv": "0.66973549"
3399
+ # },
3400
+ # "size": 5,
3401
+ # "spot_price": "36839.58153868",
3402
+ # "strike_price": "30000",
3403
+ # "symbol": "C-BTC-30000-241123",
3404
+ # "timestamp": 1699584998504530,
3405
+ # "turnover": 184.41206804,
3406
+ # "turnover_symbol": "USDT",
3407
+ # "turnover_usd": 184.41206804,
3408
+ # "volume": 0.005
3409
+ # },
3410
+ # "success": True
3411
+ # }
3412
+ #
3413
+ result = self.safe_dict(response, 'result', {})
3414
+ return self.parse_option(result, None, market)
3415
+
3416
+ def parse_option(self, chain: dict, currency: Currency = None, market: Market = None) -> Option:
3417
+ #
3418
+ # {
3419
+ # "close": 6793.0,
3420
+ # "contract_type": "call_options",
3421
+ # "greeks": {
3422
+ # "delta": "0.94739174",
3423
+ # "gamma": "0.00002206",
3424
+ # "rho": "11.00890725",
3425
+ # "spot": "36839.58124652",
3426
+ # "theta": "-18.18365310",
3427
+ # "vega": "7.85209698"
3428
+ # },
3429
+ # "high": 7556.0,
3430
+ # "low": 6793.0,
3431
+ # "mark_price": "6955.70698909",
3432
+ # "mark_vol": "0.66916863",
3433
+ # "oi": "1.8980",
3434
+ # "oi_change_usd_6h": "110.4600",
3435
+ # "oi_contracts": "1898",
3436
+ # "oi_value": "1.8980",
3437
+ # "oi_value_symbol": "BTC",
3438
+ # "oi_value_usd": "69940.7319",
3439
+ # "open": 7.2e3,
3440
+ # "price_band": {
3441
+ # "lower_limit": "5533.89814767",
3442
+ # "upper_limit": "11691.37688371"
3443
+ # },
3444
+ # "product_id": 129508,
3445
+ # "quotes": {
3446
+ # "ask_iv": "0.90180438",
3447
+ # "ask_size": "1898",
3448
+ # "best_ask": "7210",
3449
+ # "best_bid": "6913",
3450
+ # "bid_iv": "0.60881706",
3451
+ # "bid_size": "3163",
3452
+ # "impact_mid_price": null,
3453
+ # "mark_iv": "0.66973549"
3454
+ # },
3455
+ # "size": 5,
3456
+ # "spot_price": "36839.58153868",
3457
+ # "strike_price": "30000",
3458
+ # "symbol": "C-BTC-30000-241123",
3459
+ # "timestamp": 1699584998504530,
3460
+ # "turnover": 184.41206804,
3461
+ # "turnover_symbol": "USDT",
3462
+ # "turnover_usd": 184.41206804,
3463
+ # "volume": 0.005
3464
+ # }
3465
+ #
3466
+ marketId = self.safe_string(chain, 'symbol')
3467
+ market = self.safe_market(marketId, market)
3468
+ quotes = self.safe_dict(chain, 'quotes', {})
3469
+ timestamp = self.safe_integer_product(chain, 'timestamp', 0.001)
3470
+ return {
3471
+ 'info': chain,
3472
+ 'currency': None,
3473
+ 'symbol': market['symbol'],
3474
+ 'timestamp': timestamp,
3475
+ 'datetime': self.iso8601(timestamp),
3476
+ 'impliedVolatility': self.safe_number(quotes, 'mark_iv'),
3477
+ 'openInterest': self.safe_number(chain, 'oi'),
3478
+ 'bidPrice': self.safe_number(quotes, 'best_bid'),
3479
+ 'askPrice': self.safe_number(quotes, 'best_ask'),
3480
+ 'midPrice': self.safe_number(quotes, 'impact_mid_price'),
3481
+ 'markPrice': self.safe_number(chain, 'mark_price'),
3482
+ 'lastPrice': None,
3483
+ 'underlyingPrice': self.safe_number(chain, 'spot_price'),
3484
+ 'change': None,
3485
+ 'percentage': None,
3486
+ 'baseVolume': self.safe_number(chain, 'volume'),
3487
+ 'quoteVolume': None,
3488
+ }
3489
+
3195
3490
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
3196
3491
  requestPath = '/' + self.version + '/' + self.implode_params(path, params)
3197
3492
  url = self.urls['api'][api] + requestPath
@@ -3207,7 +3502,7 @@ class delta(Exchange, ImplicitAPI):
3207
3502
  'timestamp': timestamp,
3208
3503
  }
3209
3504
  auth = method + timestamp + requestPath
3210
- if (method == 'GET') or (method == 'DELETE'):
3505
+ if method == 'GET':
3211
3506
  if query:
3212
3507
  queryString = '?' + self.urlencode(query)
3213
3508
  auth += queryString
@@ -3220,7 +3515,7 @@ class delta(Exchange, ImplicitAPI):
3220
3515
  headers['signature'] = signature
3221
3516
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3222
3517
 
3223
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
3518
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
3224
3519
  if response is None:
3225
3520
  return None
3226
3521
  #