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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (772) hide show
  1. ccxt/__init__.py +358 -0
  2. ccxt/abantether.py +316 -0
  3. ccxt/abstract/__init__.py +0 -0
  4. ccxt/abstract/abantether.py +5 -0
  5. ccxt/abstract/ace.py +15 -0
  6. ccxt/abstract/afratether.py +6 -0
  7. ccxt/abstract/alpaca.py +70 -0
  8. ccxt/abstract/arzinja.py +5 -0
  9. ccxt/abstract/arzplus.py +7 -0
  10. ccxt/abstract/ascendex.py +77 -0
  11. ccxt/abstract/bequant.py +115 -0
  12. ccxt/abstract/bigone.py +45 -0
  13. ccxt/abstract/binance.py +712 -0
  14. ccxt/abstract/binancecoinm.py +712 -0
  15. ccxt/abstract/binanceus.py +764 -0
  16. ccxt/abstract/binanceusdm.py +712 -0
  17. ccxt/abstract/bingx.py +113 -0
  18. ccxt/abstract/bit2c.py +27 -0
  19. ccxt/abstract/bitbank.py +27 -0
  20. ccxt/abstract/bitbay.py +53 -0
  21. ccxt/abstract/bitbns.py +40 -0
  22. ccxt/abstract/bitcoincom.py +115 -0
  23. ccxt/abstract/bitfinex.py +69 -0
  24. ccxt/abstract/bitfinex2.py +139 -0
  25. ccxt/abstract/bitflyer.py +38 -0
  26. ccxt/abstract/bitget.py +508 -0
  27. ccxt/abstract/bithumb.py +32 -0
  28. ccxt/abstract/bitimen.py +7 -0
  29. ccxt/abstract/bitir.py +7 -0
  30. ccxt/abstract/bitmart.py +99 -0
  31. ccxt/abstract/bitmex.py +97 -0
  32. ccxt/abstract/bitopro.py +29 -0
  33. ccxt/abstract/bitpanda.py +35 -0
  34. ccxt/abstract/bitpin.py +7 -0
  35. ccxt/abstract/bitrue.py +72 -0
  36. ccxt/abstract/bitso.py +43 -0
  37. ccxt/abstract/bitstamp.py +258 -0
  38. ccxt/abstract/bitteam.py +29 -0
  39. ccxt/abstract/bitvavo.py +27 -0
  40. ccxt/abstract/bl3p.py +19 -0
  41. ccxt/abstract/blockchaincom.py +28 -0
  42. ccxt/abstract/blofin.py +37 -0
  43. ccxt/abstract/btcalpha.py +18 -0
  44. ccxt/abstract/btcbox.py +13 -0
  45. ccxt/abstract/btcmarkets.py +39 -0
  46. ccxt/abstract/btcturk.py +20 -0
  47. ccxt/abstract/bybit.py +298 -0
  48. ccxt/abstract/cex.py +33 -0
  49. ccxt/abstract/coinbase.py +94 -0
  50. ccxt/abstract/coinbaseadvanced.py +94 -0
  51. ccxt/abstract/coinbaseexchange.py +67 -0
  52. ccxt/abstract/coinbaseinternational.py +39 -0
  53. ccxt/abstract/coincatch.py +94 -0
  54. ccxt/abstract/coincheck.py +33 -0
  55. ccxt/abstract/coinex.py +237 -0
  56. ccxt/abstract/coinlist.py +54 -0
  57. ccxt/abstract/coinmate.py +62 -0
  58. ccxt/abstract/coinmetro.py +34 -0
  59. ccxt/abstract/coinone.py +67 -0
  60. ccxt/abstract/coinsph.py +54 -0
  61. ccxt/abstract/coinspot.py +28 -0
  62. ccxt/abstract/cryptocom.py +107 -0
  63. ccxt/abstract/currencycom.py +68 -0
  64. ccxt/abstract/delta.py +50 -0
  65. ccxt/abstract/deribit.py +125 -0
  66. ccxt/abstract/digifinex.py +91 -0
  67. ccxt/abstract/eterex.py +5 -0
  68. ccxt/abstract/excoino.py +7 -0
  69. ccxt/abstract/exir.py +8 -0
  70. ccxt/abstract/exmo.py +55 -0
  71. ccxt/abstract/exnovin.py +6 -0
  72. ccxt/abstract/farhadexchange.py +5 -0
  73. ccxt/abstract/fmfwio.py +115 -0
  74. ccxt/abstract/gate.py +265 -0
  75. ccxt/abstract/gateio.py +265 -0
  76. ccxt/abstract/gemini.py +58 -0
  77. ccxt/abstract/hashkey.py +67 -0
  78. ccxt/abstract/hitbtc.py +115 -0
  79. ccxt/abstract/hitbtc3.py +115 -0
  80. ccxt/abstract/hitobit.py +8 -0
  81. ccxt/abstract/hollaex.py +33 -0
  82. ccxt/abstract/htx.py +548 -0
  83. ccxt/abstract/huobi.py +548 -0
  84. ccxt/abstract/huobijp.py +114 -0
  85. ccxt/abstract/hyperliquid.py +6 -0
  86. ccxt/abstract/idex.py +26 -0
  87. ccxt/abstract/independentreserve.py +37 -0
  88. ccxt/abstract/indodax.py +26 -0
  89. ccxt/abstract/jibitex.py +7 -0
  90. ccxt/abstract/kraken.py +57 -0
  91. ccxt/abstract/krakenfutures.py +38 -0
  92. ccxt/abstract/kucoin.py +214 -0
  93. ccxt/abstract/kucoinfutures.py +233 -0
  94. ccxt/abstract/kuna.py +182 -0
  95. ccxt/abstract/latoken.py +56 -0
  96. ccxt/abstract/lbank.py +61 -0
  97. ccxt/abstract/luno.py +37 -0
  98. ccxt/abstract/lykke.py +29 -0
  99. ccxt/abstract/mercado.py +25 -0
  100. ccxt/abstract/mexc.py +178 -0
  101. ccxt/abstract/ndax.py +97 -0
  102. ccxt/abstract/nobitex.py +7 -0
  103. ccxt/abstract/novadax.py +29 -0
  104. ccxt/abstract/oceanex.py +22 -0
  105. ccxt/abstract/okcoin.py +74 -0
  106. ccxt/abstract/okexchange.py +8 -0
  107. ccxt/abstract/okx.py +324 -0
  108. ccxt/abstract/ompfinex.py +7 -0
  109. ccxt/abstract/onetrading.py +35 -0
  110. ccxt/abstract/oxfun.py +34 -0
  111. ccxt/abstract/p2b.py +22 -0
  112. ccxt/abstract/paradex.py +40 -0
  113. ccxt/abstract/paymium.py +28 -0
  114. ccxt/abstract/phemex.py +115 -0
  115. ccxt/abstract/poloniex.py +69 -0
  116. ccxt/abstract/poloniexfutures.py +48 -0
  117. ccxt/abstract/probit.py +23 -0
  118. ccxt/abstract/ramzinex.py +7 -0
  119. ccxt/abstract/sarmayex.py +5 -0
  120. ccxt/abstract/sarrafex.py +7 -0
  121. ccxt/abstract/tabdeal.py +7 -0
  122. ccxt/abstract/tetherland.py +5 -0
  123. ccxt/abstract/timex.py +62 -0
  124. ccxt/abstract/tokocrypto.py +37 -0
  125. ccxt/abstract/tradeogre.py +16 -0
  126. ccxt/abstract/twox.py +5 -0
  127. ccxt/abstract/ubitex.py +7 -0
  128. ccxt/abstract/upbit.py +38 -0
  129. ccxt/abstract/vertex.py +19 -0
  130. ccxt/abstract/wallex.py +8 -0
  131. ccxt/abstract/wavesexchange.py +154 -0
  132. ccxt/abstract/wazirx.py +30 -0
  133. ccxt/abstract/whitebit.py +98 -0
  134. ccxt/abstract/woo.py +83 -0
  135. ccxt/abstract/woofipro.py +119 -0
  136. ccxt/abstract/xt.py +152 -0
  137. ccxt/abstract/yobit.py +16 -0
  138. ccxt/abstract/zaif.py +38 -0
  139. ccxt/abstract/zonda.py +53 -0
  140. ccxt/ace.py +1012 -0
  141. ccxt/afratether.py +293 -0
  142. ccxt/alpaca.py +1083 -0
  143. ccxt/arzinja.py +285 -0
  144. ccxt/arzplus.py +412 -0
  145. ccxt/ascendex.py +3330 -0
  146. ccxt/async_support/__init__.py +337 -0
  147. ccxt/async_support/abantether.py +316 -0
  148. ccxt/async_support/ace.py +1012 -0
  149. ccxt/async_support/afratether.py +293 -0
  150. ccxt/async_support/alpaca.py +1083 -0
  151. ccxt/async_support/arzinja.py +285 -0
  152. ccxt/async_support/arzplus.py +412 -0
  153. ccxt/async_support/ascendex.py +3330 -0
  154. ccxt/async_support/base/__init__.py +1 -0
  155. ccxt/async_support/base/exchange.py +1966 -0
  156. ccxt/async_support/base/throttler.py +50 -0
  157. ccxt/async_support/base/ws/__init__.py +38 -0
  158. ccxt/async_support/base/ws/aiohttp_client.py +125 -0
  159. ccxt/async_support/base/ws/cache.py +212 -0
  160. ccxt/async_support/base/ws/client.py +193 -0
  161. ccxt/async_support/base/ws/fast_client.py +96 -0
  162. ccxt/async_support/base/ws/functions.py +59 -0
  163. ccxt/async_support/base/ws/future.py +58 -0
  164. ccxt/async_support/base/ws/order_book.py +78 -0
  165. ccxt/async_support/base/ws/order_book_side.py +174 -0
  166. ccxt/async_support/bequant.py +33 -0
  167. ccxt/async_support/bigone.py +2113 -0
  168. ccxt/async_support/binance.py +12234 -0
  169. ccxt/async_support/binancecoinm.py +45 -0
  170. ccxt/async_support/binanceus.py +211 -0
  171. ccxt/async_support/binanceusdm.py +58 -0
  172. ccxt/async_support/bingx.py +4325 -0
  173. ccxt/async_support/bit2c.py +866 -0
  174. ccxt/async_support/bitbank.py +1001 -0
  175. ccxt/async_support/bitbay.py +17 -0
  176. ccxt/async_support/bitbns.py +1154 -0
  177. ccxt/async_support/bitcoincom.py +17 -0
  178. ccxt/async_support/bitfinex.py +1617 -0
  179. ccxt/async_support/bitfinex2.py +3552 -0
  180. ccxt/async_support/bitflyer.py +995 -0
  181. ccxt/async_support/bitget.py +8273 -0
  182. ccxt/async_support/bithumb.py +1061 -0
  183. ccxt/async_support/bitimen.py +401 -0
  184. ccxt/async_support/bitir.py +490 -0
  185. ccxt/async_support/bitmart.py +4415 -0
  186. ccxt/async_support/bitmex.py +2756 -0
  187. ccxt/async_support/bitopro.py +1630 -0
  188. ccxt/async_support/bitpanda.py +16 -0
  189. ccxt/async_support/bitpin.py +454 -0
  190. ccxt/async_support/bitrue.py +3027 -0
  191. ccxt/async_support/bitso.py +1670 -0
  192. ccxt/async_support/bitstamp.py +2203 -0
  193. ccxt/async_support/bitteam.py +2239 -0
  194. ccxt/async_support/bitvavo.py +1968 -0
  195. ccxt/async_support/bl3p.py +485 -0
  196. ccxt/async_support/blockchaincom.py +1104 -0
  197. ccxt/async_support/blofin.py +2066 -0
  198. ccxt/async_support/btcalpha.py +891 -0
  199. ccxt/async_support/btcbox.py +544 -0
  200. ccxt/async_support/btcmarkets.py +1221 -0
  201. ccxt/async_support/btcturk.py +911 -0
  202. ccxt/async_support/bybit.py +8159 -0
  203. ccxt/async_support/cex.py +1605 -0
  204. ccxt/async_support/coinbase.py +4475 -0
  205. ccxt/async_support/coinbaseadvanced.py +17 -0
  206. ccxt/async_support/coinbaseexchange.py +1734 -0
  207. ccxt/async_support/coinbaseinternational.py +1899 -0
  208. ccxt/async_support/coincatch.py +5069 -0
  209. ccxt/async_support/coincheck.py +815 -0
  210. ccxt/async_support/coinex.py +5526 -0
  211. ccxt/async_support/coinlist.py +2243 -0
  212. ccxt/async_support/coinmate.py +1067 -0
  213. ccxt/async_support/coinmetro.py +1797 -0
  214. ccxt/async_support/coinone.py +1127 -0
  215. ccxt/async_support/coinsph.py +1850 -0
  216. ccxt/async_support/coinspot.py +534 -0
  217. ccxt/async_support/cryptocom.py +2822 -0
  218. ccxt/async_support/currencycom.py +1950 -0
  219. ccxt/async_support/delta.py +3376 -0
  220. ccxt/async_support/deribit.py +3437 -0
  221. ccxt/async_support/digifinex.py +3960 -0
  222. ccxt/async_support/eterex.py +286 -0
  223. ccxt/async_support/excoino.py +399 -0
  224. ccxt/async_support/exir.py +375 -0
  225. ccxt/async_support/exmo.py +2462 -0
  226. ccxt/async_support/exnovin.py +360 -0
  227. ccxt/async_support/farhadexchange.py +266 -0
  228. ccxt/async_support/fmfwio.py +34 -0
  229. ccxt/async_support/gate.py +6976 -0
  230. ccxt/async_support/gateio.py +16 -0
  231. ccxt/async_support/gemini.py +1825 -0
  232. ccxt/async_support/hashkey.py +4150 -0
  233. ccxt/async_support/hitbtc.py +3423 -0
  234. ccxt/async_support/hitbtc3.py +16 -0
  235. ccxt/async_support/hitobit.py +391 -0
  236. ccxt/async_support/hollaex.py +1813 -0
  237. ccxt/async_support/htx.py +8506 -0
  238. ccxt/async_support/huobi.py +16 -0
  239. ccxt/async_support/huobijp.py +1801 -0
  240. ccxt/async_support/hyperliquid.py +2431 -0
  241. ccxt/async_support/idex.py +1766 -0
  242. ccxt/async_support/independentreserve.py +784 -0
  243. ccxt/async_support/indodax.py +1247 -0
  244. ccxt/async_support/jibitex.py +395 -0
  245. ccxt/async_support/kraken.py +2894 -0
  246. ccxt/async_support/krakenfutures.py +2601 -0
  247. ccxt/async_support/kucoin.py +4602 -0
  248. ccxt/async_support/kucoinfutures.py +2698 -0
  249. ccxt/async_support/kuna.py +1841 -0
  250. ccxt/async_support/latoken.py +1664 -0
  251. ccxt/async_support/lbank.py +2683 -0
  252. ccxt/async_support/luno.py +1067 -0
  253. ccxt/async_support/lykke.py +1270 -0
  254. ccxt/async_support/mercado.py +842 -0
  255. ccxt/async_support/mexc.py +5369 -0
  256. ccxt/async_support/ndax.py +2354 -0
  257. ccxt/async_support/nobitex.py +419 -0
  258. ccxt/async_support/novadax.py +1484 -0
  259. ccxt/async_support/oceanex.py +903 -0
  260. ccxt/async_support/okcoin.py +2936 -0
  261. ccxt/async_support/okexchange.py +349 -0
  262. ccxt/async_support/okx.py +7827 -0
  263. ccxt/async_support/ompfinex.py +472 -0
  264. ccxt/async_support/onetrading.py +1911 -0
  265. ccxt/async_support/oxfun.py +2773 -0
  266. ccxt/async_support/p2b.py +1194 -0
  267. ccxt/async_support/paradex.py +2015 -0
  268. ccxt/async_support/paymium.py +564 -0
  269. ccxt/async_support/phemex.py +4473 -0
  270. ccxt/async_support/poloniex.py +2232 -0
  271. ccxt/async_support/poloniexfutures.py +1717 -0
  272. ccxt/async_support/probit.py +1734 -0
  273. ccxt/async_support/ramzinex.py +476 -0
  274. ccxt/async_support/sarmayex.py +357 -0
  275. ccxt/async_support/sarrafex.py +478 -0
  276. ccxt/async_support/tabdeal.py +364 -0
  277. ccxt/async_support/tetherland.py +349 -0
  278. ccxt/async_support/timex.py +1593 -0
  279. ccxt/async_support/tokocrypto.py +2405 -0
  280. ccxt/async_support/tradeogre.py +608 -0
  281. ccxt/async_support/twox.py +326 -0
  282. ccxt/async_support/ubitex.py +409 -0
  283. ccxt/async_support/upbit.py +1833 -0
  284. ccxt/async_support/vertex.py +2922 -0
  285. ccxt/async_support/wallex.py +445 -0
  286. ccxt/async_support/wavesexchange.py +2473 -0
  287. ccxt/async_support/wazirx.py +1224 -0
  288. ccxt/async_support/whitebit.py +2469 -0
  289. ccxt/async_support/woo.py +3114 -0
  290. ccxt/async_support/woofipro.py +2533 -0
  291. ccxt/async_support/xt.py +4454 -0
  292. ccxt/async_support/yobit.py +1283 -0
  293. ccxt/async_support/zaif.py +725 -0
  294. ccxt/async_support/zonda.py +1828 -0
  295. ccxt/base/__init__.py +27 -0
  296. ccxt/base/decimal_to_precision.py +174 -0
  297. ccxt/base/errors.py +242 -0
  298. ccxt/base/exchange.py +5941 -0
  299. ccxt/base/precise.py +287 -0
  300. ccxt/base/types.py +502 -0
  301. ccxt/bequant.py +33 -0
  302. ccxt/bigone.py +2112 -0
  303. ccxt/binance.py +12233 -0
  304. ccxt/binancecoinm.py +45 -0
  305. ccxt/binanceus.py +211 -0
  306. ccxt/binanceusdm.py +58 -0
  307. ccxt/bingx.py +4324 -0
  308. ccxt/bit2c.py +866 -0
  309. ccxt/bitbank.py +1001 -0
  310. ccxt/bitbay.py +17 -0
  311. ccxt/bitbns.py +1154 -0
  312. ccxt/bitcoincom.py +17 -0
  313. ccxt/bitfinex.py +1617 -0
  314. ccxt/bitfinex2.py +3552 -0
  315. ccxt/bitflyer.py +995 -0
  316. ccxt/bitget.py +8272 -0
  317. ccxt/bithumb.py +1061 -0
  318. ccxt/bitimen.py +401 -0
  319. ccxt/bitir.py +490 -0
  320. ccxt/bitmart.py +4415 -0
  321. ccxt/bitmex.py +2756 -0
  322. ccxt/bitopro.py +1630 -0
  323. ccxt/bitpanda.py +16 -0
  324. ccxt/bitpin.py +454 -0
  325. ccxt/bitrue.py +3026 -0
  326. ccxt/bitso.py +1670 -0
  327. ccxt/bitstamp.py +2203 -0
  328. ccxt/bitteam.py +2239 -0
  329. ccxt/bitvavo.py +1968 -0
  330. ccxt/bl3p.py +485 -0
  331. ccxt/blockchaincom.py +1104 -0
  332. ccxt/blofin.py +2066 -0
  333. ccxt/btcalpha.py +891 -0
  334. ccxt/btcbox.py +544 -0
  335. ccxt/btcmarkets.py +1221 -0
  336. ccxt/btcturk.py +911 -0
  337. ccxt/bybit.py +8158 -0
  338. ccxt/cex.py +1605 -0
  339. ccxt/coinbase.py +4474 -0
  340. ccxt/coinbaseadvanced.py +17 -0
  341. ccxt/coinbaseexchange.py +1734 -0
  342. ccxt/coinbaseinternational.py +1899 -0
  343. ccxt/coincatch.py +5069 -0
  344. ccxt/coincheck.py +815 -0
  345. ccxt/coinex.py +5525 -0
  346. ccxt/coinlist.py +2243 -0
  347. ccxt/coinmate.py +1067 -0
  348. ccxt/coinmetro.py +1797 -0
  349. ccxt/coinone.py +1127 -0
  350. ccxt/coinsph.py +1850 -0
  351. ccxt/coinspot.py +534 -0
  352. ccxt/cryptocom.py +2822 -0
  353. ccxt/currencycom.py +1950 -0
  354. ccxt/delta.py +3376 -0
  355. ccxt/deribit.py +3437 -0
  356. ccxt/digifinex.py +3959 -0
  357. ccxt/eterex.py +286 -0
  358. ccxt/excoino.py +399 -0
  359. ccxt/exir.py +375 -0
  360. ccxt/exmo.py +2462 -0
  361. ccxt/exnovin.py +360 -0
  362. ccxt/farhadexchange.py +266 -0
  363. ccxt/fmfwio.py +34 -0
  364. ccxt/gate.py +6975 -0
  365. ccxt/gateio.py +16 -0
  366. ccxt/gemini.py +1824 -0
  367. ccxt/hashkey.py +4150 -0
  368. ccxt/hitbtc.py +3423 -0
  369. ccxt/hitbtc3.py +16 -0
  370. ccxt/hitobit.py +391 -0
  371. ccxt/hollaex.py +1813 -0
  372. ccxt/htx.py +8505 -0
  373. ccxt/huobi.py +16 -0
  374. ccxt/huobijp.py +1801 -0
  375. ccxt/hyperliquid.py +2430 -0
  376. ccxt/idex.py +1766 -0
  377. ccxt/independentreserve.py +784 -0
  378. ccxt/indodax.py +1247 -0
  379. ccxt/jibitex.py +395 -0
  380. ccxt/kraken.py +2894 -0
  381. ccxt/krakenfutures.py +2601 -0
  382. ccxt/kucoin.py +4601 -0
  383. ccxt/kucoinfutures.py +2698 -0
  384. ccxt/kuna.py +1841 -0
  385. ccxt/latoken.py +1664 -0
  386. ccxt/lbank.py +2682 -0
  387. ccxt/luno.py +1067 -0
  388. ccxt/lykke.py +1270 -0
  389. ccxt/mercado.py +842 -0
  390. ccxt/mexc.py +5369 -0
  391. ccxt/ndax.py +2354 -0
  392. ccxt/nobitex.py +419 -0
  393. ccxt/novadax.py +1484 -0
  394. ccxt/oceanex.py +903 -0
  395. ccxt/okcoin.py +2936 -0
  396. ccxt/okexchange.py +349 -0
  397. ccxt/okx.py +7826 -0
  398. ccxt/ompfinex.py +472 -0
  399. ccxt/onetrading.py +1911 -0
  400. ccxt/oxfun.py +2772 -0
  401. ccxt/p2b.py +1194 -0
  402. ccxt/paradex.py +2015 -0
  403. ccxt/paymium.py +564 -0
  404. ccxt/phemex.py +4473 -0
  405. ccxt/poloniex.py +2232 -0
  406. ccxt/poloniexfutures.py +1717 -0
  407. ccxt/pro/__init__.py +149 -0
  408. ccxt/pro/alpaca.py +685 -0
  409. ccxt/pro/ascendex.py +916 -0
  410. ccxt/pro/bequant.py +38 -0
  411. ccxt/pro/binance.py +3488 -0
  412. ccxt/pro/binancecoinm.py +28 -0
  413. ccxt/pro/binanceus.py +48 -0
  414. ccxt/pro/binanceusdm.py +31 -0
  415. ccxt/pro/bingx.py +1264 -0
  416. ccxt/pro/bitcoincom.py +34 -0
  417. ccxt/pro/bitfinex.py +621 -0
  418. ccxt/pro/bitfinex2.py +1083 -0
  419. ccxt/pro/bitget.py +1692 -0
  420. ccxt/pro/bithumb.py +368 -0
  421. ccxt/pro/bitmart.py +1449 -0
  422. ccxt/pro/bitmex.py +1656 -0
  423. ccxt/pro/bitopro.py +445 -0
  424. ccxt/pro/bitpanda.py +15 -0
  425. ccxt/pro/bitrue.py +447 -0
  426. ccxt/pro/bitstamp.py +522 -0
  427. ccxt/pro/bitvavo.py +1270 -0
  428. ccxt/pro/blockchaincom.py +738 -0
  429. ccxt/pro/blofin.py +692 -0
  430. ccxt/pro/bybit.py +2000 -0
  431. ccxt/pro/cex.py +1440 -0
  432. ccxt/pro/coinbase.py +678 -0
  433. ccxt/pro/coinbaseadvanced.py +16 -0
  434. ccxt/pro/coinbaseexchange.py +895 -0
  435. ccxt/pro/coinbaseinternational.py +620 -0
  436. ccxt/pro/coincatch.py +1464 -0
  437. ccxt/pro/coincheck.py +199 -0
  438. ccxt/pro/coinex.py +1061 -0
  439. ccxt/pro/coinone.py +395 -0
  440. ccxt/pro/cryptocom.py +947 -0
  441. ccxt/pro/currencycom.py +536 -0
  442. ccxt/pro/deribit.py +892 -0
  443. ccxt/pro/exmo.py +629 -0
  444. ccxt/pro/gate.py +1416 -0
  445. ccxt/pro/gateio.py +15 -0
  446. ccxt/pro/gemini.py +865 -0
  447. ccxt/pro/hashkey.py +802 -0
  448. ccxt/pro/hitbtc.py +1216 -0
  449. ccxt/pro/hollaex.py +563 -0
  450. ccxt/pro/htx.py +2215 -0
  451. ccxt/pro/huobi.py +15 -0
  452. ccxt/pro/huobijp.py +570 -0
  453. ccxt/pro/hyperliquid.py +525 -0
  454. ccxt/pro/idex.py +672 -0
  455. ccxt/pro/independentreserve.py +270 -0
  456. ccxt/pro/kraken.py +1356 -0
  457. ccxt/pro/krakenfutures.py +1492 -0
  458. ccxt/pro/kucoin.py +1133 -0
  459. ccxt/pro/kucoinfutures.py +1081 -0
  460. ccxt/pro/lbank.py +843 -0
  461. ccxt/pro/luno.py +303 -0
  462. ccxt/pro/mexc.py +1122 -0
  463. ccxt/pro/ndax.py +506 -0
  464. ccxt/pro/okcoin.py +698 -0
  465. ccxt/pro/okx.py +1851 -0
  466. ccxt/pro/onetrading.py +1275 -0
  467. ccxt/pro/oxfun.py +950 -0
  468. ccxt/pro/p2b.py +419 -0
  469. ccxt/pro/paradex.py +352 -0
  470. ccxt/pro/phemex.py +1441 -0
  471. ccxt/pro/poloniex.py +1166 -0
  472. ccxt/pro/poloniexfutures.py +990 -0
  473. ccxt/pro/probit.py +551 -0
  474. ccxt/pro/upbit.py +520 -0
  475. ccxt/pro/vertex.py +943 -0
  476. ccxt/pro/wazirx.py +749 -0
  477. ccxt/pro/whitebit.py +864 -0
  478. ccxt/pro/woo.py +1078 -0
  479. ccxt/pro/woofipro.py +1183 -0
  480. ccxt/pro/xt.py +1067 -0
  481. ccxt/probit.py +1734 -0
  482. ccxt/ramzinex.py +476 -0
  483. ccxt/sarmayex.py +357 -0
  484. ccxt/sarrafex.py +478 -0
  485. ccxt/static_dependencies/__init__.py +1 -0
  486. ccxt/static_dependencies/ecdsa/__init__.py +14 -0
  487. ccxt/static_dependencies/ecdsa/_version.py +520 -0
  488. ccxt/static_dependencies/ecdsa/curves.py +56 -0
  489. ccxt/static_dependencies/ecdsa/der.py +221 -0
  490. ccxt/static_dependencies/ecdsa/ecdsa.py +310 -0
  491. ccxt/static_dependencies/ecdsa/ellipticcurve.py +197 -0
  492. ccxt/static_dependencies/ecdsa/keys.py +332 -0
  493. ccxt/static_dependencies/ecdsa/numbertheory.py +531 -0
  494. ccxt/static_dependencies/ecdsa/rfc6979.py +100 -0
  495. ccxt/static_dependencies/ecdsa/util.py +266 -0
  496. ccxt/static_dependencies/ethereum/__init__.py +7 -0
  497. ccxt/static_dependencies/ethereum/abi/__init__.py +16 -0
  498. ccxt/static_dependencies/ethereum/abi/abi.py +19 -0
  499. ccxt/static_dependencies/ethereum/abi/base.py +152 -0
  500. ccxt/static_dependencies/ethereum/abi/codec.py +217 -0
  501. ccxt/static_dependencies/ethereum/abi/constants.py +3 -0
  502. ccxt/static_dependencies/ethereum/abi/decoding.py +565 -0
  503. ccxt/static_dependencies/ethereum/abi/encoding.py +720 -0
  504. ccxt/static_dependencies/ethereum/abi/exceptions.py +139 -0
  505. ccxt/static_dependencies/ethereum/abi/grammar.py +443 -0
  506. ccxt/static_dependencies/ethereum/abi/packed.py +13 -0
  507. ccxt/static_dependencies/ethereum/abi/py.typed +0 -0
  508. ccxt/static_dependencies/ethereum/abi/registry.py +643 -0
  509. ccxt/static_dependencies/ethereum/abi/tools/__init__.py +3 -0
  510. ccxt/static_dependencies/ethereum/abi/tools/_strategies.py +230 -0
  511. ccxt/static_dependencies/ethereum/abi/utils/__init__.py +0 -0
  512. ccxt/static_dependencies/ethereum/abi/utils/numeric.py +83 -0
  513. ccxt/static_dependencies/ethereum/abi/utils/padding.py +27 -0
  514. ccxt/static_dependencies/ethereum/abi/utils/string.py +19 -0
  515. ccxt/static_dependencies/ethereum/account/__init__.py +3 -0
  516. ccxt/static_dependencies/ethereum/account/encode_typed_data/__init__.py +4 -0
  517. ccxt/static_dependencies/ethereum/account/encode_typed_data/encoding_and_hashing.py +239 -0
  518. ccxt/static_dependencies/ethereum/account/encode_typed_data/helpers.py +40 -0
  519. ccxt/static_dependencies/ethereum/account/messages.py +263 -0
  520. ccxt/static_dependencies/ethereum/account/py.typed +0 -0
  521. ccxt/static_dependencies/ethereum/hexbytes/__init__.py +5 -0
  522. ccxt/static_dependencies/ethereum/hexbytes/_utils.py +54 -0
  523. ccxt/static_dependencies/ethereum/hexbytes/main.py +65 -0
  524. ccxt/static_dependencies/ethereum/hexbytes/py.typed +0 -0
  525. ccxt/static_dependencies/ethereum/typing/__init__.py +63 -0
  526. ccxt/static_dependencies/ethereum/typing/abi.py +6 -0
  527. ccxt/static_dependencies/ethereum/typing/bls.py +7 -0
  528. ccxt/static_dependencies/ethereum/typing/discovery.py +5 -0
  529. ccxt/static_dependencies/ethereum/typing/encoding.py +7 -0
  530. ccxt/static_dependencies/ethereum/typing/enums.py +17 -0
  531. ccxt/static_dependencies/ethereum/typing/ethpm.py +9 -0
  532. ccxt/static_dependencies/ethereum/typing/evm.py +20 -0
  533. ccxt/static_dependencies/ethereum/typing/networks.py +1122 -0
  534. ccxt/static_dependencies/ethereum/typing/py.typed +0 -0
  535. ccxt/static_dependencies/ethereum/utils/__init__.py +115 -0
  536. ccxt/static_dependencies/ethereum/utils/abi.py +72 -0
  537. ccxt/static_dependencies/ethereum/utils/address.py +171 -0
  538. ccxt/static_dependencies/ethereum/utils/applicators.py +151 -0
  539. ccxt/static_dependencies/ethereum/utils/conversions.py +190 -0
  540. ccxt/static_dependencies/ethereum/utils/currency.py +107 -0
  541. ccxt/static_dependencies/ethereum/utils/curried/__init__.py +269 -0
  542. ccxt/static_dependencies/ethereum/utils/debug.py +20 -0
  543. ccxt/static_dependencies/ethereum/utils/decorators.py +132 -0
  544. ccxt/static_dependencies/ethereum/utils/encoding.py +6 -0
  545. ccxt/static_dependencies/ethereum/utils/exceptions.py +4 -0
  546. ccxt/static_dependencies/ethereum/utils/functional.py +75 -0
  547. ccxt/static_dependencies/ethereum/utils/hexadecimal.py +74 -0
  548. ccxt/static_dependencies/ethereum/utils/humanize.py +188 -0
  549. ccxt/static_dependencies/ethereum/utils/logging.py +159 -0
  550. ccxt/static_dependencies/ethereum/utils/module_loading.py +31 -0
  551. ccxt/static_dependencies/ethereum/utils/numeric.py +43 -0
  552. ccxt/static_dependencies/ethereum/utils/py.typed +0 -0
  553. ccxt/static_dependencies/ethereum/utils/toolz.py +76 -0
  554. ccxt/static_dependencies/ethereum/utils/types.py +54 -0
  555. ccxt/static_dependencies/ethereum/utils/typing/__init__.py +18 -0
  556. ccxt/static_dependencies/ethereum/utils/typing/misc.py +14 -0
  557. ccxt/static_dependencies/ethereum/utils/units.py +31 -0
  558. ccxt/static_dependencies/keccak/__init__.py +3 -0
  559. ccxt/static_dependencies/keccak/keccak.py +197 -0
  560. ccxt/static_dependencies/lark/__init__.py +38 -0
  561. ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
  562. ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
  563. ccxt/static_dependencies/lark/ast_utils.py +59 -0
  564. ccxt/static_dependencies/lark/common.py +86 -0
  565. ccxt/static_dependencies/lark/exceptions.py +292 -0
  566. ccxt/static_dependencies/lark/grammar.py +130 -0
  567. ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
  568. ccxt/static_dependencies/lark/indenter.py +143 -0
  569. ccxt/static_dependencies/lark/lark.py +658 -0
  570. ccxt/static_dependencies/lark/lexer.py +678 -0
  571. ccxt/static_dependencies/lark/load_grammar.py +1428 -0
  572. ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
  573. ccxt/static_dependencies/lark/parser_frontends.py +257 -0
  574. ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
  575. ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
  576. ccxt/static_dependencies/lark/parsers/earley.py +314 -0
  577. ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
  578. ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
  579. ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
  580. ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
  581. ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
  582. ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
  583. ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
  584. ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
  585. ccxt/static_dependencies/lark/reconstruct.py +107 -0
  586. ccxt/static_dependencies/lark/tools/__init__.py +70 -0
  587. ccxt/static_dependencies/lark/tools/nearley.py +202 -0
  588. ccxt/static_dependencies/lark/tools/serialize.py +32 -0
  589. ccxt/static_dependencies/lark/tools/standalone.py +196 -0
  590. ccxt/static_dependencies/lark/tree.py +267 -0
  591. ccxt/static_dependencies/lark/tree_matcher.py +186 -0
  592. ccxt/static_dependencies/lark/tree_templates.py +180 -0
  593. ccxt/static_dependencies/lark/utils.py +343 -0
  594. ccxt/static_dependencies/lark/visitors.py +596 -0
  595. ccxt/static_dependencies/marshmallow/__init__.py +81 -0
  596. ccxt/static_dependencies/marshmallow/base.py +65 -0
  597. ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
  598. ccxt/static_dependencies/marshmallow/decorators.py +231 -0
  599. ccxt/static_dependencies/marshmallow/error_store.py +60 -0
  600. ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
  601. ccxt/static_dependencies/marshmallow/fields.py +2114 -0
  602. ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
  603. ccxt/static_dependencies/marshmallow/schema.py +1228 -0
  604. ccxt/static_dependencies/marshmallow/types.py +12 -0
  605. ccxt/static_dependencies/marshmallow/utils.py +378 -0
  606. ccxt/static_dependencies/marshmallow/validate.py +678 -0
  607. ccxt/static_dependencies/marshmallow/warnings.py +2 -0
  608. ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
  609. ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
  610. ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
  611. ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
  612. ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
  613. ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
  614. ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
  615. ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
  616. ccxt/static_dependencies/msgpack/__init__.py +55 -0
  617. ccxt/static_dependencies/msgpack/exceptions.py +48 -0
  618. ccxt/static_dependencies/msgpack/ext.py +168 -0
  619. ccxt/static_dependencies/msgpack/fallback.py +951 -0
  620. ccxt/static_dependencies/parsimonious/__init__.py +10 -0
  621. ccxt/static_dependencies/parsimonious/exceptions.py +105 -0
  622. ccxt/static_dependencies/parsimonious/expressions.py +479 -0
  623. ccxt/static_dependencies/parsimonious/grammar.py +487 -0
  624. ccxt/static_dependencies/parsimonious/nodes.py +325 -0
  625. ccxt/static_dependencies/parsimonious/utils.py +40 -0
  626. ccxt/static_dependencies/starknet/__init__.py +0 -0
  627. ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
  628. ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
  629. ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
  630. ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
  631. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
  632. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
  633. ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
  634. ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
  635. ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
  636. ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
  637. ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
  638. ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
  639. ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
  640. ccxt/static_dependencies/starknet/common.py +15 -0
  641. ccxt/static_dependencies/starknet/constants.py +39 -0
  642. ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
  643. ccxt/static_dependencies/starknet/hash/address.py +79 -0
  644. ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
  645. ccxt/static_dependencies/starknet/hash/selector.py +16 -0
  646. ccxt/static_dependencies/starknet/hash/storage.py +12 -0
  647. ccxt/static_dependencies/starknet/hash/utils.py +78 -0
  648. ccxt/static_dependencies/starknet/models/__init__.py +0 -0
  649. ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
  650. ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
  651. ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
  652. ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
  653. ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
  654. ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
  655. ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
  656. ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
  657. ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
  658. ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
  659. ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
  660. ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
  661. ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
  662. ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
  663. ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
  664. ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
  665. ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
  666. ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
  667. ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
  668. ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
  669. ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
  670. ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
  671. ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
  672. ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
  673. ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
  674. ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
  675. ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
  676. ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
  677. ccxt/static_dependencies/starknet/utils/schema.py +13 -0
  678. ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
  679. ccxt/static_dependencies/starkware/__init__.py +0 -0
  680. ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
  681. ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
  682. ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
  683. ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
  684. ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
  685. ccxt/static_dependencies/sympy/__init__.py +0 -0
  686. ccxt/static_dependencies/sympy/core/__init__.py +0 -0
  687. ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
  688. ccxt/static_dependencies/sympy/external/__init__.py +0 -0
  689. ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
  690. ccxt/static_dependencies/sympy/external/importtools.py +187 -0
  691. ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
  692. ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
  693. ccxt/static_dependencies/toolz/__init__.py +26 -0
  694. ccxt/static_dependencies/toolz/_signatures.py +784 -0
  695. ccxt/static_dependencies/toolz/_version.py +520 -0
  696. ccxt/static_dependencies/toolz/compatibility.py +30 -0
  697. ccxt/static_dependencies/toolz/curried/__init__.py +101 -0
  698. ccxt/static_dependencies/toolz/curried/exceptions.py +22 -0
  699. ccxt/static_dependencies/toolz/curried/operator.py +22 -0
  700. ccxt/static_dependencies/toolz/dicttoolz.py +339 -0
  701. ccxt/static_dependencies/toolz/functoolz.py +1049 -0
  702. ccxt/static_dependencies/toolz/itertoolz.py +1057 -0
  703. ccxt/static_dependencies/toolz/recipes.py +46 -0
  704. ccxt/static_dependencies/toolz/utils.py +9 -0
  705. ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
  706. ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
  707. ccxt/tabdeal.py +364 -0
  708. ccxt/test/__init__.py +3 -0
  709. ccxt/test/base/__init__.py +29 -0
  710. ccxt/test/base/test_account.py +26 -0
  711. ccxt/test/base/test_balance.py +56 -0
  712. ccxt/test/base/test_borrow_interest.py +35 -0
  713. ccxt/test/base/test_borrow_rate.py +32 -0
  714. ccxt/test/base/test_calculate_fee.py +51 -0
  715. ccxt/test/base/test_crypto.py +127 -0
  716. ccxt/test/base/test_currency.py +76 -0
  717. ccxt/test/base/test_datetime.py +109 -0
  718. ccxt/test/base/test_decimal_to_precision.py +392 -0
  719. ccxt/test/base/test_deep_extend.py +68 -0
  720. ccxt/test/base/test_deposit_withdrawal.py +50 -0
  721. ccxt/test/base/test_exchange_datetime_functions.py +76 -0
  722. ccxt/test/base/test_funding_rate_history.py +29 -0
  723. ccxt/test/base/test_last_price.py +31 -0
  724. ccxt/test/base/test_ledger_entry.py +45 -0
  725. ccxt/test/base/test_ledger_item.py +48 -0
  726. ccxt/test/base/test_leverage_tier.py +33 -0
  727. ccxt/test/base/test_liquidation.py +50 -0
  728. ccxt/test/base/test_margin_mode.py +24 -0
  729. ccxt/test/base/test_margin_modification.py +35 -0
  730. ccxt/test/base/test_market.py +193 -0
  731. ccxt/test/base/test_number.py +411 -0
  732. ccxt/test/base/test_ohlcv.py +33 -0
  733. ccxt/test/base/test_open_interest.py +32 -0
  734. ccxt/test/base/test_order.py +64 -0
  735. ccxt/test/base/test_order_book.py +69 -0
  736. ccxt/test/base/test_position.py +60 -0
  737. ccxt/test/base/test_shared_methods.py +353 -0
  738. ccxt/test/base/test_status.py +24 -0
  739. ccxt/test/base/test_throttle.py +126 -0
  740. ccxt/test/base/test_ticker.py +92 -0
  741. ccxt/test/base/test_trade.py +47 -0
  742. ccxt/test/base/test_trading_fee.py +26 -0
  743. ccxt/test/base/test_transaction.py +39 -0
  744. ccxt/test/test_async.py +1649 -0
  745. ccxt/test/test_sync.py +1648 -0
  746. ccxt/test/tests_async.py +1558 -0
  747. ccxt/test/tests_helpers.py +287 -0
  748. ccxt/test/tests_init.py +39 -0
  749. ccxt/test/tests_sync.py +1555 -0
  750. ccxt/tetherland.py +349 -0
  751. ccxt/timex.py +1593 -0
  752. ccxt/tokocrypto.py +2405 -0
  753. ccxt/tradeogre.py +608 -0
  754. ccxt/twox.py +326 -0
  755. ccxt/ubitex.py +409 -0
  756. ccxt/upbit.py +1833 -0
  757. ccxt/vertex.py +2922 -0
  758. ccxt/wallex.py +445 -0
  759. ccxt/wavesexchange.py +2472 -0
  760. ccxt/wazirx.py +1224 -0
  761. ccxt/whitebit.py +2469 -0
  762. ccxt/woo.py +3114 -0
  763. ccxt/woofipro.py +2533 -0
  764. ccxt/xt.py +4453 -0
  765. ccxt/yobit.py +1283 -0
  766. ccxt/zaif.py +725 -0
  767. ccxt/zonda.py +1828 -0
  768. ccxt_ir-4.3.46.0.1.dist-info/LICENSE.txt +21 -0
  769. ccxt_ir-4.3.46.0.1.dist-info/METADATA +655 -0
  770. ccxt_ir-4.3.46.0.1.dist-info/RECORD +772 -0
  771. ccxt_ir-4.3.46.0.1.dist-info/WHEEL +6 -0
  772. ccxt_ir-4.3.46.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1850 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+
