ccxt 4.2.17 → 4.2.19

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 (439) hide show
  1. package/README.md +9 -9
  2. package/dist/ccxt.browser.js +48992 -47725
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +12 -1
  5. package/dist/cjs/src/alpaca.js +18 -18
  6. package/dist/cjs/src/ascendex.js +13 -6
  7. package/dist/cjs/src/base/Exchange.js +266 -27
  8. package/dist/cjs/src/bigone.js +434 -168
  9. package/dist/cjs/src/binance.js +163 -34
  10. package/dist/cjs/src/binanceus.js +8 -0
  11. package/dist/cjs/src/bingx.js +183 -41
  12. package/dist/cjs/src/bitfinex.js +2 -3
  13. package/dist/cjs/src/bitget.js +59 -16
  14. package/dist/cjs/src/bitmart.js +5 -5
  15. package/dist/cjs/src/bitmex.js +4 -6
  16. package/dist/cjs/src/bitpanda.js +5 -1991
  17. package/dist/cjs/src/bitstamp.js +8 -0
  18. package/dist/cjs/src/bybit.js +27 -47
  19. package/dist/cjs/src/coinbase.js +176 -26
  20. package/dist/cjs/src/coincheck.js +1 -0
  21. package/dist/cjs/src/coinex.js +3 -0
  22. package/dist/cjs/src/coinlist.js +13 -6
  23. package/dist/cjs/src/coinone.js +2 -2
  24. package/dist/cjs/src/coinsph.js +4 -5
  25. package/dist/cjs/src/delta.js +7 -1
  26. package/dist/cjs/src/deribit.js +17 -4
  27. package/dist/cjs/src/gate.js +151 -169
  28. package/dist/cjs/src/gemini.js +1 -1
  29. package/dist/cjs/src/hitbtc.js +2 -3
  30. package/dist/cjs/src/htx.js +157 -7
  31. package/dist/cjs/src/huobijp.js +2 -3
  32. package/dist/cjs/src/independentreserve.js +7 -5
  33. package/dist/cjs/src/kraken.js +86 -54
  34. package/dist/cjs/src/kucoin.js +5 -0
  35. package/dist/cjs/src/kucoinfutures.js +131 -77
  36. package/dist/cjs/src/lbank.js +60 -33
  37. package/dist/cjs/src/luno.js +84 -2
  38. package/dist/cjs/src/mexc.js +3 -3
  39. package/dist/cjs/src/oceanex.js +1 -1
  40. package/dist/cjs/src/okx.js +23 -11
  41. package/dist/cjs/{js/src/bitpanda.js → src/onetrading.js} +39 -39
  42. package/dist/cjs/src/phemex.js +37 -27
  43. package/dist/cjs/src/poloniexfutures.js +1 -0
  44. package/dist/cjs/src/pro/binance.js +66 -25
  45. package/dist/cjs/src/pro/bitget.js +1 -1
  46. package/dist/cjs/src/pro/bitpanda.js +5 -1330
  47. package/dist/cjs/src/pro/coinbase.js +4 -1
  48. package/dist/cjs/src/pro/coincheck.js +208 -0
  49. package/dist/cjs/src/pro/hitbtc.js +5 -4
  50. package/dist/cjs/src/pro/htx.js +6 -1
  51. package/dist/cjs/src/pro/kraken.js +1 -1
  52. package/dist/cjs/src/pro/krakenfutures.js +7 -1
  53. package/dist/cjs/src/pro/kucoin.js +46 -36
  54. package/dist/cjs/src/pro/kucoinfutures.js +45 -37
  55. package/dist/cjs/src/pro/lbank.js +881 -0
  56. package/dist/cjs/src/pro/okx.js +52 -2
  57. package/dist/cjs/{js/src/pro/bitpanda.js → src/pro/onetrading.js} +4 -7
  58. package/dist/cjs/src/pro/poloniex.js +2 -2
  59. package/dist/cjs/src/pro/poloniexfutures.js +43 -35
  60. package/dist/cjs/src/pro/woo.js +126 -0
  61. package/dist/cjs/src/probit.js +4 -2
  62. package/dist/cjs/src/upbit.js +12 -12
  63. package/dist/cjs/src/wavesexchange.js +1 -1
  64. package/dist/cjs/src/whitebit.js +1 -0
  65. package/dist/cjs/src/woo.js +56 -0
  66. package/js/ccxt.d.ts +14 -2
  67. package/js/ccxt.js +10 -2
  68. package/js/src/abstract/bitpanda.d.ts +4 -4
  69. package/js/src/abstract/bitstamp.d.ts +8 -0
  70. package/js/src/abstract/gate.d.ts +1 -0
  71. package/js/src/abstract/gateio.d.ts +1 -0
  72. package/js/src/abstract/htx.d.ts +3 -0
  73. package/js/src/abstract/huobi.d.ts +3 -0
  74. package/js/src/abstract/luno.d.ts +1 -0
  75. package/js/src/abstract/onetrading.d.ts +38 -0
  76. package/js/src/ascendex.js +2 -0
  77. package/js/src/base/Exchange.d.ts +2 -3
  78. package/js/src/base/Exchange.js +5 -2
  79. package/js/src/binance.js +7 -1
  80. package/js/src/bingx.d.ts +1 -0
  81. package/js/src/bingx.js +26 -0
  82. package/js/src/bitget.js +22 -3
  83. package/js/src/bitpanda.d.ts +2 -72
  84. package/js/src/bitpanda.js +5 -1991
  85. package/js/src/bitstamp.js +8 -0
  86. package/js/src/bybit.js +21 -47
  87. package/js/src/coincheck.js +1 -0
  88. package/js/src/deribit.js +16 -4
  89. package/js/src/gate.d.ts +1 -0
  90. package/js/src/gate.js +50 -110
  91. package/js/src/htx.js +3 -0
  92. package/js/src/kraken.d.ts +1 -0
  93. package/js/src/kraken.js +40 -39
  94. package/js/src/lbank.js +1 -0
  95. package/js/src/luno.d.ts +3 -1
  96. package/js/src/luno.js +84 -2
  97. package/js/src/mexc.js +1 -2
  98. package/js/src/onetrading.d.ts +74 -0
  99. package/js/src/onetrading.js +2003 -0
  100. package/js/src/poloniexfutures.js +1 -0
  101. package/js/src/pro/binance.js +7 -2
  102. package/js/src/pro/bitget.js +1 -1
  103. package/js/src/pro/bitpanda.d.ts +2 -34
  104. package/js/src/pro/bitpanda.js +5 -1330
  105. package/js/src/pro/coincheck.d.ts +12 -0
  106. package/js/src/pro/coincheck.js +209 -0
  107. package/js/src/pro/kucoin.js +43 -35
  108. package/js/src/pro/kucoinfutures.js +45 -37
  109. package/js/src/pro/lbank.d.ts +29 -0
  110. package/js/src/pro/lbank.js +882 -0
  111. package/js/src/pro/onetrading.d.ts +36 -0
  112. package/js/src/pro/onetrading.js +1339 -0
  113. package/js/src/pro/poloniexfutures.js +43 -35
  114. package/js/src/whitebit.js +1 -0
  115. package/package.json +2 -2
  116. package/rollup.config.js +2 -0
  117. package/skip-tests.json +14 -2
  118. package/test-commonjs.cjs +25 -1
  119. package/dist/cjs/js/ccxt.js +0 -476
  120. package/dist/cjs/js/src/abstract/alpaca.js +0 -9
  121. package/dist/cjs/js/src/abstract/ascendex.js +0 -9
  122. package/dist/cjs/js/src/abstract/bigone.js +0 -9
  123. package/dist/cjs/js/src/abstract/binance.js +0 -9
  124. package/dist/cjs/js/src/abstract/bingx.js +0 -9
  125. package/dist/cjs/js/src/abstract/bit2c.js +0 -9
  126. package/dist/cjs/js/src/abstract/bitbank.js +0 -9
  127. package/dist/cjs/js/src/abstract/bitbns.js +0 -9
  128. package/dist/cjs/js/src/abstract/bitfinex.js +0 -9
  129. package/dist/cjs/js/src/abstract/bitfinex2.js +0 -9
  130. package/dist/cjs/js/src/abstract/bitflyer.js +0 -9
  131. package/dist/cjs/js/src/abstract/bitforex.js +0 -9
  132. package/dist/cjs/js/src/abstract/bitget.js +0 -9
  133. package/dist/cjs/js/src/abstract/bithumb.js +0 -9
  134. package/dist/cjs/js/src/abstract/bitmart.js +0 -9
  135. package/dist/cjs/js/src/abstract/bitmex.js +0 -9
  136. package/dist/cjs/js/src/abstract/bitopro.js +0 -9
  137. package/dist/cjs/js/src/abstract/bitpanda.js +0 -9
  138. package/dist/cjs/js/src/abstract/bitrue.js +0 -9
  139. package/dist/cjs/js/src/abstract/bitso.js +0 -9
  140. package/dist/cjs/js/src/abstract/bitstamp.js +0 -9
  141. package/dist/cjs/js/src/abstract/bitteam.js +0 -9
  142. package/dist/cjs/js/src/abstract/bitvavo.js +0 -9
  143. package/dist/cjs/js/src/abstract/bl3p.js +0 -9
  144. package/dist/cjs/js/src/abstract/blockchaincom.js +0 -9
  145. package/dist/cjs/js/src/abstract/btcalpha.js +0 -9
  146. package/dist/cjs/js/src/abstract/btcbox.js +0 -9
  147. package/dist/cjs/js/src/abstract/btcmarkets.js +0 -9
  148. package/dist/cjs/js/src/abstract/btcturk.js +0 -9
  149. package/dist/cjs/js/src/abstract/bybit.js +0 -9
  150. package/dist/cjs/js/src/abstract/cex.js +0 -9
  151. package/dist/cjs/js/src/abstract/coinbase.js +0 -9
  152. package/dist/cjs/js/src/abstract/coinbasepro.js +0 -9
  153. package/dist/cjs/js/src/abstract/coincheck.js +0 -9
  154. package/dist/cjs/js/src/abstract/coinex.js +0 -9
  155. package/dist/cjs/js/src/abstract/coinlist.js +0 -9
  156. package/dist/cjs/js/src/abstract/coinmate.js +0 -9
  157. package/dist/cjs/js/src/abstract/coinone.js +0 -9
  158. package/dist/cjs/js/src/abstract/coinsph.js +0 -9
  159. package/dist/cjs/js/src/abstract/coinspot.js +0 -9
  160. package/dist/cjs/js/src/abstract/cryptocom.js +0 -9
  161. package/dist/cjs/js/src/abstract/currencycom.js +0 -9
  162. package/dist/cjs/js/src/abstract/delta.js +0 -9
  163. package/dist/cjs/js/src/abstract/deribit.js +0 -9
  164. package/dist/cjs/js/src/abstract/digifinex.js +0 -9
  165. package/dist/cjs/js/src/abstract/exmo.js +0 -9
  166. package/dist/cjs/js/src/abstract/gate.js +0 -9
  167. package/dist/cjs/js/src/abstract/gemini.js +0 -9
  168. package/dist/cjs/js/src/abstract/hitbtc.js +0 -9
  169. package/dist/cjs/js/src/abstract/hollaex.js +0 -9
  170. package/dist/cjs/js/src/abstract/htx.js +0 -9
  171. package/dist/cjs/js/src/abstract/huobijp.js +0 -9
  172. package/dist/cjs/js/src/abstract/idex.js +0 -9
  173. package/dist/cjs/js/src/abstract/independentreserve.js +0 -9
  174. package/dist/cjs/js/src/abstract/indodax.js +0 -9
  175. package/dist/cjs/js/src/abstract/kraken.js +0 -9
  176. package/dist/cjs/js/src/abstract/krakenfutures.js +0 -9
  177. package/dist/cjs/js/src/abstract/kucoin.js +0 -9
  178. package/dist/cjs/js/src/abstract/kucoinfutures.js +0 -9
  179. package/dist/cjs/js/src/abstract/kuna.js +0 -9
  180. package/dist/cjs/js/src/abstract/latoken.js +0 -9
  181. package/dist/cjs/js/src/abstract/lbank.js +0 -9
  182. package/dist/cjs/js/src/abstract/luno.js +0 -9
  183. package/dist/cjs/js/src/abstract/lykke.js +0 -9
  184. package/dist/cjs/js/src/abstract/mercado.js +0 -9
  185. package/dist/cjs/js/src/abstract/mexc.js +0 -9
  186. package/dist/cjs/js/src/abstract/ndax.js +0 -9
  187. package/dist/cjs/js/src/abstract/novadax.js +0 -9
  188. package/dist/cjs/js/src/abstract/oceanex.js +0 -9
  189. package/dist/cjs/js/src/abstract/okcoin.js +0 -9
  190. package/dist/cjs/js/src/abstract/okx.js +0 -9
  191. package/dist/cjs/js/src/abstract/p2b.js +0 -9
  192. package/dist/cjs/js/src/abstract/paymium.js +0 -9
  193. package/dist/cjs/js/src/abstract/phemex.js +0 -9
  194. package/dist/cjs/js/src/abstract/poloniex.js +0 -9
  195. package/dist/cjs/js/src/abstract/poloniexfutures.js +0 -9
  196. package/dist/cjs/js/src/abstract/probit.js +0 -9
  197. package/dist/cjs/js/src/abstract/timex.js +0 -9
  198. package/dist/cjs/js/src/abstract/tokocrypto.js +0 -9
  199. package/dist/cjs/js/src/abstract/upbit.js +0 -9
  200. package/dist/cjs/js/src/abstract/wavesexchange.js +0 -9
  201. package/dist/cjs/js/src/abstract/wazirx.js +0 -9
  202. package/dist/cjs/js/src/abstract/whitebit.js +0 -9
  203. package/dist/cjs/js/src/abstract/woo.js +0 -9
  204. package/dist/cjs/js/src/abstract/yobit.js +0 -9
  205. package/dist/cjs/js/src/abstract/zaif.js +0 -9
  206. package/dist/cjs/js/src/abstract/zonda.js +0 -9
  207. package/dist/cjs/js/src/ace.js +0 -1058
  208. package/dist/cjs/js/src/alpaca.js +0 -1125
  209. package/dist/cjs/js/src/ascendex.js +0 -3365
  210. package/dist/cjs/js/src/base/Exchange.js +0 -5257
  211. package/dist/cjs/js/src/base/Precise.js +0 -263
  212. package/dist/cjs/js/src/base/errors.js +0 -299
  213. package/dist/cjs/js/src/base/functions/crypto.js +0 -78
  214. package/dist/cjs/js/src/base/functions/encode.js +0 -44
  215. package/dist/cjs/js/src/base/functions/generic.js +0 -193
  216. package/dist/cjs/js/src/base/functions/misc.js +0 -96
  217. package/dist/cjs/js/src/base/functions/number.js +0 -297
  218. package/dist/cjs/js/src/base/functions/platform.js +0 -28
  219. package/dist/cjs/js/src/base/functions/rsa.js +0 -34
  220. package/dist/cjs/js/src/base/functions/string.js +0 -48
  221. package/dist/cjs/js/src/base/functions/throttle.js +0 -66
  222. package/dist/cjs/js/src/base/functions/time.js +0 -187
  223. package/dist/cjs/js/src/base/functions/totp.js +0 -24
  224. package/dist/cjs/js/src/base/functions/type.js +0 -162
  225. package/dist/cjs/js/src/base/functions.js +0 -157
  226. package/dist/cjs/js/src/base/ws/Cache.js +0 -254
  227. package/dist/cjs/js/src/base/ws/Client.js +0 -299
  228. package/dist/cjs/js/src/base/ws/Future.js +0 -34
  229. package/dist/cjs/js/src/base/ws/OrderBook.js +0 -107
  230. package/dist/cjs/js/src/base/ws/OrderBookSide.js +0 -281
  231. package/dist/cjs/js/src/base/ws/WsClient.js +0 -69
  232. package/dist/cjs/js/src/bequant.js +0 -33
  233. package/dist/cjs/js/src/bigone.js +0 -2213
  234. package/dist/cjs/js/src/binance.js +0 -9845
  235. package/dist/cjs/js/src/binancecoinm.js +0 -45
  236. package/dist/cjs/js/src/binanceus.js +0 -92
  237. package/dist/cjs/js/src/binanceusdm.js +0 -58
  238. package/dist/cjs/js/src/bingx.js +0 -3846
  239. package/dist/cjs/js/src/bit2c.js +0 -916
  240. package/dist/cjs/js/src/bitbank.js +0 -1000
  241. package/dist/cjs/js/src/bitbay.js +0 -17
  242. package/dist/cjs/js/src/bitbns.js +0 -1220
  243. package/dist/cjs/js/src/bitcoincom.js +0 -17
  244. package/dist/cjs/js/src/bitfinex.js +0 -1670
  245. package/dist/cjs/js/src/bitfinex2.js +0 -2990
  246. package/dist/cjs/js/src/bitflyer.js +0 -1045
  247. package/dist/cjs/js/src/bitforex.js +0 -852
  248. package/dist/cjs/js/src/bitget.js +0 -8295
  249. package/dist/cjs/js/src/bithumb.js +0 -1090
  250. package/dist/cjs/js/src/bitmart.js +0 -4454
  251. package/dist/cjs/js/src/bitmex.js +0 -2881
  252. package/dist/cjs/js/src/bitopro.js +0 -1724
  253. package/dist/cjs/js/src/bitrue.js +0 -3253
  254. package/dist/cjs/js/src/bitso.js +0 -1753
  255. package/dist/cjs/js/src/bitstamp.js +0 -2188
  256. package/dist/cjs/js/src/bitteam.js +0 -2309
  257. package/dist/cjs/js/src/bitvavo.js +0 -1968
  258. package/dist/cjs/js/src/bl3p.js +0 -447
  259. package/dist/cjs/js/src/blockchaincom.js +0 -1160
  260. package/dist/cjs/js/src/btcalpha.js +0 -929
  261. package/dist/cjs/js/src/btcbox.js +0 -565
  262. package/dist/cjs/js/src/btcmarkets.js +0 -1237
  263. package/dist/cjs/js/src/btcturk.js +0 -929
  264. package/dist/cjs/js/src/bybit.js +0 -7650
  265. package/dist/cjs/js/src/cex.js +0 -1693
  266. package/dist/cjs/js/src/coinbase.js +0 -3424
  267. package/dist/cjs/js/src/coinbasepro.js +0 -1866
  268. package/dist/cjs/js/src/coincheck.js +0 -843
  269. package/dist/cjs/js/src/coinex.js +0 -5417
  270. package/dist/cjs/js/src/coinlist.js +0 -2337
  271. package/dist/cjs/js/src/coinmate.js +0 -989
  272. package/dist/cjs/js/src/coinone.js +0 -1185
  273. package/dist/cjs/js/src/coinsph.js +0 -1933
  274. package/dist/cjs/js/src/coinspot.js +0 -548
  275. package/dist/cjs/js/src/cryptocom.js +0 -3007
  276. package/dist/cjs/js/src/currencycom.js +0 -2015
  277. package/dist/cjs/js/src/delta.js +0 -3262
  278. package/dist/cjs/js/src/deribit.js +0 -3306
  279. package/dist/cjs/js/src/digifinex.js +0 -4307
  280. package/dist/cjs/js/src/exmo.js +0 -2645
  281. package/dist/cjs/js/src/fmfwio.js +0 -34
  282. package/dist/cjs/js/src/gate.js +0 -7077
  283. package/dist/cjs/js/src/gateio.js +0 -16
  284. package/dist/cjs/js/src/gemini.js +0 -1801
  285. package/dist/cjs/js/src/hitbtc.js +0 -3660
  286. package/dist/cjs/js/src/hitbtc3.js +0 -19
  287. package/dist/cjs/js/src/hollaex.js +0 -1882
  288. package/dist/cjs/js/src/htx.js +0 -9174
  289. package/dist/cjs/js/src/huobi.js +0 -16
  290. package/dist/cjs/js/src/huobijp.js +0 -1918
  291. package/dist/cjs/js/src/idex.js +0 -1770
  292. package/dist/cjs/js/src/independentreserve.js +0 -761
  293. package/dist/cjs/js/src/indodax.js +0 -1069
  294. package/dist/cjs/js/src/kraken.js +0 -2891
  295. package/dist/cjs/js/src/krakenfutures.js +0 -2407
  296. package/dist/cjs/js/src/kucoin.js +0 -4494
  297. package/dist/cjs/js/src/kucoinfutures.js +0 -2529
  298. package/dist/cjs/js/src/kuna.js +0 -1949
  299. package/dist/cjs/js/src/latoken.js +0 -1729
  300. package/dist/cjs/js/src/lbank.js +0 -2851
  301. package/dist/cjs/js/src/luno.js +0 -1044
  302. package/dist/cjs/js/src/lykke.js +0 -1303
  303. package/dist/cjs/js/src/mercado.js +0 -897
  304. package/dist/cjs/js/src/mexc.js +0 -5407
  305. package/dist/cjs/js/src/ndax.js +0 -2450
  306. package/dist/cjs/js/src/novadax.js +0 -1556
  307. package/dist/cjs/js/src/oceanex.js +0 -964
  308. package/dist/cjs/js/src/okcoin.js +0 -3115
  309. package/dist/cjs/js/src/okx.js +0 -7331
  310. package/dist/cjs/js/src/p2b.js +0 -1243
  311. package/dist/cjs/js/src/paymium.js +0 -597
  312. package/dist/cjs/js/src/phemex.js +0 -4725
  313. package/dist/cjs/js/src/poloniex.js +0 -2356
  314. package/dist/cjs/js/src/poloniexfutures.js +0 -1794
  315. package/dist/cjs/js/src/pro/alpaca.js +0 -714
  316. package/dist/cjs/js/src/pro/ascendex.js +0 -957
  317. package/dist/cjs/js/src/pro/bequant.js +0 -33
  318. package/dist/cjs/js/src/pro/binance.js +0 -2796
  319. package/dist/cjs/js/src/pro/binancecoinm.js +0 -23
  320. package/dist/cjs/js/src/pro/binanceus.js +0 -51
  321. package/dist/cjs/js/src/pro/binanceusdm.js +0 -32
  322. package/dist/cjs/js/src/pro/bingx.js +0 -944
  323. package/dist/cjs/js/src/pro/bitcoincom.js +0 -29
  324. package/dist/cjs/js/src/pro/bitfinex.js +0 -672
  325. package/dist/cjs/js/src/pro/bitfinex2.js +0 -1159
  326. package/dist/cjs/js/src/pro/bitget.js +0 -1733
  327. package/dist/cjs/js/src/pro/bitmart.js +0 -1486
  328. package/dist/cjs/js/src/pro/bitmex.js +0 -1576
  329. package/dist/cjs/js/src/pro/bitopro.js +0 -327
  330. package/dist/cjs/js/src/pro/bitrue.js +0 -462
  331. package/dist/cjs/js/src/pro/bitstamp.js +0 -547
  332. package/dist/cjs/js/src/pro/bitvavo.js +0 -704
  333. package/dist/cjs/js/src/pro/blockchaincom.js +0 -794
  334. package/dist/cjs/js/src/pro/bybit.js +0 -1843
  335. package/dist/cjs/js/src/pro/cex.js +0 -1510
  336. package/dist/cjs/js/src/pro/coinbase.js +0 -561
  337. package/dist/cjs/js/src/pro/coinbasepro.js +0 -968
  338. package/dist/cjs/js/src/pro/coinex.js +0 -1095
  339. package/dist/cjs/js/src/pro/cryptocom.js +0 -1020
  340. package/dist/cjs/js/src/pro/currencycom.js +0 -563
  341. package/dist/cjs/js/src/pro/deribit.js +0 -825
  342. package/dist/cjs/js/src/pro/exmo.js +0 -658
  343. package/dist/cjs/js/src/pro/gate.js +0 -1316
  344. package/dist/cjs/js/src/pro/gateio.js +0 -16
  345. package/dist/cjs/js/src/pro/gemini.js +0 -649
  346. package/dist/cjs/js/src/pro/hitbtc.js +0 -1294
  347. package/dist/cjs/js/src/pro/hollaex.js +0 -597
  348. package/dist/cjs/js/src/pro/htx.js +0 -2388
  349. package/dist/cjs/js/src/pro/huobi.js +0 -16
  350. package/dist/cjs/js/src/pro/huobijp.js +0 -606
  351. package/dist/cjs/js/src/pro/idex.js +0 -714
  352. package/dist/cjs/js/src/pro/independentreserve.js +0 -280
  353. package/dist/cjs/js/src/pro/kraken.js +0 -1364
  354. package/dist/cjs/js/src/pro/krakenfutures.js +0 -1506
  355. package/dist/cjs/js/src/pro/kucoin.js +0 -1054
  356. package/dist/cjs/js/src/pro/kucoinfutures.js +0 -981
  357. package/dist/cjs/js/src/pro/luno.js +0 -322
  358. package/dist/cjs/js/src/pro/mexc.js +0 -1170
  359. package/dist/cjs/js/src/pro/ndax.js +0 -545
  360. package/dist/cjs/js/src/pro/okcoin.js +0 -760
  361. package/dist/cjs/js/src/pro/okx.js +0 -1608
  362. package/dist/cjs/js/src/pro/phemex.js +0 -1511
  363. package/dist/cjs/js/src/pro/poloniex.js +0 -1253
  364. package/dist/cjs/js/src/pro/poloniexfutures.js +0 -1014
  365. package/dist/cjs/js/src/pro/probit.js +0 -586
  366. package/dist/cjs/js/src/pro/upbit.js +0 -234
  367. package/dist/cjs/js/src/pro/wazirx.js +0 -776
  368. package/dist/cjs/js/src/pro/whitebit.js +0 -927
  369. package/dist/cjs/js/src/pro/woo.js +0 -895
  370. package/dist/cjs/js/src/probit.js +0 -1867
  371. package/dist/cjs/js/src/static_dependencies/fflake/browser.js +0 -401
  372. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -195
  373. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -308
  374. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -554
  375. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -94
  376. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -70
  377. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -91
  378. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -16
  379. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -1760
  380. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -52
  381. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -81
  382. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -376
  383. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -70
  384. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -1580
  385. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -74
  386. package/dist/cjs/js/src/static_dependencies/noble-curves/_shortw_utils.js +0 -24
  387. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/curve.js +0 -158
  388. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/edwards.js +0 -429
  389. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -176
  390. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/modular.js +0 -324
  391. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/montgomery.js +0 -163
  392. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/utils.js +0 -245
  393. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +0 -1018
  394. package/dist/cjs/js/src/static_dependencies/noble-curves/ed25519.js +0 -383
  395. package/dist/cjs/js/src/static_dependencies/noble-curves/secp256k1.js +0 -258
  396. package/dist/cjs/js/src/static_dependencies/noble-hashes/_assert.js +0 -53
  397. package/dist/cjs/js/src/static_dependencies/noble-hashes/_sha2.js +0 -120
  398. package/dist/cjs/js/src/static_dependencies/noble-hashes/_u64.js +0 -69
  399. package/dist/cjs/js/src/static_dependencies/noble-hashes/crypto.js +0 -7
  400. package/dist/cjs/js/src/static_dependencies/noble-hashes/hmac.js +0 -83
  401. package/dist/cjs/js/src/static_dependencies/noble-hashes/md5.js +0 -240
  402. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha1.js +0 -91
  403. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha256.js +0 -130
  404. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha3.js +0 -214
  405. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha512.js +0 -239
  406. package/dist/cjs/js/src/static_dependencies/noble-hashes/utils.js +0 -93
  407. package/dist/cjs/js/src/static_dependencies/node-fetch/body.js +0 -354
  408. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/abort-error.js +0 -16
  409. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/base.js +0 -20
  410. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -30
  411. package/dist/cjs/js/src/static_dependencies/node-fetch/headers.js +0 -239
  412. package/dist/cjs/js/src/static_dependencies/node-fetch/index.js +0 -372
  413. package/dist/cjs/js/src/static_dependencies/node-fetch/request.js +0 -273
  414. package/dist/cjs/js/src/static_dependencies/node-fetch/response.js +0 -139
  415. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/get-search.js +0 -14
  416. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -16
  417. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is.js +0 -81
  418. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/referrer.js +0 -292
  419. package/dist/cjs/js/src/static_dependencies/proxies/agent-base/index.js +0 -103
  420. package/dist/cjs/js/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -140
  421. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -175
  422. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -95
  423. package/dist/cjs/js/src/static_dependencies/qs/index.cjs.js +0 -7
  424. package/dist/cjs/js/src/static_dependencies/scure-base/index.js +0 -383
  425. package/dist/cjs/js/src/timex.js +0 -1562
  426. package/dist/cjs/js/src/tokocrypto.js +0 -2542
  427. package/dist/cjs/js/src/upbit.js +0 -1844
  428. package/dist/cjs/js/src/wavesexchange.js +0 -2607
  429. package/dist/cjs/js/src/wazirx.js +0 -953
  430. package/dist/cjs/js/src/whitebit.js +0 -2309
  431. package/dist/cjs/js/src/woo.js +0 -2769
  432. package/dist/cjs/js/src/yobit.js +0 -1314
  433. package/dist/cjs/js/src/zaif.js +0 -736
  434. package/dist/cjs/js/src/zonda.js +0 -1883
  435. package/dist/cjs/src/abstract/bitpanda.js +0 -9
  436. package/test.ts +0 -0
  437. /package/dist/cjs/{js/src/abstract/ace.js → src/abstract/onetrading.js} +0 -0
  438. /package/dist/cjs/{js/src → src}/pro/coinone.js +0 -0
  439. /package/js/src/abstract/{bitpanda.js → onetrading.js} +0 -0
