ccxt-ir 4.3.46.0.1__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 (772) hide show
  1. ccxt/__init__.py +358 -0
  2. ccxt/abantether.py +316 -0
  3. ccxt/abstract/__init__.py +0 -0
  4. ccxt/abstract/abantether.py +5 -0
  5. ccxt/abstract/ace.py +15 -0
  6. ccxt/abstract/afratether.py +6 -0
  7. ccxt/abstract/alpaca.py +70 -0
  8. ccxt/abstract/arzinja.py +5 -0
  9. ccxt/abstract/arzplus.py +7 -0
  10. ccxt/abstract/ascendex.py +77 -0
  11. ccxt/abstract/bequant.py +115 -0
  12. ccxt/abstract/bigone.py +45 -0
  13. ccxt/abstract/binance.py +712 -0
  14. ccxt/abstract/binancecoinm.py +712 -0
  15. ccxt/abstract/binanceus.py +764 -0
  16. ccxt/abstract/binanceusdm.py +712 -0
  17. ccxt/abstract/bingx.py +113 -0
  18. ccxt/abstract/bit2c.py +27 -0
  19. ccxt/abstract/bitbank.py +27 -0
  20. ccxt/abstract/bitbay.py +53 -0
  21. ccxt/abstract/bitbns.py +40 -0
  22. ccxt/abstract/bitcoincom.py +115 -0
  23. ccxt/abstract/bitfinex.py +69 -0
  24. ccxt/abstract/bitfinex2.py +139 -0
  25. ccxt/abstract/bitflyer.py +38 -0
  26. ccxt/abstract/bitget.py +508 -0
  27. ccxt/abstract/bithumb.py +32 -0
  28. ccxt/abstract/bitimen.py +7 -0
  29. ccxt/abstract/bitir.py +7 -0
  30. ccxt/abstract/bitmart.py +99 -0
  31. ccxt/abstract/bitmex.py +97 -0
  32. ccxt/abstract/bitopro.py +29 -0
  33. ccxt/abstract/bitpanda.py +35 -0
  34. ccxt/abstract/bitpin.py +7 -0
  35. ccxt/abstract/bitrue.py +72 -0
  36. ccxt/abstract/bitso.py +43 -0
  37. ccxt/abstract/bitstamp.py +258 -0
  38. ccxt/abstract/bitteam.py +29 -0
  39. ccxt/abstract/bitvavo.py +27 -0
  40. ccxt/abstract/bl3p.py +19 -0
  41. ccxt/abstract/blockchaincom.py +28 -0
  42. ccxt/abstract/blofin.py +37 -0
  43. ccxt/abstract/btcalpha.py +18 -0
  44. ccxt/abstract/btcbox.py +13 -0
  45. ccxt/abstract/btcmarkets.py +39 -0
  46. ccxt/abstract/btcturk.py +20 -0
  47. ccxt/abstract/bybit.py +298 -0
  48. ccxt/abstract/cex.py +33 -0
  49. ccxt/abstract/coinbase.py +94 -0
  50. ccxt/abstract/coinbaseadvanced.py +94 -0
  51. ccxt/abstract/coinbaseexchange.py +67 -0
  52. ccxt/abstract/coinbaseinternational.py +39 -0
  53. ccxt/abstract/coincatch.py +94 -0
  54. ccxt/abstract/coincheck.py +33 -0
  55. ccxt/abstract/coinex.py +237 -0
  56. ccxt/abstract/coinlist.py +54 -0
  57. ccxt/abstract/coinmate.py +62 -0
  58. ccxt/abstract/coinmetro.py +34 -0
  59. ccxt/abstract/coinone.py +67 -0
  60. ccxt/abstract/coinsph.py +54 -0
  61. ccxt/abstract/coinspot.py +28 -0
  62. ccxt/abstract/cryptocom.py +107 -0
  63. ccxt/abstract/currencycom.py +68 -0
  64. ccxt/abstract/delta.py +50 -0
  65. ccxt/abstract/deribit.py +125 -0
  66. ccxt/abstract/digifinex.py +91 -0
  67. ccxt/abstract/eterex.py +5 -0
  68. ccxt/abstract/excoino.py +7 -0
  69. ccxt/abstract/exir.py +8 -0
  70. ccxt/abstract/exmo.py +55 -0
  71. ccxt/abstract/exnovin.py +6 -0
  72. ccxt/abstract/farhadexchange.py +5 -0
  73. ccxt/abstract/fmfwio.py +115 -0
  74. ccxt/abstract/gate.py +265 -0
  75. ccxt/abstract/gateio.py +265 -0
  76. ccxt/abstract/gemini.py +58 -0
  77. ccxt/abstract/hashkey.py +67 -0
  78. ccxt/abstract/hitbtc.py +115 -0
  79. ccxt/abstract/hitbtc3.py +115 -0
  80. ccxt/abstract/hitobit.py +8 -0
  81. ccxt/abstract/hollaex.py +33 -0
  82. ccxt/abstract/htx.py +548 -0
  83. ccxt/abstract/huobi.py +548 -0
  84. ccxt/abstract/huobijp.py +114 -0
  85. ccxt/abstract/hyperliquid.py +6 -0
  86. ccxt/abstract/idex.py +26 -0
  87. ccxt/abstract/independentreserve.py +37 -0
  88. ccxt/abstract/indodax.py +26 -0
  89. ccxt/abstract/jibitex.py +7 -0
  90. ccxt/abstract/kraken.py +57 -0
  91. ccxt/abstract/krakenfutures.py +38 -0
  92. ccxt/abstract/kucoin.py +214 -0
  93. ccxt/abstract/kucoinfutures.py +233 -0
  94. ccxt/abstract/kuna.py +182 -0
  95. ccxt/abstract/latoken.py +56 -0
  96. ccxt/abstract/lbank.py +61 -0
  97. ccxt/abstract/luno.py +37 -0
  98. ccxt/abstract/lykke.py +29 -0
  99. ccxt/abstract/mercado.py +25 -0
  100. ccxt/abstract/mexc.py +178 -0
  101. ccxt/abstract/ndax.py +97 -0
  102. ccxt/abstract/nobitex.py +7 -0
  103. ccxt/abstract/novadax.py +29 -0
  104. ccxt/abstract/oceanex.py +22 -0
  105. ccxt/abstract/okcoin.py +74 -0
  106. ccxt/abstract/okexchange.py +8 -0
  107. ccxt/abstract/okx.py +324 -0
  108. ccxt/abstract/ompfinex.py +7 -0
  109. ccxt/abstract/onetrading.py +35 -0
  110. ccxt/abstract/oxfun.py +34 -0
  111. ccxt/abstract/p2b.py +22 -0
  112. ccxt/abstract/paradex.py +40 -0
  113. ccxt/abstract/paymium.py +28 -0
  114. ccxt/abstract/phemex.py +115 -0
  115. ccxt/abstract/poloniex.py +69 -0
  116. ccxt/abstract/poloniexfutures.py +48 -0
  117. ccxt/abstract/probit.py +23 -0
  118. ccxt/abstract/ramzinex.py +7 -0
  119. ccxt/abstract/sarmayex.py +5 -0
  120. ccxt/abstract/sarrafex.py +7 -0
  121. ccxt/abstract/tabdeal.py +7 -0
  122. ccxt/abstract/tetherland.py +5 -0
  123. ccxt/abstract/timex.py +62 -0
  124. ccxt/abstract/tokocrypto.py +37 -0
  125. ccxt/abstract/tradeogre.py +16 -0
  126. ccxt/abstract/twox.py +5 -0
  127. ccxt/abstract/ubitex.py +7 -0
  128. ccxt/abstract/upbit.py +38 -0
  129. ccxt/abstract/vertex.py +19 -0
  130. ccxt/abstract/wallex.py +8 -0
  131. ccxt/abstract/wavesexchange.py +154 -0
  132. ccxt/abstract/wazirx.py +30 -0
  133. ccxt/abstract/whitebit.py +98 -0
  134. ccxt/abstract/woo.py +83 -0
  135. ccxt/abstract/woofipro.py +119 -0
  136. ccxt/abstract/xt.py +152 -0
  137. ccxt/abstract/yobit.py +16 -0
  138. ccxt/abstract/zaif.py +38 -0
  139. ccxt/abstract/zonda.py +53 -0
  140. ccxt/ace.py +1012 -0
  141. ccxt/afratether.py +293 -0
  142. ccxt/alpaca.py +1083 -0
  143. ccxt/arzinja.py +285 -0
  144. ccxt/arzplus.py +412 -0
  145. ccxt/ascendex.py +3330 -0
  146. ccxt/async_support/__init__.py +337 -0
  147. ccxt/async_support/abantether.py +316 -0
  148. ccxt/async_support/ace.py +1012 -0
  149. ccxt/async_support/afratether.py +293 -0
  150. ccxt/async_support/alpaca.py +1083 -0
  151. ccxt/async_support/arzinja.py +285 -0
  152. ccxt/async_support/arzplus.py +412 -0
  153. ccxt/async_support/ascendex.py +3330 -0
  154. ccxt/async_support/base/__init__.py +1 -0
  155. ccxt/async_support/base/exchange.py +1966 -0
  156. ccxt/async_support/base/throttler.py +50 -0
  157. ccxt/async_support/base/ws/__init__.py +38 -0
  158. ccxt/async_support/base/ws/aiohttp_client.py +125 -0
  159. ccxt/async_support/base/ws/cache.py +212 -0
  160. ccxt/async_support/base/ws/client.py +193 -0
  161. ccxt/async_support/base/ws/fast_client.py +96 -0
  162. ccxt/async_support/base/ws/functions.py +59 -0
  163. ccxt/async_support/base/ws/future.py +58 -0
  164. ccxt/async_support/base/ws/order_book.py +78 -0
  165. ccxt/async_support/base/ws/order_book_side.py +174 -0
  166. ccxt/async_support/bequant.py +33 -0
  167. ccxt/async_support/bigone.py +2113 -0
  168. ccxt/async_support/binance.py +12234 -0
  169. ccxt/async_support/binancecoinm.py +45 -0
  170. ccxt/async_support/binanceus.py +211 -0
  171. ccxt/async_support/binanceusdm.py +58 -0
  172. ccxt/async_support/bingx.py +4325 -0
  173. ccxt/async_support/bit2c.py +866 -0
  174. ccxt/async_support/bitbank.py +1001 -0
  175. ccxt/async_support/bitbay.py +17 -0
  176. ccxt/async_support/bitbns.py +1154 -0
  177. ccxt/async_support/bitcoincom.py +17 -0
  178. ccxt/async_support/bitfinex.py +1617 -0
  179. ccxt/async_support/bitfinex2.py +3552 -0
  180. ccxt/async_support/bitflyer.py +995 -0
  181. ccxt/async_support/bitget.py +8273 -0
  182. ccxt/async_support/bithumb.py +1061 -0
  183. ccxt/async_support/bitimen.py +401 -0
  184. ccxt/async_support/bitir.py +490 -0
  185. ccxt/async_support/bitmart.py +4415 -0
  186. ccxt/async_support/bitmex.py +2756 -0
  187. ccxt/async_support/bitopro.py +1630 -0
  188. ccxt/async_support/bitpanda.py +16 -0
  189. ccxt/async_support/bitpin.py +454 -0
  190. ccxt/async_support/bitrue.py +3027 -0
  191. ccxt/async_support/bitso.py +1670 -0
  192. ccxt/async_support/bitstamp.py +2203 -0
  193. ccxt/async_support/bitteam.py +2239 -0
  194. ccxt/async_support/bitvavo.py +1968 -0
  195. ccxt/async_support/bl3p.py +485 -0
  196. ccxt/async_support/blockchaincom.py +1104 -0
  197. ccxt/async_support/blofin.py +2066 -0
  198. ccxt/async_support/btcalpha.py +891 -0
  199. ccxt/async_support/btcbox.py +544 -0
  200. ccxt/async_support/btcmarkets.py +1221 -0
  201. ccxt/async_support/btcturk.py +911 -0
  202. ccxt/async_support/bybit.py +8159 -0
  203. ccxt/async_support/cex.py +1605 -0
  204. ccxt/async_support/coinbase.py +4475 -0
  205. ccxt/async_support/coinbaseadvanced.py +17 -0
  206. ccxt/async_support/coinbaseexchange.py +1734 -0
  207. ccxt/async_support/coinbaseinternational.py +1899 -0
  208. ccxt/async_support/coincatch.py +5069 -0
  209. ccxt/async_support/coincheck.py +815 -0
  210. ccxt/async_support/coinex.py +5526 -0
  211. ccxt/async_support/coinlist.py +2243 -0
  212. ccxt/async_support/coinmate.py +1067 -0
  213. ccxt/async_support/coinmetro.py +1797 -0
  214. ccxt/async_support/coinone.py +1127 -0
  215. ccxt/async_support/coinsph.py +1850 -0
  216. ccxt/async_support/coinspot.py +534 -0
  217. ccxt/async_support/cryptocom.py +2822 -0
  218. ccxt/async_support/currencycom.py +1950 -0
  219. ccxt/async_support/delta.py +3376 -0
  220. ccxt/async_support/deribit.py +3437 -0
  221. ccxt/async_support/digifinex.py +3960 -0
  222. ccxt/async_support/eterex.py +286 -0
  223. ccxt/async_support/excoino.py +399 -0
  224. ccxt/async_support/exir.py +375 -0
  225. ccxt/async_support/exmo.py +2462 -0
  226. ccxt/async_support/exnovin.py +360 -0
  227. ccxt/async_support/farhadexchange.py +266 -0
  228. ccxt/async_support/fmfwio.py +34 -0
  229. ccxt/async_support/gate.py +6976 -0
  230. ccxt/async_support/gateio.py +16 -0
  231. ccxt/async_support/gemini.py +1825 -0
  232. ccxt/async_support/hashkey.py +4150 -0
  233. ccxt/async_support/hitbtc.py +3423 -0
  234. ccxt/async_support/hitbtc3.py +16 -0
  235. ccxt/async_support/hitobit.py +391 -0
  236. ccxt/async_support/hollaex.py +1813 -0
  237. ccxt/async_support/htx.py +8506 -0
  238. ccxt/async_support/huobi.py +16 -0
  239. ccxt/async_support/huobijp.py +1801 -0
  240. ccxt/async_support/hyperliquid.py +2431 -0
  241. ccxt/async_support/idex.py +1766 -0
  242. ccxt/async_support/independentreserve.py +784 -0
  243. ccxt/async_support/indodax.py +1247 -0
  244. ccxt/async_support/jibitex.py +395 -0
  245. ccxt/async_support/kraken.py +2894 -0
  246. ccxt/async_support/krakenfutures.py +2601 -0
  247. ccxt/async_support/kucoin.py +4602 -0
  248. ccxt/async_support/kucoinfutures.py +2698 -0
  249. ccxt/async_support/kuna.py +1841 -0
  250. ccxt/async_support/latoken.py +1664 -0
  251. ccxt/async_support/lbank.py +2683 -0
  252. ccxt/async_support/luno.py +1067 -0
  253. ccxt/async_support/lykke.py +1270 -0
  254. ccxt/async_support/mercado.py +842 -0
  255. ccxt/async_support/mexc.py +5369 -0
  256. ccxt/async_support/ndax.py +2354 -0
  257. ccxt/async_support/nobitex.py +419 -0
  258. ccxt/async_support/novadax.py +1484 -0
  259. ccxt/async_support/oceanex.py +903 -0
  260. ccxt/async_support/okcoin.py +2936 -0
  261. ccxt/async_support/okexchange.py +349 -0
  262. ccxt/async_support/okx.py +7827 -0
  263. ccxt/async_support/ompfinex.py +472 -0
  264. ccxt/async_support/onetrading.py +1911 -0
  265. ccxt/async_support/oxfun.py +2773 -0
  266. ccxt/async_support/p2b.py +1194 -0
  267. ccxt/async_support/paradex.py +2015 -0
  268. ccxt/async_support/paymium.py +564 -0
  269. ccxt/async_support/phemex.py +4473 -0
  270. ccxt/async_support/poloniex.py +2232 -0
  271. ccxt/async_support/poloniexfutures.py +1717 -0
  272. ccxt/async_support/probit.py +1734 -0
  273. ccxt/async_support/ramzinex.py +476 -0
  274. ccxt/async_support/sarmayex.py +357 -0
  275. ccxt/async_support/sarrafex.py +478 -0
  276. ccxt/async_support/tabdeal.py +364 -0
  277. ccxt/async_support/tetherland.py +349 -0
  278. ccxt/async_support/timex.py +1593 -0
  279. ccxt/async_support/tokocrypto.py +2405 -0
  280. ccxt/async_support/tradeogre.py +608 -0
  281. ccxt/async_support/twox.py +326 -0
  282. ccxt/async_support/ubitex.py +409 -0
  283. ccxt/async_support/upbit.py +1833 -0
  284. ccxt/async_support/vertex.py +2922 -0
  285. ccxt/async_support/wallex.py +445 -0
  286. ccxt/async_support/wavesexchange.py +2473 -0
  287. ccxt/async_support/wazirx.py +1224 -0
  288. ccxt/async_support/whitebit.py +2469 -0
  289. ccxt/async_support/woo.py +3114 -0
  290. ccxt/async_support/woofipro.py +2533 -0
  291. ccxt/async_support/xt.py +4454 -0
  292. ccxt/async_support/yobit.py +1283 -0
  293. ccxt/async_support/zaif.py +725 -0
  294. ccxt/async_support/zonda.py +1828 -0
  295. ccxt/base/__init__.py +27 -0
  296. ccxt/base/decimal_to_precision.py +174 -0
  297. ccxt/base/errors.py +242 -0
  298. ccxt/base/exchange.py +5941 -0
  299. ccxt/base/precise.py +287 -0
  300. ccxt/base/types.py +502 -0
  301. ccxt/bequant.py +33 -0
  302. ccxt/bigone.py +2112 -0
  303. ccxt/binance.py +12233 -0
  304. ccxt/binancecoinm.py +45 -0
  305. ccxt/binanceus.py +211 -0
  306. ccxt/binanceusdm.py +58 -0
  307. ccxt/bingx.py +4324 -0
  308. ccxt/bit2c.py +866 -0
  309. ccxt/bitbank.py +1001 -0
  310. ccxt/bitbay.py +17 -0
  311. ccxt/bitbns.py +1154 -0
  312. ccxt/bitcoincom.py +17 -0
  313. ccxt/bitfinex.py +1617 -0
  314. ccxt/bitfinex2.py +3552 -0
  315. ccxt/bitflyer.py +995 -0
  316. ccxt/bitget.py +8272 -0
  317. ccxt/bithumb.py +1061 -0
  318. ccxt/bitimen.py +401 -0
  319. ccxt/bitir.py +490 -0
  320. ccxt/bitmart.py +4415 -0
  321. ccxt/bitmex.py +2756 -0
  322. ccxt/bitopro.py +1630 -0
  323. ccxt/bitpanda.py +16 -0
  324. ccxt/bitpin.py +454 -0
  325. ccxt/bitrue.py +3026 -0
  326. ccxt/bitso.py +1670 -0
  327. ccxt/bitstamp.py +2203 -0
  328. ccxt/bitteam.py +2239 -0
  329. ccxt/bitvavo.py +1968 -0
  330. ccxt/bl3p.py +485 -0
  331. ccxt/blockchaincom.py +1104 -0
  332. ccxt/blofin.py +2066 -0
  333. ccxt/btcalpha.py +891 -0
  334. ccxt/btcbox.py +544 -0
  335. ccxt/btcmarkets.py +1221 -0
  336. ccxt/btcturk.py +911 -0
  337. ccxt/bybit.py +8158 -0
  338. ccxt/cex.py +1605 -0
  339. ccxt/coinbase.py +4474 -0
  340. ccxt/coinbaseadvanced.py +17 -0
  341. ccxt/coinbaseexchange.py +1734 -0
  342. ccxt/coinbaseinternational.py +1899 -0
  343. ccxt/coincatch.py +5069 -0
  344. ccxt/coincheck.py +815 -0
  345. ccxt/coinex.py +5525 -0
  346. ccxt/coinlist.py +2243 -0
  347. ccxt/coinmate.py +1067 -0
  348. ccxt/coinmetro.py +1797 -0
  349. ccxt/coinone.py +1127 -0
  350. ccxt/coinsph.py +1850 -0
  351. ccxt/coinspot.py +534 -0
  352. ccxt/cryptocom.py +2822 -0
  353. ccxt/currencycom.py +1950 -0
  354. ccxt/delta.py +3376 -0
  355. ccxt/deribit.py +3437 -0
  356. ccxt/digifinex.py +3959 -0
  357. ccxt/eterex.py +286 -0
  358. ccxt/excoino.py +399 -0
  359. ccxt/exir.py +375 -0
  360. ccxt/exmo.py +2462 -0
  361. ccxt/exnovin.py +360 -0
  362. ccxt/farhadexchange.py +266 -0
  363. ccxt/fmfwio.py +34 -0
  364. ccxt/gate.py +6975 -0
  365. ccxt/gateio.py +16 -0
  366. ccxt/gemini.py +1824 -0
  367. ccxt/hashkey.py +4150 -0
  368. ccxt/hitbtc.py +3423 -0
  369. ccxt/hitbtc3.py +16 -0
  370. ccxt/hitobit.py +391 -0
  371. ccxt/hollaex.py +1813 -0
  372. ccxt/htx.py +8505 -0
  373. ccxt/huobi.py +16 -0
  374. ccxt/huobijp.py +1801 -0
  375. ccxt/hyperliquid.py +2430 -0
  376. ccxt/idex.py +1766 -0
  377. ccxt/independentreserve.py +784 -0
  378. ccxt/indodax.py +1247 -0
  379. ccxt/jibitex.py +395 -0
  380. ccxt/kraken.py +2894 -0
  381. ccxt/krakenfutures.py +2601 -0
  382. ccxt/kucoin.py +4601 -0
  383. ccxt/kucoinfutures.py +2698 -0
  384. ccxt/kuna.py +1841 -0
  385. ccxt/latoken.py +1664 -0
  386. ccxt/lbank.py +2682 -0
  387. ccxt/luno.py +1067 -0
  388. ccxt/lykke.py +1270 -0
  389. ccxt/mercado.py +842 -0
  390. ccxt/mexc.py +5369 -0
  391. ccxt/ndax.py +2354 -0
  392. ccxt/nobitex.py +419 -0
  393. ccxt/novadax.py +1484 -0
  394. ccxt/oceanex.py +903 -0
  395. ccxt/okcoin.py +2936 -0
  396. ccxt/okexchange.py +349 -0
  397. ccxt/okx.py +7826 -0
  398. ccxt/ompfinex.py +472 -0
  399. ccxt/onetrading.py +1911 -0
  400. ccxt/oxfun.py +2772 -0
  401. ccxt/p2b.py +1194 -0
  402. ccxt/paradex.py +2015 -0
  403. ccxt/paymium.py +564 -0
  404. ccxt/phemex.py +4473 -0
  405. ccxt/poloniex.py +2232 -0
  406. ccxt/poloniexfutures.py +1717 -0
  407. ccxt/pro/__init__.py +149 -0
  408. ccxt/pro/alpaca.py +685 -0
  409. ccxt/pro/ascendex.py +916 -0
  410. ccxt/pro/bequant.py +38 -0
  411. ccxt/pro/binance.py +3488 -0
  412. ccxt/pro/binancecoinm.py +28 -0
  413. ccxt/pro/binanceus.py +48 -0
  414. ccxt/pro/binanceusdm.py +31 -0
  415. ccxt/pro/bingx.py +1264 -0
  416. ccxt/pro/bitcoincom.py +34 -0
  417. ccxt/pro/bitfinex.py +621 -0
  418. ccxt/pro/bitfinex2.py +1083 -0
  419. ccxt/pro/bitget.py +1692 -0
  420. ccxt/pro/bithumb.py +368 -0
  421. ccxt/pro/bitmart.py +1449 -0
  422. ccxt/pro/bitmex.py +1656 -0
  423. ccxt/pro/bitopro.py +445 -0
  424. ccxt/pro/bitpanda.py +15 -0
  425. ccxt/pro/bitrue.py +447 -0
  426. ccxt/pro/bitstamp.py +522 -0
  427. ccxt/pro/bitvavo.py +1270 -0
  428. ccxt/pro/blockchaincom.py +738 -0
  429. ccxt/pro/blofin.py +692 -0
  430. ccxt/pro/bybit.py +2000 -0
  431. ccxt/pro/cex.py +1440 -0
  432. ccxt/pro/coinbase.py +678 -0
  433. ccxt/pro/coinbaseadvanced.py +16 -0
  434. ccxt/pro/coinbaseexchange.py +895 -0
  435. ccxt/pro/coinbaseinternational.py +620 -0
  436. ccxt/pro/coincatch.py +1464 -0
  437. ccxt/pro/coincheck.py +199 -0
  438. ccxt/pro/coinex.py +1061 -0
  439. ccxt/pro/coinone.py +395 -0
  440. ccxt/pro/cryptocom.py +947 -0
  441. ccxt/pro/currencycom.py +536 -0
  442. ccxt/pro/deribit.py +892 -0
  443. ccxt/pro/exmo.py +629 -0
  444. ccxt/pro/gate.py +1416 -0
  445. ccxt/pro/gateio.py +15 -0
  446. ccxt/pro/gemini.py +865 -0
  447. ccxt/pro/hashkey.py +802 -0
  448. ccxt/pro/hitbtc.py +1216 -0
  449. ccxt/pro/hollaex.py +563 -0
  450. ccxt/pro/htx.py +2215 -0
  451. ccxt/pro/huobi.py +15 -0
  452. ccxt/pro/huobijp.py +570 -0
  453. ccxt/pro/hyperliquid.py +525 -0
  454. ccxt/pro/idex.py +672 -0
  455. ccxt/pro/independentreserve.py +270 -0
  456. ccxt/pro/kraken.py +1356 -0
  457. ccxt/pro/krakenfutures.py +1492 -0
  458. ccxt/pro/kucoin.py +1133 -0
  459. ccxt/pro/kucoinfutures.py +1081 -0
  460. ccxt/pro/lbank.py +843 -0
  461. ccxt/pro/luno.py +303 -0
  462. ccxt/pro/mexc.py +1122 -0
  463. ccxt/pro/ndax.py +506 -0
  464. ccxt/pro/okcoin.py +698 -0
  465. ccxt/pro/okx.py +1851 -0
  466. ccxt/pro/onetrading.py +1275 -0
  467. ccxt/pro/oxfun.py +950 -0
  468. ccxt/pro/p2b.py +419 -0
  469. ccxt/pro/paradex.py +352 -0
  470. ccxt/pro/phemex.py +1441 -0
  471. ccxt/pro/poloniex.py +1166 -0
  472. ccxt/pro/poloniexfutures.py +990 -0
  473. ccxt/pro/probit.py +551 -0
  474. ccxt/pro/upbit.py +520 -0
  475. ccxt/pro/vertex.py +943 -0
  476. ccxt/pro/wazirx.py +749 -0
  477. ccxt/pro/whitebit.py +864 -0
  478. ccxt/pro/woo.py +1078 -0
  479. ccxt/pro/woofipro.py +1183 -0
  480. ccxt/pro/xt.py +1067 -0
  481. ccxt/probit.py +1734 -0
  482. ccxt/ramzinex.py +476 -0
  483. ccxt/sarmayex.py +357 -0
  484. ccxt/sarrafex.py +478 -0
  485. ccxt/static_dependencies/__init__.py +1 -0
  486. ccxt/static_dependencies/ecdsa/__init__.py +14 -0
  487. ccxt/static_dependencies/ecdsa/_version.py +520 -0
  488. ccxt/static_dependencies/ecdsa/curves.py +56 -0
  489. ccxt/static_dependencies/ecdsa/der.py +221 -0
  490. ccxt/static_dependencies/ecdsa/ecdsa.py +310 -0
  491. ccxt/static_dependencies/ecdsa/ellipticcurve.py +197 -0
  492. ccxt/static_dependencies/ecdsa/keys.py +332 -0
  493. ccxt/static_dependencies/ecdsa/numbertheory.py +531 -0
  494. ccxt/static_dependencies/ecdsa/rfc6979.py +100 -0
  495. ccxt/static_dependencies/ecdsa/util.py +266 -0
  496. ccxt/static_dependencies/ethereum/__init__.py +7 -0
  497. ccxt/static_dependencies/ethereum/abi/__init__.py +16 -0
  498. ccxt/static_dependencies/ethereum/abi/abi.py +19 -0
  499. ccxt/static_dependencies/ethereum/abi/base.py +152 -0
  500. ccxt/static_dependencies/ethereum/abi/codec.py +217 -0
  501. ccxt/static_dependencies/ethereum/abi/constants.py +3 -0
  502. ccxt/static_dependencies/ethereum/abi/decoding.py +565 -0
  503. ccxt/static_dependencies/ethereum/abi/encoding.py +720 -0
  504. ccxt/static_dependencies/ethereum/abi/exceptions.py +139 -0
  505. ccxt/static_dependencies/ethereum/abi/grammar.py +443 -0
  506. ccxt/static_dependencies/ethereum/abi/packed.py +13 -0
  507. ccxt/static_dependencies/ethereum/abi/py.typed +0 -0
  508. ccxt/static_dependencies/ethereum/abi/registry.py +643 -0
  509. ccxt/static_dependencies/ethereum/abi/tools/__init__.py +3 -0
  510. ccxt/static_dependencies/ethereum/abi/tools/_strategies.py +230 -0
  511. ccxt/static_dependencies/ethereum/abi/utils/__init__.py +0 -0
  512. ccxt/static_dependencies/ethereum/abi/utils/numeric.py +83 -0
  513. ccxt/static_dependencies/ethereum/abi/utils/padding.py +27 -0
  514. ccxt/static_dependencies/ethereum/abi/utils/string.py +19 -0
  515. ccxt/static_dependencies/ethereum/account/__init__.py +3 -0
  516. ccxt/static_dependencies/ethereum/account/encode_typed_data/__init__.py +4 -0
  517. ccxt/static_dependencies/ethereum/account/encode_typed_data/encoding_and_hashing.py +239 -0
  518. ccxt/static_dependencies/ethereum/account/encode_typed_data/helpers.py +40 -0
  519. ccxt/static_dependencies/ethereum/account/messages.py +263 -0
  520. ccxt/static_dependencies/ethereum/account/py.typed +0 -0
  521. ccxt/static_dependencies/ethereum/hexbytes/__init__.py +5 -0
  522. ccxt/static_dependencies/ethereum/hexbytes/_utils.py +54 -0
  523. ccxt/static_dependencies/ethereum/hexbytes/main.py +65 -0
  524. ccxt/static_dependencies/ethereum/hexbytes/py.typed +0 -0
  525. ccxt/static_dependencies/ethereum/typing/__init__.py +63 -0
  526. ccxt/static_dependencies/ethereum/typing/abi.py +6 -0
  527. ccxt/static_dependencies/ethereum/typing/bls.py +7 -0
  528. ccxt/static_dependencies/ethereum/typing/discovery.py +5 -0
  529. ccxt/static_dependencies/ethereum/typing/encoding.py +7 -0
  530. ccxt/static_dependencies/ethereum/typing/enums.py +17 -0
  531. ccxt/static_dependencies/ethereum/typing/ethpm.py +9 -0
  532. ccxt/static_dependencies/ethereum/typing/evm.py +20 -0
  533. ccxt/static_dependencies/ethereum/typing/networks.py +1122 -0
  534. ccxt/static_dependencies/ethereum/typing/py.typed +0 -0
  535. ccxt/static_dependencies/ethereum/utils/__init__.py +115 -0
  536. ccxt/static_dependencies/ethereum/utils/abi.py +72 -0
  537. ccxt/static_dependencies/ethereum/utils/address.py +171 -0
  538. ccxt/static_dependencies/ethereum/utils/applicators.py +151 -0
  539. ccxt/static_dependencies/ethereum/utils/conversions.py +190 -0
  540. ccxt/static_dependencies/ethereum/utils/currency.py +107 -0
  541. ccxt/static_dependencies/ethereum/utils/curried/__init__.py +269 -0
  542. ccxt/static_dependencies/ethereum/utils/debug.py +20 -0
  543. ccxt/static_dependencies/ethereum/utils/decorators.py +132 -0
  544. ccxt/static_dependencies/ethereum/utils/encoding.py +6 -0
  545. ccxt/static_dependencies/ethereum/utils/exceptions.py +4 -0
  546. ccxt/static_dependencies/ethereum/utils/functional.py +75 -0
  547. ccxt/static_dependencies/ethereum/utils/hexadecimal.py +74 -0
  548. ccxt/static_dependencies/ethereum/utils/humanize.py +188 -0
  549. ccxt/static_dependencies/ethereum/utils/logging.py +159 -0
  550. ccxt/static_dependencies/ethereum/utils/module_loading.py +31 -0
  551. ccxt/static_dependencies/ethereum/utils/numeric.py +43 -0
  552. ccxt/static_dependencies/ethereum/utils/py.typed +0 -0
  553. ccxt/static_dependencies/ethereum/utils/toolz.py +76 -0
  554. ccxt/static_dependencies/ethereum/utils/types.py +54 -0
  555. ccxt/static_dependencies/ethereum/utils/typing/__init__.py +18 -0
  556. ccxt/static_dependencies/ethereum/utils/typing/misc.py +14 -0
  557. ccxt/static_dependencies/ethereum/utils/units.py +31 -0
  558. ccxt/static_dependencies/keccak/__init__.py +3 -0
  559. ccxt/static_dependencies/keccak/keccak.py +197 -0
  560. ccxt/static_dependencies/lark/__init__.py +38 -0
  561. ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
  562. ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
  563. ccxt/static_dependencies/lark/ast_utils.py +59 -0
  564. ccxt/static_dependencies/lark/common.py +86 -0
  565. ccxt/static_dependencies/lark/exceptions.py +292 -0
  566. ccxt/static_dependencies/lark/grammar.py +130 -0
  567. ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
  568. ccxt/static_dependencies/lark/indenter.py +143 -0
  569. ccxt/static_dependencies/lark/lark.py +658 -0
  570. ccxt/static_dependencies/lark/lexer.py +678 -0
  571. ccxt/static_dependencies/lark/load_grammar.py +1428 -0
  572. ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
  573. ccxt/static_dependencies/lark/parser_frontends.py +257 -0
  574. ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
  575. ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
  576. ccxt/static_dependencies/lark/parsers/earley.py +314 -0
  577. ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
  578. ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
  579. ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
  580. ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
  581. ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
  582. ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
  583. ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
  584. ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
  585. ccxt/static_dependencies/lark/reconstruct.py +107 -0
  586. ccxt/static_dependencies/lark/tools/__init__.py +70 -0
  587. ccxt/static_dependencies/lark/tools/nearley.py +202 -0
  588. ccxt/static_dependencies/lark/tools/serialize.py +32 -0
  589. ccxt/static_dependencies/lark/tools/standalone.py +196 -0
  590. ccxt/static_dependencies/lark/tree.py +267 -0
  591. ccxt/static_dependencies/lark/tree_matcher.py +186 -0
  592. ccxt/static_dependencies/lark/tree_templates.py +180 -0
  593. ccxt/static_dependencies/lark/utils.py +343 -0
  594. ccxt/static_dependencies/lark/visitors.py +596 -0
  595. ccxt/static_dependencies/marshmallow/__init__.py +81 -0
  596. ccxt/static_dependencies/marshmallow/base.py +65 -0
  597. ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
  598. ccxt/static_dependencies/marshmallow/decorators.py +231 -0
  599. ccxt/static_dependencies/marshmallow/error_store.py +60 -0
  600. ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
  601. ccxt/static_dependencies/marshmallow/fields.py +2114 -0
  602. ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
  603. ccxt/static_dependencies/marshmallow/schema.py +1228 -0
  604. ccxt/static_dependencies/marshmallow/types.py +12 -0
  605. ccxt/static_dependencies/marshmallow/utils.py +378 -0
  606. ccxt/static_dependencies/marshmallow/validate.py +678 -0
  607. ccxt/static_dependencies/marshmallow/warnings.py +2 -0
  608. ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
  609. ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
  610. ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
  611. ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
  612. ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
  613. ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
  614. ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
  615. ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
  616. ccxt/static_dependencies/msgpack/__init__.py +55 -0
  617. ccxt/static_dependencies/msgpack/exceptions.py +48 -0
  618. ccxt/static_dependencies/msgpack/ext.py +168 -0
  619. ccxt/static_dependencies/msgpack/fallback.py +951 -0
  620. ccxt/static_dependencies/parsimonious/__init__.py +10 -0
  621. ccxt/static_dependencies/parsimonious/exceptions.py +105 -0
  622. ccxt/static_dependencies/parsimonious/expressions.py +479 -0
  623. ccxt/static_dependencies/parsimonious/grammar.py +487 -0
  624. ccxt/static_dependencies/parsimonious/nodes.py +325 -0
  625. ccxt/static_dependencies/parsimonious/utils.py +40 -0
  626. ccxt/static_dependencies/starknet/__init__.py +0 -0
  627. ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
  628. ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
  629. ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
  630. ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
  631. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
  632. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
  633. ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
  634. ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
  635. ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
  636. ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
  637. ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
  638. ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
  639. ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
  640. ccxt/static_dependencies/starknet/common.py +15 -0
  641. ccxt/static_dependencies/starknet/constants.py +39 -0
  642. ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
  643. ccxt/static_dependencies/starknet/hash/address.py +79 -0
  644. ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
  645. ccxt/static_dependencies/starknet/hash/selector.py +16 -0
  646. ccxt/static_dependencies/starknet/hash/storage.py +12 -0
  647. ccxt/static_dependencies/starknet/hash/utils.py +78 -0
  648. ccxt/static_dependencies/starknet/models/__init__.py +0 -0
  649. ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
  650. ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
  651. ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
  652. ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
  653. ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
  654. ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
  655. ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
  656. ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
  657. ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
  658. ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
  659. ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
  660. ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
  661. ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
  662. ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
  663. ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
  664. ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
  665. ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
  666. ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
  667. ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
  668. ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
  669. ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
  670. ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
  671. ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
  672. ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
  673. ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
  674. ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
  675. ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
  676. ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
  677. ccxt/static_dependencies/starknet/utils/schema.py +13 -0
  678. ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
  679. ccxt/static_dependencies/starkware/__init__.py +0 -0
  680. ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
  681. ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
  682. ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
  683. ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
  684. ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
  685. ccxt/static_dependencies/sympy/__init__.py +0 -0
  686. ccxt/static_dependencies/sympy/core/__init__.py +0 -0
  687. ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
  688. ccxt/static_dependencies/sympy/external/__init__.py +0 -0
  689. ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
  690. ccxt/static_dependencies/sympy/external/importtools.py +187 -0
  691. ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
  692. ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
  693. ccxt/static_dependencies/toolz/__init__.py +26 -0
  694. ccxt/static_dependencies/toolz/_signatures.py +784 -0
  695. ccxt/static_dependencies/toolz/_version.py +520 -0
  696. ccxt/static_dependencies/toolz/compatibility.py +30 -0
  697. ccxt/static_dependencies/toolz/curried/__init__.py +101 -0
  698. ccxt/static_dependencies/toolz/curried/exceptions.py +22 -0
  699. ccxt/static_dependencies/toolz/curried/operator.py +22 -0
  700. ccxt/static_dependencies/toolz/dicttoolz.py +339 -0
  701. ccxt/static_dependencies/toolz/functoolz.py +1049 -0
  702. ccxt/static_dependencies/toolz/itertoolz.py +1057 -0
  703. ccxt/static_dependencies/toolz/recipes.py +46 -0
  704. ccxt/static_dependencies/toolz/utils.py +9 -0
  705. ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
  706. ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
  707. ccxt/tabdeal.py +364 -0
  708. ccxt/test/__init__.py +3 -0
  709. ccxt/test/base/__init__.py +29 -0
  710. ccxt/test/base/test_account.py +26 -0
  711. ccxt/test/base/test_balance.py +56 -0
  712. ccxt/test/base/test_borrow_interest.py +35 -0
  713. ccxt/test/base/test_borrow_rate.py +32 -0
  714. ccxt/test/base/test_calculate_fee.py +51 -0
  715. ccxt/test/base/test_crypto.py +127 -0
  716. ccxt/test/base/test_currency.py +76 -0
  717. ccxt/test/base/test_datetime.py +109 -0
  718. ccxt/test/base/test_decimal_to_precision.py +392 -0
  719. ccxt/test/base/test_deep_extend.py +68 -0
  720. ccxt/test/base/test_deposit_withdrawal.py +50 -0
  721. ccxt/test/base/test_exchange_datetime_functions.py +76 -0
  722. ccxt/test/base/test_funding_rate_history.py +29 -0
  723. ccxt/test/base/test_last_price.py +31 -0
  724. ccxt/test/base/test_ledger_entry.py +45 -0
  725. ccxt/test/base/test_ledger_item.py +48 -0
  726. ccxt/test/base/test_leverage_tier.py +33 -0
  727. ccxt/test/base/test_liquidation.py +50 -0
  728. ccxt/test/base/test_margin_mode.py +24 -0
  729. ccxt/test/base/test_margin_modification.py +35 -0
  730. ccxt/test/base/test_market.py +193 -0
  731. ccxt/test/base/test_number.py +411 -0
  732. ccxt/test/base/test_ohlcv.py +33 -0
  733. ccxt/test/base/test_open_interest.py +32 -0
  734. ccxt/test/base/test_order.py +64 -0
  735. ccxt/test/base/test_order_book.py +69 -0
  736. ccxt/test/base/test_position.py +60 -0
  737. ccxt/test/base/test_shared_methods.py +353 -0
  738. ccxt/test/base/test_status.py +24 -0
  739. ccxt/test/base/test_throttle.py +126 -0
  740. ccxt/test/base/test_ticker.py +92 -0
  741. ccxt/test/base/test_trade.py +47 -0
  742. ccxt/test/base/test_trading_fee.py +26 -0
  743. ccxt/test/base/test_transaction.py +39 -0
  744. ccxt/test/test_async.py +1649 -0
  745. ccxt/test/test_sync.py +1648 -0
  746. ccxt/test/tests_async.py +1558 -0
  747. ccxt/test/tests_helpers.py +287 -0
  748. ccxt/test/tests_init.py +39 -0
  749. ccxt/test/tests_sync.py +1555 -0
  750. ccxt/tetherland.py +349 -0
  751. ccxt/timex.py +1593 -0
  752. ccxt/tokocrypto.py +2405 -0
  753. ccxt/tradeogre.py +608 -0
  754. ccxt/twox.py +326 -0
  755. ccxt/ubitex.py +409 -0
  756. ccxt/upbit.py +1833 -0
  757. ccxt/vertex.py +2922 -0
  758. ccxt/wallex.py +445 -0
  759. ccxt/wavesexchange.py +2472 -0
  760. ccxt/wazirx.py +1224 -0
  761. ccxt/whitebit.py +2469 -0
  762. ccxt/woo.py +3114 -0
  763. ccxt/woofipro.py +2533 -0
  764. ccxt/xt.py +4453 -0
  765. ccxt/yobit.py +1283 -0
  766. ccxt/zaif.py +725 -0
  767. ccxt/zonda.py +1828 -0
  768. ccxt_ir-4.3.46.0.1.dist-info/LICENSE.txt +21 -0
  769. ccxt_ir-4.3.46.0.1.dist-info/METADATA +655 -0
  770. ccxt_ir-4.3.46.0.1.dist-info/RECORD +772 -0
  771. ccxt_ir-4.3.46.0.1.dist-info/WHEEL +6 -0
  772. ccxt_ir-4.3.46.0.1.dist-info/top_level.txt +1 -0
