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
@@ -0,0 +1,2113 @@
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.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.bigone import ImplicitAPI
8
+ import asyncio
9
+ from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from typing import List
11
+ from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
13
+ from ccxt.base.errors import PermissionDenied
14
+ from ccxt.base.errors import ArgumentsRequired
15
+ from ccxt.base.errors import BadRequest
16
+ from ccxt.base.errors import BadSymbol
17
+ from ccxt.base.errors import InsufficientFunds
18
+ from ccxt.base.errors import InvalidOrder
19
+ from ccxt.base.errors import NotSupported
20
+ from ccxt.base.errors import RateLimitExceeded
21
+ from ccxt.base.decimal_to_precision import TICK_SIZE
22
+ from ccxt.base.precise import Precise
23
+
24
+
25
+ class bigone(Exchange, ImplicitAPI):
26
+
27
+ def describe(self):
28
+ return self.deep_extend(super(bigone, self).describe(), {
29
+ 'id': 'bigone',
30
+ 'name': 'BigONE',
31
+ 'countries': ['CN'],
32
+ 'version': 'v3',
33
+ 'rateLimit': 1200, # 500 request per 10 minutes
34
+ 'has': {
35
+ 'CORS': None,
36
+ 'spot': True,
37
+ 'margin': False,
38
+ 'swap': None, # has but unimplemented
39
+ 'future': None, # has but unimplemented
40
+ 'option': False,
41
+ 'cancelAllOrders': True,
42
+ 'cancelOrder': True,
43
+ 'createMarketBuyOrderWithCost': True,
44
+ 'createMarketOrderWithCost': False,
45
+ 'createMarketSellOrderWithCost': False,
46
+ 'createOrder': True,
47
+ 'createPostOnlyOrder': True,
48
+ 'createStopLimitOrder': True,
49
+ 'createStopMarketOrder': True,
50
+ 'createStopOrder': True,
51
+ 'fetchBalance': True,
52
+ 'fetchClosedOrders': True,
53
+ 'fetchCurrencies': True,
54
+ 'fetchDepositAddress': True,
55
+ 'fetchDeposits': True,
56
+ 'fetchFundingRate': False,
57
+ 'fetchMarkets': True,
58
+ 'fetchMyTrades': True,
59
+ 'fetchOHLCV': True,
60
+ 'fetchOpenOrders': True,
61
+ 'fetchOrder': True,
62
+ 'fetchOrderBook': True,
63
+ 'fetchOrders': True,
64
+ 'fetchTicker': True,
65
+ 'fetchTickers': True,
66
+ 'fetchTime': True,
67
+ 'fetchTrades': True,
68
+ 'fetchTradingFee': False,
69
+ 'fetchTradingFees': False,
70
+ 'fetchTransactionFees': False,
71
+ 'fetchWithdrawals': True,
72
+ 'transfer': True,
73
+ 'withdraw': True,
74
+ },
75
+ 'timeframes': {
76
+ '1m': 'min1',
77
+ '5m': 'min5',
78
+ '15m': 'min15',
79
+ '30m': 'min30',
80
+ '1h': 'hour1',
81
+ '3h': 'hour3',
82
+ '4h': 'hour4',
83
+ '6h': 'hour6',
84
+ '12h': 'hour12',
85
+ '1d': 'day1',
86
+ '1w': 'week1',
87
+ '1M': 'month1',
88
+ },
89
+ 'hostname': 'big.one', # or 'bigone.com'
90
+ 'urls': {
91
+ 'logo': 'https://user-images.githubusercontent.com/1294454/69354403-1d532180-0c91-11ea-88ed-44c06cefdf87.jpg',
92
+ 'api': {
93
+ 'public': 'https://{hostname}/api/v3',
94
+ 'private': 'https://{hostname}/api/v3/viewer',
95
+ 'contractPublic': 'https://{hostname}/api/contract/v2',
96
+ 'contractPrivate': 'https://{hostname}/api/contract/v2',
97
+ 'webExchange': 'https://{hostname}/api/',
98
+ },
99
+ 'www': 'https://big.one',
100
+ 'doc': 'https://open.big.one/docs/api.html',
101
+ 'fees': 'https://bigone.zendesk.com/hc/en-us/articles/115001933374-BigONE-Fee-Policy',
102
+ 'referral': 'https://b1.run/users/new?code=D3LLBVFT',
103
+ },
104
+ 'api': {
105
+ 'public': {
106
+ 'get': [
107
+ 'ping',
108
+ 'asset_pairs',
109
+ 'asset_pairs/{asset_pair_name}/depth',
110
+ 'asset_pairs/{asset_pair_name}/trades',
111
+ 'asset_pairs/{asset_pair_name}/ticker',
112
+ 'asset_pairs/{asset_pair_name}/candles',
113
+ 'asset_pairs/tickers',
114
+ ],
115
+ },
116
+ 'private': {
117
+ 'get': [
118
+ 'accounts',
119
+ 'fund/accounts',
120
+ 'assets/{asset_symbol}/address',
121
+ 'orders',
122
+ 'orders/{id}',
123
+ 'orders/multi',
124
+ 'trades',
125
+ 'withdrawals',
126
+ 'deposits',
127
+ ],
128
+ 'post': [
129
+ 'orders',
130
+ 'orders/{id}/cancel',
131
+ 'orders/cancel',
132
+ 'withdrawals',
133
+ 'transfer',
134
+ ],
135
+ },
136
+ 'contractPublic': {
137
+ 'get': [
138
+ 'symbols',
139
+ 'instruments',
140
+ 'depth@{symbol}/snapshot',
141
+ 'instruments/difference',
142
+ 'instruments/prices',
143
+ ],
144
+ },
145
+ 'contractPrivate': {
146
+ 'get': [
147
+ 'accounts',
148
+ 'orders/{id}',
149
+ 'orders',
150
+ 'orders/opening',
151
+ 'orders/count',
152
+ 'orders/opening/count',
153
+ 'trades',
154
+ 'trades/count',
155
+ ],
156
+ 'post': [
157
+ 'orders',
158
+ 'orders/batch',
159
+ ],
160
+ 'put': [
161
+ 'positions/{symbol}/margin',
162
+ 'positions/{symbol}/risk-limit',
163
+ ],
164
+ 'delete': [
165
+ 'orders/{id}',
166
+ 'orders/batch',
167
+ ],
168
+ },
169
+ 'webExchange': {
170
+ 'get': [
171
+ 'uc/v2/assets',
172
+ ],
173
+ },
174
+ },
175
+ 'fees': {
176
+ 'trading': {
177
+ 'maker': self.parse_number('0.001'),
178
+ 'taker': self.parse_number('0.001'),
179
+ },
180
+ 'funding': {
181
+ 'withdraw': {},
182
+ },
183
+ },
184
+ 'options': {
185
+ 'createMarketBuyOrderRequiresPrice': True,
186
+ 'accountsByType': {
187
+ 'spot': 'SPOT',
188
+ 'fund': 'FUND',
189
+ 'funding': 'FUND',
190
+ 'future': 'CONTRACT',
191
+ 'swap': 'CONTRACT',
192
+ },
193
+ 'transfer': {
194
+ 'fillResponseFromRequest': True,
195
+ },
196
+ 'exchangeMillisecondsCorrection': -100,
197
+ 'fetchCurrencies': {
198
+ 'webApiEnable': True, # fetches from WEB
199
+ 'webApiRetries': 5,
200
+ 'webApiMuteFailure': True,
201
+ },
202
+ 'defaultNetwork': 'ERC20',
203
+ 'defaultNetworks': {
204
+ 'USDT': 'TRC20',
205
+ },
206
+ 'networks': {
207
+ 'ABBC': 'ABBC',
208
+ 'ACA': 'Acala',
209
+ 'AE': 'Aeternity',
210
+ 'ALGO': 'Algorand',
211
+ 'APT': 'Aptos',
212
+ 'AR': 'Arweave',
213
+ 'ASTR': 'Astar',
214
+ 'AVAXC': 'Avax',
215
+ 'AVAXX': 'AvaxChain',
216
+ 'BEAM': 'Beam',
217
+ 'BEP20': 'BinanceSmartChain',
218
+ 'BITCI': 'BitciChain',
219
+ 'BTC': 'Bitcoin',
220
+ 'BCH': 'BitcoinCash',
221
+ 'BSV': 'BitcoinSV',
222
+ 'CELO': 'Celo',
223
+ 'CKKB': 'CKB',
224
+ 'ATOM': 'Cosmos',
225
+ 'CRC20': 'CRO',
226
+ 'DASH': 'Dash',
227
+ 'DOGE': 'Dogecoin',
228
+ 'XEC': 'ECash',
229
+ 'EOS': 'EOS',
230
+ 'ETH': 'Ethereum',
231
+ 'ETC': 'EthereumClassic',
232
+ 'ETHW': 'EthereumPow',
233
+ 'FTM': 'Fantom',
234
+ 'FIL': 'Filecoin',
235
+ 'FSN': 'Fusion',
236
+ 'GRIN': 'Grin',
237
+ 'ONE': 'Harmony',
238
+ 'HRC20': 'Hecochain',
239
+ 'HBAR': 'Hedera',
240
+ 'HNT': 'Helium',
241
+ 'ZEN': 'Horizen',
242
+ 'IOST': 'IOST',
243
+ 'IRIS': 'IRIS',
244
+ 'KLAY': 'Klaytn',
245
+ 'KSM': 'Kusama',
246
+ 'LTC': 'Litecoin',
247
+ 'XMR': 'Monero',
248
+ 'GLMR': 'Moonbeam',
249
+ 'NEAR': 'Near',
250
+ 'NEO': 'Neo',
251
+ 'NEON3': 'NeoN3',
252
+ 'OASIS': 'Oasis',
253
+ 'OKC': 'Okexchain',
254
+ 'ONT': 'Ontology',
255
+ 'OPTIMISM': 'Optimism',
256
+ 'DOT': 'Polkadot',
257
+ 'MATIC': 'Polygon',
258
+ 'QTUM': 'Qtum',
259
+ 'REI': 'REI',
260
+ 'XRP': 'Ripple',
261
+ 'SGB': 'SGB',
262
+ 'SDN': 'Shiden',
263
+ 'SOL': 'Solana',
264
+ 'XLM': 'Stellar',
265
+ 'TERA': 'Tera',
266
+ 'XTZ': 'Tezos',
267
+ 'TRC20': 'Tron',
268
+ 'VET': 'Vechain',
269
+ 'VSYS': 'VSystems',
270
+ 'WAX': 'WAX',
271
+ 'ZEC': 'Zcash',
272
+ # todo: uncomment after consensus
273
+ # 'BITSHARES_OLD': 'Bitshares',
274
+ # 'BITSHARES_NEW': 'NewBitshares',
275
+ # 'MOBILECOIN': 'Mobilecoin',
276
+ # 'LBRY': 'Lbry',
277
+ # 'ZEEPIN': 'Zeepin',
278
+ # 'WAYFCOIN': 'Wayfcoin',
279
+ # 'UCACOIN': 'Ucacoin',
280
+ # 'VANILLACASH': 'Vcash',
281
+ # 'LAMDEN': 'Lamden',
282
+ # 'GXSHARES': 'Gxshares',
283
+ # 'ICP': 'Dfinity',
284
+ # 'CLOVER': 'Clover',
285
+ # 'CLASSZZ': 'Classzz',
286
+ # 'CLASSZZ_V2': 'ClasszzV2',
287
+ # 'CHAINX_V2': 'ChainxV2',
288
+ # 'BITCOINDIAMON': 'BitcoinDiamond',
289
+ # 'BITCOINGOLD': 'BitcoinGold',
290
+ # 'BUTTRUSTSYSTEM': 'BitTrustSystem',
291
+ # 'BYTOM_V2': 'BytomV2',
292
+ # 'LIBONOMY': 'Libonomy',
293
+ # 'TERRACLASSIC': 'Terra',
294
+ # 'TERRA': 'Terra2',
295
+ # 'SUPERBITCOIN': 'SuperBitcoin',
296
+ # 'SIACLASSIC': 'Sia',
297
+ # 'SIACOIN': 'SiaCore',
298
+ # 'PARALLELFINANCE': 'Parallel',
299
+ # 'PLCULTIMA': 'Plcu',
300
+ # 'PLCULTIMA2': 'Plcu2',
301
+ # undetermined: XinFin, YAS, Ycash
302
+ },
303
+ },
304
+ 'precisionMode': TICK_SIZE,
305
+ 'exceptions': {
306
+ 'exact': {
307
+ '10001': BadRequest, # syntax error
308
+ '10005': ExchangeError, # internal error
309
+ "Amount's scale must greater than AssetPair's base scale": InvalidOrder,
310
+ "Price mulit with amount should larger than AssetPair's min_quote_value": InvalidOrder,
311
+ '10007': BadRequest, # parameter error, {"code":10007,"message":"Amount's scale must greater than AssetPair's base scale"}
312
+ '10011': ExchangeError, # system error
313
+ '10013': BadSymbol, # {"code":10013,"message":"Resource not found"}
314
+ '10014': InsufficientFunds, # {"code":10014,"message":"Insufficient funds"}
315
+ '10403': PermissionDenied, # permission denied
316
+ '10429': RateLimitExceeded, # too many requests
317
+ '40004': AuthenticationError, # {"code":40004,"message":"invalid jwt"}
318
+ '40103': AuthenticationError, # invalid otp code
319
+ '40104': AuthenticationError, # invalid asset pin code
320
+ '40301': PermissionDenied, # {"code":40301,"message":"Permission denied withdrawal create"}
321
+ '40302': ExchangeError, # already requested
322
+ '40601': ExchangeError, # resource is locked
323
+ '40602': ExchangeError, # resource is depleted
324
+ '40603': InsufficientFunds, # insufficient resource
325
+ '40604': InvalidOrder, # {"code":40604,"message":"Price exceed the maximum order price"}
326
+ '40605': InvalidOrder, # {"code":40605,"message":"Price less than the minimum order price"}
327
+ '40120': InvalidOrder, # Order is in trading
328
+ '40121': InvalidOrder, # Order is already cancelled or filled
329
+ '60100': BadSymbol, # {"code":60100,"message":"Asset pair is suspended"}
330
+ },
331
+ 'broad': {
332
+ },
333
+ },
334
+ 'commonCurrencies': {
335
+ 'CRE': 'Cybereits',
336
+ 'FXT': 'FXTTOKEN',
337
+ 'FREE': 'FreeRossDAO',
338
+ 'MBN': 'Mobilian Coin',
339
+ 'ONE': 'BigONE Token',
340
+ },
341
+ })
342
+
343
+ async def fetch_currencies(self, params={}) -> Currencies:
344
+ """
345
+ fetches all available currencies on an exchange
346
+ :param dict [params]: extra parameters specific to the exchange API endpoint
347
+ :returns dict: an associative dictionary of currencies
348
+ """
349
+ # we use undocumented link(possible, less informative alternative is : https://big.one/api/uc/v3/assets/accounts)
350
+ data = await self.fetch_web_endpoint('fetchCurrencies', 'webExchangeGetUcV2Assets', True)
351
+ if data is None:
352
+ return None
353
+ #
354
+ # {
355
+ # "code": "0",
356
+ # "message": "",
357
+ # "data": [
358
+ # {
359
+ # "name": "TetherUS",
360
+ # "symbol": "USDT",
361
+ # "contract_address": "31",
362
+ # "is_deposit_enabled": True,
363
+ # "is_withdrawal_enabled": True,
364
+ # "is_stub": False,
365
+ # "withdrawal_fee": "5.0",
366
+ # "is_fiat": False,
367
+ # "is_memo_required": False,
368
+ # "logo": {
369
+ # "default": "https://assets.peatio.com/assets/v1/color/normal/usdt.png",
370
+ # "white": "https://assets.peatio.com/assets/v1/white/normal/usdt.png",
371
+ # },
372
+ # "info_link": null,
373
+ # "scale": "12",
374
+ # "default_gateway": ..., # one object from "gateways"
375
+ # "gateways": [
376
+ # {
377
+ # "uuid": "f0fa5a85-7f65-428a-b7b7-13aad55c2837",
378
+ # "name": "Mixin",
379
+ # "kind": "CHAIN",
380
+ # "required_confirmations": "0",
381
+ # },
382
+ # {
383
+ # "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
384
+ # "name": "Ethereum",
385
+ # "kind": "CHAIN",
386
+ # "required_confirmations": "18",
387
+ # },
388
+ # {
389
+ # "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
390
+ # "name": "Tron",
391
+ # "kind": "CHAIN",
392
+ # "required_confirmations": "1",
393
+ # },
394
+ # ...
395
+ # ],
396
+ # "payments": [],
397
+ # "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
398
+ # "binding_gateways": [
399
+ # {
400
+ # "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
401
+ # "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
402
+ # "is_deposit_enabled": True,
403
+ # "display_name": "Ethereum(ERC20)",
404
+ # "gateway_name": "Ethereum",
405
+ # "min_withdrawal_amount": "0.000001",
406
+ # "min_internal_withdrawal_amount": "0.00000001",
407
+ # "withdrawal_fee": "14",
408
+ # "is_withdrawal_enabled": True,
409
+ # "min_deposit_amount": "0.000001",
410
+ # "is_memo_required": False,
411
+ # "withdrawal_scale": "2",
412
+ # "gateway": {
413
+ # "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
414
+ # "name": "Ethereum",
415
+ # "kind": "CHAIN",
416
+ # "required_confirmations": "18",
417
+ # },
418
+ # "scale": "12",
419
+ # },
420
+ # {
421
+ # "guid": "b80a4d13-cac7-4319-842d-b33c3bfab8ec",
422
+ # "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
423
+ # "is_deposit_enabled": True,
424
+ # "display_name": "Tron(TRC20)",
425
+ # "gateway_name": "Tron",
426
+ # "min_withdrawal_amount": "0.000001",
427
+ # "min_internal_withdrawal_amount": "0.00000001",
428
+ # "withdrawal_fee": "1",
429
+ # "is_withdrawal_enabled": True,
430
+ # "min_deposit_amount": "0.000001",
431
+ # "is_memo_required": False,
432
+ # "withdrawal_scale": "6",
433
+ # "gateway": {
434
+ # "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
435
+ # "name": "Tron",
436
+ # "kind": "CHAIN",
437
+ # "required_confirmations": "1",
438
+ # },
439
+ # "scale": "12",
440
+ # },
441
+ # ...
442
+ # ],
443
+ # },
444
+ # ...
445
+ # ],
446
+ # }
447
+ #
448
+ currenciesData = self.safe_list(data, 'data', [])
449
+ result: dict = {}
450
+ for i in range(0, len(currenciesData)):
451
+ currency = currenciesData[i]
452
+ id = self.safe_string(currency, 'symbol')
453
+ code = self.safe_currency_code(id)
454
+ name = self.safe_string(currency, 'name')
455
+ type = 'fiat' if self.safe_bool(currency, 'is_fiat') else 'crypto'
456
+ networks: dict = {}
457
+ chains = self.safe_list(currency, 'binding_gateways', [])
458
+ currencyMaxPrecision = self.parse_precision(self.safe_string_2(currency, 'withdrawal_scale', 'scale'))
459
+ currencyDepositEnabled: Bool = None
460
+ currencyWithdrawEnabled: Bool = None
461
+ for j in range(0, len(chains)):
462
+ chain = chains[j]
463
+ networkId = self.safe_string(chain, 'gateway_name')
464
+ networkCode = self.network_id_to_code(networkId)
465
+ deposit = self.safe_bool(chain, 'is_deposit_enabled')
466
+ withdraw = self.safe_bool(chain, 'is_withdrawal_enabled')
467
+ isActive = (deposit and withdraw)
468
+ minDepositAmount = self.safe_string(chain, 'min_deposit_amount')
469
+ minWithdrawalAmount = self.safe_string(chain, 'min_withdrawal_amount')
470
+ withdrawalFee = self.safe_string(chain, 'withdrawal_fee')
471
+ precision = self.parse_precision(self.safe_string_2(chain, 'withdrawal_scale', 'scale'))
472
+ networks[networkCode] = {
473
+ 'id': networkId,
474
+ 'network': networkCode,
475
+ 'margin': None,
476
+ 'deposit': deposit,
477
+ 'withdraw': withdraw,
478
+ 'active': isActive,
479
+ 'fee': self.parse_number(withdrawalFee),
480
+ 'precision': self.parse_number(precision),
481
+ 'limits': {
482
+ 'deposit': {
483
+ 'min': minDepositAmount,
484
+ 'max': None,
485
+ },
486
+ 'withdraw': {
487
+ 'min': minWithdrawalAmount,
488
+ 'max': None,
489
+ },
490
+ },
491
+ 'info': chain,
492
+ }
493
+ # fill global values
494
+ currencyDepositEnabled = (currencyDepositEnabled is None) or deposit if deposit else currencyDepositEnabled
495
+ currencyWithdrawEnabled = (currencyWithdrawEnabled is None) or withdraw if withdraw else currencyWithdrawEnabled
496
+ currencyMaxPrecision = (currencyMaxPrecision is None) or precision if Precise.string_gt(currencyMaxPrecision, precision) else currencyMaxPrecision
497
+ result[code] = {
498
+ 'id': id,
499
+ 'code': code,
500
+ 'info': currency,
501
+ 'name': name,
502
+ 'type': type,
503
+ 'active': None,
504
+ 'deposit': currencyDepositEnabled,
505
+ 'withdraw': currencyWithdrawEnabled,
506
+ 'fee': None,
507
+ 'precision': self.parse_number(currencyMaxPrecision),
508
+ 'limits': {
509
+ 'amount': {
510
+ 'min': None,
511
+ 'max': None,
512
+ },
513
+ 'withdraw': {
514
+ 'min': None,
515
+ 'max': None,
516
+ },
517
+ },
518
+ 'networks': networks,
519
+ }
520
+ return result
521
+
522
+ async def fetch_markets(self, params={}) -> List[Market]:
523
+ """
524
+ retrieves data on all markets for bigone
525
+ :see: https://open.big.one/docs/spot_asset_pair.html
526
+ :param dict [params]: extra parameters specific to the exchange API endpoint
527
+ :returns dict[]: an array of objects representing market data
528
+ """
529
+ promises = [self.publicGetAssetPairs(params), self.contractPublicGetSymbols(params)]
530
+ promisesResult = await asyncio.gather(*promises)
531
+ response = promisesResult[0]
532
+ contractResponse = promisesResult[1]
533
+ #
534
+ # {
535
+ # "code":0,
536
+ # "data":[
537
+ # {
538
+ # "id":"01e48809-b42f-4a38-96b1-c4c547365db1",
539
+ # "name":"PCX-BTC",
540
+ # "quote_scale":7,
541
+ # "quote_asset":{
542
+ # "id":"0df9c3c3-255a-46d7-ab82-dedae169fba9",
543
+ # "symbol":"BTC",
544
+ # "name":"Bitcoin",
545
+ # },
546
+ # "base_asset":{
547
+ # "id":"405484f7-4b03-4378-a9c1-2bd718ecab51",
548
+ # "symbol":"PCX",
549
+ # "name":"ChainX",
550
+ # },
551
+ # "base_scale":3,
552
+ # "min_quote_value":"0.0001",
553
+ # "max_quote_value":"35"
554
+ # },
555
+ # ]
556
+ # }
557
+ #
558
+ #
559
+ # [
560
+ # {
561
+ # "baseCurrency": "BTC",
562
+ # "multiplier": 1,
563
+ # "enable": True,
564
+ # "priceStep": 0.5,
565
+ # "maxRiskLimit": 1000,
566
+ # "pricePrecision": 1,
567
+ # "maintenanceMargin": 0.00500,
568
+ # "symbol": "BTCUSD",
569
+ # "valuePrecision": 4,
570
+ # "minRiskLimit": 100,
571
+ # "riskLimit": 100,
572
+ # "isInverse": True,
573
+ # "riskStep": 1,
574
+ # "settleCurrency": "BTC",
575
+ # "baseName": "Bitcoin",
576
+ # "feePrecision": 8,
577
+ # "priceMin": 0.5,
578
+ # "priceMax": 1E+6,
579
+ # "initialMargin": 0.01000,
580
+ # "quoteCurrency": "USD"
581
+ # },
582
+ # ...
583
+ # ]
584
+ #
585
+ markets = self.safe_list(response, 'data', [])
586
+ result = []
587
+ for i in range(0, len(markets)):
588
+ market = markets[i]
589
+ baseAsset = self.safe_dict(market, 'base_asset', {})
590
+ quoteAsset = self.safe_dict(market, 'quote_asset', {})
591
+ baseId = self.safe_string(baseAsset, 'symbol')
592
+ quoteId = self.safe_string(quoteAsset, 'symbol')
593
+ base = self.safe_currency_code(baseId)
594
+ quote = self.safe_currency_code(quoteId)
595
+ result.append(self.safe_market_structure({
596
+ 'id': self.safe_string(market, 'name'),
597
+ 'uuid': self.safe_string(market, 'id'),
598
+ 'symbol': base + '/' + quote,
599
+ 'base': base,
600
+ 'quote': quote,
601
+ 'settle': None,
602
+ 'baseId': baseId,
603
+ 'quoteId': quoteId,
604
+ 'settleId': None,
605
+ 'type': 'spot',
606
+ 'spot': True,
607
+ 'margin': False,
608
+ 'swap': False,
609
+ 'future': False,
610
+ 'option': False,
611
+ 'active': True,
612
+ 'contract': False,
613
+ 'linear': None,
614
+ 'inverse': None,
615
+ 'contractSize': None,
616
+ 'expiry': None,
617
+ 'expiryDatetime': None,
618
+ 'strike': None,
619
+ 'optionType': None,
620
+ 'precision': {
621
+ 'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'base_scale'))),
622
+ 'price': self.parse_number(self.parse_precision(self.safe_string(market, 'quote_scale'))),
623
+ },
624
+ 'limits': {
625
+ 'leverage': {
626
+ 'min': None,
627
+ 'max': None,
628
+ },
629
+ 'amount': {
630
+ 'min': None,
631
+ 'max': None,
632
+ },
633
+ 'price': {
634
+ 'min': None,
635
+ 'max': None,
636
+ },
637
+ 'cost': {
638
+ 'min': self.safe_number(market, 'min_quote_value'),
639
+ 'max': self.safe_number(market, 'max_quote_value'),
640
+ },
641
+ },
642
+ 'created': None,
643
+ 'info': market,
644
+ }))
645
+ for i in range(0, len(contractResponse)):
646
+ market = contractResponse[i]
647
+ baseId = self.safe_string(market, 'baseCurrency')
648
+ quoteId = self.safe_string(market, 'quoteCurrency')
649
+ settleId = self.safe_string(market, 'settleCurrency')
650
+ marketId = self.safe_string(market, 'symbol')
651
+ base = self.safe_currency_code(baseId)
652
+ quote = self.safe_currency_code(quoteId)
653
+ settle = self.safe_currency_code(settleId)
654
+ inverse = self.safe_bool(market, 'isInverse')
655
+ result.append(self.safe_market_structure({
656
+ 'id': marketId,
657
+ 'symbol': base + '/' + quote + ':' + settle,
658
+ 'base': base,
659
+ 'quote': quote,
660
+ 'settle': settle,
661
+ 'baseId': baseId,
662
+ 'quoteId': quoteId,
663
+ 'settleId': settleId,
664
+ 'type': 'swap',
665
+ 'spot': False,
666
+ 'margin': False,
667
+ 'swap': True,
668
+ 'future': False,
669
+ 'option': False,
670
+ 'active': self.safe_bool(market, 'enable'),
671
+ 'contract': True,
672
+ 'linear': not inverse,
673
+ 'inverse': inverse,
674
+ 'contractSize': self.safe_number(market, 'multiplier'),
675
+ 'expiry': None,
676
+ 'expiryDatetime': None,
677
+ 'strike': None,
678
+ 'optionType': None,
679
+ 'precision': {
680
+ 'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'valuePrecision'))),
681
+ 'price': self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision'))),
682
+ },
683
+ 'limits': {
684
+ 'leverage': {
685
+ 'min': None,
686
+ 'max': None,
687
+ },
688
+ 'amount': {
689
+ 'min': None,
690
+ 'max': None,
691
+ },
692
+ 'price': {
693
+ 'min': self.safe_number(market, 'priceMin'),
694
+ 'max': self.safe_number(market, 'priceMax'),
695
+ },
696
+ 'cost': {
697
+ 'min': self.safe_number(market, 'initialMargin'),
698
+ 'max': None,
699
+ },
700
+ },
701
+ 'info': market,
702
+ }))
703
+ return result
704
+
705
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
706
+ #
707
+ # spot
708
+ #
709
+ # {
710
+ # "asset_pair_name": "ETH-BTC",
711
+ # "bid": {
712
+ # "price": "0.021593",
713
+ # "order_count": 1,
714
+ # "quantity": "0.20936"
715
+ # },
716
+ # "ask": {
717
+ # "price": "0.021613",
718
+ # "order_count": 1,
719
+ # "quantity": "2.87064"
720
+ # },
721
+ # "open": "0.021795",
722
+ # "high": "0.021795",
723
+ # "low": "0.021471",
724
+ # "close": "0.021613",
725
+ # "volume": "117078.90431",
726
+ # "daily_change": "-0.000182"
727
+ # }
728
+ #
729
+ # contract
730
+ #
731
+ # {
732
+ # "usdtPrice": 1.00031998,
733
+ # "symbol": "BTCUSD",
734
+ # "btcPrice": 34700.4,
735
+ # "ethPrice": 1787.83,
736
+ # "nextFundingRate": 0.00010,
737
+ # "fundingRate": 0.00010,
738
+ # "latestPrice": 34708.5,
739
+ # "last24hPriceChange": 0.0321,
740
+ # "indexPrice": 34700.4,
741
+ # "volume24h": 261319063,
742
+ # "turnover24h": 8204.129380685496,
743
+ # "nextFundingTime": 1698285600000,
744
+ # "markPrice": 34702.4646738,
745
+ # "last24hMaxPrice": 35127.5,
746
+ # "volume24hInUsd": 0.0,
747
+ # "openValue": 32.88054722085945,
748
+ # "last24hMinPrice": 33552.0,
749
+ # "openInterest": 1141372.0
750
+ # }
751
+ #
752
+ marketType = 'spot' if ('asset_pair_name' in ticker) else 'swap'
753
+ marketId = self.safe_string_2(ticker, 'asset_pair_name', 'symbol')
754
+ symbol = self.safe_symbol(marketId, market, '-', marketType)
755
+ close = self.safe_string_2(ticker, 'close', 'latestPrice')
756
+ bid = self.safe_dict(ticker, 'bid', {})
757
+ ask = self.safe_dict(ticker, 'ask', {})
758
+ return self.safe_ticker({
759
+ 'symbol': symbol,
760
+ 'timestamp': None,
761
+ 'datetime': None,
762
+ 'high': self.safe_string_2(ticker, 'high', 'last24hMaxPrice'),
763
+ 'low': self.safe_string_2(ticker, 'low', 'last24hMinPrice'),
764
+ 'bid': self.safe_string(bid, 'price'),
765
+ 'bidVolume': self.safe_string(bid, 'quantity'),
766
+ 'ask': self.safe_string(ask, 'price'),
767
+ 'askVolume': self.safe_string(ask, 'quantity'),
768
+ 'vwap': None,
769
+ 'open': self.safe_string(ticker, 'open'),
770
+ 'close': close,
771
+ 'last': close,
772
+ 'previousClose': None,
773
+ 'change': self.safe_string_2(ticker, 'daily_change', 'last24hPriceChange'),
774
+ 'percentage': None,
775
+ 'average': None,
776
+ 'baseVolume': self.safe_string_2(ticker, 'volume', 'volume24h'),
777
+ 'quoteVolume': self.safe_string(ticker, 'volume24hInUsd'),
778
+ 'info': ticker,
779
+ }, market)
780
+
781
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
782
+ """
783
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
784
+ :see: https://open.big.one/docs/spot_tickers.html
785
+ :param str symbol: unified symbol of the market to fetch the ticker for
786
+ :param dict [params]: extra parameters specific to the exchange API endpoint
787
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
788
+ """
789
+ await self.load_markets()
790
+ market = self.market(symbol)
791
+ type = None
792
+ type, params = self.handle_market_type_and_params('fetchTicker', market, params)
793
+ if type == 'spot':
794
+ request: dict = {
795
+ 'asset_pair_name': market['id'],
796
+ }
797
+ response = await self.publicGetAssetPairsAssetPairNameTicker(self.extend(request, params))
798
+ #
799
+ # {
800
+ # "code":0,
801
+ # "data":{
802
+ # "asset_pair_name":"ETH-BTC",
803
+ # "bid":{"price":"0.021593","order_count":1,"quantity":"0.20936"},
804
+ # "ask":{"price":"0.021613","order_count":1,"quantity":"2.87064"},
805
+ # "open":"0.021795",
806
+ # "high":"0.021795",
807
+ # "low":"0.021471",
808
+ # "close":"0.021613",
809
+ # "volume":"117078.90431",
810
+ # "daily_change":"-0.000182"
811
+ # }
812
+ # }
813
+ #
814
+ ticker = self.safe_dict(response, 'data', {})
815
+ return self.parse_ticker(ticker, market)
816
+ else:
817
+ tickers = await self.fetch_tickers([symbol], params)
818
+ return self.safe_value(tickers, symbol)
819
+
820
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
821
+ """
822
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
823
+ :see: https://open.big.one/docs/spot_tickers.html
824
+ :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
825
+ :param dict [params]: extra parameters specific to the exchange API endpoint
826
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
827
+ """
828
+ await self.load_markets()
829
+ market = None
830
+ symbol = self.safe_string(symbols, 0)
831
+ if symbol is not None:
832
+ market = self.market(symbol)
833
+ type = None
834
+ type, params = self.handle_market_type_and_params('fetchTickers', market, params)
835
+ isSpot = type == 'spot'
836
+ request: dict = {}
837
+ symbols = self.market_symbols(symbols)
838
+ data = None
839
+ if isSpot:
840
+ if symbols is not None:
841
+ ids = self.market_ids(symbols)
842
+ request['pair_names'] = ','.join(ids)
843
+ response = await self.publicGetAssetPairsTickers(self.extend(request, params))
844
+ #
845
+ # {
846
+ # "code": 0,
847
+ # "data": [
848
+ # {
849
+ # "asset_pair_name": "PCX-BTC",
850
+ # "bid": {
851
+ # "price": "0.000234",
852
+ # "order_count": 1,
853
+ # "quantity": "0.518"
854
+ # },
855
+ # "ask": {
856
+ # "price": "0.0002348",
857
+ # "order_count": 1,
858
+ # "quantity": "2.348"
859
+ # },
860
+ # "open": "0.0002343",
861
+ # "high": "0.0002348",
862
+ # "low": "0.0002162",
863
+ # "close": "0.0002348",
864
+ # "volume": "12887.016",
865
+ # "daily_change": "0.0000005"
866
+ # },
867
+ # ...
868
+ # ]
869
+ # }
870
+ #
871
+ data = self.safe_list(response, 'data', [])
872
+ else:
873
+ data = await self.contractPublicGetInstruments(params)
874
+ #
875
+ # [
876
+ # {
877
+ # "usdtPrice": 1.00031998,
878
+ # "symbol": "BTCUSD",
879
+ # "btcPrice": 34700.4,
880
+ # "ethPrice": 1787.83,
881
+ # "nextFundingRate": 0.00010,
882
+ # "fundingRate": 0.00010,
883
+ # "latestPrice": 34708.5,
884
+ # "last24hPriceChange": 0.0321,
885
+ # "indexPrice": 34700.4,
886
+ # "volume24h": 261319063,
887
+ # "turnover24h": 8204.129380685496,
888
+ # "nextFundingTime": 1698285600000,
889
+ # "markPrice": 34702.4646738,
890
+ # "last24hMaxPrice": 35127.5,
891
+ # "volume24hInUsd": 0.0,
892
+ # "openValue": 32.88054722085945,
893
+ # "last24hMinPrice": 33552.0,
894
+ # "openInterest": 1141372.0
895
+ # }
896
+ # ...
897
+ # ]
898
+ #
899
+ tickers = self.parse_tickers(data, symbols)
900
+ return self.filter_by_array_tickers(tickers, 'symbol', symbols)
901
+
902
+ async def fetch_time(self, params={}):
903
+ """
904
+ fetches the current integer timestamp in milliseconds from the exchange server
905
+ :see: https://open.big.one/docs/spot_ping.html
906
+ :param dict [params]: extra parameters specific to the exchange API endpoint
907
+ :returns int: the current integer timestamp in milliseconds from the exchange server
908
+ """
909
+ response = await self.publicGetPing(params)
910
+ #
911
+ # {
912
+ # "data": {
913
+ # "timestamp": 1527665262168391000
914
+ # }
915
+ # }
916
+ #
917
+ data = self.safe_dict(response, 'data', {})
918
+ timestamp = self.safe_integer(data, 'Timestamp')
919
+ return self.parse_to_int(timestamp / 1000000)
920
+
921
+ async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
922
+ """
923
+ fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
924
+ :see: https://open.big.one/docs/contract_misc.html#get-orderbook-snapshot
925
+ :param str symbol: unified symbol of the market to fetch the order book for
926
+ :param int [limit]: the maximum amount of order book entries to return
927
+ :param dict [params]: extra parameters specific to the exchange API endpoint
928
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
929
+ """
930
+ await self.load_markets()
931
+ market = self.market(symbol)
932
+ response = None
933
+ if market['contract']:
934
+ request: dict = {
935
+ 'symbol': market['id'],
936
+ }
937
+ response = await self.contractPublicGetDepthSymbolSnapshot(self.extend(request, params))
938
+ #
939
+ # {
940
+ # bids: {
941
+ # '20000': '20',
942
+ # ...
943
+ # '34552': '64851',
944
+ # '34526.5': '59594',
945
+ # ...
946
+ # '34551.5': '29711'
947
+ # },
948
+ # asks: {
949
+ # '34557': '34395',
950
+ # ...
951
+ # '40000': '20',
952
+ # '34611.5': '56024',
953
+ # ...
954
+ # '34578.5': '66367'
955
+ # },
956
+ # to: '59737174',
957
+ # lastPrice: '34554.5',
958
+ # bestPrices: {
959
+ # ask: '34557.0',
960
+ # bid: '34552.0'
961
+ # },
962
+ # from: '0'
963
+ # }
964
+ #
965
+ return self.parse_contract_order_book(response, market['symbol'], limit)
966
+ else:
967
+ request: dict = {
968
+ 'asset_pair_name': market['id'],
969
+ }
970
+ if limit is not None:
971
+ request['limit'] = limit # default 50, max 200
972
+ response = await self.publicGetAssetPairsAssetPairNameDepth(self.extend(request, params))
973
+ #
974
+ # {
975
+ # "code":0,
976
+ # "data": {
977
+ # "asset_pair_name": "EOS-BTC",
978
+ # "bids": [
979
+ # {"price": "42", "order_count": 4, "quantity": "23.33363711"}
980
+ # ],
981
+ # "asks": [
982
+ # {"price": "45", "order_count": 2, "quantity": "4193.3283464"}
983
+ # ]
984
+ # }
985
+ # }
986
+ #
987
+ orderbook = self.safe_dict(response, 'data', {})
988
+ return self.parse_order_book(orderbook, market['symbol'], None, 'bids', 'asks', 'price', 'quantity')
989
+
990
+ def parse_contract_bids_asks(self, bidsAsks):
991
+ bidsAsksKeys = list(bidsAsks.keys())
992
+ result = []
993
+ for i in range(0, len(bidsAsksKeys)):
994
+ price = bidsAsksKeys[i]
995
+ amount = bidsAsks[price]
996
+ result.append([self.parse_number(price), self.parse_number(amount)])
997
+ return result
998
+
999
+ def parse_contract_order_book(self, orderbook: object, symbol: str, limit: Int = None) -> OrderBook:
1000
+ responseBids = self.safe_value(orderbook, 'bids')
1001
+ responseAsks = self.safe_value(orderbook, 'asks')
1002
+ bids = self.parse_contract_bids_asks(responseBids)
1003
+ asks = self.parse_contract_bids_asks(responseAsks)
1004
+ return {
1005
+ 'symbol': symbol,
1006
+ 'bids': self.filter_by_limit(self.sort_by(bids, 0, True), limit),
1007
+ 'asks': self.filter_by_limit(self.sort_by(asks, 0), limit),
1008
+ 'timestamp': None,
1009
+ 'datetime': None,
1010
+ 'nonce': None,
1011
+ }
1012
+
1013
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1014
+ #
1015
+ # fetchTrades(public)
1016
+ #
1017
+ # {
1018
+ # "id": 38199941,
1019
+ # "price": "3378.67",
1020
+ # "amount": "0.019812",
1021
+ # "taker_side": "ASK",
1022
+ # "created_at": "2019-01-29T06:05:56Z"
1023
+ # }
1024
+ #
1025
+ # fetchMyTrades(private)
1026
+ #
1027
+ # {
1028
+ # "id": 10854280,
1029
+ # "asset_pair_name": "XIN-USDT",
1030
+ # "price": "70",
1031
+ # "amount": "1",
1032
+ # "taker_side": "ASK",
1033
+ # "maker_order_id": 58284908,
1034
+ # "taker_order_id": 58284909,
1035
+ # "maker_fee": "0.0008",
1036
+ # "taker_fee": "0.07",
1037
+ # "side": "SELF_TRADING",
1038
+ # "inserted_at": "2019-04-16T12:00:01Z"
1039
+ # },
1040
+ #
1041
+ # {
1042
+ # "id": 10854263,
1043
+ # "asset_pair_name": "XIN-USDT",
1044
+ # "price": "75.7",
1045
+ # "amount": "12.743149",
1046
+ # "taker_side": "BID",
1047
+ # "maker_order_id": null,
1048
+ # "taker_order_id": 58284888,
1049
+ # "maker_fee": null,
1050
+ # "taker_fee": "0.0025486298",
1051
+ # "side": "BID",
1052
+ # "inserted_at": "2019-04-15T06:20:57Z"
1053
+ # }
1054
+ #
1055
+ timestamp = self.parse8601(self.safe_string_2(trade, 'created_at', 'inserted_at'))
1056
+ priceString = self.safe_string(trade, 'price')
1057
+ amountString = self.safe_string(trade, 'amount')
1058
+ marketId = self.safe_string(trade, 'asset_pair_name')
1059
+ market = self.safe_market(marketId, market, '-')
1060
+ side = self.safe_string(trade, 'side')
1061
+ takerSide = self.safe_string(trade, 'taker_side')
1062
+ takerOrMaker: Str = None
1063
+ if (takerSide is not None) and (side is not None) and (side != 'SELF_TRADING'):
1064
+ takerOrMaker = 'taker' if (takerSide == side) else 'maker'
1065
+ if side is None:
1066
+ # taker side is not related to buy/sell side
1067
+ # the following code is probably a mistake
1068
+ side = 'sell' if (takerSide == 'ASK') else 'buy'
1069
+ else:
1070
+ if side == 'BID':
1071
+ side = 'buy'
1072
+ elif side == 'ASK':
1073
+ side = 'sell'
1074
+ makerOrderId = self.safe_string(trade, 'maker_order_id')
1075
+ takerOrderId = self.safe_string(trade, 'taker_order_id')
1076
+ orderId: Str = None
1077
+ if makerOrderId is not None:
1078
+ orderId = makerOrderId
1079
+ elif takerOrderId is not None:
1080
+ orderId = takerOrderId
1081
+ id = self.safe_string(trade, 'id')
1082
+ result: dict = {
1083
+ 'id': id,
1084
+ 'timestamp': timestamp,
1085
+ 'datetime': self.iso8601(timestamp),
1086
+ 'symbol': market['symbol'],
1087
+ 'order': orderId,
1088
+ 'type': 'limit',
1089
+ 'side': side,
1090
+ 'takerOrMaker': takerOrMaker,
1091
+ 'price': priceString,
1092
+ 'amount': amountString,
1093
+ 'cost': None,
1094
+ 'info': trade,
1095
+ }
1096
+ makerCurrencyCode = None
1097
+ takerCurrencyCode = None
1098
+ if takerOrMaker is not None:
1099
+ if side == 'buy':
1100
+ if takerOrMaker == 'maker':
1101
+ makerCurrencyCode = market['base']
1102
+ takerCurrencyCode = market['quote']
1103
+ else:
1104
+ makerCurrencyCode = market['quote']
1105
+ takerCurrencyCode = market['base']
1106
+ else:
1107
+ if takerOrMaker == 'maker':
1108
+ makerCurrencyCode = market['quote']
1109
+ takerCurrencyCode = market['base']
1110
+ else:
1111
+ makerCurrencyCode = market['base']
1112
+ takerCurrencyCode = market['quote']
1113
+ elif side == 'SELF_TRADING':
1114
+ if takerSide == 'BID':
1115
+ makerCurrencyCode = market['quote']
1116
+ takerCurrencyCode = market['base']
1117
+ elif takerSide == 'ASK':
1118
+ makerCurrencyCode = market['base']
1119
+ takerCurrencyCode = market['quote']
1120
+ makerFeeCost = self.safe_string(trade, 'maker_fee')
1121
+ takerFeeCost = self.safe_string(trade, 'taker_fee')
1122
+ if makerFeeCost is not None:
1123
+ if takerFeeCost is not None:
1124
+ result['fees'] = [
1125
+ {'cost': makerFeeCost, 'currency': makerCurrencyCode},
1126
+ {'cost': takerFeeCost, 'currency': takerCurrencyCode},
1127
+ ]
1128
+ else:
1129
+ result['fee'] = {'cost': makerFeeCost, 'currency': makerCurrencyCode}
1130
+ elif takerFeeCost is not None:
1131
+ result['fee'] = {'cost': takerFeeCost, 'currency': takerCurrencyCode}
1132
+ else:
1133
+ result['fee'] = None
1134
+ return self.safe_trade(result, market)
1135
+
1136
+ async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1137
+ """
1138
+ get the list of most recent trades for a particular symbol
1139
+ :see: https://open.big.one/docs/spot_asset_pair_trade.html
1140
+ :param str symbol: unified symbol of the market to fetch trades for
1141
+ :param int [since]: timestamp in ms of the earliest trade to fetch
1142
+ :param int [limit]: the maximum amount of trades to fetch
1143
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1144
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
1145
+ """
1146
+ await self.load_markets()
1147
+ market = self.market(symbol)
1148
+ if market['contract']:
1149
+ raise BadRequest(self.id + ' fetchTrades() can only fetch trades for spot markets')
1150
+ request: dict = {
1151
+ 'asset_pair_name': market['id'],
1152
+ }
1153
+ response = await self.publicGetAssetPairsAssetPairNameTrades(self.extend(request, params))
1154
+ #
1155
+ # {
1156
+ # "code": 0,
1157
+ # "data": [
1158
+ # {
1159
+ # "id": 38199941,
1160
+ # "price": "3378.67",
1161
+ # "amount": "0.019812",
1162
+ # "taker_side": "ASK",
1163
+ # "created_at": "2019-01-29T06:05:56Z"
1164
+ # },
1165
+ # {
1166
+ # "id": 38199934,
1167
+ # "price": "3376.14",
1168
+ # "amount": "0.019384",
1169
+ # "taker_side": "ASK",
1170
+ # "created_at": "2019-01-29T06:05:40Z"
1171
+ # }
1172
+ # ]
1173
+ # }
1174
+ #
1175
+ trades = self.safe_list(response, 'data', [])
1176
+ return self.parse_trades(trades, market, since, limit)
1177
+
1178
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
1179
+ #
1180
+ # {
1181
+ # "close": "0.021562",
1182
+ # "high": "0.021563",
1183
+ # "low": "0.02156",
1184
+ # "open": "0.021563",
1185
+ # "time": "2019-11-21T07:54:00Z",
1186
+ # "volume": "59.84376"
1187
+ # }
1188
+ #
1189
+ return [
1190
+ self.parse8601(self.safe_string(ohlcv, 'time')),
1191
+ self.safe_number(ohlcv, 'open'),
1192
+ self.safe_number(ohlcv, 'high'),
1193
+ self.safe_number(ohlcv, 'low'),
1194
+ self.safe_number(ohlcv, 'close'),
1195
+ self.safe_number(ohlcv, 'volume'),
1196
+ ]
1197
+
1198
+ async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1199
+ """
1200
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1201
+ :see: https://open.big.one/docs/spot_asset_pair_candle.html
1202
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
1203
+ :param str timeframe: the length of time each candle represents
1204
+ :param int [since]: timestamp in ms of the earliest candle to fetch
1205
+ :param int [limit]: the maximum amount of candles to fetch
1206
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1207
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
1208
+ """
1209
+ await self.load_markets()
1210
+ market = self.market(symbol)
1211
+ if market['contract']:
1212
+ raise BadRequest(self.id + ' fetchOHLCV() can only fetch ohlcvs for spot markets')
1213
+ if limit is None:
1214
+ limit = 100 # default 100, max 500
1215
+ request: dict = {
1216
+ 'asset_pair_name': market['id'],
1217
+ 'period': self.safe_string(self.timeframes, timeframe, timeframe),
1218
+ 'limit': limit,
1219
+ }
1220
+ if since is not None:
1221
+ # start = self.parse_to_int(since / 1000)
1222
+ duration = self.parse_timeframe(timeframe)
1223
+ end = self.sum(since, limit * duration * 1000)
1224
+ request['time'] = self.iso8601(end)
1225
+ response = await self.publicGetAssetPairsAssetPairNameCandles(self.extend(request, params))
1226
+ #
1227
+ # {
1228
+ # "code": 0,
1229
+ # "data": [
1230
+ # {
1231
+ # "close": "0.021656",
1232
+ # "high": "0.021658",
1233
+ # "low": "0.021652",
1234
+ # "open": "0.021652",
1235
+ # "time": "2019-11-21T09:30:00Z",
1236
+ # "volume": "53.08664"
1237
+ # },
1238
+ # {
1239
+ # "close": "0.021652",
1240
+ # "high": "0.021656",
1241
+ # "low": "0.021652",
1242
+ # "open": "0.021656",
1243
+ # "time": "2019-11-21T09:29:00Z",
1244
+ # "volume": "88.39861"
1245
+ # },
1246
+ # ]
1247
+ # }
1248
+ #
1249
+ data = self.safe_list(response, 'data', [])
1250
+ return self.parse_ohlcvs(data, market, timeframe, since, limit)
1251
+
1252
+ def parse_balance(self, response) -> Balances:
1253
+ result: dict = {
1254
+ 'info': response,
1255
+ 'timestamp': None,
1256
+ 'datetime': None,
1257
+ }
1258
+ balances = self.safe_list(response, 'data', [])
1259
+ for i in range(0, len(balances)):
1260
+ balance = balances[i]
1261
+ symbol = self.safe_string(balance, 'asset_symbol')
1262
+ code = self.safe_currency_code(symbol)
1263
+ account = self.account()
1264
+ account['total'] = self.safe_string(balance, 'balance')
1265
+ account['used'] = self.safe_string(balance, 'locked_balance')
1266
+ result[code] = account
1267
+ return self.safe_balance(result)
1268
+
1269
+ async def fetch_balance(self, params={}) -> Balances:
1270
+ """
1271
+ query for balance and get the amount of funds available for trading or funds locked in orders
1272
+ :see: https://open.big.one/docs/fund_accounts.html
1273
+ :see: https://open.big.one/docs/spot_accounts.html
1274
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1275
+ :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1276
+ """
1277
+ await self.load_markets()
1278
+ type = self.safe_string(params, 'type', '')
1279
+ params = self.omit(params, 'type')
1280
+ response = None
1281
+ if type == 'funding' or type == 'fund':
1282
+ response = await self.privateGetFundAccounts(params)
1283
+ else:
1284
+ response = await self.privateGetAccounts(params)
1285
+ #
1286
+ # {
1287
+ # "code":0,
1288
+ # "data":[
1289
+ # {"asset_symbol":"NKC","balance":"0","locked_balance":"0"},
1290
+ # {"asset_symbol":"UBTC","balance":"0","locked_balance":"0"},
1291
+ # {"asset_symbol":"READ","balance":"0","locked_balance":"0"},
1292
+ # ],
1293
+ # }
1294
+ #
1295
+ return self.parse_balance(response)
1296
+
1297
+ def parse_type(self, type: str):
1298
+ types: dict = {
1299
+ 'STOP_LIMIT': 'limit',
1300
+ 'STOP_MARKET': 'market',
1301
+ 'LIMIT': 'limit',
1302
+ 'MARKET': 'market',
1303
+ }
1304
+ return self.safe_string(types, type, type)
1305
+
1306
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1307
+ #
1308
+ # {
1309
+ # "id": "42154072251",
1310
+ # "asset_pair_name": "SOL-USDT",
1311
+ # "price": "20",
1312
+ # "amount": "0.5",
1313
+ # "filled_amount": "0",
1314
+ # "avg_deal_price": "0",
1315
+ # "side": "ASK",
1316
+ # "state": "PENDING",
1317
+ # "created_at": "2023-09-13T03:42:00Z",
1318
+ # "updated_at": "2023-09-13T03:42:00Z",
1319
+ # "type": "LIMIT",
1320
+ # "stop_price": "0",
1321
+ # "immediate_or_cancel": False,
1322
+ # "post_only": False,
1323
+ # "client_order_id": ''
1324
+ # }
1325
+ #
1326
+ id = self.safe_string(order, 'id')
1327
+ marketId = self.safe_string(order, 'asset_pair_name')
1328
+ symbol = self.safe_symbol(marketId, market, '-')
1329
+ timestamp = self.parse8601(self.safe_string(order, 'created_at'))
1330
+ side = self.safe_string(order, 'side')
1331
+ if side == 'BID':
1332
+ side = 'buy'
1333
+ else:
1334
+ side = 'sell'
1335
+ triggerPrice = self.safe_string(order, 'stop_price')
1336
+ if Precise.string_eq(triggerPrice, '0'):
1337
+ triggerPrice = None
1338
+ immediateOrCancel = self.safe_bool(order, 'immediate_or_cancel')
1339
+ timeInForce = None
1340
+ if immediateOrCancel:
1341
+ timeInForce = 'IOC'
1342
+ type = self.parse_type(self.safe_string(order, 'type'))
1343
+ price = self.safe_string(order, 'price')
1344
+ amount = None
1345
+ filled = None
1346
+ cost = None
1347
+ if type == 'market' and side == 'buy':
1348
+ cost = self.safe_string(order, 'filled_amount')
1349
+ else:
1350
+ amount = self.safe_string(order, 'amount')
1351
+ filled = self.safe_string(order, 'filled_amount')
1352
+ return self.safe_order({
1353
+ 'info': order,
1354
+ 'id': id,
1355
+ 'clientOrderId': self.safe_string(order, 'client_order_id'),
1356
+ 'timestamp': timestamp,
1357
+ 'datetime': self.iso8601(timestamp),
1358
+ 'lastTradeTimestamp': self.parse8601(self.safe_string(order, 'updated_at')),
1359
+ 'symbol': symbol,
1360
+ 'type': type,
1361
+ 'timeInForce': timeInForce,
1362
+ 'postOnly': self.safe_bool(order, 'post_only'),
1363
+ 'side': side,
1364
+ 'price': price,
1365
+ 'stopPrice': triggerPrice,
1366
+ 'triggerPrice': triggerPrice,
1367
+ 'amount': amount,
1368
+ 'cost': cost,
1369
+ 'average': self.safe_string(order, 'avg_deal_price'),
1370
+ 'filled': filled,
1371
+ 'remaining': None,
1372
+ 'status': self.parse_order_status(self.safe_string(order, 'state')),
1373
+ 'fee': None,
1374
+ 'trades': None,
1375
+ }, market)
1376
+
1377
+ async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1378
+ """
1379
+ create a market buy order by providing the symbol and cost
1380
+ :see: https://open.big.one/docs/spot_orders.html#create-order
1381
+ :param str symbol: unified symbol of the market to create an order in
1382
+ :param float cost: how much you want to trade in units of the quote currency
1383
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1384
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1385
+ """
1386
+ await self.load_markets()
1387
+ market = self.market(symbol)
1388
+ if not market['spot']:
1389
+ raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
1390
+ params['createMarketBuyOrderRequiresPrice'] = False
1391
+ return await self.create_order(symbol, 'market', 'buy', cost, None, params)
1392
+
1393
+ async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1394
+ """
1395
+ create a trade order
1396
+ :see: https://open.big.one/docs/spot_orders.html#create-order
1397
+ :param str symbol: unified symbol of the market to create an order in
1398
+ :param str type: 'market' or 'limit'
1399
+ :param str side: 'buy' or 'sell'
1400
+ :param float amount: how much of currency you want to trade in units of base currency
1401
+ :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1402
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1403
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1404
+ :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
1405
+ :param str [params.timeInForce]: "GTC", "IOC", or "PO"
1406
+ :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount
1407
+ *
1408
+ * EXCHANGE SPECIFIC PARAMETERS
1409
+ :param str operator: *stop order only* GTE or LTE(default)
1410
+ :param str client_order_id: must match ^[a-zA-Z0-9-_]{1,36}$ self regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused
1411
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1412
+ """
1413
+ await self.load_markets()
1414
+ market = self.market(symbol)
1415
+ isBuy = (side == 'buy')
1416
+ requestSide = 'BID' if isBuy else 'ASK'
1417
+ uppercaseType = type.upper()
1418
+ isLimit = uppercaseType == 'LIMIT'
1419
+ exchangeSpecificParam = self.safe_bool(params, 'post_only', False)
1420
+ postOnly = None
1421
+ postOnly, params = self.handle_post_only((uppercaseType == 'MARKET'), exchangeSpecificParam, params)
1422
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'stop_price'])
1423
+ request: dict = {
1424
+ 'asset_pair_name': market['id'], # asset pair name BTC-USDT, required
1425
+ 'side': requestSide, # order side one of "ASK"/"BID", required
1426
+ 'amount': self.amount_to_precision(symbol, amount), # order amount, string, required
1427
+ # "price": self.price_to_precision(symbol, price), # order price, string, required
1428
+ # "operator": "GTE", # stop orders only, GTE greater than and equal, LTE less than and equal
1429
+ # "immediate_or_cancel": False, # limit orders only, must be False when post_only is True
1430
+ # "post_only": False, # limit orders only, must be False when immediate_or_cancel is True
1431
+ }
1432
+ if isLimit or (uppercaseType == 'STOP_LIMIT'):
1433
+ request['price'] = self.price_to_precision(symbol, price)
1434
+ if isLimit:
1435
+ timeInForce = self.safe_string(params, 'timeInForce')
1436
+ if timeInForce == 'IOC':
1437
+ request['immediate_or_cancel'] = True
1438
+ if postOnly:
1439
+ request['post_only'] = True
1440
+ request['amount'] = self.amount_to_precision(symbol, amount)
1441
+ else:
1442
+ if isBuy:
1443
+ createMarketBuyOrderRequiresPrice = True
1444
+ createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', True)
1445
+ cost = self.safe_number(params, 'cost')
1446
+ params = self.omit(params, 'cost')
1447
+ if createMarketBuyOrderRequiresPrice:
1448
+ if (price is None) and (cost is None):
1449
+ raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argument')
1450
+ else:
1451
+ amountString = self.number_to_string(amount)
1452
+ priceString = self.number_to_string(price)
1453
+ quoteAmount = self.parse_to_numeric(Precise.string_mul(amountString, priceString))
1454
+ costRequest = cost if (cost is not None) else quoteAmount
1455
+ request['amount'] = self.cost_to_precision(symbol, costRequest)
1456
+ else:
1457
+ request['amount'] = self.cost_to_precision(symbol, amount)
1458
+ else:
1459
+ request['amount'] = self.amount_to_precision(symbol, amount)
1460
+ if triggerPrice is not None:
1461
+ request['stop_price'] = self.price_to_precision(symbol, triggerPrice)
1462
+ request['operator'] = 'GTE' if isBuy else 'LTE'
1463
+ if isLimit:
1464
+ uppercaseType = 'STOP_LIMIT'
1465
+ elif uppercaseType == 'MARKET':
1466
+ uppercaseType = 'STOP_MARKET'
1467
+ request['type'] = uppercaseType
1468
+ clientOrderId = self.safe_string(params, 'clientOrderId')
1469
+ if clientOrderId is not None:
1470
+ request['client_order_id'] = clientOrderId
1471
+ params = self.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce', 'clientOrderId'])
1472
+ response = await self.privatePostOrders(self.extend(request, params))
1473
+ #
1474
+ # {
1475
+ # "id": 10,
1476
+ # "asset_pair_name": "EOS-BTC",
1477
+ # "price": "10.00",
1478
+ # "amount": "10.00",
1479
+ # "filled_amount": "9.0",
1480
+ # "avg_deal_price": "12.0",
1481
+ # "side": "ASK",
1482
+ # "state": "FILLED",
1483
+ # "created_at":"2019-01-29T06:05:56Z",
1484
+ # "updated_at":"2019-01-29T06:05:56Z"
1485
+ # }
1486
+ #
1487
+ order = self.safe_dict(response, 'data')
1488
+ return self.parse_order(order, market)
1489
+
1490
+ async def cancel_order(self, id: str, symbol: Str = None, params={}):
1491
+ """
1492
+ cancels an open order
1493
+ :see: https://open.big.one/docs/spot_orders.html#cancel-order
1494
+ :param str id: order id
1495
+ :param str symbol: Not used by bigone cancelOrder()
1496
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1497
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1498
+ """
1499
+ await self.load_markets()
1500
+ request: dict = {'id': id}
1501
+ response = await self.privatePostOrdersIdCancel(self.extend(request, params))
1502
+ # {
1503
+ # "id": 10,
1504
+ # "asset_pair_name": "EOS-BTC",
1505
+ # "price": "10.00",
1506
+ # "amount": "10.00",
1507
+ # "filled_amount": "9.0",
1508
+ # "avg_deal_price": "12.0",
1509
+ # "side": "ASK",
1510
+ # "state": "CANCELLED",
1511
+ # "created_at":"2019-01-29T06:05:56Z",
1512
+ # "updated_at":"2019-01-29T06:05:56Z"
1513
+ # }
1514
+ order = self.safe_dict(response, 'data')
1515
+ return self.parse_order(order)
1516
+
1517
+ async def cancel_all_orders(self, symbol: Str = None, params={}):
1518
+ """
1519
+ cancel all open orders
1520
+ :see: https://open.big.one/docs/spot_orders.html#cancel-all-orders
1521
+ :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
1522
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1523
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1524
+ """
1525
+ await self.load_markets()
1526
+ market = self.market(symbol)
1527
+ request: dict = {
1528
+ 'asset_pair_name': market['id'],
1529
+ }
1530
+ response = await self.privatePostOrdersCancel(self.extend(request, params))
1531
+ #
1532
+ # {
1533
+ # "code":0,
1534
+ # "data": {
1535
+ # "cancelled":[
1536
+ # 58272370,
1537
+ # 58272377
1538
+ # ],
1539
+ # "failed": []
1540
+ # }
1541
+ # }
1542
+ #
1543
+ return response
1544
+
1545
+ async def fetch_order(self, id: str, symbol: Str = None, params={}):
1546
+ """
1547
+ fetches information on an order made by the user
1548
+ :see: https://open.big.one/docs/spot_orders.html#get-one-order
1549
+ :param str symbol: not used by bigone fetchOrder
1550
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1551
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1552
+ """
1553
+ await self.load_markets()
1554
+ request: dict = {'id': id}
1555
+ response = await self.privateGetOrdersId(self.extend(request, params))
1556
+ order = self.safe_dict(response, 'data', {})
1557
+ return self.parse_order(order)
1558
+
1559
+ async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1560
+ """
1561
+ fetches information on multiple orders made by the user
1562
+ :see: https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
1563
+ :param str symbol: unified market symbol of the market orders were made in
1564
+ :param int [since]: the earliest time in ms to fetch orders for
1565
+ :param int [limit]: the maximum number of order structures to retrieve
1566
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1567
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1568
+ """
1569
+ if symbol is None:
1570
+ raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
1571
+ await self.load_markets()
1572
+ market = self.market(symbol)
1573
+ request: dict = {
1574
+ 'asset_pair_name': market['id'],
1575
+ # 'page_token': 'dxzef', # request page after self page token
1576
+ # 'side': 'ASK', # 'ASK' or 'BID', optional
1577
+ # 'state': 'FILLED', # 'CANCELLED', 'FILLED', 'PENDING'
1578
+ # 'limit' 20, # default 20, max 200
1579
+ }
1580
+ if limit is not None:
1581
+ request['limit'] = limit # default 20, max 200
1582
+ response = await self.privateGetOrders(self.extend(request, params))
1583
+ #
1584
+ # {
1585
+ # "code":0,
1586
+ # "data": [
1587
+ # {
1588
+ # "id": 10,
1589
+ # "asset_pair_name": "ETH-BTC",
1590
+ # "price": "10.00",
1591
+ # "amount": "10.00",
1592
+ # "filled_amount": "9.0",
1593
+ # "avg_deal_price": "12.0",
1594
+ # "side": "ASK",
1595
+ # "state": "FILLED",
1596
+ # "created_at":"2019-01-29T06:05:56Z",
1597
+ # "updated_at":"2019-01-29T06:05:56Z",
1598
+ # },
1599
+ # ],
1600
+ # "page_token":"dxzef",
1601
+ # }
1602
+ #
1603
+ orders = self.safe_list(response, 'data', [])
1604
+ return self.parse_orders(orders, market, since, limit)
1605
+
1606
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1607
+ """
1608
+ fetch all trades made by the user
1609
+ :see: https://open.big.one/docs/spot_trade.html#trades-of-user
1610
+ :param str symbol: unified market symbol
1611
+ :param int [since]: the earliest time in ms to fetch trades for
1612
+ :param int [limit]: the maximum number of trades structures to retrieve
1613
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1614
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1615
+ """
1616
+ if symbol is None:
1617
+ raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
1618
+ await self.load_markets()
1619
+ market = self.market(symbol)
1620
+ request: dict = {
1621
+ 'asset_pair_name': market['id'],
1622
+ # 'page_token': 'dxzef', # request page after self page token
1623
+ }
1624
+ if limit is not None:
1625
+ request['limit'] = limit # default 20, max 200
1626
+ response = await self.privateGetTrades(self.extend(request, params))
1627
+ #
1628
+ # {
1629
+ # "code": 0,
1630
+ # "data": [
1631
+ # {
1632
+ # "id": 10854280,
1633
+ # "asset_pair_name": "XIN-USDT",
1634
+ # "price": "70",
1635
+ # "amount": "1",
1636
+ # "taker_side": "ASK",
1637
+ # "maker_order_id": 58284908,
1638
+ # "taker_order_id": 58284909,
1639
+ # "maker_fee": "0.0008",
1640
+ # "taker_fee": "0.07",
1641
+ # "side": "SELF_TRADING",
1642
+ # "inserted_at": "2019-04-16T12:00:01Z"
1643
+ # },
1644
+ # {
1645
+ # "id": 10854263,
1646
+ # "asset_pair_name": "XIN-USDT",
1647
+ # "price": "75.7",
1648
+ # "amount": "12.743149",
1649
+ # "taker_side": "BID",
1650
+ # "maker_order_id": null,
1651
+ # "taker_order_id": 58284888,
1652
+ # "maker_fee": null,
1653
+ # "taker_fee": "0.0025486298",
1654
+ # "side": "BID",
1655
+ # "inserted_at": "2019-04-15T06:20:57Z"
1656
+ # }
1657
+ # ],
1658
+ # "page_token":"dxfv"
1659
+ # }
1660
+ #
1661
+ trades = self.safe_list(response, 'data', [])
1662
+ return self.parse_trades(trades, market, since, limit)
1663
+
1664
+ def parse_order_status(self, status: Str):
1665
+ statuses: dict = {
1666
+ 'PENDING': 'open',
1667
+ 'FILLED': 'closed',
1668
+ 'CANCELLED': 'canceled',
1669
+ }
1670
+ return self.safe_string(statuses, status)
1671
+
1672
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1673
+ """
1674
+ fetch all unfilled currently open orders
1675
+ :see: https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
1676
+ :param str symbol: unified market symbol
1677
+ :param int [since]: the earliest time in ms to fetch open orders for
1678
+ :param int [limit]: the maximum number of open orders structures to retrieve
1679
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1680
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1681
+ """
1682
+ request: dict = {
1683
+ 'state': 'PENDING',
1684
+ }
1685
+ return await self.fetch_orders(symbol, since, limit, self.extend(request, params))
1686
+
1687
+ async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1688
+ """
1689
+ fetches information on multiple closed orders made by the user
1690
+ :see: https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
1691
+ :param str symbol: unified market symbol of the market orders were made in
1692
+ :param int [since]: the earliest time in ms to fetch orders for
1693
+ :param int [limit]: the maximum number of order structures to retrieve
1694
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1695
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1696
+ """
1697
+ request: dict = {
1698
+ 'state': 'FILLED',
1699
+ }
1700
+ return await self.fetch_orders(symbol, since, limit, self.extend(request, params))
1701
+
1702
+ def nonce(self):
1703
+ exchangeTimeCorrection = self.safe_integer(self.options, 'exchangeMillisecondsCorrection', 0) * 1000000
1704
+ return self.sum(self.microseconds() * 1000, exchangeTimeCorrection)
1705
+
1706
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
1707
+ query = self.omit(params, self.extract_params(path))
1708
+ baseUrl = self.implode_hostname(self.urls['api'][api])
1709
+ url = baseUrl + '/' + self.implode_params(path, params)
1710
+ headers = {}
1711
+ if api == 'public' or api == 'webExchange' or api == 'contractPublic':
1712
+ if query:
1713
+ url += '?' + self.urlencode(query)
1714
+ else:
1715
+ self.check_required_credentials()
1716
+ nonce = str(self.nonce())
1717
+ request: dict = {
1718
+ 'type': 'OpenAPIV2',
1719
+ 'sub': self.apiKey,
1720
+ 'nonce': nonce,
1721
+ # 'recv_window': '30', # default 30
1722
+ }
1723
+ token = self.jwt(request, self.encode(self.secret), 'sha256')
1724
+ headers['Authorization'] = 'Bearer ' + token
1725
+ if method == 'GET':
1726
+ if query:
1727
+ url += '?' + self.urlencode(query)
1728
+ elif method == 'POST':
1729
+ headers['Content-Type'] = 'application/json'
1730
+ body = self.json(query)
1731
+ headers['User-Agent'] = 'ccxt/' + self.id + '-' + self.version
1732
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}
1733
+
1734
+ async def fetch_deposit_address(self, code: str, params={}):
1735
+ """
1736
+ fetch the deposit address for a currency associated with self account
1737
+ :see: https://open.big.one/docs/spot_deposit.html#get-deposite-address-of-one-asset-of-user
1738
+ :param str code: unified currency code
1739
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1740
+ :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1741
+ """
1742
+ await self.load_markets()
1743
+ currency = self.currency(code)
1744
+ request: dict = {
1745
+ 'asset_symbol': currency['id'],
1746
+ }
1747
+ networkCode, paramsOmitted = self.handle_network_code_and_params(params)
1748
+ response = await self.privateGetAssetsAssetSymbolAddress(self.extend(request, paramsOmitted))
1749
+ #
1750
+ # the actual response format is not the same documented one
1751
+ # the data key contains an array in the actual response
1752
+ #
1753
+ # {
1754
+ # "code":0,
1755
+ # "message":"",
1756
+ # "data":[
1757
+ # {
1758
+ # "id":5521878,
1759
+ # "chain":"Bitcoin",
1760
+ # "value":"1GbmyKoikhpiQVZ1C9sbF17mTyvBjeobVe",
1761
+ # "memo":""
1762
+ # }
1763
+ # ]
1764
+ # }
1765
+ #
1766
+ data = self.safe_list(response, 'data', [])
1767
+ dataLength = len(data)
1768
+ if dataLength < 1:
1769
+ raise ExchangeError(self.id + ' fetchDepositAddress() returned empty address response')
1770
+ chainsIndexedById = self.index_by(data, 'chain')
1771
+ selectedNetworkId = self.select_network_id_from_raw_networks(code, networkCode, chainsIndexedById)
1772
+ addressObject = self.safe_dict(chainsIndexedById, selectedNetworkId, {})
1773
+ address = self.safe_string(addressObject, 'value')
1774
+ tag = self.safe_string(addressObject, 'memo')
1775
+ self.check_address(address)
1776
+ return {
1777
+ 'currency': code,
1778
+ 'address': address,
1779
+ 'tag': tag,
1780
+ 'network': self.network_id_to_code(selectedNetworkId),
1781
+ 'info': response,
1782
+ }
1783
+
1784
+ def parse_transaction_status(self, status: Str):
1785
+ statuses: dict = {
1786
+ # what are other statuses here?
1787
+ 'WITHHOLD': 'ok', # deposits
1788
+ 'UNCONFIRMED': 'pending',
1789
+ 'CONFIRMED': 'ok', # withdrawals
1790
+ 'COMPLETED': 'ok',
1791
+ 'PENDING': 'pending',
1792
+ }
1793
+ return self.safe_string(statuses, status, status)
1794
+
1795
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1796
+ #
1797
+ # fetchDeposits
1798
+ #
1799
+ # {
1800
+ # "amount": "25.0",
1801
+ # "asset_symbol": "BTS"
1802
+ # "confirms": 100,
1803
+ # "id": 5,
1804
+ # "inserted_at": "2018-02-16T11:39:58.000Z",
1805
+ # "is_internal": False,
1806
+ # "kind": "default",
1807
+ # "memo": "",
1808
+ # "state": "WITHHOLD",
1809
+ # "txid": "72e03037d144dae3d32b68b5045462b1049a0755",
1810
+ # "updated_at": "2018-11-09T10:20:09.000Z",
1811
+ # }
1812
+ #
1813
+ # fetchWithdrawals
1814
+ #
1815
+ # {
1816
+ # "amount": "5",
1817
+ # "asset_symbol": "ETH",
1818
+ # "completed_at": "2018-03-15T16:13:45.610463Z",
1819
+ # "customer_id": "10",
1820
+ # "id": 10,
1821
+ # "inserted_at": "2018-03-15T16:13:45.610463Z",
1822
+ # "is_internal": True,
1823
+ # "note": "2018-03-15T16:13:45.610463Z",
1824
+ # "state": "CONFIRMED",
1825
+ # "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7"
1826
+ # "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0",
1827
+ # }
1828
+ #
1829
+ # withdraw
1830
+ #
1831
+ # {
1832
+ # "id":1077391,
1833
+ # "customer_id":1082679,
1834
+ # "amount":"21.9000000000000000",
1835
+ # "txid":"",
1836
+ # "is_internal":false,
1837
+ # "kind":"on_chain",
1838
+ # "state":"PENDING",
1839
+ # "inserted_at":"2020-06-03T00:50:57+00:00",
1840
+ # "updated_at":"2020-06-03T00:50:57+00:00",
1841
+ # "memo":"",
1842
+ # "target_address":"rDYtYT3dBeuw376rvHqoZBKW3UmvguoBAf",
1843
+ # "fee":"0.1000000000000000",
1844
+ # "asset_symbol":"XRP"
1845
+ # }
1846
+ #
1847
+ currencyId = self.safe_string(transaction, 'asset_symbol')
1848
+ code = self.safe_currency_code(currencyId)
1849
+ id = self.safe_string(transaction, 'id')
1850
+ amount = self.safe_number(transaction, 'amount')
1851
+ status = self.parse_transaction_status(self.safe_string(transaction, 'state'))
1852
+ timestamp = self.parse8601(self.safe_string(transaction, 'inserted_at'))
1853
+ updated = self.parse8601(self.safe_string_2(transaction, 'updated_at', 'completed_at'))
1854
+ txid = self.safe_string(transaction, 'txid')
1855
+ address = self.safe_string(transaction, 'target_address')
1856
+ tag = self.safe_string(transaction, 'memo')
1857
+ type = 'withdrawal' if ('customer_id' in transaction) else 'deposit'
1858
+ internal = self.safe_bool(transaction, 'is_internal')
1859
+ return {
1860
+ 'info': transaction,
1861
+ 'id': id,
1862
+ 'txid': txid,
1863
+ 'timestamp': timestamp,
1864
+ 'datetime': self.iso8601(timestamp),
1865
+ 'network': None,
1866
+ 'addressFrom': None,
1867
+ 'address': None,
1868
+ 'addressTo': address,
1869
+ 'tagFrom': None,
1870
+ 'tag': tag,
1871
+ 'tagTo': None,
1872
+ 'type': type,
1873
+ 'amount': amount,
1874
+ 'currency': code,
1875
+ 'status': status,
1876
+ 'updated': updated,
1877
+ 'fee': None,
1878
+ 'comment': None,
1879
+ 'internal': internal,
1880
+ }
1881
+
1882
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1883
+ """
1884
+ fetch all deposits made to an account
1885
+ :see: https://open.big.one/docs/spot_deposit.html#deposit-of-user
1886
+ :param str code: unified currency code
1887
+ :param int [since]: the earliest time in ms to fetch deposits for
1888
+ :param int [limit]: the maximum number of deposits structures to retrieve
1889
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1890
+ :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1891
+ """
1892
+ await self.load_markets()
1893
+ request: dict = {
1894
+ # 'page_token': 'dxzef', # request page after self page token
1895
+ # 'limit': 50, # optional, default 50
1896
+ # 'kind': 'string', # optional - air_drop, big_holder_dividend, default, eosc_to_eos, internal, equally_airdrop, referral_mining, one_holder_dividend, single_customer, snapshotted_airdrop, trade_mining
1897
+ # 'asset_symbol': 'BTC', # optional
1898
+ }
1899
+ currency = None
1900
+ if code is not None:
1901
+ currency = self.currency(code)
1902
+ request['asset_symbol'] = currency['id']
1903
+ if limit is not None:
1904
+ request['limit'] = limit # default 50
1905
+ response = await self.privateGetDeposits(self.extend(request, params))
1906
+ #
1907
+ # {
1908
+ # "code": 0,
1909
+ # "page_token": "NQ==",
1910
+ # "data": [
1911
+ # {
1912
+ # "id": 5,
1913
+ # "amount": "25.0",
1914
+ # "confirms": 100,
1915
+ # "txid": "72e03037d144dae3d32b68b5045462b1049a0755",
1916
+ # "is_internal": False,
1917
+ # "inserted_at": "2018-02-16T11:39:58.000Z",
1918
+ # "updated_at": "2018-11-09T10:20:09.000Z",
1919
+ # "kind": "default",
1920
+ # "memo": "",
1921
+ # "state": "WITHHOLD",
1922
+ # "asset_symbol": "BTS"
1923
+ # }
1924
+ # ]
1925
+ # }
1926
+ #
1927
+ deposits = self.safe_list(response, 'data', [])
1928
+ return self.parse_transactions(deposits, currency, since, limit)
1929
+
1930
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1931
+ """
1932
+ fetch all withdrawals made from an account
1933
+ :see: https://open.big.one/docs/spot_withdrawal.html#get-withdrawals-of-user
1934
+ :param str code: unified currency code
1935
+ :param int [since]: the earliest time in ms to fetch withdrawals for
1936
+ :param int [limit]: the maximum number of withdrawals structures to retrieve
1937
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1938
+ :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1939
+ """
1940
+ await self.load_markets()
1941
+ request: dict = {
1942
+ # 'page_token': 'dxzef', # request page after self page token
1943
+ # 'limit': 50, # optional, default 50
1944
+ # 'kind': 'string', # optional - air_drop, big_holder_dividend, default, eosc_to_eos, internal, equally_airdrop, referral_mining, one_holder_dividend, single_customer, snapshotted_airdrop, trade_mining
1945
+ # 'asset_symbol': 'BTC', # optional
1946
+ }
1947
+ currency = None
1948
+ if code is not None:
1949
+ currency = self.currency(code)
1950
+ request['asset_symbol'] = currency['id']
1951
+ if limit is not None:
1952
+ request['limit'] = limit # default 50
1953
+ response = await self.privateGetWithdrawals(self.extend(request, params))
1954
+ #
1955
+ # {
1956
+ # "code": 0,
1957
+ # "data": [
1958
+ # {
1959
+ # "id": 10,
1960
+ # "customer_id": "10",
1961
+ # "asset_symbol": "ETH",
1962
+ # "amount": "5",
1963
+ # "state": "CONFIRMED",
1964
+ # "note": "2018-03-15T16:13:45.610463Z",
1965
+ # "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0",
1966
+ # "completed_at": "2018-03-15T16:13:45.610463Z",
1967
+ # "inserted_at": "2018-03-15T16:13:45.610463Z",
1968
+ # "is_internal": True,
1969
+ # "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7"
1970
+ # }
1971
+ # ],
1972
+ # "page_token":"dxvf"
1973
+ # }
1974
+ #
1975
+ withdrawals = self.safe_list(response, 'data', [])
1976
+ return self.parse_transactions(withdrawals, currency, since, limit)
1977
+
1978
+ async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
1979
+ """
1980
+ transfer currency internally between wallets on the same account
1981
+ :see: https://open.big.one/docs/spot_transfer.html#transfer-of-user
1982
+ :param str code: unified currency code
1983
+ :param float amount: amount to transfer
1984
+ :param str fromAccount: 'SPOT', 'FUND', or 'CONTRACT'
1985
+ :param str toAccount: 'SPOT', 'FUND', or 'CONTRACT'
1986
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1987
+ :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
1988
+ """
1989
+ await self.load_markets()
1990
+ currency = self.currency(code)
1991
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1992
+ fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
1993
+ toId = self.safe_string(accountsByType, toAccount, toAccount)
1994
+ guid = self.safe_string(params, 'guid', self.uuid())
1995
+ request: dict = {
1996
+ 'symbol': currency['id'],
1997
+ 'amount': self.currency_to_precision(code, amount),
1998
+ 'from': fromId,
1999
+ 'to': toId,
2000
+ 'guid': guid,
2001
+ # 'type': type, # NORMAL, MASTER_TO_SUB, SUB_TO_MASTER, SUB_INTERNAL, default is NORMAL
2002
+ # 'sub_acccunt': '', # when type is NORMAL, it should be empty, and when type is others it is required
2003
+ }
2004
+ response = await self.privatePostTransfer(self.extend(request, params))
2005
+ #
2006
+ # {
2007
+ # "code": 0,
2008
+ # "data": null
2009
+ # }
2010
+ #
2011
+ transfer = self.parse_transfer(response, currency)
2012
+ transferOptions = self.safe_dict(self.options, 'transfer', {})
2013
+ fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
2014
+ if fillResponseFromRequest:
2015
+ transfer['fromAccount'] = fromAccount
2016
+ transfer['toAccount'] = toAccount
2017
+ transfer['amount'] = amount
2018
+ transfer['id'] = guid
2019
+ return transfer
2020
+
2021
+ def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2022
+ #
2023
+ # {
2024
+ # "code": 0,
2025
+ # "data": null
2026
+ # }
2027
+ #
2028
+ code = self.safe_string(transfer, 'code')
2029
+ return {
2030
+ 'info': transfer,
2031
+ 'id': None,
2032
+ 'timestamp': None,
2033
+ 'datetime': None,
2034
+ 'currency': None,
2035
+ 'amount': None,
2036
+ 'fromAccount': None,
2037
+ 'toAccount': None,
2038
+ 'status': self.parse_transfer_status(code),
2039
+ }
2040
+
2041
+ def parse_transfer_status(self, status: Str) -> Str:
2042
+ statuses: dict = {
2043
+ '0': 'ok',
2044
+ }
2045
+ return self.safe_string(statuses, status, 'failed')
2046
+
2047
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
2048
+ """
2049
+ make a withdrawal
2050
+ :see: https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
2051
+ :param str code: unified currency code
2052
+ :param float amount: the amount to withdraw
2053
+ :param str address: the address to withdraw to
2054
+ :param str tag:
2055
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2056
+ :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
2057
+ """
2058
+ tag, params = self.handle_withdraw_tag_and_params(tag, params)
2059
+ await self.load_markets()
2060
+ currency = self.currency(code)
2061
+ request: dict = {
2062
+ 'symbol': currency['id'],
2063
+ 'target_address': address,
2064
+ 'amount': self.currency_to_precision(code, amount),
2065
+ }
2066
+ if tag is not None:
2067
+ request['memo'] = tag
2068
+ networkCode = None
2069
+ networkCode, params = self.handle_network_code_and_params(params)
2070
+ if networkCode is not None:
2071
+ request['gateway_name'] = self.network_code_to_id(networkCode)
2072
+ # requires write permission on the wallet
2073
+ response = await self.privatePostWithdrawals(self.extend(request, params))
2074
+ #
2075
+ # {
2076
+ # "code":0,
2077
+ # "message":"",
2078
+ # "data":{
2079
+ # "id":1077391,
2080
+ # "customer_id":1082679,
2081
+ # "amount":"21.9000000000000000",
2082
+ # "txid":"",
2083
+ # "is_internal":false,
2084
+ # "kind":"on_chain",
2085
+ # "state":"PENDING",
2086
+ # "inserted_at":"2020-06-03T00:50:57+00:00",
2087
+ # "updated_at":"2020-06-03T00:50:57+00:00",
2088
+ # "memo":"",
2089
+ # "target_address":"rDYtYT3dBeuw376rvHqoZBKW3UmvguoBAf",
2090
+ # "fee":"0.1000000000000000",
2091
+ # "asset_symbol":"XRP"
2092
+ # }
2093
+ # }
2094
+ #
2095
+ data = self.safe_dict(response, 'data', {})
2096
+ return self.parse_transaction(data, currency)
2097
+
2098
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2099
+ if response is None:
2100
+ return None # fallback to default error handler
2101
+ #
2102
+ # {"code":10013,"message":"Resource not found"}
2103
+ # {"code":40004,"message":"invalid jwt"}
2104
+ #
2105
+ code = self.safe_string(response, 'code')
2106
+ message = self.safe_string(response, 'message')
2107
+ if (code != '0') and (code is not None):
2108
+ feedback = self.id + ' ' + body
2109
+ self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
2110
+ self.throw_exactly_matched_exception(self.exceptions['exact'], code, feedback)
2111
+ self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
2112
+ raise ExchangeError(feedback) # unknown message
2113
+ return None