6
+ from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.coinsph import ImplicitAPI
8
+ import hashlib
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
10
+ from typing import List
11
+ from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
13
+ from ccxt.base.errors import PermissionDenied
14
+ from ccxt.base.errors import ArgumentsRequired
15
+ from ccxt.base.errors import BadRequest
16
+ from ccxt.base.errors import BadSymbol
17
+ from ccxt.base.errors import BadResponse
18
+ from ccxt.base.errors import InsufficientFunds
19
+ from ccxt.base.errors import InvalidAddress
20
+ from ccxt.base.errors import InvalidOrder
21
+ from ccxt.base.errors import OrderNotFound
22
+ from ccxt.base.errors import OrderImmediatelyFillable
23
+ from ccxt.base.errors import DuplicateOrderId
24
+ from ccxt.base.errors import NotSupported
25
+ from ccxt.base.errors import RateLimitExceeded
26
+ from ccxt.base.errors import ExchangeNotAvailable
27
+ from ccxt.base.decimal_to_precision import TICK_SIZE
28
+ from ccxt.base.precise import Precise
29
+
30
+
31
+ class coinsph(Exchange, ImplicitAPI):
32
+
33
+ def describe(self):
34
+ return self.deep_extend(super(coinsph, self).describe(), {
35
+ 'id': 'coinsph',
36
+ 'name': 'Coins.ph',
37
+ 'countries': ['PH'], # Philippines
38
+ 'version': 'v1',
39
+ 'rateLimit': 50, # 1200 per minute
40
+ 'certified': False,
41
+ 'pro': False,
42
+ 'has': {
43
+ 'CORS': None,
44
+ 'spot': True,
45
+ 'margin': False,
46
+ 'swap': False,
47
+ 'future': False,
48
+ 'option': False,
49
+ 'addMargin': False,
50
+ 'cancelAllOrders': True,
51
+ 'cancelOrder': True,
52
+ 'cancelOrders': False,
53
+ 'closeAllPositions': False,
54
+ 'closePosition': False,
55
+ 'createDepositAddress': False,
56
+ 'createMarketBuyOrderWithCost': True,
57
+ 'createMarketOrderWithCost': False,
58
+ 'createMarketSellOrderWithCost': False,
59
+ 'createOrder': True,
60
+ 'createPostOnlyOrder': False,
61
+ 'createReduceOnlyOrder': False,
62
+ 'createStopLimitOrder': True,
63
+ 'createStopMarketOrder': True,
64
+ 'createStopOrder': True,
65
+ 'deposit': True,
66
+ 'editOrder': False,
67
+ 'fetchAccounts': False,
68
+ 'fetchBalance': True,
69
+ 'fetchBidsAsks': False,
70
+ 'fetchBorrowInterest': False,
71
+ 'fetchBorrowRateHistories': False,
72
+ 'fetchBorrowRateHistory': False,
73
+ 'fetchCanceledOrders': False,
74
+ 'fetchClosedOrder': False,
75
+ 'fetchClosedOrders': True,
76
+ 'fetchCrossBorrowRate': False,
77
+ 'fetchCrossBorrowRates': False,
78
+ 'fetchCurrencies': False,
79
+ 'fetchDeposit': None,
80
+ 'fetchDepositAddress': True,
81
+ 'fetchDepositAddresses': False,
82
+ 'fetchDepositAddressesByNetwork': False,
83
+ 'fetchDeposits': True,
84
+ 'fetchDepositWithdrawFee': False,
85
+ 'fetchDepositWithdrawFees': False,
86
+ 'fetchFundingHistory': False,
87
+ 'fetchFundingRate': False,
88
+ 'fetchFundingRateHistory': False,
89
+ 'fetchFundingRates': False,
90
+ 'fetchIndexOHLCV': False,
91
+ 'fetchIsolatedBorrowRate': False,
92
+ 'fetchIsolatedBorrowRates': False,
93
+ 'fetchL3OrderBook': False,
94
+ 'fetchLedger': False,
95
+ 'fetchLeverage': False,
96
+ 'fetchLeverageTiers': False,
97
+ 'fetchMarketLeverageTiers': False,
98
+ 'fetchMarkets': True,
99
+ 'fetchMarkOHLCV': False,
100
+ 'fetchMyTrades': True,
101
+ 'fetchOHLCV': True,
102
+ 'fetchOpenInterestHistory': False,
103
+ 'fetchOpenOrder': None,
104
+ 'fetchOpenOrders': True,
105
+ 'fetchOrder': True,
106
+ 'fetchOrderBook': True,
107
+ 'fetchOrderBooks': False,
108
+ 'fetchOrders': False,
109
+ 'fetchOrderTrades': True,
110
+ 'fetchPosition': False,
111
+ 'fetchPositionHistory': False,
112
+ 'fetchPositionMode': False,
113
+ 'fetchPositions': False,
114
+ 'fetchPositionsForSymbol': False,
115
+ 'fetchPositionsHistory': False,
116
+ 'fetchPositionsRisk': False,
117
+ 'fetchPremiumIndexOHLCV': False,
118
+ 'fetchStatus': True,
119
+ 'fetchTicker': True,
120
+ 'fetchTickers': True,
121
+ 'fetchTime': True,
122
+ 'fetchTrades': True,
123
+ 'fetchTradingFee': True,
124
+ 'fetchTradingFees': True,
125
+ 'fetchTradingLimits': False,
126
+ 'fetchTransactionFee': False,
127
+ 'fetchTransactionFees': False,
128
+ 'fetchTransactions': False,
129
+ 'fetchTransfers': False,
130
+ 'fetchWithdrawal': None,
131
+ 'fetchWithdrawals': True,
132
+ 'fetchWithdrawalWhitelist': False,
133
+ 'reduceMargin': False,
134
+ 'repayCrossMargin': False,
135
+ 'repayIsolatedMargin': False,
136
+ 'setLeverage': False,
137
+ 'setMargin': False,
138
+ 'setMarginMode': False,
139
+ 'setPositionMode': False,
140
+ 'signIn': False,
141
+ 'transfer': False,
142
+ 'withdraw': True,
143
+ 'ws': False,
144
+ },
145
+ 'timeframes': {
146
+ '1m': '1m',
147
+ '3m': '3m',
148
+ '5m': '5m',
149
+ '15m': '15m',
150
+ '30m': '30m',
151
+ '1h': '1h',
152
+ '2h': '2h',
153
+ '4h': '4h',
154
+ '6h': '6h',
155
+ '8h': '8h',
156
+ '12h': '12h',
157
+ '1d': '1d',
158
+ '3d': '3d',
159
+ '1w': '1w',
160
+ '1M': '1M',
161
+ },
162
+ 'urls': {
163
+ 'logo': 'https://user-images.githubusercontent.com/1294454/225719995-48ab2026-4ddb-496c-9da7-0d7566617c9b.jpg',
164
+ 'api': {
165
+ 'public': 'https://api.pro.coins.ph',
166
+ 'private': 'https://api.pro.coins.ph',
167
+ },
168
+ 'www': 'https://coins.ph/',
169
+ 'doc': [
170
+ 'https://coins-docs.github.io/rest-api',
171
+ ],
172
+ 'fees': 'https://support.coins.ph/hc/en-us/sections/4407198694681-Limits-Fees',
173
+ },
174
+ 'api': {
175
+ 'public': {
176
+ 'get': {
177
+ 'openapi/v1/ping': 1,
178
+ 'openapi/v1/time': 1,
179
+ # cost 1 if 'symbol' param defined(one market symbol) or if 'symbols' param is a list of 1-20 market symbols
180
+ # cost 20 if 'symbols' param is a list of 21-100 market symbols
181
+ # cost 40 if 'symbols' param is a list of 101 or more market symbols or if both 'symbol' and 'symbols' params are omited
182
+ 'openapi/quote/v1/ticker/24hr': {'cost': 1, 'noSymbolAndNoSymbols': 40, 'byNumberOfSymbols': [[101, 40], [21, 20], [0, 1]]},
183
+ # cost 1 if 'symbol' param defined(one market symbol)
184
+ # cost 2 if 'symbols' param is a list of 1 or more market symbols or if both 'symbol' and 'symbols' params are omited
185
+ 'openapi/quote/v1/ticker/price': {'cost': 1, 'noSymbol': 2},
186
+ # cost 1 if 'symbol' param defined(one market symbol)
187
+ # cost 2 if 'symbols' param is a list of 1 or more market symbols or if both 'symbol' and 'symbols' params are omited
188
+ 'openapi/quote/v1/ticker/bookTicker': {'cost': 1, 'noSymbol': 2},
189
+ 'openapi/v1/exchangeInfo': 10,
190
+ # cost 1 if limit <= 100; 5 if limit > 100.
191
+ 'openapi/quote/v1/depth': {'cost': 1, 'byLimit': [[101, 5], [0, 1]]},
192
+ 'openapi/quote/v1/klines': 1, # default limit 500; max 1000.
193
+ 'openapi/quote/v1/trades': 1, # default limit 500; max 1000. if limit <=0 or > 1000 then return 1000
194
+ 'openapi/v1/pairs': 1,
195
+ 'openapi/quote/v1/avgPrice': 1,
196
+ },
197
+ },
198
+ 'private': {
199
+ 'get': {
200
+ 'openapi/wallet/v1/config/getall': 10,
201
+ 'openapi/wallet/v1/deposit/address': 10,
202
+ 'openapi/wallet/v1/deposit/history': 1,
203
+ 'openapi/wallet/v1/withdraw/history': 1,
204
+ 'openapi/v1/account': 10,
205
+ # cost 3 for a single symbol; 40 when the symbol parameter is omitted
206
+ 'openapi/v1/openOrders': {'cost': 3, 'noSymbol': 40},
207
+ 'openapi/v1/asset/tradeFee': 1,
208
+ 'openapi/v1/order': 2,
209
+ # cost 10 with symbol, 40 when the symbol parameter is omitted
210
+ 'openapi/v1/historyOrders': {'cost': 10, 'noSymbol': 40},
211
+ 'openapi/v1/myTrades': 10,
212
+ 'openapi/v1/capital/deposit/history': 1,
213
+ 'openapi/v1/capital/withdraw/history': 1,
214
+ 'openapi/v3/payment-request/get-payment-request': 1,
215
+ 'merchant-api/v1/get-invoices': 1,
216
+ 'openapi/account/v3/crypto-accounts': 1,
217
+ 'openapi/transfer/v3/transfers/{id}': 1,
218
+ },
219
+ 'post': {
220
+ 'openapi/wallet/v1/withdraw/apply': 600,
221
+ 'openapi/v1/order/test': 1,
222
+ 'openapi/v1/order': 1,
223
+ 'openapi/v1/capital/withdraw/apply': 1,
224
+ 'openapi/v1/capital/deposit/apply': 1,
225
+ 'openapi/v3/payment-request/payment-requests': 1,
226
+ 'openapi/v3/payment-request/delete-payment-request': 1,
227
+ 'openapi/v3/payment-request/payment-request-reminder': 1,
228
+ 'openapi/v1/userDataStream': 1,
229
+ 'merchant-api/v1/invoices': 1,
230
+ 'merchant-api/v1/invoices-cancel': 1,
231
+ 'openapi/convert/v1/get-supported-trading-pairs': 1,
232
+ 'openapi/convert/v1/get-quote': 1,
233
+ 'openapi/convert/v1/accpet-quote': 1,
234
+ 'openapi/fiat/v1/support-channel': 1,
235
+ 'openapi/fiat/v1/cash-out': 1,
236
+ 'openapi/fiat/v1/history': 1,
237
+ 'openapi/migration/v4/sellorder': 1,
238
+ 'openapi/migration/v4/validate-field': 1,
239
+ 'openapi/transfer/v3/transfers': 1,
240
+ },
241
+ 'delete': {
242
+ 'openapi/v1/order': 1,
243
+ 'openapi/v1/openOrders': 1,
244
+ 'openapi/v1/userDataStream': 1,
245
+ },
246
+ },
247
+ },
248
+ 'fees': {
249
+ # todo: zero fees for USDT, ETH and BTC markets till 2023-04-02
250
+ 'trading': {
251
+ 'feeSide': 'get',
252
+ 'tierBased': True,
253
+ 'percentage': True,
254
+ 'maker': self.parse_number('0.0025'),
255
+ 'taker': self.parse_number('0.003'),
256
+ 'tiers': {
257
+ 'taker': [
258
+ [self.parse_number('0'), self.parse_number('0.003')],
259
+ [self.parse_number('500000'), self.parse_number('0.0027')],
260
+ [self.parse_number('1000000'), self.parse_number('0.0024')],
261
+ [self.parse_number('2500000'), self.parse_number('0.002')],
262
+ [self.parse_number('5000000'), self.parse_number('0.0018')],
263
+ [self.parse_number('10000000'), self.parse_number('0.0015')],
264
+ [self.parse_number('100000000'), self.parse_number('0.0012')],
265
+ [self.parse_number('500000000'), self.parse_number('0.0009')],
266
+ [self.parse_number('1000000000'), self.parse_number('0.0007')],
267
+ [self.parse_number('2500000000'), self.parse_number('0.0005')],
268
+ ],
269
+ 'maker': [
270
+ [self.parse_number('0'), self.parse_number('0.0025')],
271
+ [self.parse_number('500000'), self.parse_number('0.0022')],
272
+ [self.parse_number('1000000'), self.parse_number('0.0018')],
273
+ [self.parse_number('2500000'), self.parse_number('0.0015')],
274
+ [self.parse_number('5000000'), self.parse_number('0.0012')],
275
+ [self.parse_number('10000000'), self.parse_number('0.001')],
276
+ [self.parse_number('100000000'), self.parse_number('0.0008')],
277
+ [self.parse_number('500000000'), self.parse_number('0.0007')],
278
+ [self.parse_number('1000000000'), self.parse_number('0.0006')],
279
+ [self.parse_number('2500000000'), self.parse_number('0.0005')],
280
+ ],
281
+ },
282
+ },
283
+ },
284
+ 'precisionMode': TICK_SIZE,
285
+ # exchange-specific options
286
+ 'options': {
287
+ 'createMarketBuyOrderRequiresPrice': True, # True or False
288
+ 'withdraw': {
289
+ 'warning': False,
290
+ },
291
+ 'deposit': {
292
+ 'warning': False,
293
+ },
294
+ 'createOrder': {
295
+ 'timeInForce': 'GTC', # FOK, IOC
296
+ 'newOrderRespType': {
297
+ 'market': 'FULL', # FULL, RESULT. ACK
298
+ 'limit': 'FULL', # we change it from 'ACK' by default to 'FULL'
299
+ },
300
+ },
301
+ 'fetchTicker': {
302
+ 'method': 'publicGetOpenapiQuoteV1Ticker24hr', # publicGetOpenapiQuoteV1TickerPrice, publicGetOpenapiQuoteV1TickerBookTicker
303
+ },
304
+ 'fetchTickers': {
305
+ 'method': 'publicGetOpenapiQuoteV1Ticker24hr', # publicGetOpenapiQuoteV1TickerPrice, publicGetOpenapiQuoteV1TickerBookTicker
306
+ },
307
+ 'networks': {
308
+ # all networks: 'ETH', 'TRX', 'BSC', 'ARBITRUM', 'RON', 'BTC', 'XRP'
309
+ # you can call api privateGetOpenapiWalletV1ConfigGetall to check which network is supported for the currency
310
+ 'TRC20': 'TRX',
311
+ 'ERC20': 'ETH',
312
+ 'BEP20': 'BSC',
313
+ 'ARB': 'ARBITRUM',
314
+ },
315
+ },
316
+ # https://coins-docs.github.io/errors/
317
+ 'exceptions': {
318
+ 'exact': {
319
+ '-1000': BadRequest, # An unknown error occured while processing the request.
320
+ '-1001': BadRequest, # {"code":-1001,"msg":"Internal error."}
321
+ '-1002': AuthenticationError, # You are not authorized to execute self request. Request need API Key included in . We suggest that API Key be included in any request.
322
+ '-1003': RateLimitExceeded, # Too many requests; please use the websocket for live updates. Too many requests; current limit is %s requests per minute. Please use the websocket for live updates to avoid polling the API. Way too many requests; IP banned until %s. Please use the websocket for live updates to avoid bans.
323
+ '-1004': InvalidOrder, # {"code":-1004,"msg":"Missing required parameter \u0027symbol\u0027"}
324
+ '-1006': BadResponse, # An unexpected response was received from the message bus. Execution status unknown. OPEN API server find some exception in execute request .Please report to Customer service.
325
+ '-1007': BadResponse, # Timeout waiting for response from backend server. Send status unknown; execution status unknown.
326
+ '-1014': InvalidOrder, # Unsupported order combination.
327
+ '-1015': RateLimitExceeded, # Reach the rate limit .Please slow down your request speed. Too many new orders. Too many new orders; current limit is %s orders per %s.
328
+ '-1016': NotSupported, # This service is no longer available.
329
+ '-1020': NotSupported, # This operation is not supported.
330
+ '-1021': BadRequest, # {"code":-1021,"msg":"Timestamp for self request is outside of the recvWindow."}
331
+ '-1022': BadRequest, # {"code":-1022,"msg":"Signature for self request is not valid."}
332
+ '-1023': AuthenticationError, # Please set IP whitelist before using API.
333
+ '-1024': BadRequest, # {"code":-1024,"msg":"recvWindow is not valid."}
334
+ '-1025': BadRequest, # {"code":-1025,"msg":"recvWindow cannot be greater than 60000"}
335
+ '-1030': ExchangeError, # Business error.
336
+ '-1100': BadRequest, # Illegal characters found in a parameter. Illegal characters found in parameter ‘%s’; legal range is ‘%s’.
337
+ '-1101': BadRequest, # Too many parameters sent for self endpoint. Too many parameters; expected ‘%s’ and received ‘%s’. Duplicate values for a parameter detected.
338
+ '-1102': BadRequest, # A mandatory parameter was not sent, was empty/null, or malformed. Mandatory parameter ‘%s’ was not sent, was empty/null, or malformed. Param ‘%s’ or ‘%s’ must be sent, but both were empty/null!
339
+ '-1103': BadRequest, # An unknown parameter was sent. In BHEx Open Api , each request requires at least one parameter. {Timestamp}.
340
+ '-1104': BadRequest, # Not all sent parameters were read. Not all sent parameters were read; read ‘%s’ parameter(s) but was sent ‘%s’.
341
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter \u0027orderId and origClientOrderId\u0027 is empty."}
342
+ '-1106': BadRequest, # A parameter was sent when not required. Parameter ‘%s’ sent when not required.
343
+ '-1111': BadRequest, # Precision is over the maximum defined for self asset.
344
+ '-1112': BadResponse, # No orders on book for symbol.
345
+ '-1114': BadRequest, # TimeInForce parameter sent when not required.
346
+ '-1115': InvalidOrder, # {"code":-1115,"msg":"Invalid timeInForce."}
347
+ '-1116': InvalidOrder, # {"code":-1116,"msg":"Invalid orderType."}
348
+ '-1117': InvalidOrder, # {"code":-1117,"msg":"Invalid side."}
349
+ '-1118': InvalidOrder, # New client order ID was empty.
350
+ '-1119': InvalidOrder, # Original client order ID was empty.
351
+ '-1120': BadRequest, # Invalid interval.
352
+ '-1121': BadSymbol, # Invalid symbol.
353
+ '-1122': InvalidOrder, # Invalid newOrderRespType.
354
+ '-1125': BadRequest, # This listenKey does not exist.
355
+ '-1127': BadRequest, # Lookup interval is too big. More than %s hours between startTime and endTime.
356
+ '-1128': BadRequest, # Combination of optional parameters invalid.
357
+ '-1130': BadRequest, # Invalid data sent for a parameter. Data sent for paramter ‘%s’ is not valid.
358
+ '-1131': InsufficientFunds, # {"code":-1131,"msg":"Balance insufficient "}
359
+ '-1132': InvalidOrder, # Order price too high.
360
+ '-1133': InvalidOrder, # Order price lower than the minimum,please check general broker info.
361
+ '-1134': InvalidOrder, # Order price decimal too long,please check general broker info.
362
+ '-1135': InvalidOrder, # Order quantity too large.
363
+ '-1136': InvalidOrder, # Order quantity lower than the minimum.
364
+ '-1137': InvalidOrder, # Order quantity decimal too long.
365
+ '-1138': InvalidOrder, # Order price exceeds permissible range.
366
+ '-1139': InvalidOrder, # Order has been filled.
367
+ '-1140': InvalidOrder, # {"code":-1140,"msg":"Transaction amount lower than the minimum."}
368
+ '-1141': DuplicateOrderId, # {"code":-1141,"msg":"Duplicate clientOrderId"}
369
+ '-1142': InvalidOrder, # {"code":-1142,"msg":"Order has been canceled"}
370
+ '-1143': OrderNotFound, # Cannot be found on order book
371
+ '-1144': InvalidOrder, # Order has been locked
372
+ '-1145': InvalidOrder, # This order type does not support cancellation
373
+ '-1146': InvalidOrder, # Order creation timeout
374
+ '-1147': InvalidOrder, # Order cancellation timeout
375
+ '-1148': InvalidOrder, # Market order amount decimal too long
376
+ '-1149': InvalidOrder, # Create order failed
377
+ '-1150': InvalidOrder, # Cancel order failed
378
+ '-1151': BadSymbol, # The trading pair is not open yet
379
+ '-1152': NotSupported, # Coming soon
380
+ '-1153': AuthenticationError, # User not exist
381
+ '-1154': BadRequest, # Invalid price type
382
+ '-1155': BadRequest, # Invalid position side
383
+ '-1156': InvalidOrder, # Order quantity invalid
384
+ '-1157': BadSymbol, # The trading pair is not available for api trading
385
+ '-1158': InvalidOrder, # create limit maker order failed
386
+ '-1159': InvalidOrder, # {"code":-1159,"msg":"STOP_LOSS/TAKE_PROFIT order is not allowed to trade immediately"}
387
+ '-1160': BadRequest, # Modify futures margin error
388
+ '-1161': BadRequest, # Reduce margin forbidden
389
+ '-2010': InvalidOrder, # {"code":-2010,"msg":"New order rejected."}
390
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"Order does not exist."}
391
+ '-2011': BadRequest, # CANCEL_REJECTED
392
+ '-2014': BadRequest, # API-key format invalid.
393
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
394
+ '-2016': BadResponse, # No trading window could be found for the symbol. Try ticker/24hrs instead
395
+ '-3126': InvalidOrder, # {"code":-3126,"msg":"Order price lower than 72005.93415"}
396
+ '-3127': InvalidOrder, # {"code":-3127,"msg":"Order price higher than 1523.192"}
397
+ '-4001': BadRequest, # {"code":-4001,"msg":"start time must less than end time"}
398
+ '-100011': BadSymbol, # {"code":-100011,"msg":"Not supported symbols"}
399
+ '-100012': BadSymbol, # {"code":-100012,"msg":"Parameter symbol [str] missing!"}
400
+ '-30008': InsufficientFunds, # {"code":-30008,"msg":"withdraw balance insufficient"}
401
+ '-30036': InsufficientFunds, # {"code":-30036,"msg":"Available balance not enough!"}
402
+ '403': ExchangeNotAvailable,
403
+ },
404
+ 'broad': {
405
+ 'Unknown order sent': OrderNotFound, # The order(by either orderId, clOrdId, origClOrdId) could not be found
406
+ 'Duplicate order sent': DuplicateOrderId, # The clOrdId is already in use
407
+ 'Market is closed': BadSymbol, # The symbol is not trading
408
+ 'Account has insufficient balance for requested action': InsufficientFunds, # Not enough funds to complete the action
409
+ 'Market orders are not supported for self symbol': BadSymbol, # MARKET is not enabled on the symbol
410
+ 'Iceberg orders are not supported for self symbol': BadSymbol, # icebergQty is not enabled on the symbol
411
+ 'Stop loss orders are not supported for self symbol': BadSymbol, # STOP_LOSS is not enabled on the symbol
412
+ 'Stop loss limit orders are not supported for self symbol': BadSymbol, # STOP_LOSS_LIMIT is not enabled on the symbol
413
+ 'Take profit orders are not supported for self symbol': BadSymbol, # TAKE_PROFIT is not enabled on the symbol
414
+ 'Take profit limit orders are not supported for self symbol': BadSymbol, # TAKE_PROFIT_LIMIT is not enabled on the symbol
415
+ 'Price* QTY is zero or less': BadRequest, # price* quantity is too low
416
+ 'IcebergQty exceeds QTY': BadRequest, # icebergQty must be less than the order quantity
417
+ 'This action disabled is on self account': PermissionDenied, # Contact customer support; some actions have been disabled on the account.
418
+ 'Unsupported order combination': InvalidOrder, # The orderType, timeInForce, stopPrice, and or icebergQty combination isn’t allowed.
419
+ 'Order would trigger immediately': InvalidOrder, # The order’s stop price is not valid when compared to the last traded price.
420
+ 'Cancel order is invalid. Check origClOrdId and orderId': InvalidOrder, # No origClOrdId or orderId was sent in.
421
+ 'Order would immediately match and take': OrderImmediatelyFillable, # LIMIT_MAKER order type would immediately match and trade, and not be a pure maker order.
422
+ 'PRICE_FILTER': InvalidOrder, # price is too high, too low, and or not following the tick size rule for the symbol.
423
+ 'LOT_SIZE': InvalidOrder, # quantity is too high, too low, and or not following the step size rule for the symbol.
424
+ 'MIN_NOTIONAL': InvalidOrder, # price* quantity is too low to be a valid order for the symbol.
425
+ 'MAX_NUM_ORDERS': InvalidOrder, # Account has too many open orders on the symbol.
426
+ 'MAX_ALGO_ORDERS': InvalidOrder, # Account has too many open stop loss and or take profit orders on the symbol.
427
+ 'BROKER_MAX_NUM_ORDERS': InvalidOrder, # Account has too many open orders on the broker.
428
+ 'BROKER_MAX_ALGO_ORDERS': InvalidOrder, # Account has too many open stop loss and or take profit orders on the broker.
429
+ 'ICEBERG_PARTS': BadRequest, # Iceberg order would break into too many parts; icebergQty is too small.
430
+ },
431
+ },
432
+ })
433
+
434
+ def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
435
+ if ('noSymbol' in config) and not ('symbol' in params):
436
+ return config['noSymbol']
437
+ elif ('noSymbolAndNoSymbols' in config) and not ('symbol' in params) and not ('symbols' in params):
438
+ return config['noSymbolAndNoSymbols']
439
+ elif ('byNumberOfSymbols' in config) and ('symbols' in params):
440
+ symbols = params['symbols']
441
+ symbolsAmount = len(symbols)
442
+ byNumberOfSymbols = config['byNumberOfSymbols']
443
+ for i in range(0, len(byNumberOfSymbols)):
444
+ entry = byNumberOfSymbols[i]
445
+ if symbolsAmount >= entry[0]:
446
+ return entry[1]
447
+ elif ('byLimit' in config) and ('limit' in params):
448
+ limit = params['limit']
449
+ byLimit = config['byLimit']
450
+ for i in range(0, len(byLimit)):
451
+ entry = byLimit[i]
452
+ if limit >= entry[0]:
453
+ return entry[1]
454
+ return self.safe_value(config, 'cost', 1)
455
+
456
+ async def fetch_status(self, params={}):
457
+ """
458
+ the latest known information on the availability of the exchange API
459
+ :see: https://coins-docs.github.io/rest-api/#test-connectivity
460
+ :param dict [params]: extra parameters specific to the exchange API endpoint
461
+ :returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
462
+ """
463
+ response = await self.publicGetOpenapiV1Ping(params)
464
+ return {
465
+ 'status': 'ok', # if there's no Errors, status = 'ok'
466
+ 'updated': None,
467
+ 'eta': None,
468
+ 'url': None,
469
+ 'info': response,
470
+ }
471
+
472
+ async def fetch_time(self, params={}):
473
+ """
474
+ fetches the current integer timestamp in milliseconds from the exchange server
475
+ :see: https://coins-docs.github.io/rest-api/#check-server-time
476
+ :param dict [params]: extra parameters specific to the exchange API endpoint
477
+ :returns int: the current integer timestamp in milliseconds from the exchange server
478
+ """
479
+ response = await self.publicGetOpenapiV1Time(params)
480
+ #
481
+ # {"serverTime":1677705408268}
482
+ #
483
+ return self.safe_integer(response, 'serverTime')
484
+
485
+ async def fetch_markets(self, params={}) -> List[Market]:
486
+ """
487
+ retrieves data on all markets for coinsph
488
+ :see: https://coins-docs.github.io/rest-api/#exchange-information
489
+ :param dict [params]: extra parameters specific to the exchange API endpoint
490
+ :returns dict[]: an array of objects representing market data
491
+ """
492
+ response = await self.publicGetOpenapiV1ExchangeInfo(params)
493
+ #
494
+ # {
495
+ # "timezone": "UTC",
496
+ # "serverTime": "1677449496897",
497
+ # "exchangeFilters": [],
498
+ # "symbols": [
499
+ # {
500
+ # "symbol": "XRPPHP",
501
+ # "status": "TRADING",
502
+ # "baseAsset": "XRP",
503
+ # "baseAssetPrecision": "2",
504
+ # "quoteAsset": "PHP",
505
+ # "quoteAssetPrecision": "4",
506
+ # "orderTypes": [
507
+ # "LIMIT",
508
+ # "MARKET",
509
+ # "LIMIT_MAKER",
510
+ # "STOP_LOSS_LIMIT",
511
+ # "STOP_LOSS",
512
+ # "TAKE_PROFIT_LIMIT",
513
+ # "TAKE_PROFIT"
514
+ # ],
515
+ # "filters": [
516
+ # {
517
+ # "minPrice": "0.01",
518
+ # "maxPrice": "99999999.00000000",
519
+ # "tickSize": "0.01",
520
+ # "filterType": "PRICE_FILTER"
521
+ # },
522
+ # {
523
+ # "minQty": "0.01",
524
+ # "maxQty": "99999999999.00000000",
525
+ # "stepSize": "0.01",
526
+ # "filterType": "LOT_SIZE"
527
+ # },
528
+ # {minNotional: "50", filterType: "NOTIONAL"},
529
+ # {minNotional: "50", filterType: "MIN_NOTIONAL"},
530
+ # {
531
+ # "priceUp": "99999999",
532
+ # "priceDown": "0.01",
533
+ # "filterType": "STATIC_PRICE_RANGE"
534
+ # },
535
+ # {
536
+ # "multiplierUp": "1.1",
537
+ # "multiplierDown": "0.9",
538
+ # "filterType": "PERCENT_PRICE_INDEX"
539
+ # },
540
+ # {
541
+ # "multiplierUp": "1.1",
542
+ # "multiplierDown": "0.9",
543
+ # "filterType": "PERCENT_PRICE_ORDER_SIZE"
544
+ # },
545
+ # {maxNumOrders: "200", filterType: "MAX_NUM_ORDERS"},
546
+ # {maxNumAlgoOrders: "5", filterType: "MAX_NUM_ALGO_ORDERS"}
547
+ # ]
548
+ # },
549
+ # ]
550
+ # }
551
+ #
552
+ markets = self.safe_value(response, 'symbols')
553
+ result = []
554
+ for i in range(0, len(markets)):
555
+ market = markets[i]
556
+ id = self.safe_string(market, 'symbol')
557
+ baseId = self.safe_string(market, 'baseAsset')
558
+ quoteId = self.safe_string(market, 'quoteAsset')
559
+ base = self.safe_currency_code(baseId)
560
+ quote = self.safe_currency_code(quoteId)
561
+ limits = self.index_by(self.safe_value(market, 'filters'), 'filterType')
562
+ amountLimits = self.safe_value(limits, 'LOT_SIZE', {})
563
+ priceLimits = self.safe_value(limits, 'PRICE_FILTER', {})
564
+ costLimits = self.safe_value(limits, 'NOTIONAL', {})
565
+ result.append({
566
+ 'id': id,
567
+ 'symbol': base + '/' + quote,
568
+ 'base': base,
569
+ 'quote': quote,
570
+ 'settle': None,
571
+ 'baseId': baseId,
572
+ 'quoteId': quoteId,
573
+ 'settleId': None,
574
+ 'type': 'spot',
575
+ 'spot': True,
576
+ 'margin': False,
577
+ 'swap': False,
578
+ 'future': False,
579
+ 'option': False,
580
+ 'active': self.safe_string_lower(market, 'status') == 'trading',
581
+ 'contract': False,
582
+ 'linear': None,
583
+ 'inverse': None,
584
+ 'taker': None,
585
+ 'maker': None,
586
+ 'contractSize': None,
587
+ 'expiry': None,
588
+ 'expiryDatetime': None,
589
+ 'strike': None,
590
+ 'optionType': None,
591
+ 'precision': {
592
+ 'amount': self.parse_number(self.safe_string(amountLimits, 'stepSize')),
593
+ 'price': self.parse_number(self.safe_string(priceLimits, 'tickSize')),
594
+ },
595
+ 'limits': {
596
+ 'leverage': {
597
+ 'min': None,
598
+ 'max': None,
599
+ },
600
+ 'amount': {
601
+ 'min': self.parse_number(self.safe_string(amountLimits, 'minQty')),
602
+ 'max': self.parse_number(self.safe_string(amountLimits, 'maxQty')),
603
+ },
604
+ 'price': {
605
+ 'min': self.parse_number(self.safe_string(priceLimits, 'minPrice')),
606
+ 'max': self.parse_number(self.safe_string(priceLimits, 'maxPrice')),
607
+ },
608
+ 'cost': {
609
+ 'min': self.parse_number(self.safe_string(costLimits, 'minNotional')),
610
+ 'max': None,
611
+ },
612
+ },
613
+ 'created': None,
614
+ 'info': market,
615
+ })
616
+ self.set_markets(result)
617
+ return result
618
+
619
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
620
+ """
621
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
622
+ :see: https://coins-docs.github.io/rest-api/#24hr-ticker-price-change-statistics
623
+ :see: https://coins-docs.github.io/rest-api/#symbol-price-ticker
624
+ :see: https://coins-docs.github.io/rest-api/#symbol-order-book-ticker
625
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
626
+ :param dict [params]: extra parameters specific to the exchange API endpoint
627
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
628
+ """
629
+ await self.load_markets()
630
+ request: dict = {}
631
+ if symbols is not None:
632
+ ids = []
633
+ for i in range(0, len(symbols)):
634
+ market = self.market(symbols[i])
635
+ id = market['id']
636
+ ids.append(id)
637
+ request['symbols'] = ids
638
+ defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr'
639
+ options = self.safe_value(self.options, 'fetchTickers', {})
640
+ method = self.safe_string(options, 'method', defaultMethod)
641
+ tickers = None
642
+ if method == 'publicGetOpenapiQuoteV1TickerPrice':
643
+ tickers = await self.publicGetOpenapiQuoteV1TickerPrice(self.extend(request, params))
644
+ elif method == 'publicGetOpenapiQuoteV1TickerBookTicker':
645
+ tickers = await self.publicGetOpenapiQuoteV1TickerBookTicker(self.extend(request, params))
646
+ else:
647
+ tickers = await self.publicGetOpenapiQuoteV1Ticker24hr(self.extend(request, params))
648
+ return self.parse_tickers(tickers, symbols, params)
649
+
650
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
651
+ """
652
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
653
+ :see: https://coins-docs.github.io/rest-api/#24hr-ticker-price-change-statistics
654
+ :see: https://coins-docs.github.io/rest-api/#symbol-price-ticker
655
+ :see: https://coins-docs.github.io/rest-api/#symbol-order-book-ticker
656
+ :param str symbol: unified symbol of the market to fetch the ticker for
657
+ :param dict [params]: extra parameters specific to the exchange API endpoint
658
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
659
+ """
660
+ await self.load_markets()
661
+ market = self.market(symbol)
662
+ request: dict = {
663
+ 'symbol': market['id'],
664
+ }
665
+ defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr'
666
+ options = self.safe_value(self.options, 'fetchTicker', {})
667
+ method = self.safe_string(options, 'method', defaultMethod)
668
+ ticker = None
669
+ if method == 'publicGetOpenapiQuoteV1TickerPrice':
670
+ ticker = await self.publicGetOpenapiQuoteV1TickerPrice(self.extend(request, params))
671
+ elif method == 'publicGetOpenapiQuoteV1TickerBookTicker':
672
+ ticker = await self.publicGetOpenapiQuoteV1TickerBookTicker(self.extend(request, params))
673
+ else:
674
+ ticker = await self.publicGetOpenapiQuoteV1Ticker24hr(self.extend(request, params))
675
+ return self.parse_ticker(ticker, market)
676
+
677
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
678
+ #
679
+ # publicGetOpenapiQuoteV1Ticker24hr
680
+ # {
681
+ # "symbol": "ETHUSDT",
682
+ # "priceChange": "41.440000000000000000",
683
+ # "priceChangePercent": "0.0259",
684
+ # "weightedAvgPrice": "1631.169825783972125436",
685
+ # "prevClosePrice": "1601.520000000000000000",
686
+ # "lastPrice": "1642.96",
687
+ # "lastQty": "0.000001000000000000",
688
+ # "bidPrice": "1638.790000000000000000",
689
+ # "bidQty": "0.280075000000000000",
690
+ # "askPrice": "1647.340000000000000000",
691
+ # "askQty": "0.165183000000000000",
692
+ # "openPrice": "1601.52",
693
+ # "highPrice": "1648.28",
694
+ # "lowPrice": "1601.52",
695
+ # "volume": "0.000287",
696
+ # "quoteVolume": "0.46814574",
697
+ # "openTime": "1677417000000",
698
+ # "closeTime": "1677503415200",
699
+ # "firstId": "1364680572697591809",
700
+ # "lastId": "1365389809203560449",
701
+ # "count": "100"
702
+ # }
703
+ #
704
+ # publicGetOpenapiQuoteV1TickerPrice
705
+ # {"symbol": "ETHUSDT", "price": "1599.68"}
706
+ #
707
+ # publicGetOpenapiQuoteV1TickerBookTicker
708
+ # {
709
+ # "symbol": "ETHUSDT",
710
+ # "bidPrice": "1596.57",
711
+ # "bidQty": "0.246405",
712
+ # "askPrice": "1605.12",
713
+ # "askQty": "0.242681"
714
+ # }
715
+ #
716
+ marketId = self.safe_string(ticker, 'symbol')
717
+ market = self.safe_market(marketId, market)
718
+ timestamp = self.safe_integer(ticker, 'closeTime')
719
+ bid = self.safe_string(ticker, 'bidPrice')
720
+ ask = self.safe_string(ticker, 'askPrice')
721
+ bidVolume = self.safe_string(ticker, 'bidQty')
722
+ askVolume = self.safe_string(ticker, 'askQty')
723
+ baseVolume = self.safe_string(ticker, 'volume')
724
+ quoteVolume = self.safe_string(ticker, 'quoteVolume')
725
+ open = self.safe_string(ticker, 'openPrice')
726
+ high = self.safe_string(ticker, 'highPrice')
727
+ low = self.safe_string(ticker, 'lowPrice')
728
+ prevClose = self.safe_string(ticker, 'prevClosePrice')
729
+ vwap = self.safe_string(ticker, 'weightedAvgPrice')
730
+ changeValue = self.safe_string(ticker, 'priceChange')
731
+ changePcnt = self.safe_string(ticker, 'priceChangePercent')
732
+ changePcnt = Precise.string_mul(changePcnt, '100')
733
+ return self.safe_ticker({
734
+ 'symbol': market['symbol'],
735
+ 'timestamp': timestamp,
736
+ 'datetime': self.iso8601(timestamp),
737
+ 'open': open,
738
+ 'high': high,
739
+ 'low': low,
740
+ 'close': self.safe_string_2(ticker, 'lastPrice', 'price'),
741
+ 'bid': bid,
742
+ 'bidVolume': bidVolume,
743
+ 'ask': ask,
744
+ 'askVolume': askVolume,
745
+ 'vwap': vwap,
746
+ 'previousClose': prevClose,
747
+ 'change': changeValue,
748
+ 'percentage': changePcnt,
749
+ 'average': None,
750
+ 'baseVolume': baseVolume,
751
+ 'quoteVolume': quoteVolume,
752
+ 'info': ticker,
753
+ }, market)
754
+
755
+ async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
756
+ """
757
+ fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
758
+ :see: https://coins-docs.github.io/rest-api/#order-book
759
+ :param str symbol: unified symbol of the market to fetch the order book for
760
+ :param int [limit]: the maximum amount of order book entries to return(default 100, max 200)
761
+ :param dict [params]: extra parameters specific to the exchange API endpoint
762
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
763
+ """
764
+ await self.load_markets()
765
+ market = self.market(symbol)
766
+ request: dict = {
767
+ 'symbol': market['id'],
768
+ }
769
+ if limit is not None:
770
+ request['limit'] = limit
771
+ response = await self.publicGetOpenapiQuoteV1Depth(self.extend(request, params))
772
+ #
773
+ # {
774
+ # "lastUpdateId": "1667022157000699400",
775
+ # "bids": [
776
+ # ['1651.810000000000000000', '0.214556000000000000'],
777
+ # ['1651.730000000000000000', '0.257343000000000000'],
778
+ # ],
779
+ # "asks": [
780
+ # ['1660.510000000000000000', '0.299092000000000000'],
781
+ # ['1660.600000000000000000', '0.253667000000000000'],
782
+ # ]
783
+ # }
784
+ #
785
+ orderbook = self.parse_order_book(response, symbol)
786
+ orderbook['nonce'] = self.safe_integer(response, 'lastUpdateId')
787
+ return orderbook
788
+
789
+ async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
790
+ """
791
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
792
+ :see: https://coins-docs.github.io/rest-api/#klinecandlestick-data
793
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
794
+ :param str timeframe: the length of time each candle represents
795
+ :param int [since]: timestamp in ms of the earliest candle to fetch
796
+ :param int [limit]: the maximum amount of candles to fetch(default 500, max 1000)
797
+ :param dict [params]: extra parameters specific to the exchange API endpoint
798
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
799
+ """
800
+ await self.load_markets()
801
+ market = self.market(symbol)
802
+ interval = self.safe_string(self.timeframes, timeframe)
803
+ request: dict = {
804
+ 'symbol': market['id'],
805
+ 'interval': interval,
806
+ }
807
+ if since is not None:
808
+ request['startTime'] = since
809
+ request['limit'] = 1000
810
+ # since work properly only when it is "younger" than last "limit" candle
811
+ if limit is not None:
812
+ duration = self.parse_timeframe(timeframe) * 1000
813
+ request['endTime'] = self.sum(since, duration * (limit - 1))
814
+ else:
815
+ request['endTime'] = self.milliseconds()
816
+ else:
817
+ if limit is not None:
818
+ request['limit'] = limit
819
+ response = await self.publicGetOpenapiQuoteV1Klines(self.extend(request, params))
820
+ #
821
+ # [
822
+ # [
823
+ # 1499040000000, # Open time
824
+ # "0.01634790", # Open
825
+ # "0.80000000", # High
826
+ # "0.01575800", # Low
827
+ # "0.01577100", # Close
828
+ # "148976.11427815", # Volume
829
+ # 1499644799999, # Close time
830
+ # "2434.19055334", # Quote asset volume
831
+ # 308, # Number of trades
832
+ # "1756.87402397", # Taker buy base asset volume
833
+ # "28.46694368" # Taker buy quote asset volume
834
+ # ]
835
+ # ]
836
+ #
837
+ return self.parse_ohlcvs(response, market, timeframe, since, limit)
838
+
839
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
840
+ return [
841
+ self.safe_integer(ohlcv, 0),
842
+ self.safe_number(ohlcv, 1),
843
+ self.safe_number(ohlcv, 2),
844
+ self.safe_number(ohlcv, 3),
845
+ self.safe_number(ohlcv, 4),
846
+ self.safe_number(ohlcv, 5),
847
+ ]
848
+
849
+ async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
850
+ """
851
+ get the list of most recent trades for a particular symbol
852
+ :see: https://coins-docs.github.io/rest-api/#recent-trades-list
853
+ :param str symbol: unified symbol of the market to fetch trades for
854
+ :param int [since]: timestamp in ms of the earliest trade to fetch
855
+ :param int [limit]: the maximum amount of trades to fetch(default 500, max 1000)
856
+ :param dict [params]: extra parameters specific to the exchange API endpoint
857
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
858
+ """
859
+ await self.load_markets()
860
+ market = self.market(symbol)
861
+ request: dict = {
862
+ 'symbol': market['id'],
863
+ }
864
+ if since is not None:
865
+ # since work properly only when it is "younger" than last 'limit' trade
866
+ request['limit'] = 1000
867
+ else:
868
+ if limit is not None:
869
+ request['limit'] = limit
870
+ response = await self.publicGetOpenapiQuoteV1Trades(self.extend(request, params))
871
+ #
872
+ # [
873
+ # {
874
+ # "price": "89685.8",
875
+ # "id": "1365561108437680129",
876
+ # "qty": "0.000004",
877
+ # "quoteQty": "0.000004000000000000",
878
+ # "time": "1677523569575",
879
+ # "isBuyerMaker": False,
880
+ # "isBestMatch": True
881
+ # },
882
+ # ]
883
+ #
884
+ return self.parse_trades(response, market, since, limit)
885
+
886
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
887
+ """
888
+ fetch all trades made by the user
889
+ :see: https://coins-docs.github.io/rest-api/#account-trade-list-user_data
890
+ :param str symbol: unified market symbol
891
+ :param int [since]: the earliest time in ms to fetch trades for
892
+ :param int [limit]: the maximum number of trades structures to retrieve(default 500, max 1000)
893
+ :param dict [params]: extra parameters specific to the exchange API endpoint
894
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
895
+ """
896
+ if symbol is None:
897
+ raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
898
+ await self.load_markets()
899
+ market = self.market(symbol)
900
+ request: dict = {
901
+ 'symbol': market['id'],
902
+ }
903
+ if since is not None:
904
+ request['startTime'] = since
905
+ # since work properly only when it is "younger" than last 'limit' trade
906
+ request['limit'] = 1000
907
+ elif limit is not None:
908
+ request['limit'] = limit
909
+ response = await self.privateGetOpenapiV1MyTrades(self.extend(request, params))
910
+ return self.parse_trades(response, market, since, limit)
911
+
912
+ async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
913
+ """
914
+ fetch all the trades made from a single order
915
+ :see: https://coins-docs.github.io/rest-api/#account-trade-list-user_data
916
+ :param str id: order id
917
+ :param str symbol: unified market symbol
918
+ :param int [since]: the earliest time in ms to fetch trades for
919
+ :param int [limit]: the maximum number of trades to retrieve
920
+ :param dict [params]: extra parameters specific to the exchange API endpoint
921
+ :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
922
+ """
923
+ if symbol is None:
924
+ raise ArgumentsRequired(self.id + ' fetchOrderTrades() requires a symbol argument')
925
+ request: dict = {
926
+ 'orderId': id,
927
+ }
928
+ return await self.fetch_my_trades(symbol, since, limit, self.extend(request, params))
929
+
930
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
931
+ #
932
+ # fetchTrades
933
+ # {
934
+ # "price": "89685.8",
935
+ # "id": "1365561108437680129",
936
+ # "qty": "0.000004",
937
+ # "quoteQty": "0.000004000000000000", # warning: report to exchange - self is not quote quantity, self is base quantity
938
+ # "time": "1677523569575",
939
+ # "isBuyerMaker": False,
940
+ # "isBestMatch": True
941
+ # },
942
+ #
943
+ # fetchMyTrades
944
+ # {
945
+ # "symbol": "ETHUSDT",
946
+ # "id": 1375426310524125185,
947
+ # "orderId": 1375426310415879614,
948
+ # "price": "1580.91",
949
+ # "qty": "0.01",
950
+ # "quoteQty": "15.8091",
951
+ # "commission": "0",
952
+ # "commissionAsset": "USDT",
953
+ # "time": 1678699593307,
954
+ # "isBuyer": False,
955
+ # "isMaker":false,
956
+ # "isBestMatch":false
957
+ # }
958
+ #
959
+ # createOrder
960
+ # {
961
+ # "price": "1579.51",
962
+ # "qty": "0.001899",
963
+ # "commission": "0",
964
+ # "commissionAsset": "ETH",
965
+ # "tradeId":1375445992035598337
966
+ # }
967
+ #
968
+ marketId = self.safe_string(trade, 'symbol')
969
+ market = self.safe_market(marketId, market)
970
+ symbol = market['symbol']
971
+ id = self.safe_string_2(trade, 'id', 'tradeId')
972
+ orderId = self.safe_string(trade, 'orderId')
973
+ timestamp = self.safe_integer(trade, 'time')
974
+ priceString = self.safe_string(trade, 'price')
975
+ amountString = self.safe_string(trade, 'qty')
976
+ type = None
977
+ fee = None
978
+ feeCost = self.safe_string(trade, 'commission')
979
+ if feeCost is not None:
980
+ feeCurrencyId = self.safe_string(trade, 'commissionAsset')
981
+ fee = {
982
+ 'cost': feeCost,
983
+ 'currency': self.safe_currency_code(feeCurrencyId),
984
+ }
985
+ isBuyer = self.safe_value_2(trade, 'isBuyer', 'isBuyerMaker', None)
986
+ side = None
987
+ if isBuyer is not None:
988
+ side = 'buy' if (isBuyer is True) else 'sell'
989
+ isMaker = self.safe_string_2(trade, 'isMaker', None)
990
+ takerOrMaker = None
991
+ if isMaker is not None:
992
+ takerOrMaker = 'maker' if (isMaker == 'true') else 'taker'
993
+ costString = None
994
+ if orderId is not None:
995
+ costString = self.safe_string(trade, 'quoteQty')
996
+ return self.safe_trade({
997
+ 'id': id,
998
+ 'order': orderId,
999
+ 'timestamp': timestamp,
1000
+ 'datetime': self.iso8601(timestamp),
1001
+ 'symbol': symbol,
1002
+ 'type': type,
1003
+ 'side': side,
1004
+ 'takerOrMaker': takerOrMaker,
1005
+ 'price': priceString,
1006
+ 'amount': amountString,
1007
+ 'cost': costString,
1008
+ 'fee': fee,
1009
+ 'info': trade,
1010
+ }, market)
1011
+
1012
+ async def fetch_balance(self, params={}) -> Balances:
1013
+ """
1014
+ query for balance and get the amount of funds available for trading or funds locked in orders
1015
+ :see: https://coins-docs.github.io/rest-api/#accept-the-quote
1016
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1017
+ :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1018
+ """
1019
+ await self.load_markets()
1020
+ response = await self.privateGetOpenapiV1Account(params)
1021
+ #
1022
+ # {
1023
+ # "accountType": "SPOT",
1024
+ # "balances": [
1025
+ # {
1026
+ # "asset": "BTC",
1027
+ # "free": "4723846.89208129",
1028
+ # "locked": "0.00000000"
1029
+ # },
1030
+ # {
1031
+ # "asset": "LTC",
1032
+ # "free": "4763368.68006011",
1033
+ # "locked": "0.00000000"
1034
+ # }
1035
+ # ],
1036
+ # "canDeposit": True,
1037
+ # "canTrade": True,
1038
+ # "canWithdraw": True,
1039
+ # "updateTime": "1677430932528"
1040
+ # }
1041
+ #
1042
+ return self.parse_balance(response)
1043
+
1044
+ def parse_balance(self, response) -> Balances:
1045
+ balances = self.safe_value(response, 'balances', [])
1046
+ result: dict = {
1047
+ 'info': response,
1048
+ 'timestamp': None,
1049
+ 'datetime': None,
1050
+ }
1051
+ for i in range(0, len(balances)):
1052
+ balance = balances[i]
1053
+ currencyId = self.safe_string(balance, 'asset')
1054
+ code = self.safe_currency_code(currencyId)
1055
+ account = self.account()
1056
+ account['free'] = self.safe_string(balance, 'free')
1057
+ account['used'] = self.safe_string(balance, 'locked')
1058
+ result[code] = account
1059
+ return self.safe_balance(result)
1060
+
1061
+ async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1062
+ """
1063
+ create a trade order
1064
+ :see: https://coins-docs.github.io/rest-api/#new-order--trade
1065
+ :param str symbol: unified symbol of the market to create an order in
1066
+ :param str type: 'market', 'limit', 'stop_loss', 'take_profit', 'stop_loss_limit', 'take_profit_limit' or 'limit_maker'
1067
+ :param str side: 'buy' or 'sell'
1068
+ :param float amount: how much of currency you want to trade in units of base currency
1069
+ :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1070
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1071
+ :param float [params.cost]: the quote quantity that can be used alternative for the amount for market buy orders
1072
+ :param bool [params.test]: set to True to test an order, no order will be created but the request will be validated
1073
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1074
+ """
1075
+ # todo: add test order low priority
1076
+ await self.load_markets()
1077
+ market = self.market(symbol)
1078
+ testOrder = self.safe_bool(params, 'test', False)
1079
+ params = self.omit(params, 'test')
1080
+ orderType = self.safe_string(params, 'type', type)
1081
+ orderType = self.encode_order_type(orderType)
1082
+ params = self.omit(params, 'type')
1083
+ orderSide = self.encode_order_side(side)
1084
+ request: dict = {
1085
+ 'symbol': market['id'],
1086
+ 'type': orderType,
1087
+ 'side': orderSide,
1088
+ }
1089
+ options = self.safe_value(self.options, 'createOrder', {})
1090
+ newOrderRespType = self.safe_value(options, 'newOrderRespType', {})
1091
+ # if limit order
1092
+ if orderType == 'LIMIT' or orderType == 'STOP_LOSS_LIMIT' or orderType == 'TAKE_PROFIT_LIMIT' or orderType == 'LIMIT_MAKER':
1093
+ if price is None:
1094
+ raise ArgumentsRequired(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
1095
+ newOrderRespType = self.safe_string(newOrderRespType, 'limit', 'FULL')
1096
+ request['price'] = self.price_to_precision(symbol, price)
1097
+ request['quantity'] = self.amount_to_precision(symbol, amount)
1098
+ if orderType != 'LIMIT_MAKER':
1099
+ request['timeInForce'] = self.safe_string(options, 'timeInForce', 'GTC')
1100
+ # if market order
1101
+ elif orderType == 'MARKET' or orderType == 'STOP_LOSS' or orderType == 'TAKE_PROFIT':
1102
+ newOrderRespType = self.safe_string(newOrderRespType, 'market', 'FULL')
1103
+ if orderSide == 'SELL':
1104
+ request['quantity'] = self.amount_to_precision(symbol, amount)
1105
+ elif orderSide == 'BUY':
1106
+ quoteAmount = None
1107
+ createMarketBuyOrderRequiresPrice = True
1108
+ createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', True)
1109
+ cost = self.safe_number_2(params, 'cost', 'quoteOrderQty')
1110
+ params = self.omit(params, 'cost')
1111
+ if cost is not None:
1112
+ quoteAmount = self.cost_to_precision(symbol, cost)
1113
+ elif createMarketBuyOrderRequiresPrice:
1114
+ if price is None:
1115
+ 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')
1116
+ else:
1117
+ amountString = self.number_to_string(amount)
1118
+ priceString = self.number_to_string(price)
1119
+ costRequest = Precise.string_mul(amountString, priceString)
1120
+ quoteAmount = self.cost_to_precision(symbol, costRequest)
1121
+ else:
1122
+ quoteAmount = self.cost_to_precision(symbol, amount)
1123
+ request['quoteOrderQty'] = quoteAmount
1124
+ if orderType == 'STOP_LOSS' or orderType == 'STOP_LOSS_LIMIT' or orderType == 'TAKE_PROFIT' or orderType == 'TAKE_PROFIT_LIMIT':
1125
+ stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1126
+ if stopPrice is None:
1127
+ raise InvalidOrder(self.id + ' createOrder() requires a triggerPrice or stopPrice param for stop_loss, take_profit, stop_loss_limit, and take_profit_limit orders')
1128
+ request['stopPrice'] = self.price_to_precision(symbol, stopPrice)
1129
+ request['newOrderRespType'] = newOrderRespType
1130
+ params = self.omit(params, 'price', 'stopPrice', 'triggerPrice', 'quantity', 'quoteOrderQty')
1131
+ response = None
1132
+ if testOrder:
1133
+ response = await self.privatePostOpenapiV1OrderTest(self.extend(request, params))
1134
+ else:
1135
+ response = await self.privatePostOpenapiV1Order(self.extend(request, params))
1136
+ #
1137
+ # {
1138
+ # "symbol": "ETHUSDT",
1139
+ # "orderId": "1375407140139731486",
1140
+ # "clientOrderId": "1375407140139733169",
1141
+ # "transactTime": "1678697308023",
1142
+ # "price": "1600",
1143
+ # "origQty": "0.02",
1144
+ # "executedQty": "0.02",
1145
+ # "cummulativeQuoteQty": "31.9284",
1146
+ # "status": "FILLED",
1147
+ # "timeInForce": "GTC",
1148
+ # "type": "LIMIT",
1149
+ # "side": "BUY",
1150
+ # "stopPrice": "0",
1151
+ # "origQuoteOrderQty": "0",
1152
+ # "fills": [
1153
+ # {
1154
+ # "price": "1596.42",
1155
+ # "qty": "0.02",
1156
+ # "commission": "0",
1157
+ # "commissionAsset": "ETH",
1158
+ # "tradeId": "1375407140281532417"
1159
+ # }
1160
+ # ]
1161
+ # },
1162
+ #
1163
+ return self.parse_order(response, market)
1164
+
1165
+ async def fetch_order(self, id: str, symbol: Str = None, params={}):
1166
+ """
1167
+ fetches information on an order made by the user
1168
+ :see: https://coins-docs.github.io/rest-api/#query-order-user_data
1169
+ :param int|str id: order id
1170
+ :param str symbol: not used by coinsph fetchOrder()
1171
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1172
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1173
+ """
1174
+ await self.load_markets()
1175
+ request: dict = {}
1176
+ clientOrderId = self.safe_value_2(params, 'origClientOrderId', 'clientOrderId')
1177
+ if clientOrderId is not None:
1178
+ request['origClientOrderId'] = clientOrderId
1179
+ else:
1180
+ request['orderId'] = id
1181
+ params = self.omit(params, ['clientOrderId', 'origClientOrderId'])
1182
+ response = await self.privateGetOpenapiV1Order(self.extend(request, params))
1183
+ return self.parse_order(response)
1184
+
1185
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1186
+ """
1187
+ fetch all unfilled currently open orders
1188
+ :see: https://coins-docs.github.io/rest-api/#query-order-user_data
1189
+ :param str symbol: unified market symbol
1190
+ :param int [since]: the earliest time in ms to fetch open orders for
1191
+ :param int [limit]: the maximum number of open orders structures to retrieve
1192
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1193
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1194
+ """
1195
+ await self.load_markets()
1196
+ market = None
1197
+ request: dict = {}
1198
+ if symbol is not None:
1199
+ market = self.market(symbol)
1200
+ request['symbol'] = market['id']
1201
+ response = await self.privateGetOpenapiV1OpenOrders(self.extend(request, params))
1202
+ return self.parse_orders(response, market, since, limit)
1203
+
1204
+ async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1205
+ """
1206
+ fetches information on multiple closed orders made by the user
1207
+ :see: https://coins-docs.github.io/rest-api/#history-orders-user_data
1208
+ :param str symbol: unified market symbol of the market orders were made in
1209
+ :param int [since]: the earliest time in ms to fetch orders for
1210
+ :param int [limit]: the maximum number of order structures to retrieve(default 500, max 1000)
1211
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1212
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1213
+ """
1214
+ if symbol is None:
1215
+ raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires a symbol argument')
1216
+ await self.load_markets()
1217
+ market = self.market(symbol)
1218
+ request: dict = {
1219
+ 'symbol': market['id'],
1220
+ }
1221
+ if since is not None:
1222
+ request['startTime'] = since
1223
+ # since work properly only when it is "younger" than last 'limit' order
1224
+ request['limit'] = 1000
1225
+ elif limit is not None:
1226
+ request['limit'] = limit
1227
+ response = await self.privateGetOpenapiV1HistoryOrders(self.extend(request, params))
1228
+ return self.parse_orders(response, market, since, limit)
1229
+
1230
+ async def cancel_order(self, id: str, symbol: Str = None, params={}):
1231
+ """
1232
+ cancels an open order
1233
+ :see: https://coins-docs.github.io/rest-api/#cancel-order-trade
1234
+ :param str id: order id
1235
+ :param str symbol: not used by coinsph cancelOrder()
1236
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1237
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1238
+ """
1239
+ await self.load_markets()
1240
+ request: dict = {}
1241
+ clientOrderId = self.safe_value_2(params, 'origClientOrderId', 'clientOrderId')
1242
+ if clientOrderId is not None:
1243
+ request['origClientOrderId'] = clientOrderId
1244
+ else:
1245
+ request['orderId'] = id
1246
+ params = self.omit(params, ['clientOrderId', 'origClientOrderId'])
1247
+ response = await self.privateDeleteOpenapiV1Order(self.extend(request, params))
1248
+ return self.parse_order(response)
1249
+
1250
+ async def cancel_all_orders(self, symbol: Str = None, params={}):
1251
+ """
1252
+ cancel open orders of market
1253
+ :see: https://coins-docs.github.io/rest-api/#cancel-all-open-orders-on-a-symbol-trade
1254
+ :param str symbol: unified market symbol
1255
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1256
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1257
+ """
1258
+ if symbol is None:
1259
+ raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
1260
+ await self.load_markets()
1261
+ market = None
1262
+ request: dict = {}
1263
+ if symbol is not None:
1264
+ market = self.market(symbol)
1265
+ request['symbol'] = market['id']
1266
+ response = await self.privateDeleteOpenapiV1OpenOrders(self.extend(request, params))
1267
+ return self.parse_orders(response, market)
1268
+
1269
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1270
+ #
1271
+ # createOrder POST /openapi/v1/order
1272
+ # {
1273
+ # "symbol": "ETHUSDT",
1274
+ # "orderId": 1375445991893797391,
1275
+ # "clientOrderId": "1375445991893799115",
1276
+ # "transactTime": 1678701939513,
1277
+ # "price": "0",
1278
+ # "origQty": "0",
1279
+ # "executedQty": "0.001899",
1280
+ # "cummulativeQuoteQty": "2.99948949",
1281
+ # "status": "FILLED",
1282
+ # "timeInForce": "GTC",
1283
+ # "type": "MARKET",
1284
+ # "side": "BUY",
1285
+ # "stopPrice": "0",
1286
+ # "origQuoteOrderQty": "3",
1287
+ # "fills": [
1288
+ # {
1289
+ # "price": "1579.51",
1290
+ # "qty": "0.001899",
1291
+ # "commission": "0",
1292
+ # "commissionAsset": "ETH",
1293
+ # "tradeId":1375445992035598337
1294
+ # }
1295
+ # ]
1296
+ # }
1297
+ #
1298
+ # fetchOrder GET /openapi/v1/order
1299
+ # fetchOpenOrders GET /openapi/v1/openOrders
1300
+ # fetchClosedOrders GET /openapi/v1/historyOrders
1301
+ # cancelAllOrders DELETE /openapi/v1/openOrders
1302
+ # {
1303
+ # "symbol": "DOGEPHP",
1304
+ # "orderId":1375465375097982423,
1305
+ # "clientOrderId": "1375465375098001241",
1306
+ # "price": "0",
1307
+ # "origQty": "0",
1308
+ # "executedQty": "13",
1309
+ # "cummulativeQuoteQty": "49.621",
1310
+ # "status": "FILLED",
1311
+ # "timeInForce": "GTC",
1312
+ # "type": "MARKET",
1313
+ # "side": "BUY",
1314
+ # "stopPrice": "0",
1315
+ # "time":1678704250171,
1316
+ # "updateTime":1678704250256,
1317
+ # "isWorking":false,
1318
+ # "origQuoteOrderQty": "50"
1319
+ # }
1320
+ #
1321
+ # cancelOrder DELETE /openapi/v1/order
1322
+ # {
1323
+ # "symbol": "ETHPHP",
1324
+ # "orderId":1375609441915774332,
1325
+ # "clientOrderId": "1375609441915899557",
1326
+ # "price": "96000",
1327
+ # "origQty": "0.001",
1328
+ # "executedQty": "0",
1329
+ # "cummulativeQuoteQty": "0",
1330
+ # "status": "CANCELED",
1331
+ # "timeInForce": "GTC",
1332
+ # "type": "LIMIT",
1333
+ # "side": "SELL",
1334
+ # "stopPrice": "0",
1335
+ # "origQuoteOrderQty": "0"
1336
+ # }
1337
+ #
1338
+ id = self.safe_string(order, 'orderId')
1339
+ marketId = self.safe_string(order, 'symbol')
1340
+ market = self.safe_market(marketId, market)
1341
+ timestamp = self.safe_integer_2(order, 'time', 'transactTime')
1342
+ trades = self.safe_value(order, 'fills', None)
1343
+ stopPrice = self.safe_string(order, 'stopPrice')
1344
+ if Precise.string_eq(stopPrice, '0'):
1345
+ stopPrice = None
1346
+ return self.safe_order({
1347
+ 'id': id,
1348
+ 'clientOrderId': self.safe_string(order, 'clientOrderId'),
1349
+ 'timestamp': timestamp,
1350
+ 'datetime': self.iso8601(timestamp),
1351
+ 'lastTradeTimestamp': None,
1352
+ 'status': self.parse_order_status(self.safe_string(order, 'status')),
1353
+ 'symbol': market['symbol'],
1354
+ 'type': self.parse_order_type(self.safe_string(order, 'type')),
1355
+ 'timeInForce': self.parse_order_time_in_force(self.safe_string(order, 'timeInForce')),
1356
+ 'side': self.parse_order_side(self.safe_string(order, 'side')),
1357
+ 'price': self.safe_string(order, 'price'),
1358
+ 'stopPrice': stopPrice,
1359
+ 'triggerPrice': stopPrice,
1360
+ 'average': None,
1361
+ 'amount': self.safe_string(order, 'origQty'),
1362
+ 'cost': self.safe_string(order, 'cummulativeQuoteQty'),
1363
+ 'filled': self.safe_string(order, 'executedQty'),
1364
+ 'remaining': None,
1365
+ 'fee': None,
1366
+ 'fees': None,
1367
+ 'trades': trades,
1368
+ 'info': order,
1369
+ }, market)
1370
+
1371
+ def parse_order_side(self, status):
1372
+ statuses: dict = {
1373
+ 'BUY': 'buy',
1374
+ 'SELL': 'sell',
1375
+ }
1376
+ return self.safe_string(statuses, status, status)
1377
+
1378
+ def encode_order_side(self, status):
1379
+ statuses: dict = {
1380
+ 'buy': 'BUY',
1381
+ 'sell': 'SELL',
1382
+ }
1383
+ return self.safe_string(statuses, status, status)
1384
+
1385
+ def parse_order_type(self, status):
1386
+ statuses: dict = {
1387
+ 'MARKET': 'market',
1388
+ 'LIMIT': 'limit',
1389
+ 'LIMIT_MAKER': 'limit',
1390
+ 'STOP_LOSS': 'market',
1391
+ 'STOP_LOSS_LIMIT': 'limit',
1392
+ 'TAKE_PROFIT': 'market',
1393
+ 'TAKE_PROFIT_LIMIT': 'limit',
1394
+ }
1395
+ return self.safe_string(statuses, status, status)
1396
+
1397
+ def encode_order_type(self, status):
1398
+ statuses: dict = {
1399
+ 'market': 'MARKET',
1400
+ 'limit': 'LIMIT',
1401
+ 'limit_maker': 'LIMIT_MAKER',
1402
+ 'stop_loss': 'STOP_LOSS',
1403
+ 'stop_loss_limit': 'STOP_LOSS_LIMIT',
1404
+ 'take_profit': 'TAKE_PROFIT',
1405
+ 'take_profit_limit': 'TAKE_PROFIT_LIMIT',
1406
+ }
1407
+ return self.safe_string(statuses, status, status)
1408
+
1409
+ def parse_order_status(self, status: Str):
1410
+ statuses: dict = {
1411
+ 'NEW': 'open',
1412
+ 'FILLED': 'closed',
1413
+ 'CANCELED': 'canceled',
1414
+ 'PARTIALLY_FILLED': 'open',
1415
+ 'PARTIALLY_CANCELED': 'canceled',
1416
+ 'REJECTED': 'rejected',
1417
+ }
1418
+ return self.safe_string(statuses, status, status)
1419
+
1420
+ def parse_order_time_in_force(self, status):
1421
+ statuses: dict = {
1422
+ 'GTC': 'GTC',
1423
+ 'FOK': 'FOK',
1424
+ 'IOC': 'IOC',
1425
+ }
1426
+ return self.safe_string(statuses, status, status)
1427
+
1428
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1429
+ """
1430
+ fetch the trading fees for a market
1431
+ :see: https://coins-docs.github.io/rest-api/#trade-fee-user_data
1432
+ :param str symbol: unified market symbol
1433
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1434
+ :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
1435
+ """
1436
+ await self.load_markets()
1437
+ market = self.market(symbol)
1438
+ request: dict = {
1439
+ 'symbol': market['id'],
1440
+ }
1441
+ response = await self.privateGetOpenapiV1AssetTradeFee(self.extend(request, params))
1442
+ #
1443
+ # [
1444
+ # {
1445
+ # "symbol": "ETHUSDT",
1446
+ # "makerCommission": "0.0025",
1447
+ # "takerCommission": "0.003"
1448
+ # }
1449
+ # ]
1450
+ #
1451
+ tradingFee = self.safe_value(response, 0, {})
1452
+ return self.parse_trading_fee(tradingFee, market)
1453
+
1454
+ async def fetch_trading_fees(self, params={}) -> TradingFees:
1455
+ """
1456
+ fetch the trading fees for multiple markets
1457
+ :see: https://coins-docs.github.io/rest-api/#trade-fee-user_data
1458
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1459
+ :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
1460
+ """
1461
+ await self.load_markets()
1462
+ response = await self.privateGetOpenapiV1AssetTradeFee(params)
1463
+ #
1464
+ # [
1465
+ # {
1466
+ # "symbol": "ETHPHP",
1467
+ # "makerCommission": "0.0025",
1468
+ # "takerCommission": "0.003"
1469
+ # },
1470
+ # {
1471
+ # "symbol": "UNIPHP",
1472
+ # "makerCommission": "0.0025",
1473
+ # "takerCommission": "0.003"
1474
+ # },
1475
+ # ]
1476
+ #
1477
+ result: dict = {}
1478
+ for i in range(0, len(response)):
1479
+ fee = self.parse_trading_fee(response[i])
1480
+ symbol = fee['symbol']
1481
+ result[symbol] = fee
1482
+ return result
1483
+
1484
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1485
+ #
1486
+ # {
1487
+ # "symbol": "ETHUSDT",
1488
+ # "makerCommission": "0.0025",
1489
+ # "takerCommission": "0.003"
1490
+ # }
1491
+ #
1492
+ marketId = self.safe_string(fee, 'symbol')
1493
+ market = self.safe_market(marketId, market)
1494
+ symbol = market['symbol']
1495
+ return {
1496
+ 'info': fee,
1497
+ 'symbol': symbol,
1498
+ 'maker': self.safe_number(fee, 'makerCommission'),
1499
+ 'taker': self.safe_number(fee, 'takerCommission'),
1500
+ 'percentage': None,
1501
+ 'tierBased': None,
1502
+ }
1503
+
1504
+ async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1505
+ """
1506
+ make a withdrawal to coins_ph account
1507
+ :see: https://coins-docs.github.io/rest-api/#withdrawuser_data
1508
+ :param str code: unified currency code
1509
+ :param float amount: the amount to withdraw
1510
+ :param str address: not used by coinsph withdraw()
1511
+ :param str tag:
1512
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1513
+ :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1514
+ """
1515
+ options = self.safe_value(self.options, 'withdraw')
1516
+ warning = self.safe_bool(options, 'warning', True)
1517
+ if warning:
1518
+ raise InvalidAddress(self.id + " withdraw() makes a withdrawals only to coins_ph account, add .options['withdraw']['warning'] = False to make a withdrawal to your coins_ph account")
1519
+ networkCode = self.safe_string(params, 'network')
1520
+ networkId = self.network_code_to_id(networkCode, code)
1521
+ if networkId is None:
1522
+ raise BadRequest(self.id + ' withdraw() require network parameter')
1523
+ await self.load_markets()
1524
+ currency = self.currency(code)
1525
+ request: dict = {
1526
+ 'coin': currency['id'],
1527
+ 'amount': self.number_to_string(amount),
1528
+ 'network': networkId,
1529
+ 'address': address,
1530
+ }
1531
+ if tag is not None:
1532
+ request['withdrawOrderId'] = tag
1533
+ params = self.omit(params, 'network')
1534
+ response = await self.privatePostOpenapiWalletV1WithdrawApply(self.extend(request, params))
1535
+ return self.parse_transaction(response, currency)
1536
+
1537
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1538
+ """
1539
+ fetch all deposits made to an account
1540
+ :see: https://coins-docs.github.io/rest-api/#deposit-history-user_data
1541
+ :param str code: unified currency code
1542
+ :param int [since]: the earliest time in ms to fetch deposits for
1543
+ :param int [limit]: the maximum number of deposits structures to retrieve
1544
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1545
+ :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1546
+ """
1547
+ # todo: returns an empty array - find out why
1548
+ await self.load_markets()
1549
+ currency = None
1550
+ request: dict = {}
1551
+ if code is not None:
1552
+ currency = self.currency(code)
1553
+ request['coin'] = currency['id']
1554
+ if since is not None:
1555
+ request['startTime'] = since
1556
+ if limit is not None:
1557
+ request['limit'] = limit
1558
+ response = await self.privateGetOpenapiWalletV1DepositHistory(self.extend(request, params))
1559
+ #
1560
+ # [
1561
+ # {
1562
+ # "id": "d_769800519366885376",
1563
+ # "amount": "0.001",
1564
+ # "coin": "BNB",
1565
+ # "network": "BNB",
1566
+ # "status": 0,
1567
+ # "address": "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23",
1568
+ # "addressTag": "101764890",
1569
+ # "txId": "98A3EA560C6B3336D348B6C83F0F95ECE4F1F5919E94BD006E5BF3BF264FACFC",
1570
+ # "insertTime": 1661493146000,
1571
+ # "confirmNo": 10,
1572
+ # },
1573
+ # {
1574
+ # "id": "d_769754833590042625",
1575
+ # "amount":"0.5",
1576
+ # "coin":"IOTA",
1577
+ # "network":"IOTA",
1578
+ # "status":1,
1579
+ # "address":"SIZ9VLMHWATXKV99LH99CIGFJFUMLEHGWVZVNNZXRJJVWBPHYWPPBOSDORZ9EQSHCZAMPVAPGFYQAUUV9DROOXJLNW",
1580
+ # "addressTag":"",
1581
+ # "txId":"ESBFVQUTPIWQNJSPXFNHNYHSQNTGKRVKPRABQWTAXCDWOAKDKYWPTVG9BGXNVNKTLEJGESAVXIKIZ9999",
1582
+ # "insertTime":1599620082000,
1583
+ # "confirmNo": 20,
1584
+ # }
1585
+ # ]
1586
+ #
1587
+ return self.parse_transactions(response, currency, since, limit)
1588
+
1589
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1590
+ """
1591
+ fetch all withdrawals made from an account
1592
+ :see: https://coins-docs.github.io/rest-api/#withdraw-history-user_data
1593
+ :param str code: unified currency code
1594
+ :param int [since]: the earliest time in ms to fetch withdrawals for
1595
+ :param int [limit]: the maximum number of withdrawals structures to retrieve
1596
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1597
+ :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1598
+ """
1599
+ # todo: returns an empty array - find out why
1600
+ await self.load_markets()
1601
+ currency = None
1602
+ request: dict = {}
1603
+ if code is not None:
1604
+ currency = self.currency(code)
1605
+ request['coin'] = currency['id']
1606
+ if since is not None:
1607
+ request['startTime'] = since
1608
+ if limit is not None:
1609
+ request['limit'] = limit
1610
+ response = await self.privateGetOpenapiWalletV1WithdrawHistory(self.extend(request, params))
1611
+ #
1612
+ # [
1613
+ # {
1614
+ # "id": "459890698271244288",
1615
+ # "amount": "0.01",
1616
+ # "transactionFee": "0",
1617
+ # "coin": "ETH",
1618
+ # "status": 1,
1619
+ # "address": "0x386AE30AE2dA293987B5d51ddD03AEb70b21001F",
1620
+ # "addressTag": "",
1621
+ # "txId": "0x4ae2fed36a90aada978fc31c38488e8b60d7435cfe0b4daed842456b4771fcf7",
1622
+ # "applyTime": 1673601139000,
1623
+ # "network": "ETH",
1624
+ # "withdrawOrderId": "thomas123",
1625
+ # "info": "",
1626
+ # "confirmNo": 100
1627
+ # },
1628
+ # {
1629
+ # "id": "451899190746456064",
1630
+ # "amount": "0.00063",
1631
+ # "transactionFee": "0.00037",
1632
+ # "coin": "ETH",
1633
+ # "status": 1,
1634
+ # "address": "0x386AE30AE2dA293987B5d51ddD03AEb70b21001F",
1635
+ # "addressTag": "",
1636
+ # "txId": "0x62690ca4f9d6a8868c258e2ce613805af614d9354dda7b39779c57b2e4da0260",
1637
+ # "applyTime": 1671695815000,
1638
+ # "network": "ETH",
1639
+ # "withdrawOrderId": "",
1640
+ # "info": "",
1641
+ # "confirmNo": 100
1642
+ # }
1643
+ # ]
1644
+ #
1645
+ return self.parse_transactions(response, currency, since, limit)
1646
+
1647
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1648
+ #
1649
+ # fetchDeposits
1650
+ # {
1651
+ # "coin": "PHP",
1652
+ # "address": "Internal Transfer",
1653
+ # "addressTag": "Internal Transfer",
1654
+ # "amount": "0.02",
1655
+ # "id": "31312321312312312312322",
1656
+ # "network": "Internal",
1657
+ # "transferType": "0",
1658
+ # "status": 3,
1659
+ # "confirmTimes": "",
1660
+ # "unlockConfirm": "",
1661
+ # "txId": "Internal Transfer",
1662
+ # "insertTime": 1657623798000,
1663
+ # "depositOrderId": "the deposit id which created by client"
1664
+ # }
1665
+ #
1666
+ # fetchWithdrawals
1667
+ # {
1668
+ # "coin": "BTC",
1669
+ # "address": "Internal Transfer",
1670
+ # "amount": "0.1",
1671
+ # "id": "1201515362324421632",
1672
+ # "withdrawOrderId": null,
1673
+ # "network": "Internal",
1674
+ # "transferType": "0",
1675
+ # "status": 0,
1676
+ # "transactionFee": "0",
1677
+ # "confirmNo": 0,
1678
+ # "info": "{}",
1679
+ # "txId": "Internal Transfer",
1680
+ # "applyTime": 1657967792000
1681
+ # }
1682
+ #
1683
+ # todo: self is in progress
1684
+ id = self.safe_string(transaction, 'id')
1685
+ address = self.safe_string(transaction, 'address')
1686
+ tag = self.safe_string(transaction, 'addressTag')
1687
+ if tag is not None:
1688
+ if len(tag) < 1:
1689
+ tag = None
1690
+ txid = self.safe_string(transaction, 'txId')
1691
+ currencyId = self.safe_string(transaction, 'coin')
1692
+ code = self.safe_currency_code(currencyId, currency)
1693
+ timestamp = None
1694
+ timestamp = self.safe_integer_2(transaction, 'insertTime', 'applyTime')
1695
+ updated = None
1696
+ type = None
1697
+ withdrawOrderId = self.safe_string(transaction, 'withdrawOrderId')
1698
+ depositOrderId = self.safe_string(transaction, 'depositOrderId')
1699
+ if withdrawOrderId is not None:
1700
+ type = 'withdrawal'
1701
+ elif depositOrderId is not None:
1702
+ type = 'deposit'
1703
+ status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
1704
+ amount = self.safe_number(transaction, 'amount')
1705
+ feeCost = self.safe_number(transaction, 'transactionFee')
1706
+ fee = None
1707
+ if feeCost is not None:
1708
+ fee = {'currency': code, 'cost': feeCost}
1709
+ network = self.safe_string(transaction, 'network')
1710
+ internal = network == 'Internal'
1711
+ return {
1712
+ 'info': transaction,
1713
+ 'id': id,
1714
+ 'txid': txid,
1715
+ 'timestamp': timestamp,
1716
+ 'datetime': self.iso8601(timestamp),
1717
+ 'network': network,
1718
+ 'address': address,
1719
+ 'addressTo': address,
1720
+ 'addressFrom': None,
1721
+ 'tag': tag,
1722
+ 'tagTo': tag,
1723
+ 'tagFrom': None,
1724
+ 'type': type,
1725
+ 'amount': amount,
1726
+ 'currency': code,
1727
+ 'status': status,
1728
+ 'updated': updated,
1729
+ 'internal': internal,
1730
+ 'comment': None,
1731
+ 'fee': fee,
1732
+ }
1733
+
1734
+ def parse_transaction_status(self, status: Str):
1735
+ statuses: dict = {
1736
+ '0': 'pending',
1737
+ '1': 'ok',
1738
+ '2': 'failed',
1739
+ '3': 'pending',
1740
+ }
1741
+ return self.safe_string(statuses, status, status)
1742
+
1743
+ async def fetch_deposit_address(self, code: str, params={}):
1744
+ """
1745
+ fetch the deposit address for a currency associated with self account
1746
+ :see: https://coins-docs.github.io/rest-api/#deposit-address-user_data
1747
+ :param str code: unified currency code
1748
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1749
+ :param str [params.network]: network for fetch deposit address
1750
+ :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1751
+ """
1752
+ networkCode = self.safe_string(params, 'network')
1753
+ networkId = self.network_code_to_id(networkCode, code)
1754
+ if networkId is None:
1755
+ raise BadRequest(self.id + ' fetchDepositAddress() require network parameter')
1756
+ await self.load_markets()
1757
+ currency = self.currency(code)
1758
+ request: dict = {
1759
+ 'coin': currency['id'],
1760
+ 'network': networkId,
1761
+ }
1762
+ params = self.omit(params, 'network')
1763
+ response = await self.privateGetOpenapiWalletV1DepositAddress(self.extend(request, params))
1764
+ #
1765
+ # {
1766
+ # "coin": "ETH",
1767
+ # "address": "0xfe98628173830bf79c59f04585ce41f7de168784",
1768
+ # "addressTag": ""
1769
+ # }
1770
+ #
1771
+ return self.parse_deposit_address(response, currency)
1772
+
1773
+ def parse_deposit_address(self, depositAddress, currency: Currency = None):
1774
+ #
1775
+ # {
1776
+ # "coin": "ETH",
1777
+ # "address": "0xfe98628173830bf79c59f04585ce41f7de168784",
1778
+ # "addressTag": ""
1779
+ # }
1780
+ #
1781
+ currencyId = self.safe_string(depositAddress, 'coin')
1782
+ parsedCurrency = self.safe_currency_code(currencyId, currency)
1783
+ return {
1784
+ 'currency': parsedCurrency,
1785
+ 'address': self.safe_string(depositAddress, 'address'),
1786
+ 'tag': self.safe_string(depositAddress, 'addressTag'),
1787
+ 'network': None,
1788
+ 'info': depositAddress,
1789
+ }
1790
+
1791
+ def url_encode_query(self, query={}):
1792
+ encodedArrayParams = ''
1793
+ keys = list(query.keys())
1794
+ for i in range(0, len(keys)):
1795
+ key = keys[i]
1796
+ if isinstance(query[key], list):
1797
+ if i != 0:
1798
+ encodedArrayParams += '&'
1799
+ innerArray = query[key]
1800
+ query = self.omit(query, key)
1801
+ encodedArrayParam = self.parse_array_param(innerArray, key)
1802
+ encodedArrayParams += encodedArrayParam
1803
+ encodedQuery = self.urlencode(query)
1804
+ if len(encodedQuery) != 0:
1805
+ return encodedQuery + '&' + encodedArrayParams
1806
+ else:
1807
+ return encodedArrayParams
1808
+
1809
+ def parse_array_param(self, array, key):
1810
+ stringifiedArray = self.json(array)
1811
+ stringifiedArray = stringifiedArray.replace('[', '%5B')
1812
+ stringifiedArray = stringifiedArray.replace(']', '%5D')
1813
+ urlEncodedParam = key + '=' + stringifiedArray
1814
+ return urlEncodedParam
1815
+
1816
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
1817
+ url = self.urls['api'][api]
1818
+ query = self.omit(params, self.extract_params(path))
1819
+ endpoint = self.implode_params(path, params)
1820
+ url = url + '/' + endpoint
1821
+ if api == 'private':
1822
+ self.check_required_credentials()
1823
+ query['timestamp'] = self.milliseconds()
1824
+ recvWindow = self.safe_integer(query, 'recvWindow')
1825
+ if recvWindow is None:
1826
+ defaultRecvWindow = self.safe_integer(self.options, 'recvWindow')
1827
+ if defaultRecvWindow is not None:
1828
+ query['recvWindow'] = defaultRecvWindow
1829
+ query = self.url_encode_query(query)
1830
+ signature = self.hmac(self.encode(query), self.encode(self.secret), hashlib.sha256)
1831
+ url = url + '?' + query + '&signature=' + signature
1832
+ headers = {
1833
+ 'X-COINS-APIKEY': self.apiKey,
1834
+ }
1835
+ else:
1836
+ query = self.url_encode_query(query)
1837
+ if len(query) != 0:
1838
+ url += '?' + query
1839
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}
1840
+
1841
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1842
+ if response is None:
1843
+ return None
1844
+ responseCode = self.safe_string(response, 'code', None)
1845
+ if (responseCode is not None) and (responseCode != '200') and (responseCode != '0'):
1846
+ feedback = self.id + ' ' + body
1847
+ self.throw_broadly_matched_exception(self.exceptions['broad'], body, feedback)
1848
+ self.throw_exactly_matched_exception(self.exceptions['exact'], responseCode, feedback)
1849
+ raise ExchangeError(feedback)
1850
+ return None