ccxt/wavesexchange.py ADDED
@@ -0,0 +1,2472 @@
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.wavesexchange import ImplicitAPI
8
+ import json
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
+ from typing import List
11
+ from typing import Any
12
+ from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
14
+ from ccxt.base.errors import AccountSuspended
15
+ from ccxt.base.errors import ArgumentsRequired
16
+ from ccxt.base.errors import BadRequest
17
+ from ccxt.base.errors import BadSymbol
18
+ from ccxt.base.errors import InsufficientFunds
19
+ from ccxt.base.errors import InvalidOrder
20
+ from ccxt.base.errors import OrderNotFound
21
+ from ccxt.base.errors import DuplicateOrderId
22
+ from ccxt.base.errors import ExchangeNotAvailable
23
+ from ccxt.base.decimal_to_precision import TICK_SIZE
24
+ from ccxt.base.precise import Precise
25
+
26
+
27
+ class wavesexchange(Exchange, ImplicitAPI):
28
+
29
+ def describe(self):
30
+ return self.deep_extend(super(wavesexchange, self).describe(), {
31
+ 'id': 'wavesexchange',
32
+ 'name': 'Waves.Exchange',
33
+ 'countries': ['CH'], # Switzerland
34
+ 'certified': False,
35
+ 'pro': False,
36
+ 'dex': True,
37
+ 'has': {
38
+ 'CORS': None,
39
+ 'spot': True,
40
+ 'margin': False,
41
+ 'swap': False,
42
+ 'future': False,
43
+ 'option': False,
44
+ 'addMargin': False,
45
+ 'cancelOrder': True,
46
+ 'closeAllPositions': False,
47
+ 'closePosition': False,
48
+ 'createMarketOrder': True,
49
+ 'createOrder': True,
50
+ 'createReduceOnlyOrder': False,
51
+ 'createStopLimitOrder': False,
52
+ 'createStopMarketOrder': False,
53
+ 'createStopOrder': False,
54
+ 'fetchBalance': True,
55
+ 'fetchBorrowRateHistories': False,
56
+ 'fetchBorrowRateHistory': False,
57
+ 'fetchClosedOrders': True,
58
+ 'fetchCrossBorrowRate': False,
59
+ 'fetchCrossBorrowRates': False,
60
+ 'fetchDepositAddress': True,
61
+ 'fetchDepositWithdrawFee': 'emulated',
62
+ 'fetchDepositWithdrawFees': True,
63
+ 'fetchFundingHistory': False,
64
+ 'fetchFundingRate': False,
65
+ 'fetchFundingRateHistory': False,
66
+ 'fetchFundingRates': False,
67
+ 'fetchIndexOHLCV': False,
68
+ 'fetchIsolatedBorrowRate': False,
69
+ 'fetchIsolatedBorrowRates': False,
70
+ 'fetchLeverage': False,
71
+ 'fetchLeverageTiers': False,
72
+ 'fetchMarginMode': False,
73
+ 'fetchMarkets': True,
74
+ 'fetchMarkOHLCV': False,
75
+ 'fetchMyTrades': True,
76
+ 'fetchOHLCV': True,
77
+ 'fetchOpenInterestHistory': False,
78
+ 'fetchOpenOrders': True,
79
+ 'fetchOrder': True,
80
+ 'fetchOrderBook': True,
81
+ 'fetchOrders': True,
82
+ 'fetchPosition': False,
83
+ 'fetchPositionHistory': False,
84
+ 'fetchPositionMode': False,
85
+ 'fetchPositions': False,
86
+ 'fetchPositionsForSymbol': False,
87
+ 'fetchPositionsHistory': False,
88
+ 'fetchPositionsRisk': False,
89
+ 'fetchPremiumIndexOHLCV': False,
90
+ 'fetchTicker': True,
91
+ 'fetchTickers': True,
92
+ 'fetchTrades': True,
93
+ 'fetchTransfer': False,
94
+ 'fetchTransfers': False,
95
+ 'reduceMargin': False,
96
+ 'sandbox': True,
97
+ 'setLeverage': False,
98
+ 'setMarginMode': False,
99
+ 'setPositionMode': False,
100
+ 'signIn': True,
101
+ 'transfer': False,
102
+ 'withdraw': True,
103
+ 'ws': False,
104
+ },
105
+ 'timeframes': {
106
+ '1m': '1m',
107
+ '5m': '5m',
108
+ '15m': '15m',
109
+ '30m': '30m',
110
+ '1h': '1h',
111
+ '2h': '2h',
112
+ '3h': '3h',
113
+ '4h': '4h',
114
+ '6h': '6h',
115
+ '12h': '12h',
116
+ '1d': '1d',
117
+ '1w': '1w',
118
+ '1M': '1M',
119
+ },
120
+ 'urls': {
121
+ 'logo': 'https://user-images.githubusercontent.com/1294454/84547058-5fb27d80-ad0b-11ea-8711-78ac8b3c7f31.jpg',
122
+ 'test': {
123
+ 'matcher': 'https://matcher-testnet.wx.network',
124
+ 'node': 'https://nodes-testnet.wavesnodes.com',
125
+ 'public': 'https://api-testnet.wavesplatform.com/v0',
126
+ 'private': 'https://api-testnet.wx.network/v1',
127
+ 'forward': 'https://testnet.wx.network/api/v1/forward/matcher',
128
+ 'market': 'https://testnet.wx.network/api/v1/forward/marketdata/api/v1',
129
+ },
130
+ 'api': {
131
+ 'matcher': 'https://matcher.wx.network',
132
+ 'node': 'https://nodes.wx.network',
133
+ 'public': 'https://api.wavesplatform.com/v0',
134
+ 'private': 'https://api.wx.network/v1',
135
+ 'forward': 'https://wx.network/api/v1/forward/matcher',
136
+ 'market': 'https://wx.network/api/v1/forward/marketdata/api/v1',
137
+ },
138
+ 'doc': 'https://docs.wx.network',
139
+ 'www': 'https://wx.network',
140
+ },
141
+ 'api': {
142
+ 'matcher': {
143
+ 'get': [
144
+ 'matcher',
145
+ 'matcher/settings',
146
+ 'matcher/settings/rates',
147
+ 'matcher/balance/reserved/{publicKey}',
148
+ 'matcher/debug/allSnashotOffsets',
149
+ 'matcher/debug/currentOffset',
150
+ 'matcher/debug/lastOffset',
151
+ 'matcher/debug/oldestSnapshotOffset',
152
+ 'matcher/debug/config',
153
+ 'matcher/debug/address/{address}',
154
+ 'matcher/debug/status',
155
+ 'matcher/debug/address/{address}/check',
156
+ 'matcher/orderbook',
157
+ 'matcher/orderbook/{baseId}/{quoteId}',
158
+ 'matcher/orderbook/{baseId}/{quoteId}/publicKey/{publicKey}',
159
+ 'matcher/orderbook/{baseId}/{quoteId}/{orderId}',
160
+ 'matcher/orderbook/{baseId}/{quoteId}/info',
161
+ 'matcher/orderbook/{baseId}/{quoteId}/status',
162
+ 'matcher/orderbook/{baseId}/{quoteId}/tradableBalance/{address}',
163
+ 'matcher/orderbook/{publicKey}',
164
+ 'matcher/orderbook/{publicKey}/{orderId}',
165
+ 'matcher/orders/{address}',
166
+ 'matcher/orders/{address}/{orderId}',
167
+ 'matcher/transactions/{orderId}',
168
+ 'api/v1/orderbook/{baseId}/{quoteId}',
169
+ ],
170
+ 'post': [
171
+ 'matcher/orderbook',
172
+ 'matcher/orderbook/market',
173
+ 'matcher/orderbook/cancel',
174
+ 'matcher/orderbook/{baseId}/{quoteId}/cancel',
175
+ 'matcher/orderbook/{baseId}/{quoteId}/calculateFee',
176
+ 'matcher/orderbook/{baseId}/{quoteId}/delete',
177
+ 'matcher/orderbook/{baseId}/{quoteId}/cancelAll',
178
+ 'matcher/debug/saveSnapshots',
179
+ 'matcher/orders/{address}/cancel',
180
+ 'matcher/orders/cancel/{orderId}',
181
+ 'matcher/orders/serialize',
182
+ ],
183
+ 'delete': [
184
+ 'matcher/orderbook/{baseId}/{quoteId}',
185
+ 'matcher/settings/rates/{assetId}',
186
+ ],
187
+ 'put': [
188
+ 'matcher/settings/rates/{assetId}',
189
+ ],
190
+ },
191
+ 'node': {
192
+ 'get': [
193
+ 'addresses',
194
+ 'addresses/balance/{address}',
195
+ 'addresses/balance/{address}/{confirmations}',
196
+ 'addresses/balance/details/{address}',
197
+ 'addresses/data/{address}',
198
+ 'addresses/data/{address}/{key}',
199
+ 'addresses/effectiveBalance/{address}',
200
+ 'addresses/effectiveBalance/{address}/{confirmations}',
201
+ 'addresses/publicKey/{publicKey}',
202
+ 'addresses/scriptInfo/{address}',
203
+ 'addresses/scriptInfo/{address}/meta',
204
+ 'addresses/seed/{address}',
205
+ 'addresses/seq/{from}/{to}',
206
+ 'addresses/validate/{address}',
207
+ 'alias/by-address/{address}',
208
+ 'alias/by-alias/{alias}',
209
+ 'assets/{assetId}/distribution/{height}/{limit}',
210
+ 'assets/balance/{address}',
211
+ 'assets/balance/{address}/{assetId}',
212
+ 'assets/details/{assetId}',
213
+ 'assets/nft/{address}/limit/{limit}',
214
+ 'blockchain/rewards',
215
+ 'blockchain/rewards/height',
216
+ 'blocks/address/{address}/{from}/{to}/',
217
+ 'blocks/at/{height}',
218
+ 'blocks/delay/{signature}/{blockNum}',
219
+ 'blocks/first',
220
+ 'blocks/headers/last',
221
+ 'blocks/headers/seq/{from}/{to}',
222
+ 'blocks/height',
223
+ 'blocks/height/{signature}',
224
+ 'blocks/last',
225
+ 'blocks/seq/{from}/{to}',
226
+ 'blocks/signature/{signature}',
227
+ 'consensus/algo',
228
+ 'consensus/basetarget',
229
+ 'consensus/basetarget/{blockId}',
230
+ 'consensus/{generatingbalance}/address',
231
+ 'consensus/generationsignature',
232
+ 'consensus/generationsignature/{blockId}',
233
+ 'debug/balances/history/{address}',
234
+ 'debug/blocks/{howMany}',
235
+ 'debug/configInfo',
236
+ 'debug/historyInfo',
237
+ 'debug/info',
238
+ 'debug/minerInfo',
239
+ 'debug/portfolios/{address}',
240
+ 'debug/state',
241
+ 'debug/stateChanges/address/{address}',
242
+ 'debug/stateChanges/info/{id}',
243
+ 'debug/stateWaves/{height}',
244
+ 'leasing/active/{address}',
245
+ 'node/state',
246
+ 'node/version',
247
+ 'peers/all',
248
+ 'peers/blacklisted',
249
+ 'peers/connected',
250
+ 'peers/suspended',
251
+ 'transactions/address/{address}/limit/{limit}',
252
+ 'transactions/info/{id}',
253
+ 'transactions/status',
254
+ 'transactions/unconfirmed',
255
+ 'transactions/unconfirmed/info/{id}',
256
+ 'transactions/unconfirmed/size',
257
+ 'utils/seed',
258
+ 'utils/seed/{length}',
259
+ 'utils/time',
260
+ 'wallet/seed',
261
+ ],
262
+ 'post': [
263
+ 'addresses',
264
+ 'addresses/data/{address}',
265
+ 'addresses/sign/{address}',
266
+ 'addresses/signText/{address}',
267
+ 'addresses/verify/{address}',
268
+ 'addresses/verifyText/{address}',
269
+ 'debug/blacklist',
270
+ 'debug/print',
271
+ 'debug/rollback',
272
+ 'debug/validate',
273
+ 'node/stop',
274
+ 'peers/clearblacklist',
275
+ 'peers/connect',
276
+ 'transactions/broadcast',
277
+ 'transactions/calculateFee',
278
+ 'tranasctions/sign',
279
+ 'transactions/sign/{signerAddress}',
280
+ 'tranasctions/status',
281
+ 'utils/hash/fast',
282
+ 'utils/hash/secure',
283
+ 'utils/script/compileCode',
284
+ 'utils/script/compileWithImports',
285
+ 'utils/script/decompile',
286
+ 'utils/script/estimate',
287
+ 'utils/sign/{privateKey}',
288
+ 'utils/transactionsSerialize',
289
+ ],
290
+ 'delete': [
291
+ 'addresses/{address}',
292
+ 'debug/rollback-to/{signature}',
293
+ ],
294
+ },
295
+ 'public': {
296
+ 'get': [
297
+ 'assets',
298
+ 'pairs',
299
+ 'candles/{baseId}/{quoteId}',
300
+ 'transactions/exchange',
301
+ ],
302
+ },
303
+ 'private': {
304
+ 'get': [
305
+ 'deposit/addresses/{currency}',
306
+ 'deposit/addresses/{currency}/{platform}',
307
+ 'platforms',
308
+ 'deposit/currencies',
309
+ 'withdraw/currencies',
310
+ 'withdraw/addresses/{currency}/{address}',
311
+ ],
312
+ 'post': [
313
+ 'oauth2/token',
314
+ ],
315
+ },
316
+ 'forward': {
317
+ 'get': [
318
+ 'matcher/orders/{address}', # can't get the orders endpoint to work with the matcher api
319
+ 'matcher/orders/{address}/{orderId}',
320
+ ],
321
+ 'post': [
322
+ 'matcher/orders/{wavesAddress}/cancel',
323
+ ],
324
+ },
325
+ 'market': {
326
+ 'get': [
327
+ 'tickers',
328
+ ],
329
+ },
330
+ },
331
+ 'currencies': {
332
+ 'WX': self.safe_currency_structure({'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': None, 'code': 'WX', 'precision': self.parse_number('1e-8')}),
333
+ },
334
+ 'precisionMode': TICK_SIZE,
335
+ 'options': {
336
+ 'allowedCandles': 1440,
337
+ 'accessToken': None,
338
+ 'createMarketBuyOrderRequiresPrice': True,
339
+ 'matcherPublicKey': None,
340
+ 'quotes': None,
341
+ 'createOrderDefaultExpiry': 2419200000, # 60 * 60 * 24 * 28 * 1000
342
+ 'wavesAddress': None,
343
+ 'withdrawFeeUSDN': 7420,
344
+ 'withdrawFeeWAVES': 100000,
345
+ 'wavesPrecision': 1e-8,
346
+ 'messagePrefix': 'W', # W for production, T for testnet
347
+ 'networks': {
348
+ 'ERC20': 'ETH',
349
+ 'BEP20': 'BSC',
350
+ },
351
+ },
352
+ 'commonCurrencies': {
353
+ 'EGG': 'Waves Ducks',
354
+ },
355
+ 'requiresEddsa': True,
356
+ 'exceptions': {
357
+ '3147270': InsufficientFunds, # https://github.com/wavesplatform/matcher/wiki/List-of-all-errors
358
+ '112': InsufficientFunds,
359
+ '4': ExchangeError,
360
+ '13': ExchangeNotAvailable,
361
+ '14': ExchangeNotAvailable,
362
+ '3145733': AccountSuspended,
363
+ '3148040': DuplicateOrderId,
364
+ '3148801': AuthenticationError,
365
+ '9440512': AuthenticationError,
366
+ '9440771': BadSymbol,
367
+ '9441026': InvalidOrder,
368
+ '9441282': InvalidOrder,
369
+ '9441286': InvalidOrder,
370
+ '9441295': InvalidOrder,
371
+ '9441540': InvalidOrder,
372
+ '9441542': InvalidOrder,
373
+ '106954752': AuthenticationError,
374
+ '106954769': AuthenticationError,
375
+ '106957828': AuthenticationError,
376
+ '106960131': AuthenticationError,
377
+ '106981137': AuthenticationError,
378
+ '9437184': BadRequest, # {"error":9437184,"message":"The order is invalid: SpendAmount should be > 0","template":"The order is invalid: {{details}}","params":{"details":"SpendAmount should be > 0"},"status":"OrderRejected","success":false}
379
+ '9437193': OrderNotFound,
380
+ '1048577': BadRequest,
381
+ '1051904': AuthenticationError,
382
+ },
383
+ })
384
+
385
+ def set_sandbox_mode(self, enabled):
386
+ self.options['messagePrefix'] = 'T' if enabled else 'W'
387
+ self.options['sandboxMode'] = enabled
388
+ super(wavesexchange, self).set_sandbox_mode(enabled)
389
+
390
+ def get_fees_for_asset(self, symbol: str, side, amount, price, params={}):
391
+ self.load_markets()
392
+ market = self.market(symbol)
393
+ amount = self.to_real_symbol_amount(symbol, amount)
394
+ price = self.to_real_symbol_price(symbol, price)
395
+ request = self.extend({
396
+ 'baseId': market['baseId'],
397
+ 'quoteId': market['quoteId'],
398
+ 'orderType': side,
399
+ 'amount': amount,
400
+ 'price': price,
401
+ }, params)
402
+ return self.matcherPostMatcherOrderbookBaseIdQuoteIdCalculateFee(request)
403
+
404
+ def custom_calculate_fee(self, symbol: str, type, side, amount, price, takerOrMaker='taker', params={}):
405
+ response = self.get_fees_for_asset(symbol, side, amount, price)
406
+ # {
407
+ # "base":{
408
+ # "feeAssetId":"WAVES",
409
+ # "matcherFee":"1000000"
410
+ # },
411
+ # "discount":{
412
+ # "feeAssetId":"EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc",
413
+ # "matcherFee":"4077612"
414
+ # }
415
+ # }
416
+ isDiscountFee = self.safe_bool(params, 'isDiscountFee', False)
417
+ mode = None
418
+ if isDiscountFee:
419
+ mode = self.safe_value(response, 'discount')
420
+ else:
421
+ mode = self.safe_value(response, 'base')
422
+ matcherFee = self.safe_string(mode, 'matcherFee')
423
+ feeAssetId = self.safe_string(mode, 'feeAssetId')
424
+ feeAsset = self.safe_currency_code(feeAssetId)
425
+ adjustedMatcherFee = self.from_real_currency_amount(feeAsset, matcherFee)
426
+ amountAsString = self.number_to_string(amount)
427
+ priceAsString = self.number_to_string(price)
428
+ feeCost = self.fee_to_precision(symbol, self.parse_number(adjustedMatcherFee))
429
+ feeRate = Precise.string_div(adjustedMatcherFee, Precise.string_mul(amountAsString, priceAsString))
430
+ return {
431
+ 'type': takerOrMaker,
432
+ 'currency': feeAsset,
433
+ 'rate': self.parse_number(feeRate),
434
+ 'cost': self.parse_number(feeCost),
435
+ }
436
+
437
+ def get_quotes(self):
438
+ quotes = self.safe_value(self.options, 'quotes')
439
+ if quotes:
440
+ return quotes
441
+ else:
442
+ # currencies can have any name because you can create you own token
443
+ # result someone can create a fake token called BTC
444
+ # we use self mapping to determine the real tokens
445
+ # https://docs.wx.network/en/waves-matcher/matcher-api#asset-pair
446
+ response = self.matcherGetMatcherSettings()
447
+ # {
448
+ # "orderVersions": [
449
+ # 1,
450
+ # 2,
451
+ # 3
452
+ # ],
453
+ # "success": True,
454
+ # "matcherPublicKey": "9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
455
+ # "orderFee": {
456
+ # "dynamic": {
457
+ # "baseFee": 300000,
458
+ # "rates": {
459
+ # "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ": 1.22639597,
460
+ # "62LyMjcr2DtiyF5yVXFhoQ2q414VPPJXjsNYp72SuDCH": 0.00989643,
461
+ # "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk": 0.0395674,
462
+ # "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS": 0.00018814,
463
+ # "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8": 26.19721262,
464
+ # "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu": 0.00752978,
465
+ # "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p": 1.84575,
466
+ # "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H": 0.02330273,
467
+ # "zMFqXuoyrn5w17PFurTqxB7GsS71fp9dfk6XFwxbPCy": 0.00721412,
468
+ # "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3": 0.02659103,
469
+ # "WAVES": 1,
470
+ # "BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa": 0.03433583
471
+ # }
472
+ # }
473
+ # },
474
+ # "networkByte": 87,
475
+ # "matcherVersion": "2.1.3.5",
476
+ # "status": "SimpleResponse",
477
+ # "priceAssets": [
478
+ # "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
479
+ # "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
480
+ # "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
481
+ # "Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU",
482
+ # "2mX5DzVKWrAJw8iwdJnV2qtoeVG9h5nTDpTqC1wb1WEN",
483
+ # "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
484
+ # "WAVES",
485
+ # "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
486
+ # "zMFqXuoyrn5w17PFurTqxB7GsS71fp9dfk6XFwxbPCy",
487
+ # "62LyMjcr2DtiyF5yVXFhoQ2q414VPPJXjsNYp72SuDCH",
488
+ # "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
489
+ # "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H",
490
+ # "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
491
+ # "BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa",
492
+ # "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8"
493
+ # ]
494
+ # }
495
+ quotes = {}
496
+ priceAssets = self.safe_value(response, 'priceAssets')
497
+ for i in range(0, len(priceAssets)):
498
+ quotes[priceAssets[i]] = True
499
+ self.options['quotes'] = quotes
500
+ return quotes
501
+
502
+ def fetch_markets(self, params={}) -> List[Market]:
503
+ """
504
+ retrieves data on all markets for wavesexchange
505
+ :param dict [params]: extra parameters specific to the exchange API endpoint
506
+ :returns dict[]: an array of objects representing market data
507
+ """
508
+ response = self.marketGetTickers()
509
+ #
510
+ # [
511
+ # {
512
+ # "symbol": "WAVES/BTC",
513
+ # "amountAssetID": "WAVES",
514
+ # "amountAssetName": "Waves",
515
+ # "amountAssetDecimals": 8,
516
+ # "amountAssetTotalSupply": "106908766.00000000",
517
+ # "amountAssetMaxSupply": "106908766.00000000",
518
+ # "amountAssetCirculatingSupply": "106908766.00000000",
519
+ # "priceAssetID": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
520
+ # "priceAssetName": "WBTC",
521
+ # "priceAssetDecimals": 8,
522
+ # "priceAssetTotalSupply": "20999999.96007507",
523
+ # "priceAssetMaxSupply": "20999999.96007507",
524
+ # "priceAssetCirculatingSupply": "20999999.66019601",
525
+ # "24h_open": "0.00032688",
526
+ # "24h_high": "0.00033508",
527
+ # "24h_low": "0.00032443",
528
+ # "24h_close": "0.00032806",
529
+ # "24h_vwap": "0.00032988",
530
+ # "24h_volume": "42349.69440104",
531
+ # "24h_priceVolume": "13.97037207",
532
+ # "timestamp":1640232379124
533
+ # }
534
+ # ...
535
+ # ]
536
+ #
537
+ result = []
538
+ for i in range(0, len(response)):
539
+ entry = response[i]
540
+ baseId = self.safe_string(entry, 'amountAssetID')
541
+ quoteId = self.safe_string(entry, 'priceAssetID')
542
+ id = baseId + '/' + quoteId
543
+ marketId = self.safe_string(entry, 'symbol')
544
+ base, quote = marketId.split('/')
545
+ base = self.safe_currency_code(base)
546
+ quote = self.safe_currency_code(quote)
547
+ symbol = base + '/' + quote
548
+ result.append({
549
+ 'id': id,
550
+ 'symbol': symbol,
551
+ 'base': base,
552
+ 'quote': quote,
553
+ 'settle': None,
554
+ 'baseId': baseId,
555
+ 'quoteId': quoteId,
556
+ 'settleId': None,
557
+ 'type': 'spot',
558
+ 'spot': True,
559
+ 'margin': False,
560
+ 'swap': False,
561
+ 'future': False,
562
+ 'option': False,
563
+ 'active': None,
564
+ 'contract': False,
565
+ 'linear': None,
566
+ 'inverse': None,
567
+ 'contractSize': None,
568
+ 'expiry': None,
569
+ 'expiryDatetime': None,
570
+ 'strike': None,
571
+ 'optionType': None,
572
+ 'precision': {
573
+ 'amount': self.parse_number(self.parse_precision(self.safe_string(entry, 'amountAssetDecimals'))),
574
+ 'price': self.parse_number(self.parse_precision(self.safe_string(entry, 'priceAssetDecimals'))),
575
+ },
576
+ 'limits': {
577
+ 'leverage': {
578
+ 'min': None,
579
+ 'max': None,
580
+ },
581
+ 'amount': {
582
+ 'min': None,
583
+ 'max': None,
584
+ },
585
+ 'price': {
586
+ 'min': None,
587
+ 'max': None,
588
+ },
589
+ 'cost': {
590
+ 'min': None,
591
+ 'max': None,
592
+ },
593
+ },
594
+ 'created': None,
595
+ 'info': entry,
596
+ })
597
+ return result
598
+
599
+ def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
600
+ """
601
+ fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
602
+ :param str symbol: unified symbol of the market to fetch the order book for
603
+ :param int [limit]: the maximum amount of order book entries to return
604
+ :param dict [params]: extra parameters specific to the exchange API endpoint
605
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
606
+ """
607
+ self.load_markets()
608
+ market = self.market(symbol)
609
+ request = self.extend({
610
+ 'baseId': market['baseId'],
611
+ 'quoteId': market['quoteId'],
612
+ }, params)
613
+ response = self.matcherGetMatcherOrderbookBaseIdQuoteId(request)
614
+ timestamp = self.safe_integer(response, 'timestamp')
615
+ bids = self.parse_order_book_side(self.safe_value(response, 'bids'), market, limit)
616
+ asks = self.parse_order_book_side(self.safe_value(response, 'asks'), market, limit)
617
+ return {
618
+ 'symbol': symbol,
619
+ 'bids': bids,
620
+ 'asks': asks,
621
+ 'timestamp': timestamp,
622
+ 'datetime': self.iso8601(timestamp),
623
+ 'nonce': None,
624
+ }
625
+
626
+ def parse_order_book_side(self, bookSide, market=None, limit: Int = None):
627
+ precision = market['precision']
628
+ wavesPrecision = self.safe_string(self.options, 'wavesPrecision', '1e-8')
629
+ amountPrecisionString = self.safe_string(precision, 'amount')
630
+ pricePrecisionString = self.safe_string(precision, 'price')
631
+ difference = Precise.string_div(amountPrecisionString, pricePrecisionString)
632
+ pricePrecision = Precise.string_div(wavesPrecision, difference)
633
+ result = []
634
+ for i in range(0, len(bookSide)):
635
+ entry = bookSide[i]
636
+ entryPrice = self.safe_string(entry, 'price', '0')
637
+ entryAmount = self.safe_string(entry, 'amount', '0')
638
+ price = None
639
+ amount = None
640
+ if (pricePrecision is not None) and (entryPrice is not None):
641
+ price = Precise.string_mul(entryPrice, pricePrecision)
642
+ if (amountPrecisionString is not None) and (entryAmount is not None):
643
+ amount = Precise.string_mul(entryAmount, amountPrecisionString)
644
+ if (limit is not None) and (i > limit):
645
+ break
646
+ result.append([
647
+ self.parse_number(price),
648
+ self.parse_number(amount),
649
+ ])
650
+ return result
651
+
652
+ def check_required_keys(self):
653
+ if self.apiKey is None:
654
+ raise AuthenticationError(self.id + ' requires apiKey credential')
655
+ if self.secret is None:
656
+ raise AuthenticationError(self.id + ' requires secret credential')
657
+ apiKeyBytes = None
658
+ secretKeyBytes = None
659
+ try:
660
+ apiKeyBytes = self.base58_to_binary(self.apiKey)
661
+ except Exception as e:
662
+ raise AuthenticationError(self.id + ' apiKey must be a base58 encoded public key')
663
+ try:
664
+ secretKeyBytes = self.base58_to_binary(self.secret)
665
+ except Exception as e:
666
+ raise AuthenticationError(self.id + ' secret must be a base58 encoded private key')
667
+ hexApiKeyBytes = self.binary_to_base16(apiKeyBytes)
668
+ hexSecretKeyBytes = self.binary_to_base16(secretKeyBytes)
669
+ if len(hexApiKeyBytes) != 64:
670
+ raise AuthenticationError(self.id + ' apiKey must be a base58 encoded public key')
671
+ if len(hexSecretKeyBytes) != 64:
672
+ raise AuthenticationError(self.id + ' secret must be a base58 encoded private key')
673
+
674
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
675
+ query = self.omit(params, self.extract_params(path))
676
+ isCancelOrder = path == 'matcher/orders/{wavesAddress}/cancel'
677
+ path = self.implode_params(path, params)
678
+ url = self.urls['api'][api] + '/' + path
679
+ queryString = self.urlencode_with_array_repeat(query)
680
+ if (api == 'private') or (api == 'forward'):
681
+ headers = {
682
+ 'Accept': 'application/json',
683
+ }
684
+ accessToken = self.safe_string(self.options, 'accessToken')
685
+ if accessToken:
686
+ headers['Authorization'] = 'Bearer ' + accessToken
687
+ if method == 'POST':
688
+ headers['content-type'] = 'application/json'
689
+ else:
690
+ headers['content-type'] = 'application/x-www-form-urlencoded'
691
+ if isCancelOrder:
692
+ body = self.json([query['orderId']])
693
+ queryString = ''
694
+ if len(queryString) > 0:
695
+ url += '?' + queryString
696
+ elif api == 'matcher':
697
+ if method == 'POST':
698
+ headers = {
699
+ 'Accept': 'application/json',
700
+ 'Content-Type': 'application/json',
701
+ }
702
+ body = self.json(query)
703
+ else:
704
+ headers = query
705
+ else:
706
+ if method == 'POST':
707
+ headers = {
708
+ 'content-type': 'application/json',
709
+ }
710
+ body = self.json(query)
711
+ else:
712
+ headers = {
713
+ 'content-type': 'application/x-www-form-urlencoded',
714
+ }
715
+ if len(queryString) > 0:
716
+ url += '?' + queryString
717
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}
718
+
719
+ def sign_in(self, params={}):
720
+ """
721
+ sign in, must be called prior to using other authenticated methods
722
+ :param dict [params]: extra parameters specific to the exchange API endpoint
723
+ :returns: response from exchange
724
+ """
725
+ if not self.safe_string(self.options, 'accessToken'):
726
+ prefix = 'ffffff01'
727
+ expiresDelta = 60 * 60 * 24 * 7
728
+ seconds = self.sum(self.seconds(), expiresDelta)
729
+ seconds = str(seconds)
730
+ clientId = 'wx.network'
731
+ # W for production, T for testnet
732
+ defaultMessagePrefix = self.safe_string(self.options, 'messagePrefix', 'W')
733
+ message = defaultMessagePrefix + ':' + clientId + ':' + seconds
734
+ messageHex = self.binary_to_base16(self.encode(message))
735
+ payload = prefix + messageHex
736
+ hexKey = self.binary_to_base16(self.base58_to_binary(self.secret))
737
+ signature = self.axolotl(payload, hexKey, 'ed25519')
738
+ request: dict = {
739
+ 'grant_type': 'password',
740
+ 'scope': 'general',
741
+ 'username': self.apiKey,
742
+ 'password': seconds + ':' + signature,
743
+ 'client_id': clientId,
744
+ }
745
+ response = self.privatePostOauth2Token(request)
746
+ # {access_token: "eyJhbGciOXJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWciOiJiaTZiMVhMQlo0M1Q4QmRTSlVSejJBZGlQdVlpaFZQYVhhVjc4ZGVIOEpTM3M3NUdSeEU1VkZVOE5LRUI0UXViNkFHaUhpVFpuZ3pzcnhXdExUclRvZTgiLCJhIjoiM1A4VnpMU2EyM0VXNUNWY2tIYlY3ZDVCb043NWZGMWhoRkgiLCJuYiI6IlciLCJ1c2VyX25hbWUiOiJBSFhuOG5CQTRTZkxRRjdoTFFpU24xNmt4eWVoaml6QkdXMVRkcm1TWjFnRiIsInNjb3BlIjpbImdlbmVyYWwiXSwibHQiOjYwNDc5OSwicGsiOiJBSFhuOG5CQTRTZkxRRjdoTFFpU24xNmt4eWVoaml6QkdXMVRkcm1TWjFnRiIsImV4cCI6MTU5MTk3NTA1NywiZXhwMCI6MTU5MTk3NTA1NywianRpIjoiN2JhOTUxMTMtOGI2MS00NjEzLTlkZmYtNTEwYTc0NjlkOWI5IiwiY2lkIjoid2F2ZXMuZXhjaGFuZ2UifQ.B-XwexBnUAzbWknVN68RKT0ZP5w6Qk1SKJ8usL3OIwDEzCUUX9PjW-5TQHmiCRcA4oft8lqXEiCwEoNfsblCo_jTpRo518a1vZkIbHQk0-13Dm1K5ewGxfxAwBk0g49odcbKdjl64TN1yM_PO1VtLVuiTeZP-XF-S42Uj-7fcO-r7AulyQLuTE0uo-Qdep8HDCk47rduZwtJOmhFbCCnSgnLYvKWy3CVTeldsR77qxUY-vy8q9McqeP7Id-_MWnsob8vWXpkeJxaEsw1Fke1dxApJaJam09VU8EB3ZJWpkT7V8PdafIrQGeexx3jhKKxo7rRb4hDV8kfpVoCgkvFan",
747
+ # "token_type": "bearer",
748
+ # "refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWciOiJiaTZiMVhMQlo0M1Q4QmRTSlVSejJBZGlQdVlpaFZQYVhhVjc4ZGVIOEpTM3M3NUdSeEU1VkZVOE5LRUI0UXViNkFHaUhpVFpuZ3pzcnhXdExUclRvZTgiLCJhIjoiM1A4VnpMU2EyM0VXNUNWY2tIYlY3ZDVCb043NWZGMWhoRkgiLCJuYiI6IlciLCJ1c2VyX25hbWUiOiJBSFhuOG5CQTRTZkxRRjdoTFFpU24xNmt4eWVoaml6QkdXMVRkcm1TWjFnRiIsInNjb3BlIjpbImdlbmVyYWwiXSwiYXRpIjoiN2JhOTUxMTMtOGI2MS00NjEzLTlkZmYtNTEwYTc0NjlkXWI5IiwibHQiOjYwNDc5OSwicGsiOiJBSFhuOG5CQTRTZkxRRjdoTFFpU24xNmt4eWVoaml6QkdXMVRkcm1TWjFnRiIsImV4cCI6MTU5Mzk2MjI1OCwiZXhwMCI6MTU5MTk3NTA1NywianRpIjoiM2MzZWRlMTktNjI5My00MTNlLWJmMWUtZTRlZDZlYzUzZTgzIiwiY2lkIjoid2F2ZXMuZXhjaGFuZ2UifQ.gD1Qj0jfqayfZpBvNY0t3ccMyK5hdbT7dY-_5L6LxwV0Knan4ndEtvygxlTOczmJUKtnA4T1r5GBFgNMZTvtViKZIbqZNysEg2OY8UxwDaF4VPeGJLg_QXEnn8wBeBQdyMafh9UQdwD2ci7x-saM4tOAGmncAygfTDxy80201gwDhfAkAGerb9kL00oWzSJScldxu--pNLDBUEHZt52MSEel10HGrzvZkkvvSh67vcQo5TOGb5KG6nh65UdJCwr41AVz4fbQPP-N2Nkxqy0TE_bqVzZxExXgvcS8TS0Z82T3ijJa_ct7B9wblpylBnvmyj3VycUzufD6uy8MUGq32D",
749
+ # "expires_in": 604798,
750
+ # "scope": "general"}
751
+ self.options['accessToken'] = self.safe_string(response, 'access_token')
752
+ return self.options['accessToken']
753
+ return None
754
+
755
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
756
+ #
757
+ # {
758
+ # "symbol": "WAVES/BTC",
759
+ # "amountAssetID": "WAVES",
760
+ # "amountAssetName": "Waves",
761
+ # "amountAssetDecimals": 8,
762
+ # "amountAssetTotalSupply": "106908766.00000000",
763
+ # "amountAssetMaxSupply": "106908766.00000000",
764
+ # "amountAssetCirculatingSupply": "106908766.00000000",
765
+ # "priceAssetID": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
766
+ # "priceAssetName": "WBTC",
767
+ # "priceAssetDecimals": 8,
768
+ # "priceAssetTotalSupply": "20999999.96007507",
769
+ # "priceAssetMaxSupply": "20999999.96007507",
770
+ # "priceAssetCirculatingSupply": "20999999.66019601",
771
+ # "24h_open": "0.00032688",
772
+ # "24h_high": "0.00033508",
773
+ # "24h_low": "0.00032443",
774
+ # "24h_close": "0.00032806",
775
+ # "24h_vwap": "0.00032988",
776
+ # "24h_volume": "42349.69440104",
777
+ # "24h_priceVolume": "13.97037207",
778
+ # "timestamp":1640232379124
779
+ # }
780
+ #
781
+ # fetch ticker
782
+ #
783
+ # {
784
+ # "firstPrice": "21749",
785
+ # "lastPrice": "22000",
786
+ # "volume": "0.73747149",
787
+ # "quoteVolume": "16409.44564928645471",
788
+ # "high": "23589.999941",
789
+ # "low": "21010.000845",
790
+ # "weightedAveragePrice": "22250.955964",
791
+ # "txsCount": "148",
792
+ # "volumeWaves": "0.0000000000680511203072"
793
+ # }
794
+ #
795
+ timestamp = self.safe_integer(ticker, 'timestamp')
796
+ marketId = self.safe_string(ticker, 'symbol')
797
+ market = self.safe_market(marketId, market, '/')
798
+ symbol = market['symbol']
799
+ last = self.safe_string_2(ticker, '24h_close', 'lastPrice')
800
+ low = self.safe_string_2(ticker, '24h_low', 'low')
801
+ high = self.safe_string_2(ticker, '24h_high', 'high')
802
+ vwap = self.safe_string_2(ticker, '24h_vwap', 'weightedAveragePrice')
803
+ baseVolume = self.safe_string_2(ticker, '24h_volume', 'volume')
804
+ quoteVolume = self.safe_string_2(ticker, '24h_priceVolume', 'quoteVolume')
805
+ open = self.safe_string_2(ticker, '24h_open', 'firstPrice')
806
+ return self.safe_ticker({
807
+ 'symbol': symbol,
808
+ 'timestamp': timestamp,
809
+ 'datetime': self.iso8601(timestamp),
810
+ 'high': high,
811
+ 'low': low,
812
+ 'bid': None,
813
+ 'bidVolume': None,
814
+ 'ask': None,
815
+ 'askVolume': None,
816
+ 'vwap': vwap,
817
+ 'open': open,
818
+ 'close': last,
819
+ 'last': last,
820
+ 'previousClose': None,
821
+ 'change': None,
822
+ 'percentage': None,
823
+ 'average': None,
824
+ 'baseVolume': baseVolume,
825
+ 'quoteVolume': quoteVolume,
826
+ 'info': ticker,
827
+ }, market)
828
+
829
+ def fetch_ticker(self, symbol: str, params={}) -> Ticker:
830
+ """
831
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
832
+ :param str symbol: unified symbol of the market to fetch the ticker for
833
+ :param dict [params]: extra parameters specific to the exchange API endpoint
834
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
835
+ """
836
+ self.load_markets()
837
+ market = self.market(symbol)
838
+ request: dict = {
839
+ 'pairs': market['id'],
840
+ }
841
+ response = self.publicGetPairs(self.extend(request, params))
842
+ #
843
+ # {
844
+ # "__type":"list",
845
+ # "data":[
846
+ # {
847
+ # "__type":"pair",
848
+ # "data":{
849
+ # "firstPrice":0.00012512,
850
+ # "lastPrice":0.00012441,
851
+ # "low":0.00012167,
852
+ # "high":0.00012768,
853
+ # "weightedAveragePrice":0.000124710697407246,
854
+ # "volume":209554.26356614,
855
+ # "quoteVolume":26.1336583539951,
856
+ # "volumeWaves":209554.26356614,
857
+ # "txsCount":6655
858
+ # },
859
+ # "amountAsset":"WAVES",
860
+ # "priceAsset":"8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
861
+ # }
862
+ # ]
863
+ # }
864
+ #
865
+ data = self.safe_value(response, 'data', [])
866
+ ticker = self.safe_value(data, 0, {})
867
+ dataTicker = self.safe_dict(ticker, 'data', {})
868
+ return self.parse_ticker(dataTicker, market)
869
+
870
+ def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
871
+ """
872
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
873
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
874
+ :param dict [params]: extra parameters specific to the exchange API endpoint
875
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
876
+ """
877
+ self.load_markets()
878
+ response = self.marketGetTickers(params)
879
+ #
880
+ # [
881
+ # {
882
+ # "symbol": "WAVES/BTC",
883
+ # "amountAssetID": "WAVES",
884
+ # "amountAssetName": "Waves",
885
+ # "amountAssetDecimals": 8,
886
+ # "amountAssetTotalSupply": "106908766.00000000",
887
+ # "amountAssetMaxSupply": "106908766.00000000",
888
+ # "amountAssetCirculatingSupply": "106908766.00000000",
889
+ # "priceAssetID": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
890
+ # "priceAssetName": "WBTC",
891
+ # "priceAssetDecimals": 8,
892
+ # "priceAssetTotalSupply": "20999999.96007507",
893
+ # "priceAssetMaxSupply": "20999999.96007507",
894
+ # "priceAssetCirculatingSupply": "20999999.66019601",
895
+ # "24h_open": "0.00032688",
896
+ # "24h_high": "0.00033508",
897
+ # "24h_low": "0.00032443",
898
+ # "24h_close": "0.00032806",
899
+ # "24h_vwap": "0.00032988",
900
+ # "24h_volume": "42349.69440104",
901
+ # "24h_priceVolume": "13.97037207",
902
+ # "timestamp":1640232379124
903
+ # }
904
+ # ...
905
+ # ]
906
+ #
907
+ return self.parse_tickers(response, symbols)
908
+
909
+ def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
910
+ """
911
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
912
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
913
+ :param str timeframe: the length of time each candle represents
914
+ :param int [since]: timestamp in ms of the earliest candle to fetch
915
+ :param int [limit]: the maximum amount of candles to fetch
916
+ :param dict [params]: extra parameters specific to the exchange API endpoint
917
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
918
+ """
919
+ self.load_markets()
920
+ market = self.market(symbol)
921
+ request: dict = {
922
+ 'baseId': market['baseId'],
923
+ 'quoteId': market['quoteId'],
924
+ 'interval': self.safe_string(self.timeframes, timeframe, timeframe),
925
+ }
926
+ allowedCandles = self.safe_integer(self.options, 'allowedCandles', 1440)
927
+ if limit is None:
928
+ limit = allowedCandles
929
+ limit = min(allowedCandles, limit)
930
+ duration = self.parse_timeframe(timeframe) * 1000
931
+ if since is None:
932
+ durationRoundedTimestamp = self.parse_to_int(self.milliseconds() / duration) * duration
933
+ delta = (limit - 1) * duration
934
+ timeStart = durationRoundedTimestamp - delta
935
+ request['timeStart'] = str(timeStart)
936
+ else:
937
+ request['timeStart'] = str(since)
938
+ timeEnd = self.sum(since, duration * limit)
939
+ request['timeEnd'] = str(timeEnd)
940
+ response = self.publicGetCandlesBaseIdQuoteId(self.extend(request, params))
941
+ #
942
+ # {
943
+ # "__type": "list",
944
+ # "data": [
945
+ # {
946
+ # "__type": "candle",
947
+ # "data": {
948
+ # "time": "2020-06-09T14:47:00.000Z",
949
+ # "open": 0.0250385,
950
+ # "close": 0.0250385,
951
+ # "high": 0.0250385,
952
+ # "low": 0.0250385,
953
+ # "volume": 0.01033012,
954
+ # "quoteVolume": 0.00025865,
955
+ # "weightedAveragePrice": 0.0250385,
956
+ # "maxHeight": 2099399,
957
+ # "txsCount": 5,
958
+ # "timeClose": "2020-06-09T14:47:59.999Z"
959
+ # }
960
+ # }
961
+ # ]
962
+ # }
963
+ #
964
+ data = self.safe_value(response, 'data', [])
965
+ result = self.parse_ohlcvs(data, market, timeframe, since, limit)
966
+ result = self.filter_future_candles(result)
967
+ lastClose = None
968
+ length = len(result)
969
+ for i in range(0, len(result)):
970
+ j = length - i - 1
971
+ entry = result[j]
972
+ open = entry[1]
973
+ if open is None:
974
+ entry[1] = lastClose
975
+ entry[2] = lastClose
976
+ entry[3] = lastClose
977
+ entry[4] = lastClose
978
+ result[j] = entry
979
+ lastClose = entry[4]
980
+ return result
981
+
982
+ def filter_future_candles(self, ohlcvs):
983
+ result = []
984
+ timestamp = self.milliseconds()
985
+ for i in range(0, len(ohlcvs)):
986
+ if ohlcvs[i][0] > timestamp:
987
+ # stop when getting data from the future
988
+ break
989
+ result.append(ohlcvs[i])
990
+ return result
991
+
992
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
993
+ #
994
+ # {
995
+ # "__type": "candle",
996
+ # "data": {
997
+ # "time": "2020-06-05T20:46:00.000Z",
998
+ # "open": 240.573975,
999
+ # "close": 240.573975,
1000
+ # "high": 240.573975,
1001
+ # "low": 240.573975,
1002
+ # "volume": 0.01278413,
1003
+ # "quoteVolume": 3.075528,
1004
+ # "weightedAveragePrice": 240.573975,
1005
+ # "maxHeight": 2093895,
1006
+ # "txsCount": 5,
1007
+ # "timeClose": "2020-06-05T20:46:59.999Z"
1008
+ # }
1009
+ # }
1010
+ #
1011
+ data = self.safe_value(ohlcv, 'data', {})
1012
+ return [
1013
+ self.parse8601(self.safe_string(data, 'time')),
1014
+ self.safe_number(data, 'open'),
1015
+ self.safe_number(data, 'high'),
1016
+ self.safe_number(data, 'low'),
1017
+ self.safe_number(data, 'close'),
1018
+ self.safe_number(data, 'volume', 0),
1019
+ ]
1020
+
1021
+ def fetch_deposit_address(self, code: str, params={}):
1022
+ """
1023
+ fetch the deposit address for a currency associated with self account
1024
+ :param str code: unified currency code
1025
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1026
+ :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1027
+ """
1028
+ self.sign_in()
1029
+ networks = self.safe_value(self.options, 'networks', {})
1030
+ rawNetwork = self.safe_string_upper(params, 'network')
1031
+ network = self.safe_string(networks, rawNetwork, rawNetwork)
1032
+ params = self.omit(params, ['network'])
1033
+ supportedCurrencies = self.privateGetPlatforms()
1034
+ #
1035
+ # {
1036
+ # "type": "list",
1037
+ # "page_info": {
1038
+ # "has_next_page": False,
1039
+ # "last_cursor": null
1040
+ # },
1041
+ # "items": [
1042
+ # {
1043
+ # "type": "platform",
1044
+ # "id": "ETH",
1045
+ # "name": "Ethereum",
1046
+ # "currencies": [
1047
+ # "BAG",
1048
+ # "BNT",
1049
+ # "CRV",
1050
+ # "EGG",
1051
+ # "ETH",
1052
+ # "EURN",
1053
+ # "FL",
1054
+ # "NSBT",
1055
+ # "USDAP",
1056
+ # "USDC",
1057
+ # "USDFL",
1058
+ # "USDN",
1059
+ # "USDT",
1060
+ # "WAVES"
1061
+ # ]
1062
+ # }
1063
+ # ]
1064
+ # }
1065
+ #
1066
+ currencies: dict = {}
1067
+ networksByCurrency: dict = {}
1068
+ items = self.safe_value(supportedCurrencies, 'items', [])
1069
+ for i in range(0, len(items)):
1070
+ entry = items[i]
1071
+ currencyId = self.safe_string(entry, 'id')
1072
+ innerCurrencies = self.safe_value(entry, 'currencies', [])
1073
+ for j in range(0, len(innerCurrencies)):
1074
+ currencyCode = self.safe_string(innerCurrencies, j)
1075
+ currencies[currencyCode] = True
1076
+ if not (currencyCode in networksByCurrency):
1077
+ networksByCurrency[currencyCode] = {}
1078
+ networksByCurrency[currencyCode][currencyId] = True
1079
+ if not (code in currencies):
1080
+ codes = list(currencies.keys())
1081
+ raise ExchangeError(self.id + ' fetchDepositAddress() ' + code + ' not supported. Currency code must be one of ' + ', '.join(codes))
1082
+ response = None
1083
+ if network is None:
1084
+ request: dict = {
1085
+ 'currency': code,
1086
+ }
1087
+ response = self.privateGetDepositAddressesCurrency(self.extend(request, params))
1088
+ else:
1089
+ supportedNetworks = networksByCurrency[code]
1090
+ if not (network in supportedNetworks):
1091
+ supportedNetworkKeys = list(supportedNetworks.keys())
1092
+ raise ExchangeError(self.id + ' ' + network + ' network ' + code + ' deposit address not supported. Network must be one of ' + ', '.join(supportedNetworkKeys))
1093
+ if network == 'WAVES':
1094
+ request: dict = {
1095
+ 'publicKey': self.apiKey,
1096
+ }
1097
+ responseInner = self.nodeGetAddressesPublicKeyPublicKey(self.extend(request, request))
1098
+ addressInner = self.safe_string(response, 'address')
1099
+ return {
1100
+ 'address': addressInner,
1101
+ 'code': code, # kept here for backward-compatibility, but will be removed soon
1102
+ 'currency': code,
1103
+ 'network': network,
1104
+ 'tag': None,
1105
+ 'info': responseInner,
1106
+ }
1107
+ else:
1108
+ request: dict = {
1109
+ 'currency': code,
1110
+ 'platform': network,
1111
+ }
1112
+ response = self.privateGetDepositAddressesCurrencyPlatform(self.extend(request, params))
1113
+ #
1114
+ # {
1115
+ # "type": "deposit_addresses",
1116
+ # "currency": {
1117
+ # "type": "deposit_currency",
1118
+ # "id": "ERGO",
1119
+ # "waves_asset_id": "5dJj4Hn9t2Ve3tRpNGirUHy4yBK6qdJRAJYV21yPPuGz",
1120
+ # "platform_id": "BSC",
1121
+ # "decimals": 9,
1122
+ # "status": "active",
1123
+ # "allowed_amount": {
1124
+ # "min": 0.001,
1125
+ # "max": 100000
1126
+ # },
1127
+ # "fees": {
1128
+ # "flat": 0,
1129
+ # "rate": 0
1130
+ # }
1131
+ # },
1132
+ # "deposit_addresses": [
1133
+ # "9fRAAQjF8Yqg7qicQCL884zjimsRnuwsSavsM1rUdDaoG8mThku"
1134
+ # ]
1135
+ # }
1136
+ currency = self.safe_value(response, 'currency')
1137
+ networkId = self.safe_string(currency, 'platform_id')
1138
+ networkByIds = self.safe_value(self.options, 'networkByIds', {})
1139
+ unifiedNetwork = self.safe_string(networkByIds, networkId, networkId)
1140
+ addresses = self.safe_value(response, 'deposit_addresses')
1141
+ address = self.safe_string(addresses, 0)
1142
+ return {
1143
+ 'address': address,
1144
+ 'code': code, # kept here for backward-compatibility, but will be removed soon
1145
+ 'currency': code,
1146
+ 'tag': None,
1147
+ 'network': unifiedNetwork,
1148
+ 'info': response,
1149
+ }
1150
+
1151
+ def get_matcher_public_key(self):
1152
+ # self method returns a single string
1153
+ matcherPublicKey = self.safe_string(self.options, 'matcherPublicKey')
1154
+ if matcherPublicKey:
1155
+ return matcherPublicKey
1156
+ else:
1157
+ response = self.matcherGetMatcher()
1158
+ # remove trailing quotes from string response
1159
+ self.options['matcherPublicKey'] = response[1:len(response) - 1]
1160
+ return self.options['matcherPublicKey']
1161
+
1162
+ def get_asset_bytes(self, currencyId):
1163
+ if currencyId == 'WAVES':
1164
+ return self.number_to_be(0, 1)
1165
+ else:
1166
+ return self.binary_concat(self.number_to_be(1, 1), self.base58_to_binary(currencyId))
1167
+
1168
+ def get_asset_id(self, currencyId):
1169
+ if currencyId == 'WAVES':
1170
+ return ''
1171
+ return currencyId
1172
+
1173
+ def to_real_currency_amount(self, code: str, amount: float, networkCode=None):
1174
+ currency = self.currency(code)
1175
+ stringValue = Precise.string_div(self.number_to_string(amount), self.safe_string(currency, 'precision'))
1176
+ return int(stringValue)
1177
+
1178
+ def from_real_currency_amount(self, code: str, amountString: str):
1179
+ if not (code in self.currencies):
1180
+ return amountString
1181
+ currency = self.currency(code)
1182
+ precisionAmount = self.safe_string(currency, 'precision')
1183
+ return Precise.string_mul(amountString, precisionAmount)
1184
+
1185
+ def to_real_symbol_price(self, symbol: str, price: float):
1186
+ market = self.market(symbol)
1187
+ stringValue = Precise.string_div(self.number_to_string(price), self.safe_string(market['precision'], 'price'))
1188
+ return int(stringValue)
1189
+
1190
+ def from_real_symbol_price(self, symbol: str, priceString: str):
1191
+ market = self.markets[symbol]
1192
+ return Precise.string_mul(priceString, self.safe_string(market['precision'], 'price'))
1193
+
1194
+ def to_real_symbol_amount(self, symbol: str, amount: float):
1195
+ market = self.market(symbol)
1196
+ stringValue = Precise.string_div(self.number_to_string(amount), self.safe_string(market['precision'], 'amount'))
1197
+ return int(stringValue)
1198
+
1199
+ def from_real_symbol_amount(self, symbol: str, amountString: str):
1200
+ market = self.markets[symbol]
1201
+ return Precise.string_mul(amountString, market['precision']['amount'])
1202
+
1203
+ def safe_get_dynamic(self, settings):
1204
+ orderFee = self.safe_value(settings, 'orderFee')
1205
+ if 'dynamic' in orderFee:
1206
+ return self.safe_value(orderFee, 'dynamic')
1207
+ else:
1208
+ return self.safe_value(orderFee['composite']['default'], 'dynamic')
1209
+
1210
+ def safe_get_rates(self, dynamic):
1211
+ rates = self.safe_value(dynamic, 'rates')
1212
+ if rates is None:
1213
+ return {'WAVES': 1}
1214
+ return rates
1215
+
1216
+ def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1217
+ """
1218
+ create a trade order
1219
+ :param str symbol: unified symbol of the market to create an order in
1220
+ :param str type: 'market' or 'limit'
1221
+ :param str side: 'buy' or 'sell'
1222
+ :param float amount: how much of currency you want to trade in units of base currency
1223
+ :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1224
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1225
+ :param float [params.stopPrice]: The price at which a stop order is triggered at
1226
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1227
+ """
1228
+ self.check_required_dependencies()
1229
+ self.check_required_keys()
1230
+ self.load_markets()
1231
+ market = self.market(symbol)
1232
+ matcherPublicKey = self.get_matcher_public_key()
1233
+ amountAsset = self.get_asset_id(market['baseId'])
1234
+ priceAsset = self.get_asset_id(market['quoteId'])
1235
+ isMarketOrder = (type == 'market')
1236
+ stopPrice = self.safe_float_2(params, 'triggerPrice', 'stopPrice')
1237
+ isStopOrder = (stopPrice is not None)
1238
+ if (isMarketOrder) and (price is None):
1239
+ raise InvalidOrder(self.id + ' createOrder() requires a price argument for ' + type + ' orders to determine the max price for buy and the min price for sell')
1240
+ timestamp = self.milliseconds()
1241
+ defaultExpiryDelta = self.safe_integer(self.options, 'createOrderDefaultExpiry', 2419200000)
1242
+ expiration = self.sum(timestamp, defaultExpiryDelta)
1243
+ matcherFees = self.get_fees_for_asset(symbol, side, amount, price)
1244
+ # {
1245
+ # "base":{
1246
+ # "feeAssetId":"WAVES", # varies depending on the trading pair
1247
+ # "matcherFee":"1000000"
1248
+ # },
1249
+ # "discount":{
1250
+ # "feeAssetId":"EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc",
1251
+ # "matcherFee":"4077612"
1252
+ # }
1253
+ # }
1254
+ base = self.safe_value_2(matcherFees, 'base', 'discount')
1255
+ baseFeeAssetId = self.safe_string(base, 'feeAssetId')
1256
+ baseFeeAsset = self.safe_currency_code(baseFeeAssetId)
1257
+ baseMatcherFee = self.safe_string(base, 'matcherFee')
1258
+ discount = self.safe_value(matcherFees, 'discount')
1259
+ discountFeeAssetId = self.safe_string(discount, 'feeAssetId')
1260
+ discountFeeAsset = self.safe_currency_code(discountFeeAssetId)
1261
+ discountMatcherFee = self.safe_string(discount, 'matcherFee')
1262
+ matcherFeeAssetId = None
1263
+ matcherFee = None
1264
+ # check first if user supplied asset fee is valid
1265
+ if ('feeAsset' in params) or ('feeAsset' in self.options):
1266
+ feeAsset = self.safe_string(params, 'feeAsset', self.safe_string(self.options, 'feeAsset'))
1267
+ feeCurrency = self.currency(feeAsset)
1268
+ matcherFeeAssetId = self.safe_string(feeCurrency, 'id')
1269
+ balances = self.fetch_balance()
1270
+ if matcherFeeAssetId is not None:
1271
+ if baseFeeAssetId != matcherFeeAssetId and discountFeeAssetId != matcherFeeAssetId:
1272
+ raise InvalidOrder(self.id + ' asset fee must be ' + baseFeeAsset + ' or ' + discountFeeAsset)
1273
+ matcherFeeAsset = self.safe_currency_code(matcherFeeAssetId)
1274
+ rawMatcherFee = baseMatcherFee if (matcherFeeAssetId == baseFeeAssetId) else discountMatcherFee
1275
+ floatMatcherFee = float(self.from_real_currency_amount(matcherFeeAsset, rawMatcherFee))
1276
+ if (matcherFeeAsset in balances) and (balances[matcherFeeAsset]['free'] >= floatMatcherFee):
1277
+ matcherFee = int(rawMatcherFee)
1278
+ else:
1279
+ raise InsufficientFunds(self.id + ' not enough funds of the selected asset fee')
1280
+ floatBaseMatcherFee = self.from_real_currency_amount(baseFeeAsset, baseMatcherFee)
1281
+ floatDiscountMatcherFee = self.from_real_currency_amount(discountFeeAsset, discountMatcherFee)
1282
+ if matcherFeeAssetId is None:
1283
+ # try to the pay the fee using the base first then discount asset
1284
+ if (baseFeeAsset in balances) and (balances[baseFeeAsset]['free'] >= float(floatBaseMatcherFee)):
1285
+ matcherFeeAssetId = baseFeeAssetId
1286
+ matcherFee = int(baseMatcherFee)
1287
+ else:
1288
+ if (discountFeeAsset in balances) and (balances[discountFeeAsset]['free'] >= float(floatDiscountMatcherFee)):
1289
+ matcherFeeAssetId = discountFeeAssetId
1290
+ matcherFee = int(discountMatcherFee)
1291
+ if matcherFeeAssetId is None:
1292
+ raise InsufficientFunds(self.id + ' not enough funds on none of the eligible asset fees: ' + baseFeeAsset + ' ' + floatBaseMatcherFee + ' or ' + discountFeeAsset + ' ' + floatDiscountMatcherFee)
1293
+ amount = self.to_real_symbol_amount(symbol, amount)
1294
+ price = self.to_real_symbol_price(symbol, price)
1295
+ assetPair: dict = {
1296
+ 'amountAsset': amountAsset,
1297
+ 'priceAsset': priceAsset,
1298
+ }
1299
+ sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
1300
+ chainId = 84 if (sandboxMode) else 87
1301
+ body: dict = {
1302
+ 'senderPublicKey': self.apiKey,
1303
+ 'matcherPublicKey': matcherPublicKey,
1304
+ 'assetPair': assetPair,
1305
+ 'orderType': side,
1306
+ 'price': price,
1307
+ 'amount': amount,
1308
+ 'timestamp': timestamp,
1309
+ 'expiration': expiration,
1310
+ 'matcherFee': int(matcherFee),
1311
+ 'priceMode': 'assetDecimals',
1312
+ 'version': 4,
1313
+ 'chainId': chainId,
1314
+ }
1315
+ if isStopOrder:
1316
+ #
1317
+ # {
1318
+ # "v": 1, # version(int)
1319
+ # "c": { # condition(object)
1320
+ # "t": "sp", # condition type. for now only "stop-price"(string)
1321
+ # "v": { # value(object)
1322
+ # "p": "123", # price(long)
1323
+ # },
1324
+ # },
1325
+ # }
1326
+ #
1327
+ attachment: dict = {
1328
+ 'v': 1,
1329
+ 'c': {
1330
+ 't': 'sp',
1331
+ 'v': {
1332
+ 'p': self.to_real_symbol_price(symbol, stopPrice),
1333
+ },
1334
+ },
1335
+ }
1336
+ body['attachment'] = self.binary_to_base58(self.encode(json.dumps(attachment)))
1337
+ if matcherFeeAssetId != 'WAVES':
1338
+ body['matcherFeeAssetId'] = matcherFeeAssetId
1339
+ serializedOrder = self.matcherPostMatcherOrdersSerialize(body)
1340
+ if (serializedOrder[0] == '"') and (serializedOrder[(len(serializedOrder) - 1)] == '"'):
1341
+ serializedOrder = serializedOrder[1:len(serializedOrder) - 1]
1342
+ signature = self.axolotl(self.binary_to_base16(self.base58_to_binary(serializedOrder)), self.binary_to_base16(self.base58_to_binary(self.secret)), 'ed25519')
1343
+ body['signature'] = signature
1344
+ #
1345
+ # {
1346
+ # "success": True,
1347
+ # "message": {
1348
+ # "version": 4,
1349
+ # "id": "8VR49dLZFaYcVwzx9TqVMTAZCSUoyB74kLUHrEPCSJgN",
1350
+ # "sender": "3MpEdBXtsRHRj2TvZURSb8uLDxzneVbYczW",
1351
+ # "senderPublicKey": "8aUTNqHGCBiubySBRhcS1N6NC5jLczhVcndRfMAuwtkY",
1352
+ # "matcherPublicKey": "8QUAqtTckM5B8gvcuP7mMswat9SjKUuafJMusEoSn1Gy",
1353
+ # "assetPair": {
1354
+ # "amountAsset": "EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc",
1355
+ # "priceAsset": "25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT"
1356
+ # },
1357
+ # "orderType": "sell",
1358
+ # "amount": 100000,
1359
+ # "price": 480000,
1360
+ # "timestamp": 1690852043772,
1361
+ # "expiration": 1693271243772,
1362
+ # "matcherFee": 83327570,
1363
+ # "signature": "3QYDWQVSP4kdqpTLodCuboh8bpWd6GW5s1pQyKdce1JBDwX6t4kH5Xtuq35pqo94gxjo3cfG6k6Xuic2JaYLubkK",
1364
+ # "proofs": [
1365
+ # "3QYDWQVSP4kdqpTLodCuboh8bpWd6GW5s1pQyKdce1JBDwX6t4kH5Xtuq35pqo94gxjo3cfG6k6Xuic2JaYLubkK"
1366
+ # ],
1367
+ # "matcherFeeAssetId": "EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc",
1368
+ # "eip712Signature": null,
1369
+ # "priceMode": "assetDecimals",
1370
+ # "attachment": "2PQ4akZHnMSZrQissuu5uudoXbgsipeDnFcRtXtjVgkdm1gUWEgGzp"
1371
+ # },
1372
+ # "status": "OrderAccepted"
1373
+ # }
1374
+ #
1375
+ if isMarketOrder:
1376
+ response = self.matcherPostMatcherOrderbookMarket(body)
1377
+ value = self.safe_dict(response, 'message')
1378
+ return self.parse_order(value, market)
1379
+ else:
1380
+ response = self.matcherPostMatcherOrderbook(body)
1381
+ value = self.safe_dict(response, 'message')
1382
+ return self.parse_order(value, market)
1383
+
1384
+ def cancel_order(self, id: str, symbol: Str = None, params={}):
1385
+ """
1386
+ cancels an open order
1387
+ :param str id: order id
1388
+ :param str symbol: unified symbol of the market the order was made in
1389
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1390
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1391
+ """
1392
+ self.check_required_dependencies()
1393
+ self.check_required_keys()
1394
+ self.sign_in()
1395
+ wavesAddress = self.get_waves_address()
1396
+ response = self.forwardPostMatcherOrdersWavesAddressCancel({
1397
+ 'wavesAddress': wavesAddress,
1398
+ 'orderId': id,
1399
+ })
1400
+ # {
1401
+ # "success":true,
1402
+ # "message":[[{"orderId":"EBpJeGM36KKFz5gTJAUKDBm89V8wqxKipSFBdU35AN3c","success":true,"status":"OrderCanceled"}]],
1403
+ # "status":"BatchCancelCompleted"
1404
+ # }
1405
+ message = self.safe_value(response, 'message')
1406
+ firstMessage = self.safe_value(message, 0)
1407
+ firstOrder = self.safe_value(firstMessage, 0)
1408
+ returnedId = self.safe_string(firstOrder, 'orderId')
1409
+ return self.safe_order({
1410
+ 'info': response,
1411
+ 'id': returnedId,
1412
+ 'clientOrderId': None,
1413
+ 'timestamp': None,
1414
+ 'datetime': None,
1415
+ 'lastTradeTimestamp': None,
1416
+ 'symbol': symbol,
1417
+ 'type': None,
1418
+ 'side': None,
1419
+ 'price': None,
1420
+ 'amount': None,
1421
+ 'cost': None,
1422
+ 'average': None,
1423
+ 'filled': None,
1424
+ 'remaining': None,
1425
+ 'status': None,
1426
+ 'fee': None,
1427
+ 'trades': None,
1428
+ })
1429
+
1430
+ def fetch_order(self, id: str, symbol: Str = None, params={}):
1431
+ """
1432
+ fetches information on an order made by the user
1433
+ :param str symbol: unified symbol of the market the order was made in
1434
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1435
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1436
+ """
1437
+ self.check_required_dependencies()
1438
+ self.check_required_keys()
1439
+ self.load_markets()
1440
+ market = None
1441
+ if symbol is not None:
1442
+ market = self.market(symbol)
1443
+ timestamp = self.milliseconds()
1444
+ byteArray = [
1445
+ self.base58_to_binary(self.apiKey),
1446
+ self.number_to_be(timestamp, 8),
1447
+ ]
1448
+ binary = self.binary_concat_array(byteArray)
1449
+ hexSecret = self.binary_to_base16(self.base58_to_binary(self.secret))
1450
+ signature = self.axolotl(self.binary_to_base16(binary), hexSecret, 'ed25519')
1451
+ request: dict = {
1452
+ 'Timestamp': str(timestamp),
1453
+ 'Signature': signature,
1454
+ 'publicKey': self.apiKey,
1455
+ 'orderId': id,
1456
+ }
1457
+ response = self.matcherGetMatcherOrderbookPublicKeyOrderId(self.extend(request, params))
1458
+ return self.parse_order(response, market)
1459
+
1460
+ def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1461
+ """
1462
+ fetches information on multiple orders made by the user
1463
+ :param str symbol: unified market symbol of the market orders were made in
1464
+ :param int [since]: the earliest time in ms to fetch orders for
1465
+ :param int [limit]: the maximum number of order structures to retrieve
1466
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1467
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1468
+ """
1469
+ self.check_required_dependencies()
1470
+ self.check_required_keys()
1471
+ if symbol is None:
1472
+ raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
1473
+ self.load_markets()
1474
+ market = self.market(symbol)
1475
+ timestamp = self.milliseconds()
1476
+ byteArray = [
1477
+ self.base58_to_binary(self.apiKey),
1478
+ self.number_to_be(timestamp, 8),
1479
+ ]
1480
+ binary = self.binary_concat_array(byteArray)
1481
+ hexSecret = self.binary_to_base16(self.base58_to_binary(self.secret))
1482
+ signature = self.axolotl(self.binary_to_base16(binary), hexSecret, 'ed25519')
1483
+ request: dict = {
1484
+ 'Accept': 'application/json',
1485
+ 'Timestamp': str(timestamp),
1486
+ 'Signature': signature,
1487
+ 'publicKey': self.apiKey,
1488
+ 'baseId': market['baseId'],
1489
+ 'quoteId': market['quoteId'],
1490
+ }
1491
+ response = self.matcherGetMatcherOrderbookBaseIdQuoteIdPublicKeyPublicKey(self.extend(request, params))
1492
+ # [{id: "3KicDeWayY2mdrRoYdCkP3gUAoUZUNT1AA6GAtWuPLfa",
1493
+ # "type": "sell",
1494
+ # "orderType": "limit",
1495
+ # "amount": 1,
1496
+ # "fee": 300000,
1497
+ # "price": 100000000,
1498
+ # "timestamp": 1591651254076,
1499
+ # "filled": 0,
1500
+ # "filledFee": 0,
1501
+ # "feeAsset": "WAVES",
1502
+ # "status": "Accepted",
1503
+ # "assetPair":
1504
+ # {amountAsset: null,
1505
+ # "priceAsset": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"},
1506
+ # "avgWeighedPrice": 0}, ...]
1507
+ return self.parse_orders(response, market, since, limit)
1508
+
1509
+ def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1510
+ """
1511
+ fetch all unfilled currently open orders
1512
+ :param str symbol: unified market symbol
1513
+ :param int [since]: the earliest time in ms to fetch open orders for
1514
+ :param int [limit]: the maximum number of open orders structures to retrieve
1515
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1516
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1517
+ """
1518
+ self.load_markets()
1519
+ self.sign_in()
1520
+ market = None
1521
+ if symbol is not None:
1522
+ market = self.market(symbol)
1523
+ address = self.get_waves_address()
1524
+ request: dict = {
1525
+ 'address': address,
1526
+ 'activeOnly': True,
1527
+ }
1528
+ response = self.forwardGetMatcherOrdersAddress(request)
1529
+ return self.parse_orders(response, market, since, limit)
1530
+
1531
+ def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1532
+ """
1533
+ fetches information on multiple closed orders made by the user
1534
+ :param str symbol: unified market symbol of the market orders were made in
1535
+ :param int [since]: the earliest time in ms to fetch orders for
1536
+ :param int [limit]: the maximum number of order structures to retrieve
1537
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1538
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1539
+ """
1540
+ self.load_markets()
1541
+ self.sign_in()
1542
+ market = None
1543
+ if symbol is not None:
1544
+ market = self.market(symbol)
1545
+ address = self.get_waves_address()
1546
+ request: dict = {
1547
+ 'address': address,
1548
+ 'closedOnly': True,
1549
+ }
1550
+ response = self.forwardGetMatcherOrdersAddress(request)
1551
+ # [
1552
+ # {
1553
+ # "id": "9aXcxvXai73jbAm7tQNnqaQ2PwUjdmWuyjvRTKAHsw4f",
1554
+ # "type": "buy",
1555
+ # "orderType": "limit",
1556
+ # "amount": 23738330,
1557
+ # "fee": 300000,
1558
+ # "price": 3828348334,
1559
+ # "timestamp": 1591926905636,
1560
+ # "filled": 23738330,
1561
+ # "filledFee": 300000,
1562
+ # "feeAsset": "WAVES",
1563
+ # "status": "Filled",
1564
+ # "assetPair": {
1565
+ # "amountAsset": "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
1566
+ # "priceAsset": null
1567
+ # },
1568
+ # "avgWeighedPrice": 3828348334
1569
+ # }, ...
1570
+ # ]
1571
+ return self.parse_orders(response, market, since, limit)
1572
+
1573
+ def parse_order_status(self, status: Str):
1574
+ statuses: dict = {
1575
+ 'Cancelled': 'canceled',
1576
+ 'Accepted': 'open',
1577
+ 'Filled': 'closed',
1578
+ 'PartiallyFilled': 'open',
1579
+ }
1580
+ return self.safe_string(statuses, status, status)
1581
+
1582
+ def get_symbol_from_asset_pair(self, assetPair):
1583
+ # a blank string or null can indicate WAVES
1584
+ baseId = self.safe_string(assetPair, 'amountAsset', 'WAVES')
1585
+ quoteId = self.safe_string(assetPair, 'priceAsset', 'WAVES')
1586
+ return self.safe_currency_code(baseId) + '/' + self.safe_currency_code(quoteId)
1587
+
1588
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1589
+ #
1590
+ # createOrder
1591
+ #
1592
+ # {
1593
+ # "version": 4,
1594
+ # "id": "BshyeHXDfJmTnjTdBYt371jD4yWaT3JTP6KpjpsiZepS",
1595
+ # "sender": "3P8VzLSa23EW5CVckHbV7d5BoN75fF1hhFH",
1596
+ # "senderPublicKey": "AHXn8nBA4SfLQF7hLQiSn16kxyehjizBGW1TdrmSZ1gF",
1597
+ # "matcherPublicKey": "9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
1598
+ # "assetPair": {
1599
+ # "amountAsset": "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
1600
+ # "priceAsset": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
1601
+ # },
1602
+ # "orderType": "buy",
1603
+ # "amount": 10000,
1604
+ # "price": 400000000,
1605
+ # "timestamp": 1599848586891,
1606
+ # "expiration": 1602267786891,
1607
+ # "matcherFee": 3008,
1608
+ # "matcherFeeAssetId": "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
1609
+ # "signature": "3D2h8ubrhuWkXbVn4qJ3dvjmZQxLoRNfjTqb9uNpnLxUuwm4fGW2qGH6yKFe2SQPrcbgkS3bDVe7SNtMuatEJ7qy",
1610
+ # "proofs": [
1611
+ # "3D2h8ubrhuWkXbVn4qJ3dvjmZQxLoRNfjTqb9uNpnLxUuwm4fGW2qGH6yKFe2SQPrcbgkS3bDVe7SNtMuatEJ7qy",
1612
+ # ],
1613
+ # "attachment":"77rnoyFX5BDr15hqZiUtgXKSN46zsbHHQjVNrTMLZcLz62mmFKr39FJ"
1614
+ # }
1615
+ #
1616
+ #
1617
+ # fetchOrder, fetchOrders, fetchOpenOrders, fetchClosedOrders
1618
+ #
1619
+ # {
1620
+ # "id": "81D9uKk2NfmZzfG7uaJsDtxqWFbJXZmjYvrL88h15fk8",
1621
+ # "type": "buy",
1622
+ # "orderType": "limit",
1623
+ # "amount": 30000000000,
1624
+ # "filled": 0,
1625
+ # "price": 1000000,
1626
+ # "fee": 300000,
1627
+ # "filledFee": 0,
1628
+ # "feeAsset": "WAVES",
1629
+ # "timestamp": 1594303779322,
1630
+ # "status": "Cancelled",
1631
+ # "assetPair": {
1632
+ # "amountAsset": "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
1633
+ # "priceAsset": "WAVES"
1634
+ # },
1635
+ # "avgWeighedPrice": 0,
1636
+ # "version": 4,
1637
+ # "totalExecutedPriceAssets": 0, # in fetchOpenOrder/s
1638
+ # "attachment":"77rnoyFX5BDr15hqZiUtgXKSN46zsbHHQjVNrTMLZcLz62mmFKr39FJ"
1639
+ # }
1640
+ #
1641
+ timestamp = self.safe_integer(order, 'timestamp')
1642
+ side = self.safe_string_2(order, 'type', 'orderType')
1643
+ type = 'limit'
1644
+ if 'type' in order:
1645
+ # fetchOrders
1646
+ type = self.safe_string(order, 'orderType', type)
1647
+ id = self.safe_string(order, 'id')
1648
+ filledString = self.safe_string(order, 'filled')
1649
+ priceString = self.safe_string(order, 'price')
1650
+ amountString = self.safe_string(order, 'amount')
1651
+ assetPair = self.safe_value(order, 'assetPair')
1652
+ symbol = None
1653
+ if assetPair is not None:
1654
+ symbol = self.get_symbol_from_asset_pair(assetPair)
1655
+ elif market is not None:
1656
+ symbol = market['symbol']
1657
+ amountCurrency = self.safe_currency_code(self.safe_string(assetPair, 'amountAsset', 'WAVES'))
1658
+ price = self.from_real_symbol_price(symbol, priceString)
1659
+ amount = self.from_real_currency_amount(amountCurrency, amountString)
1660
+ filled = self.from_real_currency_amount(amountCurrency, filledString)
1661
+ average = self.from_real_symbol_price(symbol, self.safe_string(order, 'avgWeighedPrice'))
1662
+ status = self.parse_order_status(self.safe_string(order, 'status'))
1663
+ fee = None
1664
+ if 'type' in order:
1665
+ code = self.safe_currency_code(self.safe_string(order, 'feeAsset'))
1666
+ fee = {
1667
+ 'currency': code,
1668
+ 'fee': self.parse_number(self.from_real_currency_amount(code, self.safe_string(order, 'filledFee'))),
1669
+ }
1670
+ else:
1671
+ code = self.safe_currency_code(self.safe_string(order, 'matcherFeeAssetId', 'WAVES'))
1672
+ fee = {
1673
+ 'currency': code,
1674
+ 'fee': self.parse_number(self.from_real_currency_amount(code, self.safe_string(order, 'matcherFee'))),
1675
+ }
1676
+ triggerPrice = None
1677
+ attachment = self.safe_string(order, 'attachment')
1678
+ if attachment is not None:
1679
+ decodedAttachment = self.parse_json(self.decode(self.base58_to_binary(attachment)))
1680
+ if decodedAttachment is not None:
1681
+ c = self.safe_value(decodedAttachment, 'c')
1682
+ if c is not None:
1683
+ v = self.safe_value(c, 'v')
1684
+ if v is not None:
1685
+ triggerPrice = self.safe_string(v, 'p')
1686
+ return self.safe_order({
1687
+ 'info': order,
1688
+ 'id': id,
1689
+ 'clientOrderId': None,
1690
+ 'timestamp': timestamp,
1691
+ 'datetime': self.iso8601(timestamp),
1692
+ 'lastTradeTimestamp': None,
1693
+ 'symbol': symbol,
1694
+ 'type': type,
1695
+ 'timeInForce': None,
1696
+ 'postOnly': None,
1697
+ 'side': side,
1698
+ 'price': price,
1699
+ 'stopPrice': triggerPrice,
1700
+ 'triggerPrice': triggerPrice,
1701
+ 'amount': amount,
1702
+ 'cost': None,
1703
+ 'average': average,
1704
+ 'filled': filled,
1705
+ 'remaining': None,
1706
+ 'status': status,
1707
+ 'fee': fee,
1708
+ 'trades': None,
1709
+ }, market)
1710
+
1711
+ def get_waves_address(self):
1712
+ cachedAddreess = self.safe_string(self.options, 'wavesAddress')
1713
+ if cachedAddreess is None:
1714
+ request: dict = {
1715
+ 'publicKey': self.apiKey,
1716
+ }
1717
+ response = self.nodeGetAddressesPublicKeyPublicKey(request)
1718
+ self.options['wavesAddress'] = self.safe_string(response, 'address')
1719
+ return self.options['wavesAddress']
1720
+ else:
1721
+ return cachedAddreess
1722
+
1723
+ def fetch_balance(self, params={}) -> Balances:
1724
+ """
1725
+ query for balance and get the amount of funds available for trading or funds locked in orders
1726
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1727
+ :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1728
+ """
1729
+ # makes a lot of different requests to get all the data
1730
+ # in particular:
1731
+ # fetchMarkets, getWavesAddress,
1732
+ # getTotalBalance(doesn't include waves), getReservedBalance(doesn't include waves)
1733
+ # getReservedBalance(includes WAVES)
1734
+ # I couldn't find another way to get all the data
1735
+ self.check_required_dependencies()
1736
+ self.check_required_keys()
1737
+ self.load_markets()
1738
+ wavesAddress = self.get_waves_address()
1739
+ request: dict = {
1740
+ 'address': wavesAddress,
1741
+ }
1742
+ totalBalance = self.nodeGetAssetsBalanceAddress(request)
1743
+ # {
1744
+ # "address": "3P8VzLSa23EW5CVckHbV7d5BoN75fF1hhFH",
1745
+ # "balances": [
1746
+ # {
1747
+ # "assetId": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
1748
+ # "balance": 1177200,
1749
+ # "reissuable": False,
1750
+ # "minSponsoredAssetFee": 7420,
1751
+ # "sponsorBalance": 47492147189709,
1752
+ # "quantity": 999999999775381400,
1753
+ # "issueTransaction": {
1754
+ # "senderPublicKey": "BRnVwSVctnV8pge5vRpsJdWnkjWEJspFb6QvrmZvu3Ht",
1755
+ # "quantity": 1000000000000000000,
1756
+ # "fee": 100400000,
1757
+ # "description": "Neutrino USD",
1758
+ # "type": 3,
1759
+ # "version": 2,
1760
+ # "reissuable": False,
1761
+ # "script": null,
1762
+ # "sender": "3PC9BfRwJWWiw9AREE2B3eWzCks3CYtg4yo",
1763
+ # "feeAssetId": null,
1764
+ # "chainId": 87,
1765
+ # "proofs": [
1766
+ # "3HNpbVkgP69NWSeb9hGYauiQDaXrRXh3tXFzNsGwsAAXnFrA29SYGbLtziW9JLpXEq7qW1uytv5Fnm5XTUMB2BxU"
1767
+ # ],
1768
+ # "assetId": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
1769
+ # "decimals": 6,
1770
+ # "name": "USD-N",
1771
+ # "id": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
1772
+ # "timestamp": 1574429393962
1773
+ # }
1774
+ # }
1775
+ # ]
1776
+ # }
1777
+ balances = self.safe_value(totalBalance, 'balances', [])
1778
+ result: dict = {}
1779
+ timestamp = None
1780
+ assetIds = []
1781
+ nonStandardBalances = []
1782
+ for i in range(0, len(balances)):
1783
+ entry = balances[i]
1784
+ entryTimestamp = self.safe_integer(entry, 'timestamp')
1785
+ timestamp = entryTimestamp if (timestamp is None) else max(timestamp, entryTimestamp)
1786
+ issueTransaction = self.safe_value(entry, 'issueTransaction')
1787
+ currencyId = self.safe_string(entry, 'assetId')
1788
+ balance = self.safe_string(entry, 'balance')
1789
+ currencyExists = (currencyId in self.currencies_by_id)
1790
+ if currencyExists:
1791
+ code = self.safe_currency_code(currencyId)
1792
+ result[code] = self.account()
1793
+ result[code]['total'] = self.from_real_currency_amount(code, balance)
1794
+ elif issueTransaction is None:
1795
+ assetIds.append(currencyId)
1796
+ nonStandardBalances.append(balance)
1797
+ nonStandardAssets = len(assetIds)
1798
+ if nonStandardAssets:
1799
+ requestInner: dict = {
1800
+ 'ids': assetIds,
1801
+ }
1802
+ response = self.publicGetAssets(requestInner)
1803
+ data = self.safe_value(response, 'data', [])
1804
+ for i in range(0, len(data)):
1805
+ entry = data[i]
1806
+ balance = nonStandardBalances[i]
1807
+ inner = self.safe_value(entry, 'data')
1808
+ precision = self.parse_precision(self.safe_string(inner, 'precision'))
1809
+ ticker = self.safe_string(inner, 'ticker')
1810
+ code = self.safe_currency_code(ticker)
1811
+ result[code] = self.account()
1812
+ result[code]['total'] = Precise.string_mul(balance, precision)
1813
+ currentTimestamp = self.milliseconds()
1814
+ byteArray = [
1815
+ self.base58_to_binary(self.apiKey),
1816
+ self.number_to_be(currentTimestamp, 8),
1817
+ ]
1818
+ binary = self.binary_concat_array(byteArray)
1819
+ hexSecret = self.binary_to_base16(self.base58_to_binary(self.secret))
1820
+ signature = self.axolotl(self.binary_to_base16(binary), hexSecret, 'ed25519')
1821
+ matcherRequest: dict = {
1822
+ 'publicKey': self.apiKey,
1823
+ 'signature': signature,
1824
+ 'timestamp': str(currentTimestamp),
1825
+ }
1826
+ reservedBalance = self.matcherGetMatcherBalanceReservedPublicKey(matcherRequest)
1827
+ # {WAVES: 200300000}
1828
+ reservedKeys = list(reservedBalance.keys())
1829
+ for i in range(0, len(reservedKeys)):
1830
+ currencyId = reservedKeys[i]
1831
+ code = self.safe_currency_code(currencyId)
1832
+ if not (code in result):
1833
+ result[code] = self.account()
1834
+ amount = self.safe_string(reservedBalance, currencyId)
1835
+ result[code]['used'] = self.from_real_currency_amount(code, amount)
1836
+ wavesRequest: dict = {
1837
+ 'address': wavesAddress,
1838
+ }
1839
+ wavesTotal = self.nodeGetAddressesBalanceAddress(wavesRequest)
1840
+ # {
1841
+ # "address": "3P8VzLSa23EW5CVckHbV7d5BoN75fF1hhFH",
1842
+ # "confirmations": 0,
1843
+ # "balance": 909085978
1844
+ # }
1845
+ result['WAVES'] = self.safe_value(result, 'WAVES', self.account())
1846
+ result['WAVES']['total'] = self.from_real_currency_amount('WAVES', self.safe_string(wavesTotal, 'balance'))
1847
+ result = self.set_undefined_balances_to_zero(result)
1848
+ result['timestamp'] = timestamp
1849
+ result['datetime'] = self.iso8601(timestamp)
1850
+ return self.safe_balance(result)
1851
+
1852
+ def set_undefined_balances_to_zero(self, balances, key='used'):
1853
+ codes = list(balances.keys())
1854
+ for i in range(0, len(codes)):
1855
+ code = codes[i]
1856
+ if self.safe_value(balances[code], 'used') is None:
1857
+ balances[code][key] = '0'
1858
+ return balances
1859
+
1860
+ def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1861
+ """
1862
+ fetch all trades made by the user
1863
+ :param str symbol: unified market symbol
1864
+ :param int [since]: the earliest time in ms to fetch trades for
1865
+ :param int [limit]: the maximum number of trades structures to retrieve
1866
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1867
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1868
+ """
1869
+ self.load_markets()
1870
+ address = self.get_waves_address()
1871
+ request: dict = {
1872
+ 'sender': address,
1873
+ }
1874
+ market = None
1875
+ if symbol is not None:
1876
+ market = self.market(symbol)
1877
+ request['amountAsset'] = market['baseId']
1878
+ request['priceAsset'] = market['quoteId']
1879
+ response = self.publicGetTransactionsExchange(request)
1880
+ data = self.safe_value(response, 'data')
1881
+ #
1882
+ # {
1883
+ # "__type":"list",
1884
+ # "isLastPage":true,
1885
+ # "lastCursor":"MzA2MjQ0MzAwMDI5OjpkZXNj",
1886
+ # "data": [
1887
+ # {
1888
+ # "__type":"transaction",
1889
+ # "data": {
1890
+ # "id":"GbjPqco2wRP5QSrY5LimFrUyJaM535K9nhK5zaQ7J7Tx",
1891
+ # "timestamp":"2022-04-06T19:56:31.479Z",
1892
+ # "height":3062443,
1893
+ # "type":7,
1894
+ # "version":2,
1895
+ # "proofs":[
1896
+ # "57mYrANw61eiArCTv2eYwzXm71jYC2KpZ5AeM9zHEstuRaYSAWSuSE7njAJYJu8zap6DMCm3nzqc6es3wQFDpRCN"
1897
+ # ],
1898
+ # "fee":0.003,
1899
+ # "applicationStatus":"succeeded",
1900
+ # "sender":"3PEjHv3JGjcWNpYEEkif2w8NXV4kbhnoGgu",
1901
+ # "senderPublicKey":"9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
1902
+ # "buyMatcherFee":0,
1903
+ # "sellMatcherFee":0.00141728,
1904
+ # "price":215.7431,
1905
+ # "amount":0.09,
1906
+ # "order1": {
1907
+ # "id":"49qiuQj5frdZ6zpTCEpMuKPMAh1EimwXpXWB4BeCw33h",
1908
+ # "senderPublicKey":"CjUfoH3dsDZsf5UuAjqqzpWHXgvKzBZpVG9YixF7L48K",
1909
+ # "matcherPublicKey":"9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
1910
+ # "assetPair": {
1911
+ # "amountAsset":"7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt",
1912
+ # "priceAsset":"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
1913
+ # },
1914
+ # "orderType":"buy",
1915
+ # "price":215.7431,
1916
+ # "sender":"3PR9WmaHV5ueVw2Wr9xsiCG3t4ySXzkkGLy",
1917
+ # "amount":0.36265477,
1918
+ # "timestamp":"2022-04-06T19:55:06.832Z",
1919
+ # "expiration":"2022-05-05T19:55:06.832Z",
1920
+ # "matcherFee":3.000334,
1921
+ # "signature":"2rBWhdeuRJNpQfXfTFtcR8x8Lpic8FUHPdLML9uxABRUuxe48YRJcZxbncwWAh9LWFCEUZiztv7RZBZfGMWfFxTs",
1922
+ # "matcherFeeAssetId":"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
1923
+ # },
1924
+ # "order2": {
1925
+ # "id":"AkxiJqCuv6wm8K41TUSgFNwShZMnCbMDT78MqrcWpQ53",
1926
+ # "senderPublicKey":"72o7qNKyne5hthB1Ww6famE7uHrk5vTVB2ZfUMBEqL3Y",
1927
+ # "matcherPublicKey":"9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
1928
+ # "assetPair": {
1929
+ # "amountAsset":"7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt",
1930
+ # "priceAsset":"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
1931
+ # },
1932
+ # "orderType":"sell",
1933
+ # "price":210,
1934
+ # "sender":"3P3CzbjGgiqEyUBeKZYfgZtyaZfMG8fjoUD",
1935
+ # "amount":0.09,
1936
+ # "timestamp":"2022-04-06T19:56:18.535Z",
1937
+ # "expiration":"2022-05-04T19:56:18.535Z",
1938
+ # "matcherFee":0.00141728,
1939
+ # "signature":"5BZCjYn6QzVkMXBFDBnzcAUBdCZqhq9hQfRXFHfLUQCsbis4zeriw4sUqLa1BZRT2isC6iY4Z4HtekikPqZ461PT",
1940
+ # "matcherFeeAssetId":"7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt"
1941
+ # }
1942
+ # }
1943
+ # },...
1944
+ # ]
1945
+ # }
1946
+ #
1947
+ return self.parse_trades(data, market, since, limit)
1948
+
1949
+ def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1950
+ """
1951
+ get the list of most recent trades for a particular symbol
1952
+ :param str symbol: unified symbol of the market to fetch trades for
1953
+ :param int [since]: timestamp in ms of the earliest trade to fetch
1954
+ :param int [limit]: the maximum amount of trades to fetch
1955
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1956
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
1957
+ """
1958
+ self.load_markets()
1959
+ market = self.market(symbol)
1960
+ request: dict = {
1961
+ 'amountAsset': market['baseId'],
1962
+ 'priceAsset': market['quoteId'],
1963
+ }
1964
+ if limit is not None:
1965
+ request['limit'] = min(limit, 100)
1966
+ if since is not None:
1967
+ request['timeStart'] = since
1968
+ response = self.publicGetTransactionsExchange(request)
1969
+ data = self.safe_value(response, 'data')
1970
+ #
1971
+ # {
1972
+ # "__type":"list",
1973
+ # "isLastPage":false,
1974
+ # "lastCursor":"MzA2MjM2MTAwMDU0OjpkZXNj",
1975
+ # "data": [
1976
+ # {
1977
+ # "__type":"transaction",
1978
+ # "data": {
1979
+ # "id":"F42WsvSsyEzvpPLFjVhQKkSNuopooP4zMkjSUs47NeML",
1980
+ # "timestamp":"2022-04-06T18:39:49.145Z",
1981
+ # "height":3062361,
1982
+ # "type":7,
1983
+ # "version":2,
1984
+ # "proofs": [
1985
+ # "39iJv82kFi4pyuBxYeZpP45NXXjbrCXdVsHPAAvj32UMLmTXLjMTfV43PcmZDSAuS93HKSDo1aKJrin8UvkeE9Bs"
1986
+ # ],
1987
+ # "fee":0.003,
1988
+ # "applicationStatus":"succeeded",
1989
+ # "sender":"3PEjHv3JGjcWNpYEEkif2w8NXV4kbhnoGgu",
1990
+ # "senderPublicKey":"9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
1991
+ # "buyMatcherFee":0.02314421,
1992
+ # "sellMatcherFee":0,
1993
+ # "price":217.3893,
1994
+ # "amount":0.34523025,
1995
+ # "order1": {
1996
+ # "id":"HkM36PHGaeeZdDKT1mYgZXhaU9PRZ54RZiJc2K4YMT3Q",
1997
+ # "senderPublicKey":"7wYCaDcc6GX1Jx2uS7QgLHBypBKvrezTS1HfiW6Xe4Bk",
1998
+ # "matcherPublicKey":"9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
1999
+ # "assetPair": {
2000
+ # "amountAsset":"7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt",
2001
+ # "priceAsset":"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
2002
+ # },
2003
+ # "orderType":"buy",
2004
+ # "price":225.2693,
2005
+ # "sender":"3PLPc8f4DGYaF9C9bwJ2uVmHqRv3NCjg5VQ",
2006
+ # "amount":2.529,
2007
+ # "timestamp":"2022-04-06T18:39:48.796Z",
2008
+ # "expiration":"2022-05-05T18:39:48.796Z",
2009
+ # "matcherFee":0.17584444,
2010
+ # "signature":"2yQfJoomv86evQDw36fg1uiRkHvPDZtRp3qvxqTBWPvz4JLTHGQtEHJF5NGTvym6U93CtgNprngzmD9ecHBjxf6U",
2011
+ # "matcherFeeAssetId":"Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on"
2012
+ # },
2013
+ # "order2": {
2014
+ # "id":"F7HKmeuzwWdk3wKitHLnVx5MuD4wBWPpphQ8kUGx4tT9",
2015
+ # "senderPublicKey":"CjUfoH3dsDZsf5UuAjqqzpWHXgvKzBZpVG9YixF7L48K",
2016
+ # "matcherPublicKey":"9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
2017
+ # "assetPair": {
2018
+ # "amountAsset":"7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt",
2019
+ # "priceAsset":"DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
2020
+ # },
2021
+ # "orderType":"sell",
2022
+ # "price":217.3893,
2023
+ # "sender":"3PR9WmaHV5ueVw2Wr9xsiCG3t4ySXzkkGLy",
2024
+ # "amount":0.35767793,
2025
+ # "timestamp":"2022-04-06T18:32:01.390Z",
2026
+ # "expiration":"2022-05-05T18:32:01.390Z",
2027
+ # "matcherFee":0.0139168,
2028
+ # "signature":"34HgWVLPgeYWkiSvAc5ChVepGTYDQDug2dMTSincs6idEyoM7AtaZuH3mqQ5RJG2fcxxH2QSB723Qq3dgLQwQmKf",
2029
+ # "matcherFeeAssetId":"7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt"
2030
+ # }
2031
+ # }
2032
+ # }, ...
2033
+ # ]
2034
+ # }
2035
+ #
2036
+ return self.parse_trades(data, market, since, limit)
2037
+
2038
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
2039
+ #
2040
+ # {__type: "transaction",
2041
+ # "data":
2042
+ # {id: "HSdruioHqvYHeyn9hhyoHdRWPB2bFA8ujeCPZMK6992c",
2043
+ # "timestamp": "2020-06-09T19:34:51.897Z",
2044
+ # "height": 2099684,
2045
+ # "type": 7,
2046
+ # "version": 2,
2047
+ # "proofs":
2048
+ # ["26teDHERQgwjjHqEn4REcDotNG8M21xjou3X42XuDuCvrRkQo6aPyrswByH3UrkWG8v27ZAaVNzoxDg4teNcLtde"],
2049
+ # "fee": 0.003,
2050
+ # "sender": "3PEjHv3JGjcWNpYEEkif2w8NXV4kbhnoGgu",
2051
+ # "senderPublicKey": "9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
2052
+ # "buyMatcherFee": 0.00299999,
2053
+ # "sellMatcherFee": 0.00299999,
2054
+ # "price": 0.00012003,
2055
+ # "amount": 60.80421562,
2056
+ # "order1":
2057
+ # {id: "CBRwP3ar4oMvvpUiGyfxc1syh41488SDi2GkrjuBDegv",
2058
+ # "senderPublicKey": "DBXSHBz96NFsMu7xh4fi2eT9ZnyxefAHXsMxUayzgC6a",
2059
+ # "matcherPublicKey": "9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
2060
+ # "assetPair": [Object],
2061
+ # "orderType": "buy",
2062
+ # "price": 0.00012003,
2063
+ # "sender": "3PJfFRgVuJ47UY4ckb74EGzEBzkHXtmG1LA",
2064
+ # "amount": 60.80424773,
2065
+ # "timestamp": "2020-06-09T19:34:51.885Z",
2066
+ # "expiration": "2020-06-10T12:31:31.885Z",
2067
+ # "matcherFee": 0.003,
2068
+ # "signature": "4cA3ZAb3XAEEXaFG7caqpto5TRbpR5PkhZpxoNQZ9ZReNvjuJQs5a3THnumv7rcqmVUiVtuHAgk2f67ANcqtKyJ8",
2069
+ # "matcherFeeAssetId": null},
2070
+ # "order2":
2071
+ # {id: "CHJSLQ6dfSPs6gu2mAegrMUcRiDEDqaj2GKfvptMjS3M",
2072
+ # "senderPublicKey": "3RUC4NGFZm9H8VJhSSjJyFLdiE42qNiUagDcZPwjgDf8",
2073
+ # "matcherPublicKey": "9cpfKN9suPNvfeUNphzxXMjcnn974eme8ZhWUjaktzU5",
2074
+ # "assetPair": [Object],
2075
+ # "orderType": "sell",
2076
+ # "price": 0.00012003,
2077
+ # "sender": "3P9vKoQpMZtaSkHKpNh977YY9ZPzTuntLAq",
2078
+ # "amount": 60.80424773,
2079
+ # "timestamp": "2020-06-09T19:34:51.887Z",
2080
+ # "expiration": "2020-06-10T12:31:31.887Z",
2081
+ # "matcherFee": 0.003,
2082
+ # "signature": "3SFyrcqzou2ddZyNisnLYaGhLt5qRjKxH8Nw3s4T5U7CEKGX9DDo8dS27RgThPVGbYF1rYET1FwrWoQ2UFZ6SMTR",
2083
+ # "matcherFeeAssetId": null}}}
2084
+ #
2085
+ data = self.safe_value(trade, 'data')
2086
+ datetime = self.safe_string(data, 'timestamp')
2087
+ timestamp = self.parse8601(datetime)
2088
+ id = self.safe_string(data, 'id')
2089
+ priceString = self.safe_string(data, 'price')
2090
+ amountString = self.safe_string(data, 'amount')
2091
+ order1 = self.safe_value(data, 'order1')
2092
+ order2 = self.safe_value(data, 'order2')
2093
+ order = None
2094
+ # order2 arrived after order1
2095
+ if self.safe_string(order1, 'senderPublicKey') == self.apiKey:
2096
+ order = order1
2097
+ else:
2098
+ order = order2
2099
+ symbol = None
2100
+ assetPair = self.safe_value(order, 'assetPair')
2101
+ if assetPair is not None:
2102
+ symbol = self.get_symbol_from_asset_pair(assetPair)
2103
+ elif market is not None:
2104
+ symbol = market['symbol']
2105
+ side = self.safe_string(order, 'orderType')
2106
+ orderId = self.safe_string(order, 'id')
2107
+ fee = {
2108
+ 'cost': self.safe_string(order, 'matcherFee'),
2109
+ 'currency': self.safe_currency_code(self.safe_string(order, 'matcherFeeAssetId', 'WAVES')),
2110
+ }
2111
+ return self.safe_trade({
2112
+ 'info': trade,
2113
+ 'timestamp': timestamp,
2114
+ 'datetime': datetime,
2115
+ 'symbol': symbol,
2116
+ 'id': id,
2117
+ 'order': orderId,
2118
+ 'type': None,
2119
+ 'side': side,
2120
+ 'takerOrMaker': None,
2121
+ 'price': priceString,
2122
+ 'amount': amountString,
2123
+ 'cost': None,
2124
+ 'fee': fee,
2125
+ }, market)
2126
+
2127
+ def parse_deposit_withdraw_fees(self, response, codes: Strings = None, currencyIdKey=None) -> Any:
2128
+ depositWithdrawFees: dict = {}
2129
+ codes = self.market_codes(codes)
2130
+ for i in range(0, len(response)):
2131
+ entry = response[i]
2132
+ dictionary = entry
2133
+ currencyId = self.safe_string(dictionary, currencyIdKey)
2134
+ currency = self.safe_value(self.currencies_by_id, currencyId)
2135
+ code = self.safe_string(currency, 'code', currencyId)
2136
+ if (codes is None) or (self.in_array(code, codes)):
2137
+ depositWithdrawFee = self.safe_value(depositWithdrawFees, code)
2138
+ if depositWithdrawFee is None:
2139
+ depositWithdrawFee = {
2140
+ 'info': [dictionary],
2141
+ 'withdraw': {
2142
+ 'fee': None,
2143
+ 'percentage': None,
2144
+ },
2145
+ 'deposit': {
2146
+ 'fee': None,
2147
+ 'percentage': None,
2148
+ },
2149
+ 'networks': {},
2150
+ }
2151
+ else:
2152
+ depositWithdrawFee = depositWithdrawFees[code]
2153
+ depositWithdrawFee['info'] = self.array_concat(depositWithdrawFee['info'], [dictionary])
2154
+ networkId = self.safe_string(dictionary, 'platform_id')
2155
+ currencyCode = self.safe_string(currency, 'code')
2156
+ networkCode = self.network_id_to_code(networkId, currencyCode)
2157
+ network = self.safe_value(depositWithdrawFee['networks'], networkCode)
2158
+ if network is None:
2159
+ network = {
2160
+ 'withdraw': {
2161
+ 'fee': None,
2162
+ 'percentage': None,
2163
+ },
2164
+ 'deposit': {
2165
+ 'fee': None,
2166
+ 'percentage': None,
2167
+ },
2168
+ }
2169
+ feeType = self.safe_string(dictionary, 'type')
2170
+ fees = self.safe_value(dictionary, 'fees')
2171
+ networkKey = 'deposit'
2172
+ if feeType == 'withdrawal_currency':
2173
+ networkKey = 'withdraw'
2174
+ network[networkKey] = {'fee': self.safe_number(fees, 'flat'), 'percentage': False}
2175
+ depositWithdrawFee['networks'][networkCode] = network
2176
+ depositWithdrawFees[code] = depositWithdrawFee
2177
+ depositWithdrawFeesKeys = list(depositWithdrawFees.keys())
2178
+ for i in range(0, len(depositWithdrawFeesKeys)):
2179
+ code = depositWithdrawFeesKeys[i]
2180
+ entry = depositWithdrawFees[code]
2181
+ networks = self.safe_value(entry, 'networks')
2182
+ networkKeys = list(networks.keys())
2183
+ networkKeysLength = len(networkKeys)
2184
+ if networkKeysLength == 1:
2185
+ network = self.safe_value(networks, networkKeys[0])
2186
+ depositWithdrawFees[code]['withdraw'] = self.safe_value(network, 'withdraw')
2187
+ depositWithdrawFees[code]['deposit'] = self.safe_value(network, 'deposit')
2188
+ return depositWithdrawFees
2189
+
2190
+ def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
2191
+ """
2192
+ fetch deposit and withdraw fees
2193
+ :see: https://docs.wx.network/en/api/gateways/deposit/currencies
2194
+ :see: https://docs.wx.network/en/api/gateways/withdraw/currencies
2195
+ :param str[]|None codes: list of unified currency codes
2196
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2197
+ :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
2198
+ """
2199
+ self.load_markets()
2200
+ data = []
2201
+ promises = []
2202
+ promises.append(self.privateGetDepositCurrencies(params))
2203
+ promises.append(self.privateGetWithdrawCurrencies(params))
2204
+ promises = promises
2205
+ #
2206
+ # {
2207
+ # "type": "list",
2208
+ # "page_info": {
2209
+ # "has_next_page": False,
2210
+ # "last_cursor": null
2211
+ # },
2212
+ # "items": [
2213
+ # {
2214
+ # "type": "deposit_currency",
2215
+ # "id": "WEST",
2216
+ # "platform_id": "WEST",
2217
+ # "waves_asset_id": "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
2218
+ # "platform_asset_id": "WEST",
2219
+ # "decimals": 8,
2220
+ # "status": "active",
2221
+ # "allowed_amount": {
2222
+ # "min": 0.1,
2223
+ # "max": 2000000
2224
+ # },
2225
+ # "fees": {
2226
+ # "flat": 0,
2227
+ # "rate": 0
2228
+ # }
2229
+ # },
2230
+ # ]
2231
+ # }
2232
+ #
2233
+ #
2234
+ # {
2235
+ # "type": "list",
2236
+ # "page_info": {
2237
+ # "has_next_page": False,
2238
+ # "last_cursor": null
2239
+ # },
2240
+ # "items": [
2241
+ # {
2242
+ # "type": "withdrawal_currency",
2243
+ # "id": "BTC",
2244
+ # "platform_id": "BTC",
2245
+ # "waves_asset_id": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
2246
+ # "platform_asset_id": "BTC",
2247
+ # "decimals": 8,
2248
+ # "status": "inactive",
2249
+ # "allowed_amount": {
2250
+ # "min": 0.001,
2251
+ # "max": 10
2252
+ # },
2253
+ # "fees": {
2254
+ # "flat": 0.001,
2255
+ # "rate": 0
2256
+ # }
2257
+ # },
2258
+ # ]
2259
+ # }
2260
+ #
2261
+ for i in range(0, len(promises)):
2262
+ items = self.safe_value(promises[i], 'items')
2263
+ data = self.array_concat(data, items)
2264
+ return self.parse_deposit_withdraw_fees(data, codes, 'id')
2265
+
2266
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2267
+ errorCode = self.safe_string(response, 'error')
2268
+ success = self.safe_bool(response, 'success', True)
2269
+ Exception = self.safe_value(self.exceptions, errorCode)
2270
+ if Exception is not None:
2271
+ messageInner = self.safe_string(response, 'message')
2272
+ raise Exception(self.id + ' ' + messageInner)
2273
+ message = self.safe_string(response, 'message')
2274
+ if message == 'Validation Error':
2275
+ raise BadRequest(self.id + ' ' + body)
2276
+ if not success:
2277
+ raise ExchangeError(self.id + ' ' + body)
2278
+ return None
2279
+
2280
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2281
+ """
2282
+ make a withdrawal
2283
+ :param str code: unified currency code
2284
+ :param float amount: the amount to withdraw
2285
+ :param str address: the address to withdraw to
2286
+ :param str tag:
2287
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2288
+ :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
2289
+ """
2290
+ tag, params = self.handle_withdraw_tag_and_params(tag, params)
2291
+ # currently only works for BTC and WAVES
2292
+ if code != 'WAVES':
2293
+ supportedCurrencies = self.privateGetWithdrawCurrencies()
2294
+ currencies: dict = {}
2295
+ items = self.safe_value(supportedCurrencies, 'items', [])
2296
+ for i in range(0, len(items)):
2297
+ entry = items[i]
2298
+ currencyCode = self.safe_string(entry, 'id')
2299
+ currencies[currencyCode] = True
2300
+ if not (code in currencies):
2301
+ codes = list(currencies.keys())
2302
+ raise ExchangeError(self.id + ' withdraw() ' + code + ' not supported. Currency code must be one of ' + str(codes))
2303
+ self.load_markets()
2304
+ hexChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
2305
+ set: dict = {}
2306
+ for i in range(0, len(hexChars)):
2307
+ key = hexChars[i]
2308
+ set[key] = True
2309
+ isErc20 = True
2310
+ noPrefix = self.remove0x_prefix(address)
2311
+ lower = noPrefix.lower()
2312
+ stringLength = len(lower) * 1
2313
+ for i in range(0, stringLength):
2314
+ character = lower[i]
2315
+ if not (character in set):
2316
+ isErc20 = False
2317
+ break
2318
+ self.sign_in()
2319
+ proxyAddress = None
2320
+ if code == 'WAVES' and not isErc20:
2321
+ proxyAddress = address
2322
+ else:
2323
+ withdrawAddressRequest: dict = {
2324
+ 'address': address,
2325
+ 'currency': code,
2326
+ }
2327
+ withdrawAddress = self.privateGetWithdrawAddressesCurrencyAddress(withdrawAddressRequest)
2328
+ currencyInner = self.safe_value(withdrawAddress, 'currency')
2329
+ allowedAmount = self.safe_value(currencyInner, 'allowed_amount')
2330
+ minimum = self.safe_number(allowedAmount, 'min')
2331
+ if amount <= minimum:
2332
+ raise BadRequest(self.id + ' ' + code + ' withdraw failed, amount ' + str(amount) + ' must be greater than the minimum allowed amount of ' + str(minimum))
2333
+ # {
2334
+ # "type": "withdrawal_addresses",
2335
+ # "currency": {
2336
+ # "type": "withdrawal_currency",
2337
+ # "id": "BTC",
2338
+ # "waves_asset_id": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
2339
+ # "decimals": 8,
2340
+ # "status": "active",
2341
+ # "allowed_amount": {
2342
+ # "min": 0.001,
2343
+ # "max": 20
2344
+ # },
2345
+ # "fees": {
2346
+ # "flat": 0.001,
2347
+ # "rate": 0
2348
+ # }
2349
+ # },
2350
+ # "proxy_addresses": [
2351
+ # "3P3qqmkiLwNHB7x1FeoE8bvkRtULwGpo9ga"
2352
+ # ]
2353
+ # }
2354
+ proxyAddresses = self.safe_value(withdrawAddress, 'proxy_addresses', [])
2355
+ proxyAddress = self.safe_string(proxyAddresses, 0)
2356
+ fee = self.safe_integer(self.options, 'withdrawFeeWAVES', 100000) # 0.001 WAVES
2357
+ feeAssetId = 'WAVES'
2358
+ type = 4 # transfer
2359
+ version = 2
2360
+ amountInteger = self.to_real_currency_amount(code, amount)
2361
+ currency = self.currency(code)
2362
+ timestamp = self.milliseconds()
2363
+ byteArray = [
2364
+ self.number_to_be(4, 1),
2365
+ self.number_to_be(2, 1),
2366
+ self.base58_to_binary(self.apiKey),
2367
+ self.get_asset_bytes(currency['id']),
2368
+ self.get_asset_bytes(feeAssetId),
2369
+ self.number_to_be(timestamp, 8),
2370
+ self.number_to_be(amountInteger, 8),
2371
+ self.number_to_be(fee, 8),
2372
+ self.base58_to_binary(proxyAddress),
2373
+ self.number_to_be(0, 2),
2374
+ ]
2375
+ binary = self.binary_concat_array(byteArray)
2376
+ hexSecret = self.binary_to_base16(self.base58_to_binary(self.secret))
2377
+ signature = self.axolotl(self.binary_to_base16(binary), hexSecret, 'ed25519')
2378
+ request: dict = {
2379
+ 'senderPublicKey': self.apiKey,
2380
+ 'amount': amountInteger,
2381
+ 'fee': fee,
2382
+ 'type': type,
2383
+ 'version': version,
2384
+ 'attachment': '',
2385
+ 'feeAssetId': self.get_asset_id(feeAssetId),
2386
+ 'proofs': [
2387
+ signature,
2388
+ ],
2389
+ 'assetId': self.get_asset_id(currency['id']),
2390
+ 'recipient': proxyAddress,
2391
+ 'timestamp': timestamp,
2392
+ 'signature': signature,
2393
+ }
2394
+ result = self.nodePostTransactionsBroadcast(request)
2395
+ #
2396
+ # {
2397
+ # "id": "string",
2398
+ # "signature": "string",
2399
+ # "fee": 0,
2400
+ # "timestamp": 1460678400000,
2401
+ # "recipient": "3P274YB5qseSE9DTTL3bpSjosZrYBPDpJ8k",
2402
+ # "amount": 0
2403
+ # }
2404
+ #
2405
+ return self.parse_transaction(result, currency)
2406
+
2407
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
2408
+ #
2409
+ # withdraw
2410
+ #
2411
+ # {
2412
+ # "id": "string",
2413
+ # "signature": "string",
2414
+ # "fee": 0,
2415
+ # "timestamp": 1460678400000,
2416
+ # "recipient": "3P274YB5qseSE9DTTL3bpSjosZrYBPDpJ8k",
2417
+ # "amount": 0
2418
+ # }
2419
+ #
2420
+ # withdraw new:
2421
+ # {
2422
+ # type: "4",
2423
+ # id: "2xnWTqG9ar7jEDrLxfbVyyspPZ6XZNrrw9ai9sQ81Eya",
2424
+ # fee: "100000",
2425
+ # feeAssetId: null,
2426
+ # timestamp: "1715786263807",
2427
+ # version: "2",
2428
+ # sender: "3P81LLX1kk2CSJC9L8C2enxdHB7XvnSGAEE",
2429
+ # senderPublicKey: "DdmzmXf9mty1FBE8AdVGnrncVLEAzP4gR4nWoTFAJoXz",
2430
+ # proofs: ["RyoKwdSYv3EqotJCYftfFM9JE2j1ZpDRxKwYfiRhLAFeyNp6VfJUXNDS884XfeCeHeNypNmTCZt5NYR1ekyjCX3",],
2431
+ # recipient: "3P9tXxu38a8tgewNEKFzourVxeqHd11ppOc",
2432
+ # assetId: null,
2433
+ # feeAsset: null,
2434
+ # amount: "2000000",
2435
+ # attachment: "",
2436
+ # }
2437
+ #
2438
+ currency = self.safe_currency(None, currency)
2439
+ code = currency['code']
2440
+ typeRaw = self.safe_string(transaction, 'type')
2441
+ type = 'withdraw' if (typeRaw == '4') else 'deposit'
2442
+ amount = self.parse_number(self.from_real_currency_amount(code, self.safe_string(transaction, 'amount')))
2443
+ feeString = self.safe_string(transaction, 'fee')
2444
+ feeAssetId = self.safe_string(transaction, 'feeAssetId', 'WAVES')
2445
+ feeCode = self.safe_currency_code(feeAssetId)
2446
+ feeAmount = self.parse_number(self.from_real_currency_amount(feeCode, feeString))
2447
+ timestamp = self.safe_integer(transaction, 'timestamp')
2448
+ return {
2449
+ 'id': self.safe_string(transaction, 'id'),
2450
+ 'txid': None,
2451
+ 'timestamp': timestamp,
2452
+ 'datetime': self.iso8601(timestamp),
2453
+ 'network': None,
2454
+ 'addressFrom': self.safe_string(transaction, 'sender'),
2455
+ 'address': None,
2456
+ 'addressTo': self.safe_string(transaction, 'recipient'),
2457
+ 'amount': amount,
2458
+ 'type': type,
2459
+ 'currency': currency['code'],
2460
+ 'status': None,
2461
+ 'updated': None,
2462
+ 'tagFrom': None,
2463
+ 'tag': None,
2464
+ 'tagTo': None,
2465
+ 'comment': None,
2466
+ 'internal': None,
2467
+ 'fee': {
2468
+ 'currency': feeCode,
2469
+ 'cost': feeAmount,
2470
+ },
2471
+ 'info': transaction,
2472
+ }