@@ -1,1724 +0,0 @@
1
- 'use strict';
2
-
3
- var bitopro$1 = require('./abstract/bitopro.js');
4
- var errors = require('./base/errors.js');
5
- var Precise = require('./base/Precise.js');
6
- var number = require('./base/functions/number.js');
7
- var sha512 = require('./static_dependencies/noble-hashes/sha512.js');
8
-
9
- // ---------------------------------------------------------------------------
10
- // ---------------------------------------------------------------------------
11
- /**
12
- * @class bitopro
13
- * @augments Exchange
14
- */
15
- class bitopro extends bitopro$1 {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'bitopro',
19
- 'name': 'BitoPro',
20
- 'countries': ['TW'],
21
- 'version': 'v3',
22
- 'rateLimit': 100,
23
- 'pro': true,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': true,
27
- 'margin': false,
28
- 'swap': false,
29
- 'future': false,
30
- 'option': false,
31
- 'cancelAllOrders': true,
32
- 'cancelOrder': true,
33
- 'cancelOrders': true,
34
- 'closeAllPositions': false,
35
- 'closePosition': false,
36
- 'createOrder': true,
37
- 'editOrder': false,
38
- 'fetchBalance': true,
39
- 'fetchBorrowRateHistories': false,
40
- 'fetchBorrowRateHistory': false,
41
- 'fetchClosedOrders': true,
42
- 'fetchCrossBorrowRate': false,
43
- 'fetchCrossBorrowRates': false,
44
- 'fetchCurrencies': true,
45
- 'fetchDepositAddress': false,
46
- 'fetchDeposits': true,
47
- 'fetchDepositsWithdrawals': false,
48
- 'fetchDepositWithdrawFee': 'emulated',
49
- 'fetchDepositWithdrawFees': true,
50
- 'fetchFundingHistory': false,
51
- 'fetchFundingRate': false,
52
- 'fetchFundingRateHistory': false,
53
- 'fetchFundingRates': false,
54
- 'fetchIndexOHLCV': false,
55
- 'fetchIsolatedBorrowRate': false,
56
- 'fetchIsolatedBorrowRates': false,
57
- 'fetchMarginMode': false,
58
- 'fetchMarkets': true,
59
- 'fetchMarkOHLCV': false,
60
- 'fetchMyTrades': true,
61
- 'fetchOHLCV': true,
62
- 'fetchOpenInterestHistory': false,
63
- 'fetchOpenOrders': true,
64
- 'fetchOrder': true,
65
- 'fetchOrderBook': true,
66
- 'fetchOrders': false,
67
- 'fetchOrderTrades': false,
68
- 'fetchPositionMode': false,
69
- 'fetchPositions': false,
70
- 'fetchPremiumIndexOHLCV': false,
71
- 'fetchTicker': true,
72
- 'fetchTickers': true,
73
- 'fetchTime': false,
74
- 'fetchTrades': true,
75
- 'fetchTradingFee': false,
76
- 'fetchTradingFees': true,
77
- 'fetchTransactionFees': false,
78
- 'fetchTransactions': false,
79
- 'fetchTransfer': false,
80
- 'fetchTransfers': false,
81
- 'fetchWithdrawal': true,
82
- 'fetchWithdrawals': true,
83
- 'setLeverage': false,
84
- 'setMarginMode': false,
85
- 'transfer': false,
86
- 'withdraw': true,
87
- },
88
- 'timeframes': {
89
- '1m': '1m',
90
- '5m': '5m',
91
- '15m': '15m',
92
- '30m': '30m',
93
- '1h': '1h',
94
- '3h': '3h',
95
- '6h': '6h',
96
- '12h': '12h',
97
- '1d': '1d',
98
- '1w': '1w',
99
- '1M': '1M',
100
- },
101
- 'urls': {
102
- 'logo': 'https://user-images.githubusercontent.com/1294454/158227251-3a92a220-9222-453c-9277-977c6677fe71.jpg',
103
- 'api': {
104
- 'rest': 'https://api.bitopro.com/v3',
105
- },
106
- 'www': 'https://www.bitopro.com',
107
- 'doc': [
108
- 'https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md',
109
- ],
110
- 'fees': 'https://www.bitopro.com/fees',
111
- },
112
- 'requiredCredentials': {
113
- 'apiKey': true,
114
- 'secret': true,
115
- },
116
- 'api': {
117
- 'public': {
118
- 'get': {
119
- 'order-book/{pair}': 1,
120
- 'tickers': 1,
121
- 'tickers/{pair}': 1,
122
- 'trades/{pair}': 1,
123
- 'provisioning/currencies': 1,
124
- 'provisioning/trading-pairs': 1,
125
- 'provisioning/limitations-and-fees': 1,
126
- 'trading-history/{pair}': 1,
127
- 'price/otc/{currency}': 1,
128
- },
129
- },
130
- 'private': {
131
- 'get': {
132
- 'accounts/balance': 1,
133
- 'orders/history': 1,
134
- 'orders/all/{pair}': 1,
135
- 'orders/trades/{pair}': 1,
136
- 'orders/{pair}/{orderId}': 1,
137
- 'wallet/withdraw/{currency}/{serial}': 1,
138
- 'wallet/withdraw/{currency}/id/{id}': 1,
139
- 'wallet/depositHistory/{currency}': 1,
140
- 'wallet/withdrawHistory/{currency}': 1,
141
- },
142
- 'post': {
143
- 'orders/{pair}': 1 / 2,
144
- 'orders/batch': 20 / 3,
145
- 'wallet/withdraw/{currency}': 10, // 60/m => 1/s => 10/1 = 10
146
- },
147
- 'put': {
148
- 'orders': 5, // 2/s => 10/2 = 5
149
- },
150
- 'delete': {
151
- 'orders/{pair}/{id}': 2 / 3,
152
- 'orders/all': 5,
153
- 'orders/{pair}': 5, // 2/s => 10/2 = 5
154
- },
155
- },
156
- },
157
- 'fees': {
158
- 'trading': {
159
- 'tierBased': true,
160
- 'percentage': true,
161
- 'maker': this.parseNumber('0.001'),
162
- 'taker': this.parseNumber('0.002'),
163
- 'tiers': {
164
- 'taker': [
165
- [this.parseNumber('0'), this.parseNumber('0.002')],
166
- [this.parseNumber('3000000'), this.parseNumber('0.00194')],
167
- [this.parseNumber('5000000'), this.parseNumber('0.0015')],
168
- [this.parseNumber('30000000'), this.parseNumber('0.0014')],
169
- [this.parseNumber('300000000'), this.parseNumber('0.0013')],
170
- [this.parseNumber('550000000'), this.parseNumber('0.0012')],
171
- [this.parseNumber('1300000000'), this.parseNumber('0.0011')],
172
- ],
173
- 'maker': [
174
- [this.parseNumber('0'), this.parseNumber('0.001')],
175
- [this.parseNumber('3000000'), this.parseNumber('0.00097')],
176
- [this.parseNumber('5000000'), this.parseNumber('0.0007')],
177
- [this.parseNumber('30000000'), this.parseNumber('0.0006')],
178
- [this.parseNumber('300000000'), this.parseNumber('0.0005')],
179
- [this.parseNumber('550000000'), this.parseNumber('0.0004')],
180
- [this.parseNumber('1300000000'), this.parseNumber('0.0003')],
181
- ],
182
- },
183
- },
184
- },
185
- 'options': {
186
- 'networks': {
187
- 'ERC20': 'ERC20',
188
- 'ETH': 'ERC20',
189
- 'TRX': 'TRX',
190
- 'TRC20': 'TRX',
191
- 'BEP20': 'BSC',
192
- 'BSC': 'BSC',
193
- },
194
- },
195
- 'precisionMode': number.TICK_SIZE,
196
- 'exceptions': {
197
- 'exact': {
198
- 'Unsupported currency.': errors.BadRequest,
199
- 'Unsupported order type': errors.BadRequest,
200
- 'Invalid body': errors.BadRequest,
201
- 'Invalid Signature': errors.AuthenticationError,
202
- 'Address not in whitelist.': errors.BadRequest,
203
- },
204
- 'broad': {
205
- 'Invalid amount': errors.InvalidOrder,
206
- 'Balance for ': errors.InsufficientFunds,
207
- 'Invalid ': errors.BadRequest,
208
- 'Wrong parameter': errors.BadRequest, // {"error":"Wrong parameter: from"}
209
- },
210
- },
211
- 'commonCurrencies': {},
212
- });
213
- }
214
- async fetchCurrencies(params = {}) {
215
- /**
216
- * @method
217
- * @name bitopro#fetchCurrencies
218
- * @description fetches all available currencies on an exchange
219
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_currency_info.md
220
- * @param {object} [params] extra parameters specific to the exchange API endpoint
221
- * @returns {object} an associative dictionary of currencies
222
- */
223
- const response = await this.publicGetProvisioningCurrencies(params);
224
- const currencies = this.safeValue(response, 'data', []);
225
- //
226
- // {
227
- // "data":[
228
- // {
229
- // "currency":"eth",
230
- // "withdrawFee":"0.007",
231
- // "minWithdraw":"0.001",
232
- // "maxWithdraw":"1000",
233
- // "maxDailyWithdraw":"2000",
234
- // "withdraw":true,
235
- // "deposit":true,
236
- // "depositConfirmation":"12"
237
- // }
238
- // ]
239
- // }
240
- //
241
- const result = {};
242
- for (let i = 0; i < currencies.length; i++) {
243
- const currency = currencies[i];
244
- const currencyId = this.safeString(currency, 'currency');
245
- const code = this.safeCurrencyCode(currencyId);
246
- const deposit = this.safeValue(currency, 'deposit');
247
- const withdraw = this.safeValue(currency, 'withdraw');
248
- const fee = this.safeNumber(currency, 'withdrawFee');
249
- const withdrawMin = this.safeNumber(currency, 'minWithdraw');
250
- const withdrawMax = this.safeNumber(currency, 'maxWithdraw');
251
- const limits = {
252
- 'withdraw': {
253
- 'min': withdrawMin,
254
- 'max': withdrawMax,
255
- },
256
- 'amount': {
257
- 'min': undefined,
258
- 'max': undefined,
259
- },
260
- };
261
- result[code] = {
262
- 'id': currencyId,
263
- 'code': code,
264
- 'info': currency,
265
- 'type': undefined,
266
- 'name': undefined,
267
- 'active': deposit && withdraw,
268
- 'deposit': deposit,
269
- 'withdraw': withdraw,
270
- 'fee': fee,
271
- 'precision': undefined,
272
- 'limits': limits,
273
- };
274
- }
275
- return result;
276
- }
277
- async fetchMarkets(params = {}) {
278
- /**
279
- * @method
280
- * @name bitopro#fetchMarkets
281
- * @description retrieves data on all markets for bitopro
282
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_trading_pair_info.md
283
- * @param {object} [params] extra parameters specific to the exchange API endpoint
284
- * @returns {object[]} an array of objects representing market data
285
- */
286
- const response = await this.publicGetProvisioningTradingPairs();
287
- const markets = this.safeValue(response, 'data', []);
288
- //
289
- // {
290
- // "data":[
291
- // {
292
- // "pair":"shib_twd",
293
- // "base":"shib",
294
- // "quote":"twd",
295
- // "basePrecision":"8",
296
- // "quotePrecision":"6",
297
- // "minLimitBaseAmount":"100000",
298
- // "maxLimitBaseAmount":"5500000000",
299
- // "minMarketBuyQuoteAmount":"1000",
300
- // "orderOpenLimit":"200",
301
- // "maintain":false,
302
- // "orderBookQuotePrecision":"6",
303
- // "orderBookQuoteScaleLevel":"5"
304
- // }
305
- // ]
306
- // }
307
- //
308
- return this.parseMarkets(markets);
309
- }
310
- parseMarket(market) {
311
- const active = !this.safeValue(market, 'maintain');
312
- const id = this.safeString(market, 'pair');
313
- const uppercaseId = id.toUpperCase();
314
- const baseId = this.safeString(market, 'base');
315
- const quoteId = this.safeString(market, 'quote');
316
- const base = this.safeCurrencyCode(baseId);
317
- const quote = this.safeCurrencyCode(quoteId);
318
- const symbol = base + '/' + quote;
319
- const limits = {
320
- 'amount': {
321
- 'min': this.safeNumber(market, 'minLimitBaseAmount'),
322
- 'max': this.safeNumber(market, 'maxLimitBaseAmount'),
323
- },
324
- 'price': {
325
- 'min': undefined,
326
- 'max': undefined,
327
- },
328
- 'cost': {
329
- 'min': undefined,
330
- 'max': undefined,
331
- },
332
- 'leverage': {
333
- 'min': undefined,
334
- 'max': undefined,
335
- },
336
- };
337
- return {
338
- 'id': id,
339
- 'uppercaseId': uppercaseId,
340
- 'symbol': symbol,
341
- 'base': base,
342
- 'quote': quote,
343
- 'baseId': base,
344
- 'quoteId': quote,
345
- 'settle': undefined,
346
- 'settleId': undefined,
347
- 'type': 'spot',
348
- 'spot': true,
349
- 'margin': false,
350
- 'swap': false,
351
- 'future': false,
352
- 'option': false,
353
- 'contract': false,
354
- 'linear': undefined,
355
- 'inverse': undefined,
356
- 'contractSize': undefined,
357
- 'expiry': undefined,
358
- 'expiryDatetime': undefined,
359
- 'strike': undefined,
360
- 'optionType': undefined,
361
- 'limits': limits,
362
- 'precision': {
363
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
364
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'basePrecision'))),
365
- },
366
- 'active': active,
367
- 'created': undefined,
368
- 'info': market,
369
- };
370
- }
371
- parseTicker(ticker, market = undefined) {
372
- //
373
- // {
374
- // "pair":"btc_twd",
375
- // "lastPrice":"1182449.00000000",
376
- // "isBuyer":false,
377
- // "priceChange24hr":"-1.99",
378
- // "volume24hr":"9.13089740",
379
- // "high24hr":"1226097.00000000",
380
- // "low24hr":"1181000.00000000"
381
- // }
382
- //
383
- const marketId = this.safeString(ticker, 'pair');
384
- market = this.safeMarket(marketId, market);
385
- const symbol = this.safeString(market, 'symbol');
386
- return this.safeTicker({
387
- 'symbol': symbol,
388
- 'timestamp': undefined,
389
- 'datetime': undefined,
390
- 'high': this.safeString(ticker, 'high24hr'),
391
- 'low': this.safeString(ticker, 'low24hr'),
392
- 'bid': undefined,
393
- 'bidVolume': undefined,
394
- 'ask': undefined,
395
- 'askVolume': undefined,
396
- 'vwap': undefined,
397
- 'open': undefined,
398
- 'close': this.safeString(ticker, 'lastPrice'),
399
- 'last': this.safeString(ticker, 'lastPrice'),
400
- 'previousClose': undefined,
401
- 'change': undefined,
402
- 'percentage': this.safeString(ticker, 'priceChange24hr'),
403
- 'average': undefined,
404
- 'baseVolume': this.safeString(ticker, 'volume24hr'),
405
- 'quoteVolume': undefined,
406
- 'info': ticker,
407
- }, market);
408
- }
409
- async fetchTicker(symbol, params = {}) {
410
- /**
411
- * @method
412
- * @name bitopro#fetchTicker
413
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
414
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_ticker_data.md
415
- * @param {string} symbol unified symbol of the market to fetch the ticker for
416
- * @param {object} [params] extra parameters specific to the exchange API endpoint
417
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
418
- */
419
- await this.loadMarkets();
420
- const market = this.market(symbol);
421
- const request = {
422
- 'pair': market['id'],
423
- };
424
- const response = await this.publicGetTickersPair(this.extend(request, params));
425
- const ticker = this.safeValue(response, 'data', {});
426
- //
427
- // {
428
- // "data":{
429
- // "pair":"btc_twd",
430
- // "lastPrice":"1182449.00000000",
431
- // "isBuyer":false,
432
- // "priceChange24hr":"-1.99",
433
- // "volume24hr":"9.13089740",
434
- // "high24hr":"1226097.00000000",
435
- // "low24hr":"1181000.00000000"
436
- // }
437
- // }
438
- //
439
- return this.parseTicker(ticker, market);
440
- }
441
- async fetchTickers(symbols = undefined, params = {}) {
442
- /**
443
- * @method
444
- * @name bitopro#fetchTickers
445
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
446
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_ticker_data.md
447
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
448
- * @param {object} [params] extra parameters specific to the exchange API endpoint
449
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
450
- */
451
- await this.loadMarkets();
452
- const response = await this.publicGetTickers();
453
- const tickers = this.safeValue(response, 'data', []);
454
- //
455
- // {
456
- // "data":[
457
- // {
458
- // "pair":"xrp_twd",
459
- // "lastPrice":"21.26110000",
460
- // "isBuyer":false,
461
- // "priceChange24hr":"-6.53",
462
- // "volume24hr":"102846.47084802",
463
- // "high24hr":"23.24460000",
464
- // "low24hr":"21.13730000"
465
- // }
466
- // ]
467
- // }
468
- //
469
- return this.parseTickers(tickers, symbols);
470
- }
471
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
472
- /**
473
- * @method
474
- * @name bitopro#fetchOrderBook
475
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
476
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_orderbook_data.md
477
- * @param {string} symbol unified symbol of the market to fetch the order book for
478
- * @param {int} [limit] the maximum amount of order book entries to return
479
- * @param {object} [params] extra parameters specific to the exchange API endpoint
480
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
481
- */
482
- await this.loadMarkets();
483
- const market = this.market(symbol);
484
- const request = {
485
- 'pair': market['id'],
486
- };
487
- if (limit !== undefined) {
488
- request['limit'] = limit;
489
- }
490
- const response = await this.publicGetOrderBookPair(this.extend(request, params));
491
- //
492
- // {
493
- // "bids":[
494
- // {
495
- // "price":"1175271",
496
- // "amount":"0.00022804",
497
- // "count":1,
498
- // "total":"0.00022804"
499
- // }
500
- // ],
501
- // "asks":[
502
- // {
503
- // "price":"1176906",
504
- // "amount":"0.0496",
505
- // "count":1,
506
- // "total":"0.0496"
507
- // }
508
- // ]
509
- // }
510
- //
511
- return this.parseOrderBook(response, market['symbol'], undefined, 'bids', 'asks', 'price', 'amount');
512
- }
513
- parseTrade(trade, market = undefined) {
514
- //
515
- // fetchTrades
516
- // {
517
- // "timestamp":1644651458,
518
- // "price":"1180785.00000000",
519
- // "amount":"0.00020000",
520
- // "isBuyer":false
521
- // }
522
- //
523
- // fetchMyTrades
524
- // {
525
- // "tradeId":"5685030251",
526
- // "orderId":"9669168142",
527
- // "price":"11821.8",
528
- // "action":"SELL",
529
- // "baseAmount":"0.01",
530
- // "quoteAmount":"118.218",
531
- // "fee":"0.236436",
532
- // "feeSymbol":"BNB",
533
- // "isTaker":true,
534
- // "timestamp":1644905714862,
535
- // "createdTimestamp":1644905714862
536
- // }
537
- //
538
- const id = this.safeString(trade, 'tradeId');
539
- const orderId = this.safeString(trade, 'orderId');
540
- let timestamp = undefined;
541
- if (id === undefined) {
542
- timestamp = this.safeTimestamp(trade, 'timestamp');
543
- }
544
- else {
545
- timestamp = this.safeInteger(trade, 'timestamp');
546
- }
547
- const marketId = this.safeString(trade, 'pair');
548
- market = this.safeMarket(marketId, market);
549
- const symbol = this.safeString(market, 'symbol');
550
- const price = this.safeString(trade, 'price');
551
- const type = this.safeStringLower(trade, 'type');
552
- let side = this.safeStringLower(trade, 'action');
553
- if (side === undefined) {
554
- const isBuyer = this.safeValue(trade, 'isBuyer');
555
- if (isBuyer) {
556
- side = 'buy';
557
- }
558
- else {
559
- side = 'sell';
560
- }
561
- }
562
- let amount = this.safeString(trade, 'amount');
563
- if (amount === undefined) {
564
- amount = this.safeString(trade, 'baseAmount');
565
- }
566
- let fee = undefined;
567
- const feeAmount = this.safeString(trade, 'fee');
568
- const feeSymbol = this.safeCurrencyCode(this.safeString(trade, 'feeSymbol'));
569
- if (feeAmount !== undefined) {
570
- fee = {
571
- 'cost': feeAmount,
572
- 'currency': feeSymbol,
573
- 'rate': undefined,
574
- };
575
- }
576
- const isTaker = this.safeValue(trade, 'isTaker');
577
- let takerOrMaker = undefined;
578
- if (isTaker !== undefined) {
579
- if (isTaker) {
580
- takerOrMaker = 'taker';
581
- }
582
- else {
583
- takerOrMaker = 'maker';
584
- }
585
- }
586
- return this.safeTrade({
587
- 'id': id,
588
- 'info': trade,
589
- 'order': orderId,
590
- 'timestamp': timestamp,
591
- 'datetime': this.iso8601(timestamp),
592
- 'symbol': symbol,
593
- 'takerOrMaker': takerOrMaker,
594
- 'type': type,
595
- 'side': side,
596
- 'price': price,
597
- 'amount': amount,
598
- 'cost': undefined,
599
- 'fee': fee,
600
- }, market);
601
- }
602
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
603
- /**
604
- * @method
605
- * @name bitopro#fetchTrades
606
- * @description get the list of most recent trades for a particular symbol
607
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_trades_data.md
608
- * @param {string} symbol unified symbol of the market to fetch trades for
609
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
610
- * @param {int} [limit] the maximum amount of trades to fetch
611
- * @param {object} [params] extra parameters specific to the exchange API endpoint
612
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
613
- */
614
- await this.loadMarkets();
615
- const market = this.market(symbol);
616
- const request = {
617
- 'pair': market['id'],
618
- };
619
- const response = await this.publicGetTradesPair(this.extend(request, params));
620
- const trades = this.safeValue(response, 'data', []);
621
- //
622
- // {
623
- // "data":[
624
- // {
625
- // "timestamp":1644651458,
626
- // "price":"1180785.00000000",
627
- // "amount":"0.00020000",
628
- // "isBuyer":false
629
- // }
630
- // ]
631
- // }
632
- //
633
- return this.parseTrades(trades, market, since, limit);
634
- }
635
- async fetchTradingFees(params = {}) {
636
- /**
637
- * @method
638
- * @name bitopro#fetchTradingFees
639
- * @description fetch the trading fees for multiple markets
640
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_limitations_and_fees.md
641
- * @param {object} [params] extra parameters specific to the exchange API endpoint
642
- * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
643
- */
644
- await this.loadMarkets();
645
- const response = await this.publicGetProvisioningLimitationsAndFees(params);
646
- const tradingFeeRate = this.safeValue(response, 'tradingFeeRate', {});
647
- const first = this.safeValue(tradingFeeRate, 0);
648
- //
649
- // {
650
- // "tradingFeeRate":[
651
- // {
652
- // "rank":0,
653
- // "twdVolumeSymbol":"\u003c",
654
- // "twdVolume":"3000000",
655
- // "bitoAmountSymbol":"\u003c",
656
- // "bitoAmount":"7500",
657
- // "makerFee":"0.001",
658
- // "takerFee":"0.002",
659
- // "makerBitoFee":"0.0008",
660
- // "takerBitoFee":"0.0016"
661
- // }
662
- // ],
663
- // "orderFeesAndLimitations":[
664
- // {
665
- // "pair":"BTC/TWD",
666
- // "minimumOrderAmount":"0.0001",
667
- // "minimumOrderAmountBase":"BTC",
668
- // "minimumOrderNumberOfDigits":"0"
669
- // }
670
- // ],
671
- // "restrictionsOfWithdrawalFees":[
672
- // {
673
- // "currency":"TWD",
674
- // "fee":"15",
675
- // "minimumTradingAmount":"100",
676
- // "maximumTradingAmount":"1000000",
677
- // "dailyCumulativeMaximumAmount":"2000000",
678
- // "remarks":"",
679
- // "protocol":""
680
- // }
681
- // ],
682
- // "cryptocurrencyDepositFeeAndConfirmation":[
683
- // {
684
- // "currency":"TWD",
685
- // "generalDepositFees":"0",
686
- // "blockchainConfirmationRequired":""
687
- // }
688
- // ],
689
- // "ttCheckFeesAndLimitationsLevel1":[
690
- // {
691
- // "currency":"TWD",
692
- // "redeemDailyCumulativeMaximumAmount":"",
693
- // "generateMinimumTradingAmount":"",
694
- // "generateMaximumTradingAmount":"",
695
- // "generateDailyCumulativeMaximumAmount":""
696
- // }
697
- // ],
698
- // "ttCheckFeesAndLimitationsLevel2":[
699
- // {
700
- // "currency":"TWD",
701
- // "redeemDailyCumulativeMaximumAmount":"20000000",
702
- // "generateMinimumTradingAmount":"30",
703
- // "generateMaximumTradingAmount":"10000000",
704
- // "generateDailyCumulativeMaximumAmount":"10000000"
705
- // }
706
- // ]
707
- // }
708
- //
709
- const result = {};
710
- const maker = this.safeNumber(first, 'makerFee');
711
- const taker = this.safeNumber(first, 'takerFee');
712
- for (let i = 0; i < this.symbols.length; i++) {
713
- const symbol = this.symbols[i];
714
- result[symbol] = {
715
- 'info': first,
716
- 'symbol': symbol,
717
- 'maker': maker,
718
- 'taker': taker,
719
- 'percentage': true,
720
- 'tierBased': true,
721
- };
722
- }
723
- return result;
724
- }
725
- parseOHLCV(ohlcv, market = undefined) {
726
- return [
727
- this.safeInteger(ohlcv, 'timestamp'),
728
- this.safeNumber(ohlcv, 'open'),
729
- this.safeNumber(ohlcv, 'high'),
730
- this.safeNumber(ohlcv, 'low'),
731
- this.safeNumber(ohlcv, 'close'),
732
- this.safeNumber(ohlcv, 'volume'),
733
- ];
734
- }
735
- async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
736
- /**
737
- * @method
738
- * @name bitopro#fetchOHLCV
739
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
740
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_ohlc_data.md
741
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
742
- * @param {string} timeframe the length of time each candle represents
743
- * @param {int} [since] timestamp in ms of the earliest candle to fetch
744
- * @param {int} [limit] the maximum amount of candles to fetch
745
- * @param {object} [params] extra parameters specific to the exchange API endpoint
746
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
747
- */
748
- await this.loadMarkets();
749
- const market = this.market(symbol);
750
- const resolution = this.safeString(this.timeframes, timeframe, timeframe);
751
- const request = {
752
- 'pair': market['id'],
753
- 'resolution': resolution,
754
- };
755
- // we need to have a limit argument because "to" and "from" are required
756
- if (limit === undefined) {
757
- limit = 500;
758
- }
759
- const timeframeInSeconds = this.parseTimeframe(timeframe);
760
- let alignedSince = undefined;
761
- if (since === undefined) {
762
- request['to'] = this.seconds();
763
- request['from'] = request['to'] - (limit * timeframeInSeconds);
764
- }
765
- else {
766
- const timeframeInMilliseconds = timeframeInSeconds * 1000;
767
- alignedSince = Math.floor(since / timeframeInMilliseconds) * timeframeInMilliseconds;
768
- request['from'] = Math.floor(since / 1000);
769
- request['to'] = this.sum(request['from'], limit * timeframeInSeconds);
770
- }
771
- const response = await this.publicGetTradingHistoryPair(this.extend(request, params));
772
- const data = this.safeValue(response, 'data', []);
773
- //
774
- // {
775
- // "data":[
776
- // {
777
- // "timestamp":1644581100000,
778
- // "open":"1214737",
779
- // "high":"1215110",
780
- // "low":"1214737",
781
- // "close":"1215110",
782
- // "volume":"0.08423959"
783
- // }
784
- // ]
785
- // }
786
- //
787
- const sparse = this.parseOHLCVs(data, market, timeframe, since, limit);
788
- return this.insertMissingCandles(sparse, timeframeInSeconds, alignedSince, limit);
789
- }
790
- insertMissingCandles(candles, distance, since, limit) {
791
- // the exchange doesn't send zero volume candles so we emulate them instead
792
- // otherwise sending a limit arg leads to unexpected results
793
- const length = candles.length;
794
- if (length === 0) {
795
- return candles;
796
- }
797
- const result = [];
798
- let copyFrom = candles[0];
799
- let timestamp = undefined;
800
- if (since === undefined) {
801
- timestamp = copyFrom[0];
802
- }
803
- else {
804
- timestamp = since;
805
- }
806
- let i = 0;
807
- const candleLength = candles.length;
808
- let resultLength = 0;
809
- while ((resultLength < limit) && (i < candleLength)) {
810
- const candle = candles[i];
811
- if (candle[0] === timestamp) {
812
- result.push(candle);
813
- i = this.sum(i, 1);
814
- }
815
- else {
816
- const copy = this.arrayConcat([], copyFrom);
817
- copy[0] = timestamp;
818
- // set open, high, low to close
819
- copy[1] = copy[4];
820
- copy[2] = copy[4];
821
- copy[3] = copy[4];
822
- copy[5] = this.parseNumber('0');
823
- result.push(copy);
824
- }
825
- timestamp = this.sum(timestamp, distance * 1000);
826
- resultLength = result.length;
827
- copyFrom = result[resultLength - 1];
828
- }
829
- return result;
830
- }
831
- parseBalance(response) {
832
- //
833
- // [{
834
- // "currency":"twd",
835
- // "amount":"0",
836
- // "available":"0",
837
- // "stake":"0",
838
- // "tradable":true
839
- // }]
840
- //
841
- const result = {
842
- 'info': response,
843
- };
844
- for (let i = 0; i < response.length; i++) {
845
- const balance = response[i];
846
- const currencyId = this.safeString(balance, 'currency');
847
- const code = this.safeCurrencyCode(currencyId);
848
- const amount = this.safeString(balance, 'amount');
849
- const available = this.safeString(balance, 'available');
850
- const account = {
851
- 'free': available,
852
- 'total': amount,
853
- };
854
- result[code] = account;
855
- }
856
- return this.safeBalance(result);
857
- }
858
- async fetchBalance(params = {}) {
859
- /**
860
- * @method
861
- * @name bitopro#fetchBalance
862
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
863
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_account_balance.md
864
- * @param {object} [params] extra parameters specific to the exchange API endpoint
865
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
866
- */
867
- await this.loadMarkets();
868
- const response = await this.privateGetAccountsBalance(params);
869
- const balances = this.safeValue(response, 'data', []);
870
- //
871
- // {
872
- // "data":[
873
- // {
874
- // "currency":"twd",
875
- // "amount":"0",
876
- // "available":"0",
877
- // "stake":"0",
878
- // "tradable":true
879
- // }
880
- // ]
881
- // }
882
- //
883
- return this.parseBalance(balances);
884
- }
885
- parseOrderStatus(status) {
886
- const statuses = {
887
- '-1': 'open',
888
- '0': 'open',
889
- '1': 'open',
890
- '2': 'closed',
891
- '3': 'closed',
892
- '4': 'canceled',
893
- '6': 'canceled',
894
- };
895
- return this.safeString(statuses, status, undefined);
896
- }
897
- parseOrder(order, market = undefined) {
898
- //
899
- // createOrder
900
- // {
901
- // "orderId": "2220595581",
902
- // "timestamp": "1644896744886",
903
- // "action": "SELL",
904
- // "amount": "0.01",
905
- // "price": "15000",
906
- // "timeInForce": "GTC"
907
- // }
908
- //
909
- // fetchOrder
910
- // {
911
- // "id":"8777138788",
912
- // "pair":"bnb_twd",
913
- // "price":"16000",
914
- // "avgExecutionPrice":"0",
915
- // "action":"SELL",
916
- // "type":"LIMIT",
917
- // "timestamp":1644899002598,
918
- // "status":4,
919
- // "originalAmount":"0.01",
920
- // "remainingAmount":"0.01",
921
- // "executedAmount":"0",
922
- // "fee":"0",
923
- // "feeSymbol":"twd",
924
- // "bitoFee":"0",
925
- // "total":"0",
926
- // "seq":"BNBTWD548774666",
927
- // "timeInForce":"GTC",
928
- // "createdTimestamp":1644898944074,
929
- // "updatedTimestamp":1644899002598
930
- // }
931
- //
932
- const id = this.safeString2(order, 'id', 'orderId');
933
- const timestamp = this.safeInteger2(order, 'timestamp', 'createdTimestamp');
934
- let side = this.safeString(order, 'action');
935
- side = side.toLowerCase();
936
- const amount = this.safeString2(order, 'amount', 'originalAmount');
937
- const price = this.safeString(order, 'price');
938
- const marketId = this.safeString(order, 'pair');
939
- market = this.safeMarket(marketId, market, '_');
940
- const symbol = this.safeString(market, 'symbol');
941
- const orderStatus = this.safeString(order, 'status');
942
- const status = this.parseOrderStatus(orderStatus);
943
- const type = this.safeStringLower(order, 'type');
944
- const average = this.safeString(order, 'avgExecutionPrice');
945
- const filled = this.safeString(order, 'executedAmount');
946
- const remaining = this.safeString(order, 'remainingAmount');
947
- const timeInForce = this.safeString(order, 'timeInForce');
948
- let postOnly = undefined;
949
- if (timeInForce === 'POST_ONLY') {
950
- postOnly = true;
951
- }
952
- let fee = undefined;
953
- const feeAmount = this.safeString(order, 'fee');
954
- const feeSymbol = this.safeCurrencyCode(this.safeString(order, 'feeSymbol'));
955
- if (Precise["default"].stringGt(feeAmount, '0')) {
956
- fee = {
957
- 'currency': feeSymbol,
958
- 'cost': feeAmount,
959
- };
960
- }
961
- return this.safeOrder({
962
- 'id': id,
963
- 'clientOrderId': undefined,
964
- 'timestamp': timestamp,
965
- 'datetime': this.iso8601(timestamp),
966
- 'lastTradeTimestamp': this.safeInteger(order, 'updatedTimestamp'),
967
- 'symbol': symbol,
968
- 'type': type,
969
- 'timeInForce': timeInForce,
970
- 'postOnly': postOnly,
971
- 'side': side,
972
- 'price': price,
973
- 'stopPrice': undefined,
974
- 'triggerPrice': undefined,
975
- 'amount': amount,
976
- 'cost': undefined,
977
- 'average': average,
978
- 'filled': filled,
979
- 'remaining': remaining,
980
- 'status': status,
981
- 'fee': fee,
982
- 'trades': undefined,
983
- 'info': order,
984
- }, market);
985
- }
986
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
987
- /**
988
- * @method
989
- * @name bitopro#createOrder
990
- * @description create a trade order
991
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/create_an_order.md
992
- * @param {string} symbol unified symbol of the market to create an order in
993
- * @param {string} type 'market' or 'limit'
994
- * @param {string} side 'buy' or 'sell'
995
- * @param {float} amount how much of currency you want to trade in units of base currency
996
- * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
997
- * @param {object} [params] extra parameters specific to the exchange API endpoint
998
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
999
- */
1000
- await this.loadMarkets();
1001
- const market = this.market(symbol);
1002
- const request = {
1003
- 'type': type,
1004
- 'pair': market['id'],
1005
- 'action': side,
1006
- 'amount': this.amountToPrecision(symbol, amount),
1007
- 'timestamp': this.milliseconds(),
1008
- };
1009
- const orderType = type.toUpperCase();
1010
- if (orderType === 'LIMIT') {
1011
- request['price'] = this.priceToPrecision(symbol, price);
1012
- }
1013
- if (orderType === 'STOP_LIMIT') {
1014
- request['price'] = this.priceToPrecision(symbol, price);
1015
- const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1016
- params = this.omit(params, ['triggerPrice', 'stopPrice']);
1017
- if (stopPrice === undefined) {
1018
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice parameter for ' + orderType + ' orders');
1019
- }
1020
- else {
1021
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
1022
- }
1023
- const condition = this.safeString(params, 'condition');
1024
- if (condition === undefined) {
1025
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a condition parameter for ' + orderType + ' orders');
1026
- }
1027
- else {
1028
- request['condition'] = condition;
1029
- }
1030
- }
1031
- const postOnly = this.isPostOnly(orderType === 'MARKET', undefined, params);
1032
- if (postOnly) {
1033
- request['timeInForce'] = 'POST_ONLY';
1034
- }
1035
- const response = await this.privatePostOrdersPair(this.extend(request, params));
1036
- //
1037
- // {
1038
- // "orderId": "2220595581",
1039
- // "timestamp": "1644896744886",
1040
- // "action": "SELL",
1041
- // "amount": "0.01",
1042
- // "price": "15000",
1043
- // "timeInForce": "GTC"
1044
- // }
1045
- //
1046
- return this.parseOrder(response, market);
1047
- }
1048
- async cancelOrder(id, symbol = undefined, params = {}) {
1049
- /**
1050
- * @method
1051
- * @name bitopro#cancelOrder
1052
- * @description cancels an open order
1053
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/cancel_an_order.md
1054
- * @param {string} id order id
1055
- * @param {string} symbol unified symbol of the market the order was made in
1056
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1057
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1058
- */
1059
- if (symbol === undefined) {
1060
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1061
- }
1062
- await this.loadMarkets();
1063
- const market = this.market(symbol);
1064
- const request = {
1065
- 'id': id,
1066
- 'pair': market['id'],
1067
- };
1068
- const response = await this.privateDeleteOrdersPairId(this.extend(request, params));
1069
- //
1070
- // {
1071
- // "orderId":"8777138788",
1072
- // "action":"SELL",
1073
- // "timestamp":1644899002465,
1074
- // "price":"16000",
1075
- // "amount":"0.01"
1076
- // }
1077
- //
1078
- return this.parseOrder(response, market);
1079
- }
1080
- async cancelOrders(ids, symbol = undefined, params = {}) {
1081
- /**
1082
- * @method
1083
- * @name bitopro#cancelOrders
1084
- * @description cancel multiple orders
1085
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/cancel_batch_orders.md
1086
- * @param {string[]} ids order ids
1087
- * @param {string} symbol unified market symbol
1088
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1089
- * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1090
- */
1091
- if (symbol === undefined) {
1092
- throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
1093
- }
1094
- await this.loadMarkets();
1095
- const market = this.market(symbol);
1096
- const id = market['uppercaseId'];
1097
- const request = {};
1098
- request[id] = ids;
1099
- const response = await this.privatePutOrders(this.extend(request, params));
1100
- //
1101
- // {
1102
- // "data":{
1103
- // "BNB_TWD":[
1104
- // "5236347105",
1105
- // "359488711"
1106
- // ]
1107
- // }
1108
- // }
1109
- //
1110
- return response;
1111
- }
1112
- async cancelAllOrders(symbol = undefined, params = {}) {
1113
- /**
1114
- * @method
1115
- * @name bitopro#cancelAllOrders
1116
- * @description cancel all open orders
1117
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/cancel_all_orders.md
1118
- * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1119
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1120
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1121
- */
1122
- await this.loadMarkets();
1123
- const request = {
1124
- // 'pair': market['id'], // optional
1125
- };
1126
- let response = undefined;
1127
- if (symbol !== undefined) {
1128
- const market = this.market(symbol);
1129
- request['pair'] = market['id'];
1130
- response = await this.privateDeleteOrdersPair(this.extend(request, params));
1131
- }
1132
- else {
1133
- response = await this.privateDeleteOrdersAll(this.extend(request, params));
1134
- }
1135
- const result = this.safeValue(response, 'data', {});
1136
- //
1137
- // {
1138
- // "data":{
1139
- // "BNB_TWD":[
1140
- // "9515988421",
1141
- // "4639130027"
1142
- // ]
1143
- // }
1144
- // }
1145
- //
1146
- return result;
1147
- }
1148
- async fetchOrder(id, symbol = undefined, params = {}) {
1149
- /**
1150
- * @method
1151
- * @name bitopro#fetchOrder
1152
- * @description fetches information on an order made by the user
1153
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_an_order_data.md
1154
- * @param {string} symbol unified symbol of the market the order was made in
1155
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1156
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1157
- */
1158
- if (symbol === undefined) {
1159
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1160
- }
1161
- await this.loadMarkets();
1162
- const market = this.market(symbol);
1163
- const request = {
1164
- 'orderId': id,
1165
- 'pair': market['id'],
1166
- };
1167
- const response = await this.privateGetOrdersPairOrderId(this.extend(request, params));
1168
- //
1169
- // {
1170
- // "id":"8777138788",
1171
- // "pair":"bnb_twd",
1172
- // "price":"16000",
1173
- // "avgExecutionPrice":"0",
1174
- // "action":"SELL",
1175
- // "type":"LIMIT",
1176
- // "timestamp":1644899002598,
1177
- // "status":4,
1178
- // "originalAmount":"0.01",
1179
- // "remainingAmount":"0.01",
1180
- // "executedAmount":"0",
1181
- // "fee":"0",
1182
- // "feeSymbol":"twd",
1183
- // "bitoFee":"0",
1184
- // "total":"0",
1185
- // "seq":"BNBTWD548774666",
1186
- // "timeInForce":"GTC",
1187
- // "createdTimestamp":1644898944074,
1188
- // "updatedTimestamp":1644899002598
1189
- // }
1190
- //
1191
- return this.parseOrder(response, market);
1192
- }
1193
- async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1194
- /**
1195
- * @method
1196
- * @name bitopro#fetchOrders
1197
- * @description fetches information on multiple orders made by the user
1198
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md
1199
- * @param {string} symbol unified market symbol of the market orders were made in
1200
- * @param {int} [since] the earliest time in ms to fetch orders for
1201
- * @param {int} [limit] the maximum number of order structures to retrieve
1202
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1203
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1204
- */
1205
- if (symbol === undefined) {
1206
- throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
1207
- }
1208
- await this.loadMarkets();
1209
- const market = this.market(symbol);
1210
- const request = {
1211
- 'pair': market['id'],
1212
- // 'startTimestamp': 0,
1213
- // 'endTimestamp': 0,
1214
- // 'statusKind': '',
1215
- // 'orderId': '',
1216
- };
1217
- if (since !== undefined) {
1218
- request['startTimestamp'] = since;
1219
- }
1220
- if (limit !== undefined) {
1221
- request['limit'] = limit;
1222
- }
1223
- const response = await this.privateGetOrdersAllPair(this.extend(request, params));
1224
- let orders = this.safeValue(response, 'data');
1225
- if (orders === undefined) {
1226
- orders = [];
1227
- }
1228
- //
1229
- // {
1230
- // "data":[
1231
- // {
1232
- // "id":"2220595581",
1233
- // "pair":"bnb_twd",
1234
- // "price":"15000",
1235
- // "avgExecutionPrice":"0",
1236
- // "action":"SELL",
1237
- // "type":"LIMIT",
1238
- // "createdTimestamp":1644896744886,
1239
- // "updatedTimestamp":1644898706236,
1240
- // "status":4,
1241
- // "originalAmount":"0.01",
1242
- // "remainingAmount":"0.01",
1243
- // "executedAmount":"0",
1244
- // "fee":"0",
1245
- // "feeSymbol":"twd",
1246
- // "bitoFee":"0",
1247
- // "total":"0",
1248
- // "seq":"BNBTWD8540871774",
1249
- // "timeInForce":"GTC"
1250
- // }
1251
- // ]
1252
- // }
1253
- //
1254
- return this.parseOrders(orders, market, since, limit);
1255
- }
1256
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1257
- const request = {
1258
- 'statusKind': 'OPEN',
1259
- };
1260
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1261
- }
1262
- async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1263
- /**
1264
- * @method
1265
- * @name bitopro#fetchClosedOrders
1266
- * @description fetches information on multiple closed orders made by the user
1267
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md
1268
- * @param {string} symbol unified market symbol of the market orders were made in
1269
- * @param {int} [since] the earliest time in ms to fetch orders for
1270
- * @param {int} [limit] the maximum number of order structures to retrieve
1271
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1272
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1273
- */
1274
- const request = {
1275
- 'statusKind': 'DONE',
1276
- };
1277
- return this.fetchOrders(symbol, since, limit, this.extend(request, params));
1278
- }
1279
- async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1280
- /**
1281
- * @method
1282
- * @name bitopro#fetchMyTrades
1283
- * @description fetch all trades made by the user
1284
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_trades_data.md
1285
- * @param {string} symbol unified market symbol
1286
- * @param {int} [since] the earliest time in ms to fetch trades for
1287
- * @param {int} [limit] the maximum number of trades structures to retrieve
1288
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1289
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1290
- */
1291
- if (symbol === undefined) {
1292
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
1293
- }
1294
- await this.loadMarkets();
1295
- const market = this.market(symbol);
1296
- const request = {
1297
- 'pair': market['id'],
1298
- };
1299
- const response = await this.privateGetOrdersTradesPair(this.extend(request, params));
1300
- const trades = this.safeValue(response, 'data', []);
1301
- //
1302
- // {
1303
- // "data":[
1304
- // {
1305
- // "tradeId":"5685030251",
1306
- // "orderId":"9669168142",
1307
- // "price":"11821.8",
1308
- // "action":"SELL",
1309
- // "baseAmount":"0.01",
1310
- // "quoteAmount":"118.218",
1311
- // "fee":"0.236436",
1312
- // "feeSymbol":"BNB",
1313
- // "isTaker":true,
1314
- // "timestamp":1644905714862,
1315
- // "createdTimestamp":1644905714862
1316
- // }
1317
- // ]
1318
- // }
1319
- //
1320
- return this.parseTrades(trades, market, since, limit);
1321
- }
1322
- parseTransactionStatus(status) {
1323
- const states = {
1324
- 'COMPLETE': 'ok',
1325
- 'INVALID': 'failed',
1326
- 'PROCESSING': 'pending',
1327
- 'WAIT_PROCESS': 'pending',
1328
- 'FAILED': 'failed',
1329
- 'EXPIRED': 'failed',
1330
- 'CANCELLED': 'failed',
1331
- 'EMAIL_VERIFICATION': 'pending',
1332
- 'WAIT_CONFIRMATION': 'pending',
1333
- };
1334
- return this.safeString(states, status, status);
1335
- }
1336
- parseTransaction(transaction, currency = undefined) {
1337
- //
1338
- // fetchDeposits
1339
- //
1340
- // {
1341
- // "serial": "20220214X766799",
1342
- // "timestamp": "1644833015053",
1343
- // "address": "bnb1xml62k5a9dcewgc542fha75fyxdcp0zv8eqfsh",
1344
- // "amount": "0.20000000",
1345
- // "fee": "0.00000000",
1346
- // "total": "0.20000000",
1347
- // "status": "COMPLETE",
1348
- // "txid": "A3CC4F6828CC752B9F3737F48B5826B9EC2857040CB5141D0CC955F7E53DB6D9",
1349
- // "message": "778553959",
1350
- // "protocol": "MAIN",
1351
- // "id": "2905906537"
1352
- // }
1353
- //
1354
- // fetchWithdrawals || fetchWithdraw
1355
- //
1356
- // {
1357
- // "serial": "20220215BW14069838",
1358
- // "timestamp": "1644907716044",
1359
- // "address": "TKrwMaZaGiAvtXCFT41xHuusNcs4LPWS7w",
1360
- // "amount": "8.00000000",
1361
- // "fee": "2.00000000",
1362
- // "total": "10.00000000",
1363
- // "status": "COMPLETE",
1364
- // "txid": "50bf250c71a582f40cf699fb58bab978437ea9bdf7259ff8072e669aab30c32b",
1365
- // "protocol": "TRX",
1366
- // "id": "9925310345"
1367
- // }
1368
- //
1369
- // withdraw
1370
- //
1371
- // {
1372
- // "serial": "20220215BW14069838",
1373
- // "currency": "USDT",
1374
- // "protocol": "TRX",
1375
- // "address": "TKrwMaZaGiAvtXCFT41xHuusNcs4LPWS7w",
1376
- // "amount": "8",
1377
- // "fee": "2",
1378
- // "total": "10"
1379
- // }
1380
- //
1381
- const currencyId = this.safeString(transaction, 'coin');
1382
- const code = this.safeCurrencyCode(currencyId, currency);
1383
- const timestamp = this.safeInteger(transaction, 'timestamp');
1384
- const address = this.safeString(transaction, 'address');
1385
- const tag = this.safeString(transaction, 'message');
1386
- const status = this.safeString(transaction, 'status');
1387
- let networkId = this.safeString(transaction, 'protocol');
1388
- if (networkId === 'MAIN') {
1389
- networkId = code;
1390
- }
1391
- return {
1392
- 'info': transaction,
1393
- 'id': this.safeString(transaction, 'serial'),
1394
- 'txid': this.safeString(transaction, 'txid'),
1395
- 'type': undefined,
1396
- 'currency': code,
1397
- 'network': this.networkIdToCode(networkId),
1398
- 'amount': this.safeNumber(transaction, 'total'),
1399
- 'status': this.parseTransactionStatus(status),
1400
- 'timestamp': timestamp,
1401
- 'datetime': this.iso8601(timestamp),
1402
- 'address': address,
1403
- 'addressFrom': undefined,
1404
- 'addressTo': address,
1405
- 'tag': tag,
1406
- 'tagFrom': undefined,
1407
- 'tagTo': tag,
1408
- 'updated': undefined,
1409
- 'comment': undefined,
1410
- 'internal': undefined,
1411
- 'fee': {
1412
- 'currency': code,
1413
- 'cost': this.safeNumber(transaction, 'fee'),
1414
- 'rate': undefined,
1415
- },
1416
- };
1417
- }
1418
- async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1419
- /**
1420
- * @method
1421
- * @name bitopro#fetchDeposits
1422
- * @description fetch all deposits made to an account
1423
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_deposit_invoices_data.md
1424
- * @param {string} code unified currency code
1425
- * @param {int} [since] the earliest time in ms to fetch deposits for
1426
- * @param {int} [limit] the maximum number of deposits structures to retrieve
1427
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1428
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1429
- */
1430
- if (code === undefined) {
1431
- throw new errors.ArgumentsRequired(this.id + ' fetchDeposits() requires the code argument');
1432
- }
1433
- await this.loadMarkets();
1434
- const currency = this.safeCurrency(code);
1435
- const request = {
1436
- 'currency': currency['id'],
1437
- // 'endTimestamp': 0,
1438
- // 'id': '',
1439
- // 'statuses': '', // 'ROCESSING,COMPLETE,INVALID,WAIT_PROCESS,CANCELLED,FAILED'
1440
- };
1441
- if (since !== undefined) {
1442
- request['startTimestamp'] = since;
1443
- }
1444
- if (limit !== undefined) {
1445
- request['limit'] = limit;
1446
- }
1447
- const response = await this.privateGetWalletDepositHistoryCurrency(this.extend(request, params));
1448
- const result = this.safeValue(response, 'data', []);
1449
- //
1450
- // {
1451
- // "data":[
1452
- // {
1453
- // "serial":"20220214X766799",
1454
- // "timestamp":"1644833015053",
1455
- // "address":"bnb1xml62k5a9dcewgc542fha75fyxdcp0zv8eqfsh",
1456
- // "amount":"0.20000000",
1457
- // "fee":"0.00000000",
1458
- // "total":"0.20000000",
1459
- // "status":"COMPLETE",
1460
- // "txid":"A3CC4F6828CC752B9F3737F48B5826B9EC2857040CB5141D0CC955F7E53DB6D9",
1461
- // "message":"778553959",
1462
- // "protocol":"MAIN",
1463
- // "id":"2905906537"
1464
- // }
1465
- // ]
1466
- // }
1467
- //
1468
- return this.parseTransactions(result, currency, since, limit, { 'type': 'deposit' });
1469
- }
1470
- async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1471
- /**
1472
- * @method
1473
- * @name bitopro#fetchWithdrawals
1474
- * @description fetch all withdrawals made from an account
1475
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_withdraw_invoices_data.md
1476
- * @param {string} code unified currency code
1477
- * @param {int} [since] the earliest time in ms to fetch withdrawals for
1478
- * @param {int} [limit] the maximum number of withdrawals structures to retrieve
1479
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1480
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1481
- */
1482
- if (code === undefined) {
1483
- throw new errors.ArgumentsRequired(this.id + ' fetchWithdrawals() requires the code argument');
1484
- }
1485
- await this.loadMarkets();
1486
- const currency = this.safeCurrency(code);
1487
- const request = {
1488
- 'currency': currency['id'],
1489
- // 'endTimestamp': 0,
1490
- // 'id': '',
1491
- // 'statuses': '', // 'PROCESSING,COMPLETE,EXPIRED,INVALID,WAIT_PROCESS,WAIT_CONFIRMATION,EMAIL_VERIFICATION,CANCELLED'
1492
- };
1493
- if (since !== undefined) {
1494
- request['startTimestamp'] = since;
1495
- }
1496
- if (limit !== undefined) {
1497
- request['limit'] = limit;
1498
- }
1499
- const response = await this.privateGetWalletWithdrawHistoryCurrency(this.extend(request, params));
1500
- const result = this.safeValue(response, 'data', []);
1501
- //
1502
- // {
1503
- // "data":[
1504
- // {
1505
- // "serial":"20220215BW14069838",
1506
- // "timestamp":"1644907716044",
1507
- // "address":"TKrwMaZaGiAvtXCFT41xHuusNcs4LPWS7w",
1508
- // "amount":"8.00000000",
1509
- // "fee":"2.00000000",
1510
- // "total":"10.00000000",
1511
- // "status":"COMPLETE",
1512
- // "txid":"50bf250c71a582f40cf699fb58bab978437ea9bdf7259ff8072e669aab30c32b",
1513
- // "protocol":"TRX",
1514
- // "id":"9925310345"
1515
- // }
1516
- // ]
1517
- // }
1518
- //
1519
- return this.parseTransactions(result, currency, since, limit, { 'type': 'withdrawal' });
1520
- }
1521
- async fetchWithdrawal(id, code = undefined, params = {}) {
1522
- /**
1523
- * @method
1524
- * @name bitopro#fetchWithdrawal
1525
- * @description fetch data on a currency withdrawal via the withdrawal id
1526
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_an_withdraw_invoice_data.md
1527
- * @param {string} id withdrawal id
1528
- * @param {string} code unified currency code of the currency withdrawn, default is undefined
1529
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1530
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1531
- */
1532
- if (code === undefined) {
1533
- throw new errors.ArgumentsRequired(this.id + ' fetchWithdrawal() requires the code argument');
1534
- }
1535
- await this.loadMarkets();
1536
- const currency = this.safeCurrency(code);
1537
- const request = {
1538
- 'serial': id,
1539
- 'currency': currency['id'],
1540
- };
1541
- const response = await this.privateGetWalletWithdrawCurrencySerial(this.extend(request, params));
1542
- const result = this.safeValue(response, 'data', {});
1543
- //
1544
- // {
1545
- // "data":{
1546
- // "serial":"20220215BW14069838",
1547
- // "address":"TKrwMaZaGiAvtXCFT41xHuusNcs4LPWS7w",
1548
- // "amount":"8.00000000",
1549
- // "fee":"2.00000000",
1550
- // "total":"10.00000000",
1551
- // "status":"COMPLETE",
1552
- // "txid":"50bf250c71a582f40cf699fb58bab978437ea9bdf7259ff8072e669aab30c32b",
1553
- // "protocol":"TRX",
1554
- // "id":"9925310345",
1555
- // "timestamp":"1644907716044"
1556
- // }
1557
- // }
1558
- //
1559
- return this.parseTransaction(result, currency);
1560
- }
1561
- async withdraw(code, amount, address, tag = undefined, params = {}) {
1562
- /**
1563
- * @method
1564
- * @name bitopro#withdraw
1565
- * @description make a withdrawal
1566
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/create_an_withdraw_invoice.md
1567
- * @param {string} code unified currency code
1568
- * @param {float} amount the amount to withdraw
1569
- * @param {string} address the address to withdraw to
1570
- * @param {string} tag
1571
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1572
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1573
- */
1574
- [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1575
- await this.loadMarkets();
1576
- this.checkAddress(address);
1577
- const currency = this.currency(code);
1578
- const request = {
1579
- 'currency': currency['id'],
1580
- 'amount': this.numberToString(amount),
1581
- 'address': address,
1582
- };
1583
- if ('network' in params) {
1584
- const networks = this.safeValue(this.options, 'networks', {});
1585
- const requestedNetwork = this.safeStringUpper(params, 'network');
1586
- params = this.omit(params, ['network']);
1587
- const networkId = this.safeString(networks, requestedNetwork);
1588
- if (networkId === undefined) {
1589
- throw new errors.ExchangeError(this.id + ' invalid network ' + requestedNetwork);
1590
- }
1591
- request['protocol'] = networkId;
1592
- }
1593
- if (tag !== undefined) {
1594
- request['message'] = tag;
1595
- }
1596
- const response = await this.privatePostWalletWithdrawCurrency(this.extend(request, params));
1597
- const result = this.safeValue(response, 'data', {});
1598
- //
1599
- // {
1600
- // "data":{
1601
- // "serial":"20220215BW14069838",
1602
- // "currency":"USDT",
1603
- // "protocol":"TRX",
1604
- // "address":"TKrwMaZaGiAvtXCFT41xHuusNcs4LPWS7w",
1605
- // "amount":"8",
1606
- // "fee":"2",
1607
- // "total":"10"
1608
- // }
1609
- // }
1610
- //
1611
- return this.parseTransaction(result, currency);
1612
- }
1613
- parseDepositWithdrawFee(fee, currency = undefined) {
1614
- // {
1615
- // "currency":"eth",
1616
- // "withdrawFee":"0.007",
1617
- // "minWithdraw":"0.001",
1618
- // "maxWithdraw":"1000",
1619
- // "maxDailyWithdraw":"2000",
1620
- // "withdraw":true,
1621
- // "deposit":true,
1622
- // "depositConfirmation":"12"
1623
- // }
1624
- return {
1625
- 'info': fee,
1626
- 'withdraw': {
1627
- 'fee': this.safeNumber(fee, 'withdrawFee'),
1628
- 'percentage': false,
1629
- },
1630
- 'deposit': {
1631
- 'fee': undefined,
1632
- 'percentage': undefined,
1633
- },
1634
- 'networks': {},
1635
- };
1636
- }
1637
- async fetchDepositWithdrawFees(codes = undefined, params = {}) {
1638
- /**
1639
- * @method
1640
- * @name bitopro#fetchDepositWithdrawFees
1641
- * @description fetch deposit and withdraw fees
1642
- * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_currency_info.md
1643
- * @param {string[]|undefined} codes list of unified currency codes
1644
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1645
- * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1646
- */
1647
- await this.loadMarkets();
1648
- const response = await this.publicGetProvisioningCurrencies(params);
1649
- //
1650
- // {
1651
- // "data":[
1652
- // {
1653
- // "currency":"eth",
1654
- // "withdrawFee":"0.007",
1655
- // "minWithdraw":"0.001",
1656
- // "maxWithdraw":"1000",
1657
- // "maxDailyWithdraw":"2000",
1658
- // "withdraw":true,
1659
- // "deposit":true,
1660
- // "depositConfirmation":"12"
1661
- // }
1662
- // ]
1663
- // }
1664
- //
1665
- const data = this.safeValue(response, 'data', []);
1666
- return this.parseDepositWithdrawFees(data, codes, 'currency');
1667
- }
1668
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1669
- let url = '/' + this.implodeParams(path, params);
1670
- const query = this.omit(params, this.extractParams(path));
1671
- if (headers === undefined) {
1672
- headers = {};
1673
- }
1674
- headers['X-BITOPRO-API'] = 'ccxt';
1675
- if (api === 'private') {
1676
- this.checkRequiredCredentials();
1677
- if (method === 'POST' || method === 'PUT') {
1678
- body = this.json(params);
1679
- const payload = this.stringToBase64(body);
1680
- const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha512.sha384);
1681
- headers['X-BITOPRO-APIKEY'] = this.apiKey;
1682
- headers['X-BITOPRO-PAYLOAD'] = payload;
1683
- headers['X-BITOPRO-SIGNATURE'] = signature;
1684
- }
1685
- else if (method === 'GET' || method === 'DELETE') {
1686
- if (Object.keys(query).length) {
1687
- url += '?' + this.urlencode(query);
1688
- }
1689
- const nonce = this.milliseconds();
1690
- const rawData = {
1691
- 'nonce': nonce,
1692
- };
1693
- const data = this.json(rawData);
1694
- const payload = this.stringToBase64(data);
1695
- const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha512.sha384);
1696
- headers['X-BITOPRO-APIKEY'] = this.apiKey;
1697
- headers['X-BITOPRO-PAYLOAD'] = payload;
1698
- headers['X-BITOPRO-SIGNATURE'] = signature;
1699
- }
1700
- }
1701
- else if (api === 'public' && method === 'GET') {
1702
- if (Object.keys(query).length) {
1703
- url += '?' + this.urlencode(query);
1704
- }
1705
- }
1706
- url = this.urls['api']['rest'] + url;
1707
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1708
- }
1709
- handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1710
- if (response === undefined) {
1711
- return undefined; // fallback to the default error handler
1712
- }
1713
- if (code >= 200 && code < 300) {
1714
- return undefined;
1715
- }
1716
- const feedback = this.id + ' ' + body;
1717
- const error = this.safeString(response, 'error');
1718
- this.throwExactlyMatchedException(this.exceptions['exact'], error, feedback);
1719
- this.throwBroadlyMatchedException(this.exceptions['broad'], error, feedback);
1720
- throw new errors.ExchangeError(feedback); // unknown message
1721
- }
1722
- }
1723
-
1724
- module.exports = bitopro;