ccxt-ir 4.3.46.0.3__py2.py3-none-any.whl → 4.5.0__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 (529) hide show
  1. ccxt/__init__.py +39 -35
  2. ccxt/abantether.py +8 -8
  3. ccxt/abstract/alpaca.py +4 -0
  4. ccxt/abstract/apex.py +31 -0
  5. ccxt/abstract/bigone.py +1 -1
  6. ccxt/abstract/binance.py +106 -48
  7. ccxt/abstract/binancecoinm.py +106 -48
  8. ccxt/abstract/binanceus.py +141 -83
  9. ccxt/abstract/binanceusdm.py +106 -48
  10. ccxt/abstract/bingx.py +50 -1
  11. ccxt/abstract/bitbank.py +5 -0
  12. ccxt/abstract/bitfinex.py +136 -65
  13. ccxt/abstract/bitflyer.py +1 -0
  14. ccxt/abstract/bitget.py +67 -0
  15. ccxt/abstract/bitmart.py +19 -1
  16. ccxt/abstract/bitopro.py +1 -0
  17. ccxt/abstract/bitrue.py +68 -68
  18. ccxt/abstract/bitstamp.py +1 -0
  19. ccxt/abstract/blofin.py +30 -0
  20. ccxt/abstract/btcbox.py +2 -0
  21. ccxt/abstract/bybit.py +28 -13
  22. ccxt/abstract/cex.py +28 -29
  23. ccxt/abstract/coinbaseexchange.py +1 -0
  24. ccxt/abstract/coinbaseinternational.py +1 -1
  25. ccxt/abstract/cryptocom.py +16 -0
  26. ccxt/abstract/cryptomus.py +20 -0
  27. ccxt/abstract/defx.py +69 -0
  28. ccxt/abstract/deribit.py +1 -0
  29. ccxt/abstract/derive.py +117 -0
  30. ccxt/abstract/digifinex.py +1 -0
  31. ccxt/abstract/ellipx.py +25 -0
  32. ccxt/abstract/foxbit.py +26 -0
  33. ccxt/abstract/gate.py +19 -0
  34. ccxt/abstract/gateio.py +19 -0
  35. ccxt/abstract/gemini.py +1 -0
  36. ccxt/abstract/hibachi.py +26 -0
  37. ccxt/abstract/hyperliquid.py +1 -1
  38. ccxt/abstract/independentreserve.py +6 -0
  39. ccxt/abstract/kraken.py +1 -0
  40. ccxt/abstract/krakenfutures.py +4 -0
  41. ccxt/abstract/kucoin.py +10 -0
  42. ccxt/abstract/kucoinfutures.py +18 -0
  43. ccxt/abstract/lbank.py +2 -1
  44. ccxt/abstract/luno.py +1 -0
  45. ccxt/abstract/mexc.py +2 -0
  46. ccxt/abstract/modetrade.py +119 -0
  47. ccxt/abstract/myokx.py +349 -0
  48. ccxt/abstract/oceanex.py +5 -0
  49. ccxt/abstract/okx.py +25 -0
  50. ccxt/abstract/okxus.py +349 -0
  51. ccxt/abstract/onetrading.py +0 -12
  52. ccxt/abstract/paradex.py +23 -0
  53. ccxt/abstract/phemex.py +2 -0
  54. ccxt/abstract/poloniex.py +36 -0
  55. ccxt/abstract/tradeogre.py +3 -1
  56. ccxt/abstract/upbit.py +51 -34
  57. ccxt/abstract/whitebit.py +16 -0
  58. ccxt/abstract/woo.py +64 -6
  59. ccxt/abstract/xt.py +10 -5
  60. ccxt/afratether.py +7 -7
  61. ccxt/alpaca.py +828 -51
  62. ccxt/apex.py +1875 -0
  63. ccxt/arzinja.py +7 -7
  64. ccxt/arzplus.py +9 -9
  65. ccxt/ascendex.py +501 -306
  66. ccxt/async_support/__init__.py +39 -35
  67. ccxt/async_support/abantether.py +8 -8
  68. ccxt/async_support/afratether.py +9 -9
  69. ccxt/async_support/alpaca.py +828 -51
  70. ccxt/async_support/apex.py +1875 -0
  71. ccxt/async_support/arzinja.py +10 -10
  72. ccxt/async_support/arzplus.py +12 -12
  73. ccxt/async_support/ascendex.py +502 -306
  74. ccxt/async_support/base/exchange.py +303 -89
  75. ccxt/async_support/base/ws/cache.py +9 -3
  76. ccxt/async_support/base/ws/client.py +173 -38
  77. ccxt/async_support/base/ws/future.py +25 -37
  78. ccxt/async_support/bequant.py +5 -3
  79. ccxt/async_support/bigone.py +279 -144
  80. ccxt/async_support/binance.py +2347 -1158
  81. ccxt/async_support/binancecoinm.py +9 -3
  82. ccxt/async_support/binanceus.py +17 -3
  83. ccxt/async_support/binanceusdm.py +9 -4
  84. ccxt/async_support/bingx.py +2962 -920
  85. ccxt/async_support/bit2c.py +147 -27
  86. ccxt/async_support/bitbank.py +151 -23
  87. ccxt/async_support/bitbns.py +104 -30
  88. ccxt/async_support/bitfinex.py +3291 -1113
  89. ccxt/async_support/bitflyer.py +202 -27
  90. ccxt/async_support/bitget.py +3683 -1538
  91. ccxt/async_support/bithumb.py +195 -38
  92. ccxt/async_support/bitimen.py +12 -12
  93. ccxt/async_support/bitir.py +38 -38
  94. ccxt/async_support/bitmart.py +1288 -350
  95. ccxt/async_support/bitmex.py +260 -75
  96. ccxt/async_support/bitopro.py +262 -62
  97. ccxt/async_support/bitpin.py +17 -16
  98. ccxt/async_support/bitrue.py +459 -290
  99. ccxt/async_support/bitso.py +199 -54
  100. ccxt/async_support/bitstamp.py +230 -96
  101. ccxt/async_support/bitteam.py +167 -25
  102. ccxt/async_support/{huobijp.py → bittrade.py} +158 -30
  103. ccxt/async_support/bitvavo.py +213 -49
  104. ccxt/async_support/blockchaincom.py +160 -46
  105. ccxt/async_support/blofin.py +502 -120
  106. ccxt/async_support/btcalpha.py +169 -31
  107. ccxt/async_support/btcbox.py +292 -23
  108. ccxt/async_support/btcmarkets.py +211 -58
  109. ccxt/async_support/btcturk.py +161 -38
  110. ccxt/async_support/bybit.py +1775 -1030
  111. ccxt/async_support/cex.py +1440 -1303
  112. ccxt/async_support/coinbase.py +724 -212
  113. ccxt/async_support/coinbaseadvanced.py +2 -1
  114. ccxt/async_support/coinbaseexchange.py +388 -89
  115. ccxt/async_support/coinbaseinternational.py +412 -57
  116. ccxt/async_support/coincatch.py +177 -78
  117. ccxt/async_support/coincheck.py +135 -19
  118. ccxt/async_support/coinex.py +606 -232
  119. ccxt/async_support/coinmate.py +189 -63
  120. ccxt/async_support/coinmetro.py +195 -54
  121. ccxt/async_support/coinone.py +158 -51
  122. ccxt/async_support/coinsph.py +336 -61
  123. ccxt/async_support/coinspot.py +151 -52
  124. ccxt/async_support/cryptocom.py +661 -111
  125. ccxt/async_support/cryptomus.py +1137 -0
  126. ccxt/async_support/defx.py +2071 -0
  127. ccxt/async_support/delta.py +299 -99
  128. ccxt/async_support/deribit.py +348 -126
  129. ccxt/async_support/derive.py +2572 -0
  130. ccxt/async_support/digifinex.py +430 -214
  131. ccxt/async_support/ellipx.py +2029 -0
  132. ccxt/async_support/eterex.py +10 -10
  133. ccxt/async_support/excoino.py +31 -31
  134. ccxt/async_support/exir.py +14 -14
  135. ccxt/async_support/exmo.py +344 -131
  136. ccxt/async_support/exnovin.py +10 -10
  137. ccxt/async_support/farhadexchange.py +12 -12
  138. ccxt/async_support/fmfwio.py +2 -1
  139. ccxt/async_support/foxbit.py +1935 -0
  140. ccxt/async_support/gate.py +1351 -529
  141. ccxt/async_support/gateio.py +2 -1
  142. ccxt/async_support/gemini.py +144 -39
  143. ccxt/async_support/hashkey.py +152 -109
  144. ccxt/async_support/hibachi.py +2080 -0
  145. ccxt/async_support/hitbtc.py +395 -167
  146. ccxt/async_support/hitobit.py +12 -12
  147. ccxt/async_support/hollaex.py +307 -119
  148. ccxt/async_support/htx.py +851 -383
  149. ccxt/async_support/huobi.py +2 -1
  150. ccxt/async_support/hyperliquid.py +1848 -536
  151. ccxt/async_support/independentreserve.py +288 -15
  152. ccxt/async_support/indodax.py +190 -33
  153. ccxt/async_support/jibitex.py +12 -12
  154. ccxt/async_support/kraken.py +795 -351
  155. ccxt/async_support/krakenfutures.py +214 -62
  156. ccxt/async_support/kucoin.py +715 -396
  157. ccxt/async_support/kucoinfutures.py +652 -89
  158. ccxt/async_support/latoken.py +217 -113
  159. ccxt/async_support/lbank.py +425 -97
  160. ccxt/async_support/luno.py +382 -35
  161. ccxt/async_support/mercado.py +113 -6
  162. ccxt/async_support/mexc.py +874 -437
  163. ccxt/async_support/modetrade.py +2818 -0
  164. ccxt/async_support/myokx.py +54 -0
  165. ccxt/async_support/ndax.py +221 -64
  166. ccxt/async_support/nobitex.py +31 -37
  167. ccxt/async_support/novadax.py +190 -34
  168. ccxt/async_support/oceanex.py +217 -28
  169. ccxt/async_support/okcoin.py +253 -145
  170. ccxt/async_support/okexchange.py +11 -11
  171. ccxt/async_support/okx.py +1088 -351
  172. ccxt/async_support/okxus.py +54 -0
  173. ccxt/async_support/ompfinex.py +25 -24
  174. ccxt/async_support/onetrading.py +213 -392
  175. ccxt/async_support/oxfun.py +245 -166
  176. ccxt/async_support/p2b.py +151 -29
  177. ccxt/async_support/paradex.py +562 -49
  178. ccxt/async_support/paymium.py +82 -19
  179. ccxt/async_support/phemex.py +713 -172
  180. ccxt/async_support/poloniex.py +1602 -283
  181. ccxt/async_support/probit.py +224 -95
  182. ccxt/async_support/ramzinex.py +30 -27
  183. ccxt/async_support/sarmayex.py +9 -9
  184. ccxt/async_support/sarrafex.py +13 -13
  185. ccxt/async_support/tabdeal.py +14 -13
  186. ccxt/async_support/tetherland.py +9 -9
  187. ccxt/async_support/timex.py +210 -51
  188. ccxt/async_support/tokocrypto.py +167 -47
  189. ccxt/async_support/tradeogre.py +266 -31
  190. ccxt/async_support/twox.py +9 -9
  191. ccxt/async_support/ubitex.py +12 -12
  192. ccxt/async_support/upbit.py +568 -165
  193. ccxt/async_support/vertex.py +160 -32
  194. ccxt/async_support/wallex.py +12 -12
  195. ccxt/async_support/wavesexchange.py +165 -30
  196. ccxt/async_support/whitebit.py +975 -127
  197. ccxt/async_support/woo.py +1918 -1016
  198. ccxt/async_support/woofipro.py +433 -141
  199. ccxt/async_support/xt.py +649 -193
  200. ccxt/async_support/yobit.py +195 -70
  201. ccxt/async_support/zaif.py +91 -15
  202. ccxt/async_support/zonda.py +151 -36
  203. ccxt/base/decimal_to_precision.py +14 -10
  204. ccxt/base/errors.py +49 -18
  205. ccxt/base/exchange.py +1556 -450
  206. ccxt/base/precise.py +10 -0
  207. ccxt/base/types.py +114 -6
  208. ccxt/bequant.py +5 -3
  209. ccxt/bigone.py +279 -144
  210. ccxt/binance.py +2347 -1158
  211. ccxt/binancecoinm.py +9 -3
  212. ccxt/binanceus.py +17 -3
  213. ccxt/binanceusdm.py +9 -4
  214. ccxt/bingx.py +2962 -920
  215. ccxt/bit2c.py +147 -27
  216. ccxt/bitbank.py +151 -23
  217. ccxt/bitbns.py +104 -30
  218. ccxt/bitfinex.py +3290 -1113
  219. ccxt/bitflyer.py +202 -27
  220. ccxt/bitget.py +3683 -1538
  221. ccxt/bithumb.py +194 -38
  222. ccxt/bitimen.py +9 -9
  223. ccxt/bitir.py +35 -35
  224. ccxt/bitmart.py +1288 -350
  225. ccxt/bitmex.py +260 -75
  226. ccxt/bitopro.py +262 -62
  227. ccxt/bitpin.py +15 -14
  228. ccxt/bitrue.py +459 -290
  229. ccxt/bitso.py +199 -54
  230. ccxt/bitstamp.py +230 -96
  231. ccxt/bitteam.py +167 -25
  232. ccxt/{huobijp.py → bittrade.py} +158 -30
  233. ccxt/bitvavo.py +213 -49
  234. ccxt/blockchaincom.py +160 -46
  235. ccxt/blofin.py +502 -120
  236. ccxt/btcalpha.py +169 -31
  237. ccxt/btcbox.py +291 -23
  238. ccxt/btcmarkets.py +211 -58
  239. ccxt/btcturk.py +161 -38
  240. ccxt/bybit.py +1775 -1030
  241. ccxt/cex.py +1439 -1303
  242. ccxt/coinbase.py +724 -212
  243. ccxt/coinbaseadvanced.py +2 -1
  244. ccxt/coinbaseexchange.py +388 -89
  245. ccxt/coinbaseinternational.py +412 -57
  246. ccxt/coincatch.py +177 -78
  247. ccxt/coincheck.py +135 -19
  248. ccxt/coinex.py +606 -232
  249. ccxt/coinmate.py +189 -63
  250. ccxt/coinmetro.py +194 -54
  251. ccxt/coinone.py +158 -51
  252. ccxt/coinsph.py +336 -61
  253. ccxt/coinspot.py +151 -52
  254. ccxt/cryptocom.py +661 -111
  255. ccxt/cryptomus.py +1137 -0
  256. ccxt/defx.py +2070 -0
  257. ccxt/delta.py +299 -99
  258. ccxt/deribit.py +348 -126
  259. ccxt/derive.py +2571 -0
  260. ccxt/digifinex.py +430 -214
  261. ccxt/ellipx.py +2029 -0
  262. ccxt/eterex.py +7 -7
  263. ccxt/excoino.py +29 -29
  264. ccxt/exir.py +11 -11
  265. ccxt/exmo.py +343 -131
  266. ccxt/exnovin.py +8 -8
  267. ccxt/farhadexchange.py +10 -10
  268. ccxt/fmfwio.py +2 -1
  269. ccxt/foxbit.py +1935 -0
  270. ccxt/gate.py +1351 -529
  271. ccxt/gateio.py +2 -1
  272. ccxt/gemini.py +144 -39
  273. ccxt/hashkey.py +152 -109
  274. ccxt/hibachi.py +2079 -0
  275. ccxt/hitbtc.py +395 -167
  276. ccxt/hitobit.py +9 -9
  277. ccxt/hollaex.py +307 -119
  278. ccxt/htx.py +851 -383
  279. ccxt/huobi.py +2 -1
  280. ccxt/hyperliquid.py +1848 -536
  281. ccxt/independentreserve.py +287 -15
  282. ccxt/indodax.py +190 -33
  283. ccxt/jibitex.py +9 -9
  284. ccxt/kraken.py +794 -351
  285. ccxt/krakenfutures.py +214 -62
  286. ccxt/kucoin.py +715 -396
  287. ccxt/kucoinfutures.py +652 -89
  288. ccxt/latoken.py +217 -113
  289. ccxt/lbank.py +425 -97
  290. ccxt/luno.py +382 -35
  291. ccxt/mercado.py +113 -6
  292. ccxt/mexc.py +873 -437
  293. ccxt/modetrade.py +2818 -0
  294. ccxt/myokx.py +54 -0
  295. ccxt/ndax.py +221 -64
  296. ccxt/nobitex.py +29 -35
  297. ccxt/novadax.py +190 -34
  298. ccxt/oceanex.py +217 -28
  299. ccxt/okcoin.py +253 -145
  300. ccxt/okexchange.py +9 -9
  301. ccxt/okx.py +1088 -351
  302. ccxt/okxus.py +54 -0
  303. ccxt/ompfinex.py +22 -21
  304. ccxt/onetrading.py +213 -392
  305. ccxt/oxfun.py +245 -166
  306. ccxt/p2b.py +151 -29
  307. ccxt/paradex.py +562 -49
  308. ccxt/paymium.py +82 -19
  309. ccxt/phemex.py +712 -172
  310. ccxt/poloniex.py +1601 -283
  311. ccxt/pro/__init__.py +76 -17
  312. ccxt/pro/alpaca.py +21 -6
  313. ccxt/pro/apex.py +984 -0
  314. ccxt/pro/ascendex.py +58 -10
  315. ccxt/pro/bequant.py +6 -1
  316. ccxt/pro/binance.py +728 -156
  317. ccxt/pro/binancecoinm.py +6 -2
  318. ccxt/pro/binanceus.py +8 -4
  319. ccxt/pro/binanceusdm.py +7 -2
  320. ccxt/pro/bingx.py +333 -142
  321. ccxt/pro/bitfinex.py +727 -262
  322. ccxt/pro/bitget.py +570 -79
  323. ccxt/pro/bithumb.py +20 -6
  324. ccxt/pro/bitmart.py +216 -87
  325. ccxt/pro/bitmex.py +47 -9
  326. ccxt/pro/bitopro.py +26 -14
  327. ccxt/pro/bitrue.py +22 -22
  328. ccxt/pro/bitstamp.py +54 -21
  329. ccxt/pro/{huobijp.py → bittrade.py} +7 -6
  330. ccxt/pro/bitvavo.py +191 -67
  331. ccxt/pro/blockchaincom.py +21 -8
  332. ccxt/pro/blofin.py +9 -1
  333. ccxt/pro/bybit.py +632 -245
  334. ccxt/pro/cex.py +59 -24
  335. ccxt/pro/coinbase.py +102 -73
  336. ccxt/pro/coinbaseadvanced.py +2 -1
  337. ccxt/pro/coinbaseexchange.py +8 -8
  338. ccxt/pro/coinbaseinternational.py +181 -25
  339. ccxt/pro/coincatch.py +6 -7
  340. ccxt/pro/coincheck.py +11 -6
  341. ccxt/pro/coinex.py +967 -665
  342. ccxt/pro/coinone.py +16 -9
  343. ccxt/pro/cryptocom.py +448 -45
  344. ccxt/pro/defx.py +831 -0
  345. ccxt/pro/deribit.py +150 -14
  346. ccxt/pro/derive.py +704 -0
  347. ccxt/pro/exmo.py +239 -6
  348. ccxt/pro/gate.py +623 -65
  349. ccxt/pro/gateio.py +2 -1
  350. ccxt/pro/gemini.py +27 -11
  351. ccxt/pro/hashkey.py +2 -2
  352. ccxt/pro/hitbtc.py +196 -91
  353. ccxt/pro/hollaex.py +23 -7
  354. ccxt/pro/htx.py +51 -14
  355. ccxt/pro/huobi.py +2 -1
  356. ccxt/pro/hyperliquid.py +591 -27
  357. ccxt/pro/independentreserve.py +9 -6
  358. ccxt/pro/kraken.py +640 -320
  359. ccxt/pro/krakenfutures.py +62 -35
  360. ccxt/pro/kucoin.py +267 -46
  361. ccxt/pro/kucoinfutures.py +165 -21
  362. ccxt/pro/lbank.py +102 -21
  363. ccxt/pro/luno.py +12 -8
  364. ccxt/pro/mexc.py +877 -111
  365. ccxt/pro/modetrade.py +1271 -0
  366. ccxt/pro/myokx.py +38 -0
  367. ccxt/pro/ndax.py +15 -2
  368. ccxt/pro/okcoin.py +23 -4
  369. ccxt/pro/okx.py +573 -98
  370. ccxt/pro/okxus.py +38 -0
  371. ccxt/pro/onetrading.py +30 -13
  372. ccxt/pro/oxfun.py +131 -27
  373. ccxt/pro/p2b.py +88 -22
  374. ccxt/pro/paradex.py +3 -3
  375. ccxt/pro/phemex.py +75 -21
  376. ccxt/pro/poloniex.py +124 -41
  377. ccxt/pro/probit.py +87 -80
  378. ccxt/pro/tradeogre.py +272 -0
  379. ccxt/pro/upbit.py +152 -12
  380. ccxt/pro/vertex.py +8 -3
  381. ccxt/pro/whitebit.py +58 -5
  382. ccxt/pro/woo.py +228 -37
  383. ccxt/pro/woofipro.py +106 -18
  384. ccxt/pro/xt.py +111 -5
  385. ccxt/probit.py +224 -95
  386. ccxt/protobuf/__init__.py +0 -0
  387. ccxt/protobuf/mexc/PrivateAccountV3Api_pb2.py +37 -0
  388. ccxt/protobuf/mexc/PrivateDealsV3Api_pb2.py +37 -0
  389. ccxt/protobuf/mexc/PrivateOrdersV3Api_pb2.py +37 -0
  390. ccxt/protobuf/mexc/PublicAggreBookTickerV3Api_pb2.py +37 -0
  391. ccxt/protobuf/mexc/PublicAggreDealsV3Api_pb2.py +39 -0
  392. ccxt/protobuf/mexc/PublicAggreDepthsV3Api_pb2.py +39 -0
  393. ccxt/protobuf/mexc/PublicBookTickerBatchV3Api_pb2.py +38 -0
  394. ccxt/protobuf/mexc/PublicBookTickerV3Api_pb2.py +37 -0
  395. ccxt/protobuf/mexc/PublicDealsV3Api_pb2.py +39 -0
  396. ccxt/protobuf/mexc/PublicIncreaseDepthsBatchV3Api_pb2.py +38 -0
  397. ccxt/protobuf/mexc/PublicIncreaseDepthsV3Api_pb2.py +39 -0
  398. ccxt/protobuf/mexc/PublicLimitDepthsV3Api_pb2.py +39 -0
  399. ccxt/protobuf/mexc/PublicMiniTickerV3Api_pb2.py +37 -0
  400. ccxt/protobuf/mexc/PublicMiniTickersV3Api_pb2.py +38 -0
  401. ccxt/protobuf/mexc/PublicSpotKlineV3Api_pb2.py +37 -0
  402. ccxt/protobuf/mexc/PushDataV3ApiWrapper_pb2.py +52 -0
  403. ccxt/protobuf/mexc/__init__.py +0 -0
  404. ccxt/ramzinex.py +28 -25
  405. ccxt/sarmayex.py +7 -7
  406. ccxt/sarrafex.py +10 -10
  407. ccxt/static_dependencies/__init__.py +1 -1
  408. ccxt/static_dependencies/lark/py.typed +0 -0
  409. ccxt/static_dependencies/marshmallow/py.typed +0 -0
  410. ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
  411. ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
  412. ccxt/tabdeal.py +12 -11
  413. ccxt/test/tests_async.py +261 -57
  414. ccxt/test/tests_helpers.py +1 -3
  415. ccxt/test/tests_init.py +4 -3
  416. ccxt/test/tests_sync.py +261 -57
  417. ccxt/tetherland.py +7 -7
  418. ccxt/timex.py +210 -51
  419. ccxt/tokocrypto.py +167 -47
  420. ccxt/tradeogre.py +266 -31
  421. ccxt/twox.py +7 -7
  422. ccxt/ubitex.py +9 -9
  423. ccxt/upbit.py +568 -165
  424. ccxt/vertex.py +160 -32
  425. ccxt/wallex.py +9 -9
  426. ccxt/wavesexchange.py +165 -30
  427. ccxt/whitebit.py +975 -127
  428. ccxt/woo.py +1917 -1016
  429. ccxt/woofipro.py +432 -141
  430. ccxt/xt.py +649 -193
  431. ccxt/yobit.py +194 -70
  432. ccxt/zaif.py +91 -15
  433. ccxt/zonda.py +151 -36
  434. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/METADATA +225 -73
  435. ccxt_ir-4.5.0.dist-info/RECORD +743 -0
  436. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/WHEEL +1 -1
  437. ccxt/__test__.py +0 -7
  438. ccxt/abstract/ace.py +0 -15
  439. ccxt/abstract/bitbay.py +0 -53
  440. ccxt/abstract/bitcoincom.py +0 -115
  441. ccxt/abstract/bitfinex2.py +0 -139
  442. ccxt/abstract/bitpanda.py +0 -35
  443. ccxt/abstract/bl3p.py +0 -19
  444. ccxt/abstract/coinlist.py +0 -54
  445. ccxt/abstract/currencycom.py +0 -68
  446. ccxt/abstract/hitbtc3.py +0 -115
  447. ccxt/abstract/idex.py +0 -26
  448. ccxt/abstract/kuna.py +0 -182
  449. ccxt/abstract/lykke.py +0 -29
  450. ccxt/abstract/poloniexfutures.py +0 -48
  451. ccxt/abstract/wazirx.py +0 -30
  452. ccxt/ace.py +0 -1012
  453. ccxt/async_support/ace.py +0 -1012
  454. ccxt/async_support/base/ws/aiohttp_client.py +0 -125
  455. ccxt/async_support/base/ws/fast_client.py +0 -96
  456. ccxt/async_support/bitbay.py +0 -17
  457. ccxt/async_support/bitcoincom.py +0 -17
  458. ccxt/async_support/bitfinex2.py +0 -3552
  459. ccxt/async_support/bitpanda.py +0 -16
  460. ccxt/async_support/bl3p.py +0 -485
  461. ccxt/async_support/coinlist.py +0 -2243
  462. ccxt/async_support/currencycom.py +0 -1950
  463. ccxt/async_support/hitbtc3.py +0 -16
  464. ccxt/async_support/idex.py +0 -1766
  465. ccxt/async_support/kuna.py +0 -1841
  466. ccxt/async_support/lykke.py +0 -1270
  467. ccxt/async_support/poloniexfutures.py +0 -1717
  468. ccxt/async_support/wazirx.py +0 -1224
  469. ccxt/bitbay.py +0 -17
  470. ccxt/bitcoincom.py +0 -17
  471. ccxt/bitfinex2.py +0 -3552
  472. ccxt/bitpanda.py +0 -16
  473. ccxt/bl3p.py +0 -485
  474. ccxt/coinlist.py +0 -2243
  475. ccxt/currencycom.py +0 -1950
  476. ccxt/hitbtc3.py +0 -16
  477. ccxt/idex.py +0 -1766
  478. ccxt/kuna.py +0 -1841
  479. ccxt/lykke.py +0 -1270
  480. ccxt/poloniexfutures.py +0 -1717
  481. ccxt/pro/bitcoincom.py +0 -34
  482. ccxt/pro/bitfinex2.py +0 -1083
  483. ccxt/pro/bitpanda.py +0 -15
  484. ccxt/pro/currencycom.py +0 -536
  485. ccxt/pro/idex.py +0 -672
  486. ccxt/pro/poloniexfutures.py +0 -990
  487. ccxt/pro/wazirx.py +0 -749
  488. ccxt/test/base/__init__.py +0 -29
  489. ccxt/test/base/test_account.py +0 -26
  490. ccxt/test/base/test_balance.py +0 -56
  491. ccxt/test/base/test_borrow_interest.py +0 -35
  492. ccxt/test/base/test_borrow_rate.py +0 -32
  493. ccxt/test/base/test_calculate_fee.py +0 -51
  494. ccxt/test/base/test_crypto.py +0 -127
  495. ccxt/test/base/test_currency.py +0 -76
  496. ccxt/test/base/test_datetime.py +0 -109
  497. ccxt/test/base/test_decimal_to_precision.py +0 -392
  498. ccxt/test/base/test_deep_extend.py +0 -68
  499. ccxt/test/base/test_deposit_withdrawal.py +0 -50
  500. ccxt/test/base/test_exchange_datetime_functions.py +0 -76
  501. ccxt/test/base/test_funding_rate_history.py +0 -29
  502. ccxt/test/base/test_last_price.py +0 -31
  503. ccxt/test/base/test_ledger_entry.py +0 -45
  504. ccxt/test/base/test_ledger_item.py +0 -48
  505. ccxt/test/base/test_leverage_tier.py +0 -33
  506. ccxt/test/base/test_liquidation.py +0 -50
  507. ccxt/test/base/test_margin_mode.py +0 -24
  508. ccxt/test/base/test_margin_modification.py +0 -35
  509. ccxt/test/base/test_market.py +0 -193
  510. ccxt/test/base/test_number.py +0 -411
  511. ccxt/test/base/test_ohlcv.py +0 -33
  512. ccxt/test/base/test_open_interest.py +0 -32
  513. ccxt/test/base/test_order.py +0 -64
  514. ccxt/test/base/test_order_book.py +0 -69
  515. ccxt/test/base/test_position.py +0 -60
  516. ccxt/test/base/test_shared_methods.py +0 -353
  517. ccxt/test/base/test_status.py +0 -24
  518. ccxt/test/base/test_throttle.py +0 -126
  519. ccxt/test/base/test_ticker.py +0 -92
  520. ccxt/test/base/test_trade.py +0 -47
  521. ccxt/test/base/test_trading_fee.py +0 -26
  522. ccxt/test/base/test_transaction.py +0 -39
  523. ccxt/test/test_async.py +0 -1649
  524. ccxt/test/test_sync.py +0 -1648
  525. ccxt/wazirx.py +0 -1224
  526. ccxt_ir-4.3.46.0.3.dist-info/RECORD +0 -773
  527. /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
  528. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info/licenses}/LICENSE.txt +0 -0
  529. {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/top_level.txt +0 -0
ccxt/kuna.py DELETED
@@ -1,1841 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
-
6
- from ccxt.base.exchange import Exchange
7
- from ccxt.abstract.kuna import ImplicitAPI
8
- import hashlib
9
- import json
10
- from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
11
- from typing import List
12
- from ccxt.base.errors import ExchangeError
13
- from ccxt.base.errors import ArgumentsRequired
14
- from ccxt.base.errors import BadRequest
15
- from ccxt.base.errors import InsufficientFunds
16
- from ccxt.base.errors import InvalidOrder
17
- from ccxt.base.errors import OrderNotFound
18
- from ccxt.base.errors import NotSupported
19
- from ccxt.base.decimal_to_precision import TICK_SIZE
20
- from ccxt.base.precise import Precise
21
-
22
-
23
- class kuna(Exchange, ImplicitAPI):
24
-
25
- def describe(self):
26
- return self.deep_extend(super(kuna, self).describe(), {
27
- 'id': 'kuna',
28
- 'name': 'Kuna',
29
- 'countries': ['UA'],
30
- 'rateLimit': 1000, # on private endpoints rateLimit = 200 for authenticated users, 50 for pro/vip users
31
- 'version': 'v4',
32
- 'has': {
33
- 'CORS': None,
34
- 'spot': True,
35
- 'margin': False,
36
- 'swap': False,
37
- 'future': False,
38
- 'option': False,
39
- 'addMargin': False,
40
- 'cancelOrder': True,
41
- 'cancelOrders': True,
42
- 'closeAllPositions': False,
43
- 'closePosition': False,
44
- 'createDepositAddress': True,
45
- 'createOrder': True,
46
- 'createPostOnlyOrder': False,
47
- 'createReduceOnlyOrder': False,
48
- 'createStopLimitOrder': True,
49
- 'createStopMarketOrder': False,
50
- 'createStopOrder': True,
51
- 'fetchBalance': True,
52
- 'fetchBorrowInterest': False,
53
- 'fetchBorrowRateHistories': False,
54
- 'fetchBorrowRateHistory': False,
55
- 'fetchClosedOrders': True,
56
- 'fetchCrossBorrowRate': False,
57
- 'fetchCrossBorrowRates': False,
58
- 'fetchCurrencies': True,
59
- 'fetchDeposit': True,
60
- 'fetchDepositAddress': True,
61
- 'fetchDeposits': True,
62
- 'fetchDepositsWithdrawals': False,
63
- 'fetchFundingHistory': False,
64
- 'fetchFundingRate': False,
65
- 'fetchFundingRateHistory': False,
66
- 'fetchFundingRates': False,
67
- 'fetchIndexOHLCV': False,
68
- 'fetchIsolatedBorrowRate': False,
69
- 'fetchIsolatedBorrowRates': False,
70
- 'fetchIsolatedPositions': False,
71
- 'fetchL3OrderBook': True,
72
- 'fetchLeverage': False,
73
- 'fetchLeverageTiers': False,
74
- 'fetchMarginMode': False,
75
- 'fetchMarketLeverageTiers': False,
76
- 'fetchMarkets': True,
77
- 'fetchMarkOHLCV': False,
78
- 'fetchMyTrades': True,
79
- 'fetchOHLCV': 'emulated',
80
- 'fetchOpenInterest': False,
81
- 'fetchOpenInterestHistory': False,
82
- 'fetchOpenOrders': True,
83
- 'fetchOrder': True,
84
- 'fetchOrderBook': True,
85
- 'fetchOrdersByStatus': True,
86
- 'fetchPosition': False,
87
- 'fetchPositionMode': False,
88
- 'fetchPositions': False,
89
- 'fetchPositionsForSymbol': False,
90
- 'fetchPositionsRisk': False,
91
- 'fetchPremiumIndexOHLCV': False,
92
- 'fetchTicker': True,
93
- 'fetchTickers': True,
94
- 'fetchTime': True,
95
- 'fetchTrades': True,
96
- 'fetchTradingFee': False,
97
- 'fetchTradingFees': False,
98
- 'fetchTransactions': False,
99
- 'fetchTransfers': False,
100
- 'fetchWithdrawAddresses': False,
101
- 'fetchWithdrawal': True,
102
- 'fetchWithdrawals': True,
103
- 'reduceMargin': False,
104
- 'repayCrossMargin': False,
105
- 'repayIsolatedMargin': False,
106
- 'setLeverage': False,
107
- 'setMargin': False,
108
- 'setMarginMode': False,
109
- 'setPositionMode': False,
110
- 'signIn': False,
111
- 'transfer': False,
112
- 'withdraw': True,
113
- },
114
- 'timeframes': None,
115
- 'urls': {
116
- 'extension': '.json',
117
- 'referral': 'https://kuna.io?r=kunaid-gvfihe8az7o4',
118
- 'logo': 'https://user-images.githubusercontent.com/51840849/87153927-f0578b80-c2c0-11ea-84b6-74612568e9e1.jpg',
119
- 'api': {
120
- 'xreserve': 'https://api.xreserve.fund',
121
- 'v3': 'https://api.kuna.io',
122
- 'v4': 'https://api.kuna.io',
123
- 'public': 'https://kuna.io', # v2
124
- 'private': 'https://kuna.io', # v2
125
- },
126
- 'www': 'https://kuna.io',
127
- 'doc': 'https://kuna.io/documents/api',
128
- 'fees': 'https://kuna.io/documents/api',
129
- },
130
- 'api': {
131
- 'xreserve': {
132
- 'get': {
133
- 'nonce': 1,
134
- 'fee': 1,
135
- 'delegated-transactions': 1,
136
- },
137
- 'post': {
138
- 'delegate-transfer': 1,
139
- },
140
- },
141
- 'v4': {
142
- 'private': {
143
- 'get': {
144
- 'private/me': 1,
145
- 'private/getBalance': 1,
146
- 'order/private/active': 1,
147
- 'order/private/history': 1,
148
- 'order/private/{id}/trades': 1,
149
- 'order/private/details/{id}': 1,
150
- 'trade/private/history': 1,
151
- 'transaction/private/{hash}': 1,
152
- 'deposit/private/preRequest': 1,
153
- 'deposit/private/crypto/address': 1,
154
- 'deposit/private/crypto/getMerchantAddress': 1,
155
- 'deposit/private/history': 1,
156
- 'deposit/private/details/{depositId}': 1,
157
- 'withdraw/private/preRequest': 1,
158
- 'withdraw/private/history': 1,
159
- 'withdraw/private/details/{withdrawId}': 1,
160
- 'kuna-code/{id}': 1,
161
- 'kuna-code/{code}/check': 1,
162
- 'kuna-code/issued-by-me': 1,
163
- 'kuna-code/redeemed-by-me': 1,
164
- },
165
- 'post': {
166
- 'order/private/create': 1,
167
- 'order/private/cancel': 1,
168
- 'order/private/cancel/multi': 1,
169
- 'deposit/private/crypto/generateAddress': 1,
170
- 'deposit/private/crypto/generateMerchantAddress': 1,
171
- 'withdraw/private/create': 1,
172
- 'kuna-code': 1,
173
- },
174
- 'put': {
175
- 'kuna-code/redeem': 1,
176
- },
177
- },
178
- 'public': {
179
- 'get': {
180
- 'public/timestamp': 1,
181
- 'public/fees': 1,
182
- 'public/currencies?type={type}': 1,
183
- 'public/currencies': 1,
184
- 'markets/public/getAll': 1,
185
- 'markets/public/tickers?pairs={pairs}': 1,
186
- 'order/public/book/{pairs}': 1,
187
- 'trade/public/book/{pairs}': 1,
188
- },
189
- },
190
- },
191
- 'v3': {
192
- 'public': {
193
- 'get': {
194
- 'timestamp': 1,
195
- 'currencies': 1,
196
- 'markets': 1,
197
- 'tickers': 1,
198
- 'k': 1,
199
- 'trades_history': 1,
200
- 'fees': 1,
201
- 'exchange-rates': 1,
202
- 'exchange-rates/currency': 1,
203
- 'book/market': 1,
204
- 'kuna_codes/code/check': 1,
205
- 'landing_page_statistic': 1,
206
- 'translations/locale': 1,
207
- 'trades/market/hist': 1,
208
- },
209
- 'post': {
210
- 'http_test': 1,
211
- 'deposit_channels': 1,
212
- 'withdraw_channels': 1,
213
- 'subscription_plans': 1,
214
- 'send_to': 1,
215
- 'confirm_token': 1,
216
- 'kunaid': 1,
217
- 'withdraw/prerequest': 1,
218
- 'deposit/prerequest': 1,
219
- 'deposit/exchange-rates': 1,
220
- },
221
- },
222
- 'sign': {
223
- 'get': {
224
- 'reset_password/token': 1,
225
- },
226
- 'post': {
227
- 'signup/google': 1,
228
- 'signup/resend_confirmation': 1,
229
- 'signup': 1,
230
- 'signin': 1,
231
- 'signin/two_factor': 1,
232
- 'signin/resend_confirm_device': 1,
233
- 'signin/confirm_device': 1,
234
- 'reset_password': 1,
235
- 'cool-signin': 1,
236
- },
237
- 'put': {
238
- 'reset_password/token': 1,
239
- 'signup/code/confirm': 1,
240
- },
241
- },
242
- 'private': {
243
- 'post': {
244
- 'auth/w/order/submit': 1,
245
- 'auth/r/orders': 1,
246
- 'auth/r/orders/market': 1,
247
- 'auth/r/orders/markets': 1,
248
- 'auth/api_tokens/delete': 1,
249
- 'auth/api_tokens/create': 1,
250
- 'auth/api_tokens': 1,
251
- 'auth/signin_history/uniq': 1,
252
- 'auth/signin_history': 1,
253
- 'auth/disable_withdraw_confirmation': 1,
254
- 'auth/change_password': 1,
255
- 'auth/deposit_address': 1,
256
- 'auth/announcements/accept': 1,
257
- 'auth/announcements/unaccepted': 1,
258
- 'auth/otp/deactivate': 1,
259
- 'auth/otp/activate': 1,
260
- 'auth/otp/secret': 1,
261
- 'auth/r/order/market/:order_id/trades': 1,
262
- 'auth/r/orders/market/hist': 1,
263
- 'auth/r/orders/hist': 1,
264
- 'auth/r/orders/hist/markets': 1,
265
- 'auth/r/orders/details': 1,
266
- 'auth/assets-history': 1,
267
- 'auth/assets-history/withdraws': 1,
268
- 'auth/assets-history/deposits': 1,
269
- 'auth/r/wallets': 1,
270
- 'auth/markets/favorites': 1,
271
- 'auth/markets/favorites/list': 1,
272
- 'auth/me/update': 1,
273
- 'auth/me': 1,
274
- 'auth/fund_sources': 1,
275
- 'auth/fund_sources/list': 1,
276
- 'auth/withdraw/resend_confirmation': 1,
277
- 'auth/withdraw': 1,
278
- 'auth/withdraw/details': 1,
279
- 'auth/withdraw/info': 1,
280
- 'auth/payment_addresses': 1,
281
- 'auth/deposit/prerequest': 1,
282
- 'auth/deposit/exchange-rates': 1,
283
- 'auth/deposit': 1,
284
- 'auth/deposit/details': 1,
285
- 'auth/deposit/info': 1,
286
- 'auth/kuna_codes/count': 1,
287
- 'auth/kuna_codes/details': 1,
288
- 'auth/kuna_codes/edit': 1,
289
- 'auth/kuna_codes/send-pdf': 1,
290
- 'auth/kuna_codes': 1,
291
- 'auth/kuna_codes/redeemed-by-me': 1,
292
- 'auth/kuna_codes/issued-by-me': 1,
293
- 'auth/payment_requests/invoice': 1,
294
- 'auth/payment_requests/type': 1,
295
- 'auth/referral_program/weekly_earnings': 1,
296
- 'auth/referral_program/stats': 1,
297
- 'auth/merchant/payout_services': 1,
298
- 'auth/merchant/withdraw': 1,
299
- 'auth/merchant/payment_services': 1,
300
- 'auth/merchant/deposit': 1,
301
- 'auth/verification/auth_token': 1,
302
- 'auth/kunaid_purchase/create': 1,
303
- 'auth/devices/list': 1,
304
- 'auth/sessions/list': 1,
305
- 'auth/subscriptions/reactivate': 1,
306
- 'auth/subscriptions/cancel': 1,
307
- 'auth/subscriptions/prolong': 1,
308
- 'auth/subscriptions/create': 1,
309
- 'auth/subscriptions/list': 1,
310
- 'auth/kuna_ids/list': 1,
311
- 'order/cancel/multi': 1,
312
- 'order/cancel': 1,
313
- },
314
- 'put': {
315
- 'auth/fund_sources/id': 1,
316
- 'auth/kuna_codes/redeem': 1,
317
- },
318
- 'delete': {
319
- 'auth/markets/favorites': 1,
320
- 'auth/fund_sources': 1,
321
- 'auth/devices': 1,
322
- 'auth/devices/list': 1,
323
- 'auth/sessions/list': 1,
324
- 'auth/sessions': 1,
325
- },
326
- },
327
- },
328
- 'public': {
329
- 'get': [
330
- 'depth', # Get depth or specified market Both asks and bids are sorted from highest price to lowest.
331
- 'k_with_pending_trades', # Get K data with pending trades, which are the trades not included in K data yet, because there's delay between trade generated and processed by K data generator
332
- 'k', # Get OHLC(k line) of specific market
333
- 'markets', # Get all available markets
334
- 'order_book', # Get the order book of specified market
335
- 'order_book/{market}',
336
- 'tickers', # Get ticker of all markets
337
- 'tickers/{market}', # Get ticker of specific market
338
- 'timestamp', # Get server current time, in seconds since Unix epoch
339
- 'trades', # Get recent trades on market, each trade is included only once Trades are sorted in reverse creation order.
340
- 'trades/{market}',
341
- ],
342
- },
343
- 'private': {
344
- 'get': [
345
- 'members/me', # Get your profile and accounts info
346
- 'deposits', # Get your deposits history
347
- 'deposit', # Get details of specific deposit
348
- 'deposit_address', # Where to deposit The address field could be empty when a new address is generating(e.g. for bitcoin), you should try again later in that case.
349
- 'orders', # Get your orders, results is paginated
350
- 'order', # Get information of specified order
351
- 'trades/my', # Get your executed trades Trades are sorted in reverse creation order.
352
- 'withdraws', # Get your cryptocurrency withdraws
353
- 'withdraw', # Get your cryptocurrency withdraw
354
- ],
355
- 'post': [
356
- 'orders', # Create a Sell/Buy order
357
- 'orders/multi', # Create multiple sell/buy orders
358
- 'orders/clear', # Cancel all my orders
359
- 'order/delete', # Cancel an order
360
- 'withdraw', # Create a withdraw
361
- ],
362
- },
363
- },
364
- 'fees': {
365
- 'trading': {
366
- 'tierBased': False,
367
- 'percentage': True,
368
- 'taker': self.parse_number('0.0025'),
369
- 'maker': self.parse_number('0.0025'),
370
- },
371
- 'funding': {
372
- 'withdraw': {
373
- 'UAH': '1%',
374
- 'BTC': 0.001,
375
- 'BCH': 0.001,
376
- 'ETH': 0.01,
377
- 'WAVES': 0.01,
378
- 'GOL': 0.0,
379
- 'GBG': 0.0,
380
- # 'RMC': 0.001 BTC
381
- # 'ARN': 0.01 ETH
382
- # 'R': 0.01 ETH
383
- # 'EVR': 0.01 ETH
384
- },
385
- 'deposit': {
386
- # 'UAH': (amount) => amount * 0.001 + 5
387
- },
388
- },
389
- },
390
- 'commonCurrencies': {
391
- 'PLA': 'Plair',
392
- },
393
- 'precisionMode': TICK_SIZE,
394
- 'exceptions': {
395
- 'ARGUMENT_VALIDATION_ERROR': BadRequest,
396
- 'PAYMENT_METHOD_NOT_SUPPORTED': BadRequest,
397
- 'NOT_FOUND': OrderNotFound,
398
- 'INVALID:ORDER_SIZE': InvalidOrder,
399
- 'WrongRequestException': BadRequest,
400
- 'INSUFFICIENT_FUNDS': InsufficientFunds,
401
- '2002': InsufficientFunds,
402
- '2003': OrderNotFound,
403
- },
404
- 'options': {
405
- # 'account': 'pro' # Only for pro accounts
406
- },
407
- })
408
-
409
- def fetch_time(self, params={}):
410
- """
411
- fetches the current integer timestamp in milliseconds from the exchange server
412
- :see: https://docs.kuna.io/docs/get-time-on-the-server
413
- :param dict [params]: extra parameters specific to the exchange API endpoint
414
- :returns int: the current integer timestamp in milliseconds from the exchange server
415
- """
416
- response = self.v4PublicGetPublicTimestamp(params)
417
- #
418
- # {
419
- # "data": {
420
- # "timestamp": 1686740531,
421
- # "timestamp_miliseconds": 1686740531725,
422
- # }
423
- # }
424
- #
425
- data = self.safe_value(response, 'data', {})
426
- return self.safe_integer(data, 'timestamp_miliseconds')
427
-
428
- def fetch_currencies(self, params={}) -> Currencies:
429
- """
430
- fetches all available currencies on an exchange
431
- :see: https://docs.kuna.io/docs/get-information-about-available-currencies
432
- :param dict [params]: extra parameters specific to the exchange API endpoint
433
- :returns dict: an associative dictionary of currencies
434
- """
435
- response = self.v4PublicGetPublicCurrencies(params)
436
- #
437
- # {
438
- # "data": [
439
- # {
440
- # "code": "BTC",
441
- # "name": "Bitcoin",
442
- # "payload": {
443
- # "chart": "https://kuna-pro.kuna.io/bitcoin-chart",
444
- # "icons": {
445
- # "svg": "https://kuna-pro.kuna.io/icon-btc-svg",
446
- # "png2x": "https://kuna-pro.kuna.io/icon-btc-png2x",
447
- # "png3x": "https://kuna-pro.kuna.io/icon-btc-png3x",
448
- # "svgXL": "https://kuna-pro.kuna.io/icon-btc-svg"
449
- # },
450
- # "pngChart": "https://kuna-pro.kuna.io/png-bitcoin-chart"
451
- # },
452
- # "position": 1,
453
- # "precision": 8,
454
- # "tradePrecision": 6,
455
- # "type": "Crypto"
456
- # }
457
- # ]
458
- # }
459
- #
460
- data = self.safe_value(response, 'data', [])
461
- return self.parse_currencies(data)
462
-
463
- def parse_currencies(self, currencies, params={}):
464
- currencies = self.to_array(currencies)
465
- result: dict = {}
466
- for i in range(0, len(currencies)):
467
- currency = self.parse_currency(currencies[i])
468
- result[currency['code']] = currency
469
- return result
470
-
471
- def parse_currency(self, currency: dict):
472
- #
473
- # {
474
- # "code": "BTC",
475
- # "name": "Bitcoin",
476
- # "payload": {
477
- # "chart": "https://kuna-pro.kuna.io/bitcoin-chart",
478
- # "icons": {
479
- # "svg": "https://kuna-pro.kuna.io/icon-btc-svg",
480
- # "png2x": "https://kuna-pro.kuna.io/icon-btc-png2x",
481
- # "png3x": "https://kuna-pro.kuna.io/icon-btc-png3x",
482
- # "svgXL": "https://kuna-pro.kuna.io/icon-btc-svg"
483
- # },
484
- # "pngChart": "https://kuna-pro.kuna.io/png-bitcoin-chart"
485
- # },
486
- # "position": 1,
487
- # "precision": 8,
488
- # "tradePrecision": 6,
489
- # "type": "Crypto"
490
- # }
491
- #
492
- currencyId = self.safe_string(currency, 'code')
493
- precision = self.safe_string(currency, 'precision')
494
- tradePrecision = self.safe_string(currency, 'tradePrecision')
495
- return {
496
- 'info': currency,
497
- 'id': currencyId,
498
- 'code': self.safe_currency_code(currencyId),
499
- 'type': None,
500
- 'margin': None,
501
- 'name': self.safe_string(currency, 'name'),
502
- 'active': None,
503
- 'deposit': None,
504
- 'withdraw': None,
505
- 'fee': None,
506
- 'precision': Precise.string_min(precision, tradePrecision),
507
- 'limits': {
508
- 'amount': {
509
- 'min': None,
510
- 'max': None,
511
- },
512
- 'withdraw': {
513
- 'min': None,
514
- 'max': None,
515
- },
516
- },
517
- 'networks': {},
518
- }
519
-
520
- def fetch_markets(self, params={}) -> List[Market]:
521
- """
522
- retrieves data on all markets for kuna
523
- :see: https://docs.kuna.io/docs/get-all-traded-markets
524
- :param dict [params]: extra parameters specific to the exchange API endpoint
525
- :returns dict[]: an array of objects representing market data
526
- """
527
- response = self.v4PublicGetMarketsPublicGetAll(params)
528
- #
529
- # {
530
- # "data": [
531
- # {
532
- # "pair": "BTC_USDT", # Traded pair of assets
533
- # "baseAsset": { # The base asset of the traded pair, the one to sell or buy result of the trade
534
- # "code": "BTC",
535
- # "precision": 6 # Maximum amount of digits for the decimal part of a number
536
- # },
537
- # "quoteAsset": { # The quoted asset of the traded pair, the one to use to sell or buy the base asset
538
- # "code": "USDT",
539
- # "precision": 2 # Maximum amount of digits for the decimal part of a number
540
- # },
541
- # "tickerPriceChange": "-0.07" # Relative change compared with the last tick
542
- # }
543
- # ]
544
- # }
545
- #
546
- data = self.safe_value(response, 'data', [])
547
- markets = []
548
- for i in range(0, len(data)):
549
- item = data[i]
550
- marketId = self.safe_string(item, 'pair')
551
- baseAsset = self.safe_value(item, 'baseAsset')
552
- quoteAsset = self.safe_value(item, 'quoteAsset')
553
- baseId = self.safe_string(baseAsset, 'code')
554
- quoteId = self.safe_string(quoteAsset, 'code')
555
- base = self.safe_currency_code(baseId)
556
- quote = self.safe_currency_code(quoteId)
557
- basePrecision = self.safe_string(baseAsset, 'precision')
558
- quotePrecision = self.safe_string(quoteAsset, 'precision')
559
- markets.append({
560
- 'id': marketId,
561
- 'symbol': base + '/' + quote,
562
- 'base': base,
563
- 'quote': quote,
564
- 'settle': None,
565
- 'baseId': baseId,
566
- 'quoteId': quoteId,
567
- 'settleId': None,
568
- 'type': 'spot',
569
- 'spot': True,
570
- 'margin': False,
571
- 'swap': False,
572
- 'future': False,
573
- 'option': False,
574
- 'active': None,
575
- 'contract': False,
576
- 'linear': None,
577
- 'inverse': None,
578
- 'contractSize': None,
579
- 'expiry': None,
580
- 'expiryDatetime': None,
581
- 'strike': None,
582
- 'optionType': None,
583
- 'precision': {
584
- 'amount': self.parse_number(self.parse_precision(basePrecision)),
585
- 'price': self.parse_number(self.parse_precision(quotePrecision)),
586
- },
587
- 'limits': {
588
- 'leverage': {
589
- 'min': None,
590
- 'max': None,
591
- },
592
- 'amount': {
593
- 'min': None,
594
- 'max': None,
595
- },
596
- 'price': {
597
- 'min': None,
598
- 'max': None,
599
- },
600
- 'cost': {
601
- 'min': None,
602
- 'max': None,
603
- },
604
- },
605
- 'created': None,
606
- 'info': item,
607
- })
608
- return markets
609
-
610
- def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
611
- """
612
- fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
613
- :see: https://docs.kuna.io/docs/get-public-orders-book
614
- :param str symbol: unified symbol of the market to fetch the order book for
615
- :param int [limit]: 5, 10, 20, 50, 100, 500, or 1000(default)
616
- :param dict [params]: extra parameters specific to the exchange API endpoint
617
- :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
618
- """
619
- self.load_markets()
620
- market = self.market(symbol)
621
- request: dict = {
622
- 'pairs': market['id'],
623
- }
624
- if limit is not None:
625
- request['level'] = limit
626
- response = self.v4PublicGetOrderPublicBookPairs(self.extend(request, params))
627
- #
628
- # {
629
- # "data": {
630
- # "asks": [ # An array of sell orders
631
- # [
632
- # "16950", # Sell price, level 1
633
- # "0.001" # Sell quantity, level 1
634
- # ],
635
- # [
636
- # "17000", # Sell price, level 2
637
- # "0.01" # Sell quantity, level 2
638
- # ]
639
- # ],
640
- # "bids": [ # An array of buy orders
641
- # [
642
- # "16700", # Sell price, level 1
643
- # "0.01" # Sell quantity, level 1
644
- # ],
645
- # [
646
- # "16000", # Sell price, level 2
647
- # "0.001" # Sell quantity, level 2
648
- # ]
649
- # ]
650
- # }
651
- # }
652
- #
653
- data = self.safe_dict(response, 'data', {})
654
- return self.parse_order_book(data, market['symbol'], None, 'bids', 'asks', 0, 1)
655
-
656
- def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
657
- #
658
- # {
659
- # "pair": "BTC_USDT", # Traded pair
660
- # "percentagePriceChange": "-0.03490931899641581", # Relative price change, in percent
661
- # "price": "27900", # Current median price
662
- # "equivalentPrice": "", # TBD
663
- # "high": "29059.69", # Highest price
664
- # "low": "27900", # Lowest price
665
- # "baseVolume": "2.9008499999999993", # Traded volume
666
- # "quoteVolume": "82251.41477976", # Traded volume
667
- # "bestBidPrice": "27926.91", # The best bid price now
668
- # "bestAskPrice": "27970.02", # The best ask price now
669
- # "priceChange": "-973.9700000000012" # Absolute price change
670
- # }
671
- #
672
- marketId = self.safe_string(ticker, 'pair')
673
- return self.safe_ticker({
674
- 'info': ticker,
675
- 'symbol': self.safe_symbol(marketId, market),
676
- 'timestamp': None,
677
- 'datetime': None,
678
- 'high': self.safe_string(ticker, 'high'),
679
- 'low': self.safe_string(ticker, 'low'),
680
- 'bid': self.safe_string(ticker, 'bestBidPrice'),
681
- 'ask': self.safe_string(ticker, 'bestAskPrice'),
682
- 'vwap': None,
683
- 'open': self.safe_string(ticker, 'open'),
684
- 'close': None,
685
- 'last': None,
686
- 'previousClose': None,
687
- 'change': self.safe_string(ticker, 'priceChange'),
688
- 'percentage': self.safe_string(ticker, 'percentagePriceChange'),
689
- 'average': None,
690
- 'baseVolume': self.safe_string(ticker, 'baseVolume'),
691
- 'quoteVolume': self.safe_string(ticker, 'quoteVolume'),
692
- }, market)
693
-
694
- def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
695
- """
696
- fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market. The average is not returned in the response, but the median can be accessed via response['info']['price']
697
- :see: https://docs.kuna.io/docs/get-market-info-by-tickers
698
- :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
699
- :param dict [params]: extra parameters specific to the exchange API endpoint
700
- :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
701
- """
702
- self.load_markets()
703
- if symbols is None:
704
- raise ArgumentsRequired(self.id + ' fetchTickers() requires a symbols argument')
705
- symbols = self.market_symbols(symbols)
706
- marketIds = self.market_ids(symbols)
707
- request: dict = {
708
- 'pairs': ','.join(marketIds),
709
- }
710
- response = self.v4PublicGetMarketsPublicTickersPairsPairs(self.extend(request, params))
711
- #
712
- # {
713
- # "data": [
714
- # {
715
- # "pair": "BTC_USDT", # Traded pair
716
- # "percentagePriceChange": "-0.03490931899641581", # Relative price change, in percent
717
- # "price": "27900", # Current median price
718
- # "equivalentPrice": "", # TBD
719
- # "high": "29059.69", # Highest price
720
- # "low": "27900", # Lowest price
721
- # "baseVolume": "2.9008499999999993", # Traded volume
722
- # "quoteVolume": "82251.41477976", # Traded volume
723
- # "bestBidPrice": "27926.91", # The best bid price now
724
- # "bestAskPrice": "27970.02", # The best ask price now
725
- # "priceChange": "-973.9700000000012" # Absolute price change
726
- # }
727
- # ...
728
- # ]
729
- # }
730
- #
731
- data = self.safe_list(response, 'data', [])
732
- return self.parse_tickers(data, symbols, params)
733
-
734
- def fetch_ticker(self, symbol: str, params={}) -> Ticker:
735
- """
736
- fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
737
- :see: https://docs.kuna.io/docs/get-market-info-by-tickers
738
- :param str symbol: unified symbol of the market to fetch the ticker for
739
- :param dict [params]: extra parameters specific to the exchange API endpoint
740
- :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
741
- """
742
- self.load_markets()
743
- market = self.market(symbol)
744
- request: dict = {
745
- 'pairs': market['id'],
746
- }
747
- response = self.v4PublicGetMarketsPublicTickersPairsPairs(self.extend(request, params))
748
- #
749
- # {
750
- # "data": [
751
- # {
752
- # "pair": "BTC_USDT", # Traded pair
753
- # "percentagePriceChange": "-0.03490931899641581", # Relative price change, in percent
754
- # "price": "27900", # Current median price
755
- # "equivalentPrice": "", # TBD
756
- # "high": "29059.69", # Highest price
757
- # "low": "27900", # Lowest price
758
- # "baseVolume": "2.9008499999999993", # Traded volume
759
- # "quoteVolume": "82251.41477976", # Traded volume
760
- # "bestBidPrice": "27926.91", # The best bid price now
761
- # "bestAskPrice": "27970.02", # The best ask price now
762
- # "priceChange": "-973.9700000000012" # Absolute price change
763
- # }
764
- # ...
765
- # ]
766
- # }
767
- #
768
- data = self.safe_value(response, 'data', [])
769
- ticker = self.safe_dict(data, 0)
770
- return self.parse_ticker(ticker, market)
771
-
772
- def fetch_l3_order_book(self, symbol: str, limit: Int = None, params={}):
773
- """
774
- * TODO: double check
775
- fetches level 3 information on open orders with bid(buy) and ask(sell) prices, volumes and other data
776
- :param str symbol: unified market symbol
777
- :param int [limit]: max number of orders to return, default is None
778
- :param dict [params]: extra parameters specific to the exchange API endpoint
779
- :returns dict: an `order book structure <https://docs.ccxt.com/#/?id=order-book-structure>`
780
- """
781
- return self.fetch_order_book(symbol, limit, params)
782
-
783
- def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
784
- """
785
- get the list of most recent trades for a particular symbol
786
- :see: https://docs.kuna.io/docs/get-public-trades-book
787
- :param str symbol: unified symbol of the market to fetch trades for
788
- :param int [since]: timestamp in ms of the earliest trade to fetch
789
- :param int [limit]: between 1 and 100, 25 by default
790
- :param dict [params]: extra parameters specific to the exchange API endpoint
791
- :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
792
- """
793
- self.load_markets()
794
- market = self.market(symbol)
795
- request: dict = {
796
- 'pairs': market['id'],
797
- }
798
- if limit is not None:
799
- request['limit'] = limit
800
- response = self.v4PublicGetTradePublicBookPairs(self.extend(request, params))
801
- #
802
- # {
803
- # 'data': [
804
- # {
805
- # 'createdAt': '2024-03-02T00:10:49.385Z',
806
- # 'id': '3b42878a-3688-4bc1-891e-5cc2fc902142',
807
- # 'matchPrice': '62181.31',
808
- # 'matchQuantity': '0.00568',
809
- # 'pair': 'BTC_USDT',
810
- # 'quoteQuantity': '353.1898408',
811
- # 'side': 'Bid'
812
- # },
813
- # ...
814
- # ]
815
- # }
816
- #
817
- data = self.safe_list(response, 'data', [])
818
- return self.parse_trades(data, market, since, limit)
819
-
820
- def parse_trade(self, trade: dict, market: Market = None) -> Trade:
821
- #
822
- # fetchTrades(public)
823
- #
824
- # {
825
- # "id": "3e5591ba-2778-4d85-8851-54284045ea44", # Unique identifier of a trade
826
- # "pair": "BTC_USDT", # Market pair that is being traded
827
- # "quoteQuantity": "11528.8118", # Qty of the quote asset, hasattr(self, USDT) example
828
- # "matchPrice": "18649", # Exchange price at the moment of execution
829
- # "matchQuantity": "0.6182", # Qty of the base asset, hasattr(self, BTC) example
830
- # "createdAt": "2022-09-23T14:30:41.486Z", # Date-time of trade execution, UTC
831
- # "side": "Ask" # Trade type: `Ask` or `Bid`. Bid for buying base asset, Ask for selling base asset(e.g. for BTC_USDT trading pair, BTC is the base asset).
832
- # }
833
- #
834
- # fetchMyTrades, fetchOrder(private)
835
- #
836
- # {
837
- # "id": "edb17459-c9bf-4148-9ae6-7367d7f55d71", # Unique identifier of a trade
838
- # "orderId": "a80bec3f-4ffa-45c1-9d78-f6301e9748fe", # Unique identifier of an order associated with the trade
839
- # "pair": "BTC_USDT", # Traded pair, base asset first, followed by quoted asset
840
- # "quantity": "1.5862", # Traded quantity of base asset
841
- # "price": "19087", # Price of the trade
842
- # "isTaker": True, # Various fees for Makers and Takers; "Market" orders are always `true`
843
- # "fee": "0.0039655", # Exchange commission fee
844
- # "feeCurrency": "BTC", # Currency of the commission
845
- # "isBuyer": True, # Buy or sell the base asset
846
- # "quoteQuantity": "30275.7994", # Quote asset quantity spent to fulfill the base amount
847
- # "createdAt": "2022-09-29T13:43:53.824Z", # Date-time of trade execution, UTC
848
- # }
849
- #
850
- datetime = self.safe_string(trade, 'createdAt')
851
- marketId = self.safe_string(trade, 'pair')
852
- isTaker = self.safe_value(trade, 'isMaker')
853
- side = self.safe_string_lower(trade, 'side')
854
- if side is None:
855
- isBuyer = self.safe_value(trade, 'isBuyer')
856
- side = 'buy' if isBuyer else 'sell'
857
- return self.safe_trade({
858
- 'info': trade,
859
- 'id': self.safe_string(trade, 'id'),
860
- 'symbol': self.safe_symbol(marketId, market),
861
- 'timestamp': self.parse8601(datetime),
862
- 'datetime': datetime,
863
- 'type': None,
864
- 'side': side,
865
- 'order': self.safe_string(trade, 'orderId'),
866
- 'takerOrMaker': 'taker' if isTaker else 'maker',
867
- 'price': self.safe_string_2(trade, 'matchPrice', 'price'),
868
- 'amount': self.safe_string_2(trade, 'matchQuantity', 'quantity'),
869
- 'cost': self.safe_string(trade, 'quoteQuantity'),
870
- 'fee': {
871
- 'cost': self.safe_string(trade, 'fee'),
872
- 'currency': self.safe_currency_code(self.safe_string(trade, 'feeCurrency')),
873
- 'rate': None,
874
- },
875
- }, market)
876
-
877
- def parse_balance(self, response) -> Balances:
878
- #
879
- # [
880
- # {
881
- # "currency": "UAH",
882
- # "balance": "7134.6",
883
- # "lockBalance": "100"
884
- # }
885
- # ...
886
- # ]
887
- #
888
- result: dict = {'info': response}
889
- for i in range(0, len(response)):
890
- balance = response[i]
891
- currencyId = self.safe_string(balance, 'currency')
892
- code = self.safe_currency_code(currencyId)
893
- account = self.account()
894
- account['free'] = self.safe_string(balance, 'balance')
895
- account['used'] = self.safe_string(balance, 'lockBalance')
896
- result[code] = account
897
- return self.safe_balance(result)
898
-
899
- def fetch_balance(self, params={}) -> Balances:
900
- """
901
- query for balance and get the amount of funds available for trading or funds locked in orders
902
- :param dict [params]: extra parameters specific to the exchange API endpoint
903
- :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
904
- """
905
- self.load_markets()
906
- response = self.v4PrivateGetPrivateGetBalance(params)
907
- #
908
- # {
909
- # "data": [{
910
- # "currency": "UAH", # Wallet currency
911
- # "balance": "7134.6", # Available balance, precision depends on the currency
912
- # "lockBalance": "100" # Minimum amount locked on the balance
913
- # }]
914
- # }
915
- #
916
- data = self.safe_value(response, 'data', [])
917
- return self.parse_balance(data)
918
-
919
- def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
920
- """
921
- create a trade order
922
- :see: https://docs.kuna.io/docs/create-a-new-order-private
923
- :param str symbol: unified symbol of the market to create an order in
924
- :param str type: 'market' or 'limit'
925
- :param str side: 'buy' or 'sell'
926
- :param float amount: how much of currency you want to trade in units of base currency
927
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
928
- :param dict [params]: extra parameters specific to the exchange API endpoint
929
- :param float [params.triggerPrice]: the price at which a trigger order is triggered at
930
- *
931
- * EXCHANGE SPECIFIC PARAMETERS
932
- :param str [params.id]: id must be a UUID format, if you do not specify id, it will be generated automatically.
933
- :param float [params.quoteQuantity]: the max quantity of the quote asset to use for selling/buying
934
- :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
935
- """
936
- self.load_markets()
937
- market = self.market(symbol)
938
- triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
939
- params = self.omit(params, ['triggerPrice', 'stopPrice'])
940
- capitalizedType = self.capitalize(type)
941
- request: dict = {
942
- 'pair': market['id'],
943
- 'orderSide': 'Bid' if (side == 'buy') else 'Ask',
944
- 'quantity': self.number_to_string(amount),
945
- 'type': capitalizedType,
946
- }
947
- if capitalizedType == 'Limit':
948
- request['price'] = self.price_to_precision(market['symbol'], price)
949
- if triggerPrice is not None:
950
- if capitalizedType == 'Market':
951
- raise BadRequest(self.id + ' createOrder() cannot place trigger market orders, or trigger limit')
952
- request['stopPrice'] = self.price_to_precision(market['symbol'], triggerPrice)
953
- if capitalizedType != 'TakeProfitLimit':
954
- request['type'] = 'StopLossLimit'
955
- response = self.v4PrivatePostOrderPrivateCreate(self.extend(request, params))
956
- #
957
- # {
958
- # "data": {
959
- # "id": "b0fcb54c-2278-4f16-a300-02765faad8b0", # ID of your newly created order
960
- # "type": "Limit", # Type of an order
961
- # "quantity": "0.06", # Original order quantity
962
- # "executedQuantity": "0", # Traded quantity in stock(>0 if traded)
963
- # "pair": "BTC_USDT", # Traded pair
964
- # "price": "26440.46", # Price of the trade
965
- # "status": "Open", # The status of the order
966
- # "createdAt": "2023-07-11T08:01:30.550Z", # Date-time of order creation, UTC
967
- # "updatedAt": "2023-07-11T08:01:30.550Z" # Date-time of the last update of the order, UTC
968
- # }
969
- # }
970
- #
971
- data = self.safe_dict(response, 'data', {})
972
- return self.parse_order(data, market)
973
-
974
- def cancel_order(self, id: str, symbol: Str = None, params={}):
975
- """
976
- cancels an open order
977
- :param str id: order id
978
- :param str symbol: unified market symbol
979
- :param dict [params]: extra parameters specific to the exchange API endpoint
980
- :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
981
- """
982
- self.load_markets()
983
- request: dict = {
984
- 'orderId': id,
985
- }
986
- response = self.v4PrivatePostOrderPrivateCancel(self.extend(request, params))
987
- #
988
- # {
989
- # "data": {
990
- # "success": True
991
- # }
992
- # }
993
- #
994
- data = self.safe_value(response, 'data', {})
995
- market = None
996
- if symbol is not None:
997
- market = self.market(symbol)
998
- order = self.parse_order(data, market)
999
- order['id'] = id
1000
- return order
1001
-
1002
- def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
1003
- """
1004
- cancels an open order
1005
- :param str ids: order ids
1006
- :param str symbol: not used by kuna cancelOrder
1007
- :param dict [params]: extra parameters specific to the exchange API endpoint
1008
- :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1009
- """
1010
- self.load_markets()
1011
- request: dict = {
1012
- 'orderIds': ids,
1013
- }
1014
- response = self.v4PrivatePostOrderPrivateCancelMulti(self.extend(request, params))
1015
- #
1016
- # {
1017
- # "data": [
1018
- # {
1019
- # "id": "c7fc5b2b-bd9d-48c1-a458-a83412669fe2", # Unique identifier of a canceled order
1020
- # "success": True # Status for self order
1021
- # },
1022
- # ...
1023
- # ]
1024
- # }
1025
- #
1026
- data = self.safe_list(response, 'data', [])
1027
- return self.parse_orders(data)
1028
-
1029
- def parse_order_status(self, status: Str):
1030
- statuses: dict = {
1031
- 'Canceled': 'canceled',
1032
- 'Closed': 'filled',
1033
- 'Pending': 'open',
1034
- 'Open': 'open',
1035
- 'done': 'closed',
1036
- 'wait': 'open',
1037
- 'cancel': 'canceled',
1038
- }
1039
- return self.safe_string(statuses, status, status)
1040
-
1041
- def parse_order(self, order: dict, market: Market = None) -> Order:
1042
- #
1043
- # createOrder, fetchOrder, fetchOpenOrders, fetchOrdersByStatus
1044
- #
1045
- # {
1046
- # "id": "5992a049-8612-409d-8599-2c3d7298b106", # Unique identifier of an order
1047
- # "type": "Limit", # Type of an order
1048
- # "quantity": "5", # Original order quantity
1049
- # "executedQuantity": "0", # Traded quantity in stock(>0 if traded)
1050
- # "cumulativeQuoteQty": "0", # *absent on createOrder* Traded quantity in money(>0 if traded)
1051
- # "cost": "0.05", # Total amount
1052
- # "side": "Bid", # *absent on createOrder* Bid for buying base asset, Ask for selling base asset. FYI: For BTC_USDT trading pair, BTC is the base asset
1053
- # "pair": "TRX_USDT", # Traded pair
1054
- # "price": "0.01", # Price of the trade
1055
- # "status": "Open", # The status of the order
1056
- # "createdAt": "2023-07-11T07:04:20.131Z", # Date-time of order creation, UTC
1057
- # "updatedAt": "2023-07-11T07:04:20.131Z" # Date-time of the last update of the order, UTC
1058
- # "closedAt": "2023-05-08T08:53:58.333Z" # *absent on fetchOpenOrders/createOrder* Date-time of order finish time, UTC
1059
- # "trades": [ # * fetchOrder only *
1060
- # {
1061
- # "id": "15ff497c-8d25-4155-8184-bb1f905cce1e", # Unique identifier of a trade
1062
- # "orderId": "4b9b9705-e85f-4180-bdec-219fbf025fa3", # Unique identifier of an associated order
1063
- # "pair": "BTC_USDT", # Traded pair
1064
- # "quantity": "0.00054", # Traded quantity
1065
- # "price": "27770", # Traded price
1066
- # "isTaker": False, # Various fees for Makers and Takers; "Market" orders are always `true`
1067
- # "fee": "0.000001350", # Exchange commission fee
1068
- # "feeCurrency": "BTC", # Currency of the commission
1069
- # "isBuyer": True, # Buy or sell the base asset
1070
- # "quoteQuantity": "14.9958", # Quote asset quantity
1071
- # "createdAt": "2023-05-08T08:53:58.332Z" # Date-time of trade execution, UTC
1072
- # }
1073
- # ]
1074
- # }
1075
- #
1076
- # cancelOrder, cancelOrders
1077
- #
1078
- # {
1079
- # "id": "c7fc5b2b-bd9d-48c1-a458-a83412669fe2", # Unique identifier of a canceled order *absent on cancelOrder*
1080
- # "success": True # Status for self order
1081
- # }
1082
- #
1083
- marketId = self.safe_string(order, 'pair')
1084
- datetime = self.safe_string(order, 'createdAt')
1085
- triggerPrice = self.safe_string(order, 'stopPrice')
1086
- side = self.safe_string(order, 'side')
1087
- if side == 'Bid':
1088
- side = 'buy'
1089
- elif side == 'Ask':
1090
- side = 'sell'
1091
- trades = self.safe_value(order, 'trades', [])
1092
- return self.safe_order({
1093
- 'info': order,
1094
- 'id': self.safe_string_2(order, 'id', 'orderId'),
1095
- 'clientOrderId': None,
1096
- 'symbol': self.safe_symbol(marketId, market),
1097
- 'timestamp': self.parse8601(datetime),
1098
- 'datetime': datetime,
1099
- 'lastTradeTimestamp': self.parse8601(self.safe_string(order, 'updatedAt')),
1100
- 'status': self.parse_order_status(self.safe_string(order, 'status')),
1101
- 'type': self.safe_string_lower(order, 'type'),
1102
- 'timeInForce': None,
1103
- 'postOnly': None,
1104
- 'side': side,
1105
- 'price': self.safe_string(order, 'price'),
1106
- 'stopPrice': triggerPrice,
1107
- 'triggerPrice': triggerPrice,
1108
- 'amount': self.safe_string(order, 'quantity'),
1109
- 'filled': self.safe_string(order, 'executedQuantity'),
1110
- 'remaining': None,
1111
- 'trades': self.parse_trades(trades),
1112
- 'cost': self.safe_string(order, 'cost'),
1113
- 'average': None,
1114
- 'fee': None,
1115
- }, market)
1116
-
1117
- def fetch_order(self, id: str, symbol: Str = None, params={}):
1118
- """
1119
- fetches information on an order made by the user
1120
- :see: https://docs.kuna.io/docs/get-order-details-by-id
1121
- :param str symbol: not used by kuna fetchOrder
1122
- :param dict [params]: extra parameters specific to the exchange API endpoint
1123
- *
1124
- * EXCHANGE SPECIFIC PARAMETERS
1125
- :param boolean [params.withTrades]: default is True, specify if the response should include trades associated with the order
1126
- :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1127
- """
1128
- self.load_markets()
1129
- request: dict = {
1130
- 'id': id,
1131
- 'withTrades': True,
1132
- }
1133
- response = self.v4PrivateGetOrderPrivateDetailsId(self.extend(request, params))
1134
- #
1135
- # {
1136
- # "data": {
1137
- # "id": "4b9b9705-e85f-4180-bdec-219fbf025fa3",
1138
- # "type": "Limit",
1139
- # "quantity": "0.00054",
1140
- # "executedQuantity": "0.00054",
1141
- # "cumulativeQuoteQty": "14.99580",
1142
- # "cost": "14.9958",
1143
- # "side": "Bid",
1144
- # "pair": "BTC_USDT",
1145
- # "price": "27770",
1146
- # "status": "Closed",
1147
- # "createdAt": "2023-05-08T08:39:46.708Z",
1148
- # "updatedAt": "2023-05-08T08:53:58.332Z",
1149
- # "closedAt": "2023-05-08T08:53:58.333Z",
1150
- # "trades": [
1151
- # {
1152
- # "id": "15ff497c-8d25-4155-8184-bb1f905cce1e", # Unique identifier of a trade
1153
- # "orderId": "4b9b9705-e85f-4180-bdec-219fbf025fa3", # Unique identifier of an associated order
1154
- # "pair": "BTC_USDT", # Traded pair
1155
- # "quantity": "0.00054", # Traded quantity
1156
- # "price": "27770", # Traded price
1157
- # "isTaker": False, # Various fees for Makers and Takers; "Market" orders are always `true`
1158
- # "fee": "0.000001350", # Exchange commission fee
1159
- # "feeCurrency": "BTC", # Currency of the commission
1160
- # "isBuyer": True, # Buy or sell the base asset
1161
- # "quoteQuantity": "14.9958", # Quote asset quantity
1162
- # "createdAt": "2023-05-08T08:53:58.332Z" # Date-time of trade execution, UTC
1163
- # }
1164
- # ]
1165
- # }
1166
- # }
1167
- #
1168
- data = self.safe_dict(response, 'data', {})
1169
- return self.parse_order(data)
1170
-
1171
- def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1172
- """
1173
- fetch all unfilled currently open orders
1174
- :see: https://docs.kuna.io/docs/get-active-client-orders-private
1175
- :param str symbol: unified market symbol
1176
- :param int [since]: the earliest time in ms to fetch open orders for
1177
- :param int [limit]: 1-100, the maximum number of open orders structures to retrieve
1178
- :param dict [params]: extra parameters specific to the exchange API endpoint
1179
- :param int [params.until]: the latest timestamp(ms) to fetch orders for
1180
- *
1181
- * EXCHANGE SPECIFIC PARAMETERS
1182
- :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
1183
- :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1184
- """
1185
- self.load_markets()
1186
- until = self.safe_integer(params, 'until')
1187
- params = self.omit(params, ['until'])
1188
- market = None
1189
- request: dict = {
1190
- }
1191
- if symbol is not None:
1192
- market = self.market(symbol)
1193
- request['pairs'] = market['id']
1194
- if since is not None:
1195
- request['start'] = self.iso8601(since)
1196
- if limit is not None:
1197
- request['limit'] = limit
1198
- if until is not None:
1199
- request['end'] = self.iso8601(until)
1200
- response = self.v4PrivateGetOrderPrivateActive(self.extend(request, params))
1201
- #
1202
- # {
1203
- # "data": [
1204
- # {
1205
- # "id": "5992a049-8612-409d-8599-2c3d7298b106", # Unique identifier of an order
1206
- # "type": "Limit", # Type of an order
1207
- # "quantity": "5", # Original order quantity
1208
- # "executedQuantity": "0", # Traded quantity in stock(>0 if traded)
1209
- # "cumulativeQuoteQty": "0", # Traded quantity in money(>0 if traded)
1210
- # "cost": "0.05", # Total amount
1211
- # "side": "Bid", # Bid for buying base asset, Ask for selling base asset. FYI: For BTC_USDT trading pair, BTC is the base asset
1212
- # "pair": "TRX_USDT", # Traded pair
1213
- # "price": "0.01", # Price of the trade
1214
- # "status": "Open", # The status of the order
1215
- # "createdAt": "2023-07-11T07:04:20.131Z", # Date-time of order creation, UTC
1216
- # "updatedAt": "2023-07-11T07:04:20.131Z" # Date-time of the last update of the order, UTC
1217
- # }
1218
- # ...
1219
- # ]
1220
- # }
1221
- #
1222
- data = self.safe_list(response, 'data', [])
1223
- return self.parse_orders(data, market, since, limit)
1224
-
1225
- def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1226
- """
1227
- fetches information on multiple closed orders made by the user
1228
- :see: https://docs.kuna.io/docs/get-private-orders-history
1229
- :param str symbol: unified market symbol of the market orders were made in
1230
- :param int [since]: the earliest time in ms to fetch orders for
1231
- :param int [limit]: the maximum number of order structures to retrieve
1232
- :param dict [params]: extra parameters specific to the exchange API endpoint
1233
- :param int [params.until]: the latest time in ms to fetch orders for
1234
- *
1235
- * EXCHANGE SPECIFIC PARAMETERS
1236
- :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
1237
- :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1238
- """
1239
- return self.fetch_orders_by_status('closed', symbol, since, limit, params)
1240
-
1241
- def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1242
- """
1243
- fetch a list of orders
1244
- :see: https://docs.kuna.io/docs/get-private-orders-history
1245
- :param str status: canceled, closed, expired, open, pending, rejected, or waitStop
1246
- :param str symbol: unified market symbol of the market orders were made in
1247
- :param int [since]: the earliest time in ms to fetch orders for
1248
- :param int [limit]: 1-100, the maximum number of open orders structures to retrieve
1249
- :param dict [params]: extra parameters specific to the exchange API endpoint
1250
- :param int [params.until]: the latest timestamp(ms) to fetch orders for
1251
- *
1252
- * EXCHANGE SPECIFIC PARAMETERS
1253
- :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
1254
- :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1255
- """
1256
- self.load_markets()
1257
- if status == 'open':
1258
- return self.fetch_open_orders(symbol, since, limit, params)
1259
- until = self.safe_integer(params, 'until')
1260
- params = self.omit(params, ['until'])
1261
- market = None
1262
- request: dict = {
1263
- 'status': self.capitalize(status),
1264
- }
1265
- if symbol is not None:
1266
- market = self.market(symbol)
1267
- request['pairs'] = market['id']
1268
- if since is not None:
1269
- request['start'] = self.iso8601(since)
1270
- if limit is not None:
1271
- request['limit'] = limit
1272
- if until is not None:
1273
- request['end'] = self.iso8601(until)
1274
- response = self.v4PrivateGetOrderPrivateHistory(request)
1275
- #
1276
- # {
1277
- # "data": [
1278
- # {
1279
- # "id": "4b9b9705-e85f-4180-bdec-219fbf025fa3", # Unique identifier of an order
1280
- # "type": "Limit", # Type of an order
1281
- # "quantity": "0.00054", # Original order quantity
1282
- # "executedQuantity": "0.00054", # Traded quantity in stock(>0 if traded)
1283
- # "cumulativeQuoteQty": "14.99580", # Traded quantity in money(>0 if traded)
1284
- # "cost": "14.9958", # Total amount
1285
- # "side": "Bid", # Bid for buying base asset, Ask for selling base asset. FYI: For BTC_USDT trading pair, BTC is the base asset
1286
- # "pair": "BTC_USDT", # Traded pair
1287
- # "price": "27770", # Price of the trade
1288
- # "status": "Closed", # The status of the order
1289
- # "createdAt": "2023-05-08T08:39:46.708Z", # Date-time of order creation, UTC
1290
- # "updatedAt": "2023-05-08T08:53:58.332Z", # Date-time of the last update of the order, UTC
1291
- # "closedAt": "2023-05-08T08:53:58.333Z" # Date-time of order finish time, UTC
1292
- # },
1293
- # ...
1294
- # ]
1295
- # }
1296
- #
1297
- data = self.safe_list(response, 'data', [])
1298
- return self.parse_orders(data, market, since, limit)
1299
-
1300
- def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1301
- """
1302
- fetch all trades made by the user
1303
- :see: https://docs.kuna.io/docs/get-private-trades-history
1304
- :param str symbol: unified market symbol
1305
- :param int [since]: not used by kuna fetchMyTrades
1306
- :param int [limit]: not used by kuna fetchMyTrades
1307
- :param dict [params]: extra parameters specific to the exchange API endpoint
1308
- *
1309
- * EXCHANGE SPECIFIC PARAMETERS
1310
- :param str [params.orderId]: UUID of an order, to receive trades for self order only
1311
- :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
1312
- :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1313
- """
1314
- self.load_markets()
1315
- market = None
1316
- request: dict = {}
1317
- if symbol is not None:
1318
- market = self.market(symbol)
1319
- request['pair'] = market['id']
1320
- response = self.v4PrivateGetTradePrivateHistory(self.extend(request, params))
1321
- #
1322
- # {
1323
- # "data": [
1324
- # {
1325
- # "id": "edb17459-c9bf-4148-9ae6-7367d7f55d71", # Unique identifier of a trade
1326
- # "orderId": "a80bec3f-4ffa-45c1-9d78-f6301e9748fe", # Unique identifier of an order associated with the trade
1327
- # "pair": "BTC_USDT", # Traded pair, base asset first, followed by quoted asset
1328
- # "quantity": "1.5862", # Traded quantity of base asset
1329
- # "price": "19087", # Price of the trade
1330
- # "isTaker": True, # Various fees for Makers and Takers; "Market" orders are always `true`
1331
- # "fee": "0.0039655", # Exchange commission fee
1332
- # "feeCurrency": "BTC", # Currency of the commission
1333
- # "isBuyer": True, # Buy or sell the base asset
1334
- # "quoteQuantity": "30275.7994", # Quote asset quantity spent to fulfill the base amount
1335
- # "createdAt": "2022-09-29T13:43:53.824Z", # Date-time of trade execution, UTC
1336
- # },
1337
- # ]
1338
- # }
1339
- #
1340
- data = self.safe_list(response, 'data')
1341
- return self.parse_trades(data, market, since, limit)
1342
-
1343
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1344
- """
1345
- make a withdrawal
1346
- :see: https://docs.kuna.io/docs/create-a-withdraw
1347
- :param str code: unified currency code
1348
- :param float amount: the amount to withdraw
1349
- :param str address: the address to withdraw to
1350
- :param str tag:
1351
- :param dict [params]: extra parameters specific to the exchange API endpoint
1352
- :param str [params.chain]: the chain to withdraw to
1353
- *
1354
- * EXCHANGE SPECIFIC PARAMETERS
1355
- :param str [params.id]: id must be a uuid format, if you do not specify id, it will be generated automatically
1356
- :param boolean [params.withdrawAll]: self field says that the amount should also include a fee
1357
- :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1358
- """
1359
- self.check_address(address)
1360
- chain = self.safe_string_2(params, 'chain', 'network')
1361
- params = self.omit(params, ['chain', 'network'])
1362
- self.load_markets()
1363
- currency = self.currency(code)
1364
- if chain is None:
1365
- if currency['code'].find('USD') > 0:
1366
- raise ArgumentsRequired(self.id + ' withdraw() requires an extra parameter params["network"] to withdraw ' + currency['code'])
1367
- else:
1368
- chain = currency['id'].upper()
1369
- networkId = self.network_code_to_id(chain)
1370
- request: dict = {
1371
- 'currency': networkId,
1372
- 'amount': amount,
1373
- 'address': address,
1374
- 'paymentMethod': chain, # TODO: double check, Withdraw method for currency, should be taken from "Get info about withdrawal methods by currency name" endpoint(key field).
1375
- }
1376
- if tag is not None:
1377
- request['paymentId'] = tag
1378
- response = self.v4PrivatePostWithdrawPrivateCreate(self.extend(request, params))
1379
- #
1380
- # {
1381
- # "data": {
1382
- # "id": "edb17459-c9bf-4148-9ae6-7367d7f55d71", # unique identifier of a withdraw
1383
- # "status": "waitingForConfirmation" # status of a withdraw, if you turn off withdrawal confirmation by email, it will return "processing" status, which means that the transaction is already being processed on our side
1384
- # }
1385
- # }
1386
- #
1387
- data = self.safe_dict(response, 'data', {})
1388
- return self.parse_transaction(data, currency)
1389
-
1390
- def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1391
- """
1392
- fetch all withdrawals made to an account
1393
- :see: https://docs.kuna.io/docs/get-withdraw-history
1394
- :param str code: unified currency code
1395
- :param int [since]: the earliest time in ms to fetch withdrawals for
1396
- :param int [limit]: the maximum number of withdrawals structures to retrieve
1397
- :param dict [params]: extra parameters specific to the exchange API endpoint
1398
- :param int [params.until]: the latest time in ms to fetch deposits for
1399
- *
1400
- * EXCHANGE SPECIFIC PARAMETERS
1401
- :param str [params.status]: Created, Canceled, PartiallyProcessed, Processing, Processed, WaitForConfirmation, Pending, AmlChecking
1402
- :param str [params.sortField]: amount(sorting by time), createdAt(sorting by date)
1403
- :param str [params.sortOrder]: asc(oldest-on-top), or desc(newest-on-top, default)
1404
- :param int [params.skip]: 0 - ... Select the number of transactions to skip
1405
- :param str [params.address]:
1406
- :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1407
- """
1408
- self.load_markets()
1409
- until = self.safe_integer(params, 'until')
1410
- params = self.omit(params, 'until')
1411
- currency = None
1412
- if code is not None:
1413
- currency = self.currency(code)
1414
- request: dict = {}
1415
- if code is not None:
1416
- request['currency'] = code
1417
- if since is not None:
1418
- request['dateFrom'] = self.iso8601(since)
1419
- if limit is not None:
1420
- request['take'] = limit
1421
- if until is not None:
1422
- request['dateTo'] = self.iso8601(until)
1423
- response = self.v4PrivateGetWithdrawPrivateHistory(self.extend(request, params))
1424
- #
1425
- # {
1426
- # "data": [
1427
- # {
1428
- # "id": "e9aa15b8-9c19-42eb-800a-026a7a153990", # Unique identifier of withdrawal
1429
- # "amount": "10.75", # Amount deducted from your account
1430
- # "asset": "USDT", # Withdrawal currency
1431
- # "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", # Internal ID(not for use)
1432
- # "paymentCode": "TRX", # Blockchain name
1433
- # "status": "Processed", # Withdrawal status
1434
- # "type": "Withdraw", # Transaction type
1435
- # "reason": [], # Reason for manual transaction processing
1436
- # "address": "TL3CWAwviQQYSnzHT4RotCWYnarnunQM46", # Withdrawal address
1437
- # "memo": "", # Withdrawal memo
1438
- # "txId": "5ecc4e559b528c57be6723ac960a38211fbd3101ef4b59008452b3bd88c84621", # Withdrawal transaction hash
1439
- # "fee": "0.75", # Withdrawal fee
1440
- # "processedAmount": "10", # Withdrawal amount
1441
- # "createdAt": "2023-06-09T11:33:02.383Z", # Withdrawal creation date
1442
- # "updatedAt": "2023-06-09T11:34:25.317Z" # Date of final withdrawal status
1443
- # },
1444
- # ...
1445
- # ]
1446
- # }
1447
- #
1448
- data = self.safe_list(response, 'data', [])
1449
- return self.parse_transactions(data, currency)
1450
-
1451
- def fetch_withdrawal(self, id: str, code: Str = None, params={}):
1452
- """
1453
- fetch data on a currency withdrawal via the withdrawal id
1454
- :see: https://docs.kuna.io/docs/get-withdraw-details-by-id
1455
- :param str id: withdrawal id
1456
- :param str code: not used by kuna.fetchWithdrawal
1457
- :param dict [params]: extra parameters specific to the exchange API endpoint
1458
- :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1459
- """
1460
- self.load_markets()
1461
- request: dict = {
1462
- 'withdrawId': id,
1463
- }
1464
- response = self.v4PrivateGetWithdrawPrivateDetailsWithdrawId(self.extend(request, params))
1465
- #
1466
- # {
1467
- # "data": {
1468
- # "id": "e9aa15b8-9c19-42eb-800a-026a7a153990", # Unique identifier of withdrawal
1469
- # "amount": "10.75", # Amount deducted from your account
1470
- # "asset": "USDT", # Withdrawal currency
1471
- # "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", # Internal ID(not for use)
1472
- # "paymentCode": "TRX", # Blockchain name
1473
- # "status": "Processed", # Withdrawal status
1474
- # "type": "Withdraw", # Transaction type
1475
- # "reason": [], # Reason for manual transaction processing
1476
- # "address": "TL3CWAwviQQYSnzHT4RotCWYnarnunQM46", # Withdrawal address
1477
- # "memo": "", # Withdrawal memo
1478
- # "txId": "5ecc4e559b528c57be6723ac960a38211fbd3101ef4b59008452b3bd88c84621", # Withdrawal transaction hash
1479
- # "fee": "0.75", # Withdrawal fee
1480
- # "processedAmount": "10", # Withdrawal amount
1481
- # "createdAt": "2023-06-09T11:33:02.383Z", # Withdrawal creation date
1482
- # "updatedAt": "2023-06-09T11:34:25.317Z" # Date of final withdrawal status
1483
- # }
1484
- # }
1485
- #
1486
- data = self.safe_dict(response, 'data', {})
1487
- return self.parse_transaction(data)
1488
-
1489
- def create_deposit_address(self, code: str, params={}):
1490
- """
1491
- create a currency deposit address
1492
- :see: https://docs.kuna.io/docs/generate-a-constant-crypto-address-for-deposit
1493
- :param str code: unified currency code of the currency for the deposit address
1494
- :param dict [params]: extra parameters specific to the exchange API endpoint
1495
- :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1496
- """
1497
- self.load_markets()
1498
- currency = self.currency(code)
1499
- request: dict = {
1500
- 'source': currency['id'],
1501
- }
1502
- response = self.v4PrivatePostDepositPrivateCryptoGenerateAddress(self.extend(request, params))
1503
- #
1504
- # {
1505
- # "data": {
1506
- # "id": "1300c2b6-ree4-4f1e-2a9d-e0f7ed0991a7", # ID of your address
1507
- # "source": "BTC", # Blockchain name for which you want to get the address to deposit into the account
1508
- # "address": "bc1qm6xfv0qsaaanx0egn6hca5vgsd4r7ak9ttha2a" # Your deposit address
1509
- # }
1510
- # }
1511
- #
1512
- data = self.safe_dict(response, 'data', {})
1513
- return self.parse_deposit_address(data, currency)
1514
-
1515
- def fetch_deposit_address(self, code: str, params={}):
1516
- """
1517
- fetch the deposit address for a currency associated with self account
1518
- :see: https://docs.kuna.io/docs/find-crypto-address-for-deposit
1519
- :param str code: unified currency code
1520
- :param dict [params]: extra parameters specific to the exchange API endpoint
1521
- :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1522
- """
1523
- self.load_markets()
1524
- currency = self.currency(code)
1525
- request: dict = {
1526
- 'source': currency['id'].upper(),
1527
- }
1528
- response = self.v4PrivateGetDepositPrivateCryptoAddress(self.extend(request, params))
1529
- #
1530
- # {
1531
- # "data": {
1532
- # "id": "c52b6646-fb91-4760-b147-a4f952e8652c", # ID of the address.
1533
- # "source": "BTC", # Blockchain name for which you want to get the address to deposit into the account.
1534
- # "address": "bc1qm6xfv0qsaaanx0egn6hca5vgsd4r7ak9ttha2a" # Your deposit address
1535
- # }
1536
- # }
1537
- #
1538
- data = self.safe_dict(response, 'data', {})
1539
- return self.parse_deposit_address(data, currency)
1540
-
1541
- def parse_deposit_address(self, depositAddress, currency: Currency = None):
1542
- #
1543
- # {
1544
- # "id": "c52b6646-fb91-4760-b147-a4f952e8652c", # ID of the address.
1545
- # "source": "BTC", # Blockchain name for which you want to get the address to deposit into the account.
1546
- # "address": "bc1qm6xfv0qsaaanx0egn6hca5vgsd4r7ak9ttha2a" # Your deposit address
1547
- # }
1548
- #
1549
- currencyId = self.safe_string(depositAddress, 'source')
1550
- return {
1551
- 'info': self.safe_string(depositAddress, ''),
1552
- 'currency': self.safe_currency_code(currencyId, currency),
1553
- 'network': None,
1554
- 'address': self.safe_string(depositAddress, 'address'),
1555
- 'tag': None,
1556
- }
1557
-
1558
- def parse_transaction_status(self, status: Str):
1559
- statuses: dict = {
1560
- 'Created': 'pending',
1561
- 'Canceled': 'canceled',
1562
- 'PartiallyProcessed': 'pending',
1563
- 'Processing': 'pending',
1564
- 'Processed': 'ok',
1565
- 'WaitForConfirmation': 'pending',
1566
- 'Pending': 'pending',
1567
- 'AmlChecking': 'pending',
1568
- }
1569
- return self.safe_string(statuses, status, status)
1570
-
1571
- def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1572
- """
1573
- fetch all deposits made to an account
1574
- :see: https://docs.kuna.io/docs/get-deposit-history
1575
- :param str code: unified currency code
1576
- :param int [since]: the earliest time in ms to fetch deposits for
1577
- :param int [limit]: the maximum number of deposits structures to retrieve
1578
- :param dict [params]: extra parameters specific to the exchange API endpoint
1579
- :param int [params.until]: the latest time in ms to fetch deposits for
1580
- *
1581
- * EXCHANGE SPECIFIC PARAMETERS
1582
- :param str [params.status]: Created, Canceled, PartiallyProcessed, Processing, Processed, WaitForConfirmation, Pending, AmlChecking
1583
- :param str [params.sortField]: amount(sorting by time), createdAt(sorting by date)
1584
- :param str [params.sortOrder]: asc(oldest-on-top), or desc(newest-on-top, default)
1585
- :param int [params.skip]: 0 - ... Select the number of transactions to skip
1586
- :param str [params.address]:
1587
- :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1588
- """
1589
- self.load_markets()
1590
- until = self.safe_integer(params, 'until')
1591
- params = self.omit(params, 'until')
1592
- currency = None
1593
- if code is not None:
1594
- currency = self.currency(code)
1595
- request: dict = {}
1596
- if code is not None:
1597
- request['currency'] = code
1598
- if since is not None:
1599
- request['dateFrom'] = self.iso8601(since)
1600
- if limit is not None:
1601
- request['take'] = limit
1602
- if until is not None:
1603
- request['dateTo'] = self.iso8601(until)
1604
- response = self.v4PrivateGetDepositPrivateHistory(self.extend(request, params))
1605
- #
1606
- # {
1607
- # "data": [
1608
- # {
1609
- # "id": "a201cb3c-5830-57ac-ad2c-f6a588dd55eb", # Unique ID of deposit
1610
- # "amount": "9.9", # Amount credited to your account
1611
- # "asset": "USDT", # Deposit currency
1612
- # "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", # Internal ID(not for use)
1613
- # "paymentCode": "TRX", # Blockchain name
1614
- # "status": "Processed", # Transactions status
1615
- # "type": "Deposit", # Transaction type
1616
- # "reason": [], # Reason for manual transaction processing
1617
- # "address": "TNeBQz8RyGGiAYAR7r8G6QGxtTWDkpH4dV", # Deposit address
1618
- # "memo": "", # Deposit memo
1619
- # "txId": "8a0b0c5a2ac5679879b71b2fa63b0a5c39f90bc8ff6c41e708906b398ac3d4ef", # Deposit transaction hash
1620
- # "fee": "0.1", # Deposit fee
1621
- # "processedAmount": "10", # Amount of deposit
1622
- # "createdAt": "2023-06-13T12:55:01.256Z", # Deposit receipt date
1623
- # "updatedAt": "2023-06-13T12:55:01.696Z" # Deposit credit date
1624
- # },
1625
- # ...
1626
- # ]
1627
- # }
1628
- #
1629
- data = self.safe_list(response, 'data', [])
1630
- return self.parse_transactions(data, currency)
1631
-
1632
- def fetch_deposit(self, id: str, code: Str = None, params={}):
1633
- """
1634
- fetch data on a currency deposit via the deposit id
1635
- :see: https://docs.kuna.io/docs/get-deposit-details-by-id
1636
- :param str id: deposit id
1637
- :param str code: filter by currency code
1638
- :param dict [params]: extra parameters specific to the exchange API endpoint
1639
- :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1640
- """
1641
- self.load_markets()
1642
- currency = None
1643
- if code is not None:
1644
- currency = self.currency(code)
1645
- request: dict = {
1646
- 'depositId': id,
1647
- }
1648
- response = self.v4PrivateGetDepositPrivateDetailsDepositId(self.extend(request, params))
1649
- #
1650
- # {
1651
- # "data": {
1652
- # "id": "a201cb3c-5830-57ac-ad2c-f6a588dd55eb", # Unique ID of deposit
1653
- # "amount": "9.9", # Amount credited to your account
1654
- # "asset": "USDT", # Deposit currency
1655
- # "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", # Internal ID(not for use)
1656
- # "paymentCode": "TRX", # Blockchain name
1657
- # "status": "Processed", # Transactions status
1658
- # "type": "Deposit", # Transaction type
1659
- # "reason": [], # Reason for manual transaction processing
1660
- # "address": "TNeBQz8RyGGiAYAR7r8G6QGxtTWDkpH4dV", # Deposit address
1661
- # "memo": "", # Deposit memo
1662
- # "txId": "8a0b0c5a2ac5679879b71b2fa63b0a5c39f90bc8ff6c41e708906b398ac3d4ef", # Deposit transaction hash
1663
- # "fee": "0.1", # Deposit fee
1664
- # "processedAmount": "10", # Amount of deposit
1665
- # "createdAt": "2023-06-13T12:55:01.256Z", # Deposit receipt date
1666
- # "updatedAt": "2023-06-13T12:55:01.696Z" # Deposit credit date
1667
- # }
1668
- # }
1669
- #
1670
- data = self.safe_dict(response, 'data', {})
1671
- return self.parse_transaction(data, currency)
1672
-
1673
- def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1674
- #
1675
- # {
1676
- # "id": "a201cb3c-5830-57ac-ad2c-f6a588dd55eb", # Unique ID of deposit
1677
- # "amount": "9.9", # Amount credited to your account
1678
- # "asset": "USDT", # Deposit currency
1679
- # "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", # Internal ID(not for use)
1680
- # "paymentCode": "TRX", # Blockchain name
1681
- # "status": "Processed", # Transactions status
1682
- # "type": "Deposit", # Transaction type
1683
- # "reason": [], # Reason for manual transaction processing
1684
- # "address": "TNeBQz8RyGGiAYAR7r8G6QGxtTWDkpH4dV", # Deposit address
1685
- # "memo": "", # Deposit memo
1686
- # "txId": "8a0b0c5a2ac5679879b71b2fa63b0a5c39f90bc8ff6c41e708906b398ac3d4ef", # Deposit transaction hash
1687
- # "fee": "0.1", # Deposit fee
1688
- # "processedAmount": "10", # Amount of deposit
1689
- # "createdAt": "2023-06-13T12:55:01.256Z", # Deposit receipt date
1690
- # "updatedAt": "2023-06-13T12:55:01.696Z" # Deposit credit date
1691
- # }
1692
- #
1693
- datetime = self.safe_string(transaction, 'createdAt')
1694
- currencyId = self.safe_string(transaction, 'asset')
1695
- code = self.safe_currency_code(currencyId, currency)
1696
- networkId = self.safe_string(transaction, 'paymentCode')
1697
- type = self.safe_string_lower(transaction, 'type')
1698
- address = self.safe_string(transaction, 'address')
1699
- isDeposit = (type == 'deposit')
1700
- parsedType = type if isDeposit else 'withdrawal'
1701
- return {
1702
- 'info': transaction,
1703
- 'id': self.safe_string(transaction, 'id'),
1704
- 'txid': self.safe_string(transaction, 'txId'),
1705
- 'currency': code,
1706
- 'timestamp': self.parse8601(datetime),
1707
- 'datetime': datetime,
1708
- 'network': self.network_id_to_code(networkId),
1709
- 'addressFrom': None,
1710
- 'address': address,
1711
- 'addressTo': address,
1712
- 'amount': self.safe_number(transaction, 'amount'),
1713
- 'type': parsedType,
1714
- 'status': self.parse_transaction_status(self.safe_string(transaction, 'status')),
1715
- 'updated': self.parse8601(self.safe_string(transaction, 'updatedAt')),
1716
- 'tagFrom': None,
1717
- 'tag': None,
1718
- 'tagTo': None,
1719
- 'comment': self.safe_string(transaction, 'memo'),
1720
- 'internal': None,
1721
- 'fee': {
1722
- 'cost': self.safe_number(transaction, 'fee'),
1723
- 'currency': code,
1724
- },
1725
- }
1726
-
1727
- def nonce(self):
1728
- return self.milliseconds()
1729
-
1730
- def encode_params(self, params):
1731
- if 'orders' in params:
1732
- orders = params['orders']
1733
- query = self.urlencode(self.keysort(self.omit(params, 'orders')))
1734
- for i in range(0, len(orders)):
1735
- order = orders[i]
1736
- keys = list(order.keys())
1737
- for k in range(0, len(keys)):
1738
- key = keys[k]
1739
- value = order[key]
1740
- query += '&orders%5B%5D%5B' + key + '%5D=' + str(value)
1741
- return query
1742
- return self.urlencode(self.keysort(params))
1743
-
1744
- def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
1745
- url = None
1746
- if isinstance(api, list):
1747
- isGet = method == 'GET'
1748
- version = self.safe_string(api, 0)
1749
- access = self.safe_string(api, 1)
1750
- if version == 'v3':
1751
- url = self.urls['api'][version] + '/' + version + '/' + self.implode_params(path, params)
1752
- if access == 'public':
1753
- if isGet:
1754
- if params:
1755
- url += '?' + self.urlencode(params)
1756
- elif (method == 'POST') or (method == 'PUT'):
1757
- headers = {'Content-Type': 'application/json'}
1758
- body = self.json(params)
1759
- elif access == 'private':
1760
- raise NotSupported(self.id + ' private v3 API is not supported yet')
1761
- elif version == 'v4':
1762
- extractedParams = self.extract_params(path)
1763
- urlPath = '/' + version + '/' + self.implode_params(path, params)
1764
- params = self.omit(params, extractedParams)
1765
- if isGet:
1766
- paramsList = list(params.keys())
1767
- numParams = len(paramsList)
1768
- if numParams > 0:
1769
- urlPath += '?' + self.urlencode(params)
1770
- if access == 'private':
1771
- nonce = str(self.nonce())
1772
- auth = urlPath + nonce
1773
- if isGet:
1774
- auth = auth + self.json({})
1775
- else:
1776
- auth = auth + self.json(params)
1777
- body = params
1778
- headers = {
1779
- 'Content-Type': 'application/json',
1780
- 'accept': 'application/json',
1781
- 'nonce': nonce,
1782
- 'public-key': self.apiKey,
1783
- 'signature': self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha384, 'hex'),
1784
- }
1785
- account = self.safe_string(self.options, 'account')
1786
- if account == 'pro':
1787
- headers['account'] = 'pro'
1788
- url = self.urls['api'][version] + urlPath
1789
- else:
1790
- request = '/api/' + self.version + '/' + self.implode_params(path, params)
1791
- if 'extension' in self.urls:
1792
- request += self.urls['extension']
1793
- query = self.omit(params, self.extract_params(path))
1794
- url = self.urls['api'][api] + request
1795
- if api == 'public':
1796
- if query:
1797
- url += '?' + self.urlencode(query)
1798
- else:
1799
- self.check_required_credentials()
1800
- nonce = str(self.nonce())
1801
- queryInner = self.encode_params(self.extend({
1802
- 'access_key': self.apiKey,
1803
- 'tonce': nonce,
1804
- }, params))
1805
- auth = method + '|' + request + '|' + queryInner
1806
- signed = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256)
1807
- suffix = query + '&signature=' + signed
1808
- if method == 'GET':
1809
- url += '?' + suffix
1810
- else:
1811
- body = suffix
1812
- headers = {'Content-Type': 'application/x-www-form-urlencoded'}
1813
- if body is not None:
1814
- body = json.dumps(body)
1815
- return {'url': url, 'method': method, 'body': body, 'headers': headers}
1816
-
1817
- def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1818
- #
1819
- # {
1820
- # "errors": [
1821
- # {
1822
- # "extensions": {
1823
- # "code": "IP_NOT_IN_WHITE_LIST"
1824
- # },
1825
- # "code": "IP_NOT_IN_WHITE_LIST"
1826
- # }
1827
- # ]
1828
- # }
1829
- #
1830
- errors = self.safe_value(response, 'errors')
1831
- if (response is None) and (errors is None):
1832
- return None
1833
- if (errors is not None) or (code == 400):
1834
- error = self.safe_value(errors, 0)
1835
- if error is None:
1836
- error = self.safe_value(response, 'error')
1837
- errorCode = self.safe_string(error, 'code')
1838
- feedback = self.id + ' ' + self.json(response)
1839
- self.throw_exactly_matched_exception(self.exceptions, errorCode, feedback)
1840
- raise ExchangeError(feedback)
1841
- return None