ccxt-ir 4.3.46.0.1__py2.py3-none-any.whl

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