ccxt 4.2.18 → 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 (426) hide show
  1. package/README.md +8 -8
  2. package/dist/ccxt.browser.js +34202 -33193
  3. package/dist/ccxt.browser.min.js +2 -2
  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/hitbtc.js +5 -4
  49. package/dist/cjs/src/pro/htx.js +6 -1
  50. package/dist/cjs/src/pro/kraken.js +1 -1
  51. package/dist/cjs/src/pro/krakenfutures.js +7 -1
  52. package/dist/cjs/src/pro/kucoin.js +46 -36
  53. package/dist/cjs/src/pro/kucoinfutures.js +45 -37
  54. package/dist/cjs/src/pro/lbank.js +881 -0
  55. package/dist/cjs/src/pro/okx.js +52 -2
  56. package/dist/cjs/{js/src/pro/bitpanda.js → src/pro/onetrading.js} +4 -7
  57. package/dist/cjs/src/pro/poloniex.js +2 -2
  58. package/dist/cjs/src/pro/poloniexfutures.js +43 -35
  59. package/dist/cjs/src/pro/woo.js +126 -0
  60. package/dist/cjs/src/probit.js +4 -2
  61. package/dist/cjs/src/upbit.js +12 -12
  62. package/dist/cjs/src/wavesexchange.js +1 -1
  63. package/dist/cjs/src/whitebit.js +1 -0
  64. package/dist/cjs/src/woo.js +56 -0
  65. package/js/ccxt.d.ts +11 -2
  66. package/js/ccxt.js +8 -2
  67. package/js/src/abstract/bitpanda.d.ts +4 -4
  68. package/js/src/abstract/bitstamp.d.ts +8 -0
  69. package/js/src/abstract/gate.d.ts +1 -0
  70. package/js/src/abstract/gateio.d.ts +1 -0
  71. package/js/src/abstract/htx.d.ts +3 -0
  72. package/js/src/abstract/huobi.d.ts +3 -0
  73. package/js/src/abstract/luno.d.ts +1 -0
  74. package/js/src/abstract/onetrading.d.ts +38 -0
  75. package/js/src/ascendex.js +2 -0
  76. package/js/src/bingx.js +1 -1
  77. package/js/src/bitget.js +22 -3
  78. package/js/src/bitpanda.d.ts +2 -72
  79. package/js/src/bitpanda.js +5 -1991
  80. package/js/src/bitstamp.js +8 -0
  81. package/js/src/deribit.js +11 -3
  82. package/js/src/gate.d.ts +1 -0
  83. package/js/src/gate.js +50 -110
  84. package/js/src/htx.js +3 -0
  85. package/js/src/kraken.d.ts +1 -0
  86. package/js/src/kraken.js +39 -38
  87. package/js/src/lbank.js +1 -0
  88. package/js/src/luno.d.ts +3 -1
  89. package/js/src/luno.js +84 -2
  90. package/js/src/mexc.js +1 -2
  91. package/js/src/onetrading.d.ts +74 -0
  92. package/js/src/onetrading.js +2003 -0
  93. package/js/src/poloniexfutures.js +1 -0
  94. package/js/src/pro/binance.js +6 -1
  95. package/js/src/pro/bitpanda.d.ts +2 -34
  96. package/js/src/pro/bitpanda.js +5 -1330
  97. package/js/src/pro/lbank.d.ts +29 -0
  98. package/js/src/pro/lbank.js +882 -0
  99. package/js/src/pro/onetrading.d.ts +36 -0
  100. package/js/src/pro/onetrading.js +1339 -0
  101. package/package.json +2 -2
  102. package/rollup.config.js +2 -0
  103. package/skip-tests.json +2 -1
  104. package/test-commonjs.cjs +25 -1
  105. package/dist/cjs/js/ccxt.js +0 -478
  106. package/dist/cjs/js/src/abstract/alpaca.js +0 -9
  107. package/dist/cjs/js/src/abstract/ascendex.js +0 -9
  108. package/dist/cjs/js/src/abstract/bigone.js +0 -9
  109. package/dist/cjs/js/src/abstract/binance.js +0 -9
  110. package/dist/cjs/js/src/abstract/bingx.js +0 -9
  111. package/dist/cjs/js/src/abstract/bit2c.js +0 -9
  112. package/dist/cjs/js/src/abstract/bitbank.js +0 -9
  113. package/dist/cjs/js/src/abstract/bitbns.js +0 -9
  114. package/dist/cjs/js/src/abstract/bitfinex.js +0 -9
  115. package/dist/cjs/js/src/abstract/bitfinex2.js +0 -9
  116. package/dist/cjs/js/src/abstract/bitflyer.js +0 -9
  117. package/dist/cjs/js/src/abstract/bitforex.js +0 -9
  118. package/dist/cjs/js/src/abstract/bitget.js +0 -9
  119. package/dist/cjs/js/src/abstract/bithumb.js +0 -9
  120. package/dist/cjs/js/src/abstract/bitmart.js +0 -9
  121. package/dist/cjs/js/src/abstract/bitmex.js +0 -9
  122. package/dist/cjs/js/src/abstract/bitopro.js +0 -9
  123. package/dist/cjs/js/src/abstract/bitpanda.js +0 -9
  124. package/dist/cjs/js/src/abstract/bitrue.js +0 -9
  125. package/dist/cjs/js/src/abstract/bitso.js +0 -9
  126. package/dist/cjs/js/src/abstract/bitstamp.js +0 -9
  127. package/dist/cjs/js/src/abstract/bitteam.js +0 -9
  128. package/dist/cjs/js/src/abstract/bitvavo.js +0 -9
  129. package/dist/cjs/js/src/abstract/bl3p.js +0 -9
  130. package/dist/cjs/js/src/abstract/blockchaincom.js +0 -9
  131. package/dist/cjs/js/src/abstract/btcalpha.js +0 -9
  132. package/dist/cjs/js/src/abstract/btcbox.js +0 -9
  133. package/dist/cjs/js/src/abstract/btcmarkets.js +0 -9
  134. package/dist/cjs/js/src/abstract/btcturk.js +0 -9
  135. package/dist/cjs/js/src/abstract/bybit.js +0 -9
  136. package/dist/cjs/js/src/abstract/cex.js +0 -9
  137. package/dist/cjs/js/src/abstract/coinbase.js +0 -9
  138. package/dist/cjs/js/src/abstract/coinbasepro.js +0 -9
  139. package/dist/cjs/js/src/abstract/coincheck.js +0 -9
  140. package/dist/cjs/js/src/abstract/coinex.js +0 -9
  141. package/dist/cjs/js/src/abstract/coinlist.js +0 -9
  142. package/dist/cjs/js/src/abstract/coinmate.js +0 -9
  143. package/dist/cjs/js/src/abstract/coinone.js +0 -9
  144. package/dist/cjs/js/src/abstract/coinsph.js +0 -9
  145. package/dist/cjs/js/src/abstract/coinspot.js +0 -9
  146. package/dist/cjs/js/src/abstract/cryptocom.js +0 -9
  147. package/dist/cjs/js/src/abstract/currencycom.js +0 -9
  148. package/dist/cjs/js/src/abstract/delta.js +0 -9
  149. package/dist/cjs/js/src/abstract/deribit.js +0 -9
  150. package/dist/cjs/js/src/abstract/digifinex.js +0 -9
  151. package/dist/cjs/js/src/abstract/exmo.js +0 -9
  152. package/dist/cjs/js/src/abstract/gate.js +0 -9
  153. package/dist/cjs/js/src/abstract/gemini.js +0 -9
  154. package/dist/cjs/js/src/abstract/hitbtc.js +0 -9
  155. package/dist/cjs/js/src/abstract/hollaex.js +0 -9
  156. package/dist/cjs/js/src/abstract/htx.js +0 -9
  157. package/dist/cjs/js/src/abstract/huobijp.js +0 -9
  158. package/dist/cjs/js/src/abstract/idex.js +0 -9
  159. package/dist/cjs/js/src/abstract/independentreserve.js +0 -9
  160. package/dist/cjs/js/src/abstract/indodax.js +0 -9
  161. package/dist/cjs/js/src/abstract/kraken.js +0 -9
  162. package/dist/cjs/js/src/abstract/krakenfutures.js +0 -9
  163. package/dist/cjs/js/src/abstract/kucoin.js +0 -9
  164. package/dist/cjs/js/src/abstract/kucoinfutures.js +0 -9
  165. package/dist/cjs/js/src/abstract/kuna.js +0 -9
  166. package/dist/cjs/js/src/abstract/latoken.js +0 -9
  167. package/dist/cjs/js/src/abstract/lbank.js +0 -9
  168. package/dist/cjs/js/src/abstract/luno.js +0 -9
  169. package/dist/cjs/js/src/abstract/lykke.js +0 -9
  170. package/dist/cjs/js/src/abstract/mercado.js +0 -9
  171. package/dist/cjs/js/src/abstract/mexc.js +0 -9
  172. package/dist/cjs/js/src/abstract/ndax.js +0 -9
  173. package/dist/cjs/js/src/abstract/novadax.js +0 -9
  174. package/dist/cjs/js/src/abstract/oceanex.js +0 -9
  175. package/dist/cjs/js/src/abstract/okcoin.js +0 -9
  176. package/dist/cjs/js/src/abstract/okx.js +0 -9
  177. package/dist/cjs/js/src/abstract/p2b.js +0 -9
  178. package/dist/cjs/js/src/abstract/paymium.js +0 -9
  179. package/dist/cjs/js/src/abstract/phemex.js +0 -9
  180. package/dist/cjs/js/src/abstract/poloniex.js +0 -9
  181. package/dist/cjs/js/src/abstract/poloniexfutures.js +0 -9
  182. package/dist/cjs/js/src/abstract/probit.js +0 -9
  183. package/dist/cjs/js/src/abstract/timex.js +0 -9
  184. package/dist/cjs/js/src/abstract/tokocrypto.js +0 -9
  185. package/dist/cjs/js/src/abstract/upbit.js +0 -9
  186. package/dist/cjs/js/src/abstract/wavesexchange.js +0 -9
  187. package/dist/cjs/js/src/abstract/wazirx.js +0 -9
  188. package/dist/cjs/js/src/abstract/whitebit.js +0 -9
  189. package/dist/cjs/js/src/abstract/woo.js +0 -9
  190. package/dist/cjs/js/src/abstract/yobit.js +0 -9
  191. package/dist/cjs/js/src/abstract/zaif.js +0 -9
  192. package/dist/cjs/js/src/abstract/zonda.js +0 -9
  193. package/dist/cjs/js/src/ace.js +0 -1058
  194. package/dist/cjs/js/src/alpaca.js +0 -1125
  195. package/dist/cjs/js/src/ascendex.js +0 -3365
  196. package/dist/cjs/js/src/base/Exchange.js +0 -5260
  197. package/dist/cjs/js/src/base/Precise.js +0 -263
  198. package/dist/cjs/js/src/base/errors.js +0 -299
  199. package/dist/cjs/js/src/base/functions/crypto.js +0 -78
  200. package/dist/cjs/js/src/base/functions/encode.js +0 -44
  201. package/dist/cjs/js/src/base/functions/generic.js +0 -193
  202. package/dist/cjs/js/src/base/functions/misc.js +0 -96
  203. package/dist/cjs/js/src/base/functions/number.js +0 -297
  204. package/dist/cjs/js/src/base/functions/platform.js +0 -28
  205. package/dist/cjs/js/src/base/functions/rsa.js +0 -34
  206. package/dist/cjs/js/src/base/functions/string.js +0 -48
  207. package/dist/cjs/js/src/base/functions/throttle.js +0 -66
  208. package/dist/cjs/js/src/base/functions/time.js +0 -187
  209. package/dist/cjs/js/src/base/functions/totp.js +0 -24
  210. package/dist/cjs/js/src/base/functions/type.js +0 -162
  211. package/dist/cjs/js/src/base/functions.js +0 -157
  212. package/dist/cjs/js/src/base/ws/Cache.js +0 -254
  213. package/dist/cjs/js/src/base/ws/Client.js +0 -299
  214. package/dist/cjs/js/src/base/ws/Future.js +0 -34
  215. package/dist/cjs/js/src/base/ws/OrderBook.js +0 -107
  216. package/dist/cjs/js/src/base/ws/OrderBookSide.js +0 -281
  217. package/dist/cjs/js/src/base/ws/WsClient.js +0 -69
  218. package/dist/cjs/js/src/bequant.js +0 -33
  219. package/dist/cjs/js/src/bigone.js +0 -2213
  220. package/dist/cjs/js/src/binance.js +0 -9851
  221. package/dist/cjs/js/src/binancecoinm.js +0 -45
  222. package/dist/cjs/js/src/binanceus.js +0 -92
  223. package/dist/cjs/js/src/binanceusdm.js +0 -58
  224. package/dist/cjs/js/src/bingx.js +0 -3872
  225. package/dist/cjs/js/src/bit2c.js +0 -916
  226. package/dist/cjs/js/src/bitbank.js +0 -1000
  227. package/dist/cjs/js/src/bitbay.js +0 -17
  228. package/dist/cjs/js/src/bitbns.js +0 -1220
  229. package/dist/cjs/js/src/bitcoincom.js +0 -17
  230. package/dist/cjs/js/src/bitfinex.js +0 -1670
  231. package/dist/cjs/js/src/bitfinex2.js +0 -2990
  232. package/dist/cjs/js/src/bitflyer.js +0 -1045
  233. package/dist/cjs/js/src/bitforex.js +0 -852
  234. package/dist/cjs/js/src/bitget.js +0 -8295
  235. package/dist/cjs/js/src/bithumb.js +0 -1090
  236. package/dist/cjs/js/src/bitmart.js +0 -4454
  237. package/dist/cjs/js/src/bitmex.js +0 -2881
  238. package/dist/cjs/js/src/bitopro.js +0 -1724
  239. package/dist/cjs/js/src/bitrue.js +0 -3253
  240. package/dist/cjs/js/src/bitso.js +0 -1753
  241. package/dist/cjs/js/src/bitstamp.js +0 -2188
  242. package/dist/cjs/js/src/bitteam.js +0 -2309
  243. package/dist/cjs/js/src/bitvavo.js +0 -1968
  244. package/dist/cjs/js/src/bl3p.js +0 -447
  245. package/dist/cjs/js/src/blockchaincom.js +0 -1160
  246. package/dist/cjs/js/src/btcalpha.js +0 -929
  247. package/dist/cjs/js/src/btcbox.js +0 -565
  248. package/dist/cjs/js/src/btcmarkets.js +0 -1237
  249. package/dist/cjs/js/src/btcturk.js +0 -929
  250. package/dist/cjs/js/src/bybit.js +0 -7624
  251. package/dist/cjs/js/src/cex.js +0 -1693
  252. package/dist/cjs/js/src/coinbase.js +0 -3424
  253. package/dist/cjs/js/src/coinbasepro.js +0 -1866
  254. package/dist/cjs/js/src/coincheck.js +0 -844
  255. package/dist/cjs/js/src/coinex.js +0 -5417
  256. package/dist/cjs/js/src/coinlist.js +0 -2337
  257. package/dist/cjs/js/src/coinmate.js +0 -989
  258. package/dist/cjs/js/src/coinone.js +0 -1185
  259. package/dist/cjs/js/src/coinsph.js +0 -1933
  260. package/dist/cjs/js/src/coinspot.js +0 -548
  261. package/dist/cjs/js/src/cryptocom.js +0 -3007
  262. package/dist/cjs/js/src/currencycom.js +0 -2015
  263. package/dist/cjs/js/src/delta.js +0 -3262
  264. package/dist/cjs/js/src/deribit.js +0 -3310
  265. package/dist/cjs/js/src/digifinex.js +0 -4307
  266. package/dist/cjs/js/src/exmo.js +0 -2645
  267. package/dist/cjs/js/src/fmfwio.js +0 -34
  268. package/dist/cjs/js/src/gate.js +0 -7077
  269. package/dist/cjs/js/src/gateio.js +0 -16
  270. package/dist/cjs/js/src/gemini.js +0 -1801
  271. package/dist/cjs/js/src/hitbtc.js +0 -3660
  272. package/dist/cjs/js/src/hitbtc3.js +0 -19
  273. package/dist/cjs/js/src/hollaex.js +0 -1882
  274. package/dist/cjs/js/src/htx.js +0 -9174
  275. package/dist/cjs/js/src/huobi.js +0 -16
  276. package/dist/cjs/js/src/huobijp.js +0 -1918
  277. package/dist/cjs/js/src/idex.js +0 -1770
  278. package/dist/cjs/js/src/independentreserve.js +0 -761
  279. package/dist/cjs/js/src/indodax.js +0 -1069
  280. package/dist/cjs/js/src/kraken.js +0 -2891
  281. package/dist/cjs/js/src/krakenfutures.js +0 -2407
  282. package/dist/cjs/js/src/kucoin.js +0 -4494
  283. package/dist/cjs/js/src/kucoinfutures.js +0 -2529
  284. package/dist/cjs/js/src/kuna.js +0 -1949
  285. package/dist/cjs/js/src/latoken.js +0 -1729
  286. package/dist/cjs/js/src/lbank.js +0 -2851
  287. package/dist/cjs/js/src/luno.js +0 -1044
  288. package/dist/cjs/js/src/lykke.js +0 -1303
  289. package/dist/cjs/js/src/mercado.js +0 -897
  290. package/dist/cjs/js/src/mexc.js +0 -5407
  291. package/dist/cjs/js/src/ndax.js +0 -2450
  292. package/dist/cjs/js/src/novadax.js +0 -1556
  293. package/dist/cjs/js/src/oceanex.js +0 -964
  294. package/dist/cjs/js/src/okcoin.js +0 -3115
  295. package/dist/cjs/js/src/okx.js +0 -7331
  296. package/dist/cjs/js/src/p2b.js +0 -1243
  297. package/dist/cjs/js/src/paymium.js +0 -597
  298. package/dist/cjs/js/src/phemex.js +0 -4725
  299. package/dist/cjs/js/src/poloniex.js +0 -2356
  300. package/dist/cjs/js/src/poloniexfutures.js +0 -1794
  301. package/dist/cjs/js/src/pro/alpaca.js +0 -714
  302. package/dist/cjs/js/src/pro/ascendex.js +0 -957
  303. package/dist/cjs/js/src/pro/bequant.js +0 -33
  304. package/dist/cjs/js/src/pro/binance.js +0 -2796
  305. package/dist/cjs/js/src/pro/binancecoinm.js +0 -23
  306. package/dist/cjs/js/src/pro/binanceus.js +0 -51
  307. package/dist/cjs/js/src/pro/binanceusdm.js +0 -32
  308. package/dist/cjs/js/src/pro/bingx.js +0 -944
  309. package/dist/cjs/js/src/pro/bitcoincom.js +0 -29
  310. package/dist/cjs/js/src/pro/bitfinex.js +0 -672
  311. package/dist/cjs/js/src/pro/bitfinex2.js +0 -1159
  312. package/dist/cjs/js/src/pro/bitget.js +0 -1733
  313. package/dist/cjs/js/src/pro/bitmart.js +0 -1486
  314. package/dist/cjs/js/src/pro/bitmex.js +0 -1576
  315. package/dist/cjs/js/src/pro/bitopro.js +0 -327
  316. package/dist/cjs/js/src/pro/bitrue.js +0 -462
  317. package/dist/cjs/js/src/pro/bitstamp.js +0 -547
  318. package/dist/cjs/js/src/pro/bitvavo.js +0 -704
  319. package/dist/cjs/js/src/pro/blockchaincom.js +0 -794
  320. package/dist/cjs/js/src/pro/bybit.js +0 -1843
  321. package/dist/cjs/js/src/pro/cex.js +0 -1510
  322. package/dist/cjs/js/src/pro/coinbase.js +0 -561
  323. package/dist/cjs/js/src/pro/coinbasepro.js +0 -968
  324. package/dist/cjs/js/src/pro/coinex.js +0 -1095
  325. package/dist/cjs/js/src/pro/cryptocom.js +0 -1020
  326. package/dist/cjs/js/src/pro/currencycom.js +0 -563
  327. package/dist/cjs/js/src/pro/deribit.js +0 -825
  328. package/dist/cjs/js/src/pro/exmo.js +0 -658
  329. package/dist/cjs/js/src/pro/gate.js +0 -1316
  330. package/dist/cjs/js/src/pro/gateio.js +0 -16
  331. package/dist/cjs/js/src/pro/gemini.js +0 -649
  332. package/dist/cjs/js/src/pro/hitbtc.js +0 -1294
  333. package/dist/cjs/js/src/pro/hollaex.js +0 -597
  334. package/dist/cjs/js/src/pro/htx.js +0 -2388
  335. package/dist/cjs/js/src/pro/huobi.js +0 -16
  336. package/dist/cjs/js/src/pro/huobijp.js +0 -606
  337. package/dist/cjs/js/src/pro/idex.js +0 -714
  338. package/dist/cjs/js/src/pro/independentreserve.js +0 -280
  339. package/dist/cjs/js/src/pro/kraken.js +0 -1364
  340. package/dist/cjs/js/src/pro/krakenfutures.js +0 -1506
  341. package/dist/cjs/js/src/pro/kucoin.js +0 -1062
  342. package/dist/cjs/js/src/pro/kucoinfutures.js +0 -989
  343. package/dist/cjs/js/src/pro/luno.js +0 -322
  344. package/dist/cjs/js/src/pro/mexc.js +0 -1170
  345. package/dist/cjs/js/src/pro/ndax.js +0 -545
  346. package/dist/cjs/js/src/pro/okcoin.js +0 -760
  347. package/dist/cjs/js/src/pro/okx.js +0 -1608
  348. package/dist/cjs/js/src/pro/phemex.js +0 -1511
  349. package/dist/cjs/js/src/pro/poloniex.js +0 -1253
  350. package/dist/cjs/js/src/pro/poloniexfutures.js +0 -1022
  351. package/dist/cjs/js/src/pro/probit.js +0 -586
  352. package/dist/cjs/js/src/pro/upbit.js +0 -234
  353. package/dist/cjs/js/src/pro/wazirx.js +0 -776
  354. package/dist/cjs/js/src/pro/whitebit.js +0 -927
  355. package/dist/cjs/js/src/pro/woo.js +0 -895
  356. package/dist/cjs/js/src/probit.js +0 -1867
  357. package/dist/cjs/js/src/static_dependencies/fflake/browser.js +0 -401
  358. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -195
  359. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -308
  360. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -554
  361. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -94
  362. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -70
  363. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -91
  364. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -16
  365. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -1760
  366. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -52
  367. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -81
  368. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -376
  369. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -70
  370. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -1580
  371. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -74
  372. package/dist/cjs/js/src/static_dependencies/noble-curves/_shortw_utils.js +0 -24
  373. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/curve.js +0 -158
  374. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/edwards.js +0 -429
  375. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -176
  376. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/modular.js +0 -324
  377. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/montgomery.js +0 -163
  378. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/utils.js +0 -245
  379. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +0 -1018
  380. package/dist/cjs/js/src/static_dependencies/noble-curves/ed25519.js +0 -383
  381. package/dist/cjs/js/src/static_dependencies/noble-curves/secp256k1.js +0 -258
  382. package/dist/cjs/js/src/static_dependencies/noble-hashes/_assert.js +0 -53
  383. package/dist/cjs/js/src/static_dependencies/noble-hashes/_sha2.js +0 -120
  384. package/dist/cjs/js/src/static_dependencies/noble-hashes/_u64.js +0 -69
  385. package/dist/cjs/js/src/static_dependencies/noble-hashes/crypto.js +0 -7
  386. package/dist/cjs/js/src/static_dependencies/noble-hashes/hmac.js +0 -83
  387. package/dist/cjs/js/src/static_dependencies/noble-hashes/md5.js +0 -240
  388. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha1.js +0 -91
  389. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha256.js +0 -130
  390. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha3.js +0 -214
  391. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha512.js +0 -239
  392. package/dist/cjs/js/src/static_dependencies/noble-hashes/utils.js +0 -93
  393. package/dist/cjs/js/src/static_dependencies/node-fetch/body.js +0 -354
  394. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/abort-error.js +0 -16
  395. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/base.js +0 -20
  396. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -30
  397. package/dist/cjs/js/src/static_dependencies/node-fetch/headers.js +0 -239
  398. package/dist/cjs/js/src/static_dependencies/node-fetch/index.js +0 -372
  399. package/dist/cjs/js/src/static_dependencies/node-fetch/request.js +0 -273
  400. package/dist/cjs/js/src/static_dependencies/node-fetch/response.js +0 -139
  401. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/get-search.js +0 -14
  402. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -16
  403. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is.js +0 -81
  404. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/referrer.js +0 -292
  405. package/dist/cjs/js/src/static_dependencies/proxies/agent-base/index.js +0 -103
  406. package/dist/cjs/js/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -140
  407. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -175
  408. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -95
  409. package/dist/cjs/js/src/static_dependencies/qs/index.cjs.js +0 -7
  410. package/dist/cjs/js/src/static_dependencies/scure-base/index.js +0 -383
  411. package/dist/cjs/js/src/timex.js +0 -1562
  412. package/dist/cjs/js/src/tokocrypto.js +0 -2542
  413. package/dist/cjs/js/src/upbit.js +0 -1844
  414. package/dist/cjs/js/src/wavesexchange.js +0 -2607
  415. package/dist/cjs/js/src/wazirx.js +0 -953
  416. package/dist/cjs/js/src/whitebit.js +0 -2310
  417. package/dist/cjs/js/src/woo.js +0 -2769
  418. package/dist/cjs/js/src/yobit.js +0 -1314
  419. package/dist/cjs/js/src/zaif.js +0 -736
  420. package/dist/cjs/js/src/zonda.js +0 -1883
  421. package/dist/cjs/src/abstract/bitpanda.js +0 -9
  422. package/test.ts +0 -0
  423. /package/dist/cjs/{js/src/abstract/ace.js → src/abstract/onetrading.js} +0 -0
  424. /package/dist/cjs/{js/src → src}/pro/coincheck.js +0 -0
  425. /package/dist/cjs/{js/src → src}/pro/coinone.js +0 -0
  426. /package/js/src/abstract/{bitpanda.js → onetrading.js} +0 -0
@@ -1,1882 +0,0 @@
1
- 'use strict';
2
-
3
- var hollaex$1 = require('./abstract/hollaex.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 sha256 = require('./static_dependencies/noble-hashes/sha256.js');
8
-
9
- // ---------------------------------------------------------------------------
10
- // ---------------------------------------------------------------------------
11
- /**
12
- * @class hollaex
13
- * @augments Exchange
14
- */
15
- class hollaex extends hollaex$1 {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'hollaex',
19
- 'name': 'HollaEx',
20
- 'countries': ['KR'],
21
- // 4 requests per second => 1000ms / 4 = 250 ms between requests
22
- 'rateLimit': 250,
23
- 'version': 'v2',
24
- 'pro': true,
25
- 'has': {
26
- 'CORS': undefined,
27
- 'spot': true,
28
- 'margin': undefined,
29
- 'swap': false,
30
- 'future': false,
31
- 'option': false,
32
- 'addMargin': false,
33
- 'cancelAllOrders': true,
34
- 'cancelOrder': true,
35
- 'createLimitBuyOrder': true,
36
- 'createLimitSellOrder': true,
37
- 'createMarketBuyOrder': true,
38
- 'createMarketSellOrder': true,
39
- 'createOrder': true,
40
- 'createPostOnlyOrder': true,
41
- 'createReduceOnlyOrder': false,
42
- 'createStopLimitOrder': true,
43
- 'createStopMarketOrder': true,
44
- 'createStopOrder': true,
45
- 'fetchBalance': true,
46
- 'fetchBorrowRateHistories': false,
47
- 'fetchBorrowRateHistory': false,
48
- 'fetchClosedOrders': true,
49
- 'fetchCrossBorrowRate': false,
50
- 'fetchCrossBorrowRates': false,
51
- 'fetchCurrencies': true,
52
- 'fetchDepositAddress': 'emulated',
53
- 'fetchDepositAddresses': true,
54
- 'fetchDeposits': true,
55
- 'fetchFundingHistory': false,
56
- 'fetchFundingRate': false,
57
- 'fetchFundingRateHistory': false,
58
- 'fetchFundingRates': false,
59
- 'fetchIndexOHLCV': false,
60
- 'fetchIsolatedBorrowRate': false,
61
- 'fetchIsolatedBorrowRates': false,
62
- 'fetchLeverage': false,
63
- 'fetchMarginMode': false,
64
- 'fetchMarkets': true,
65
- 'fetchMarkOHLCV': false,
66
- 'fetchMyTrades': true,
67
- 'fetchOHLCV': true,
68
- 'fetchOpenInterestHistory': false,
69
- 'fetchOpenOrder': true,
70
- 'fetchOpenOrders': true,
71
- 'fetchOrder': true,
72
- 'fetchOrderBook': true,
73
- 'fetchOrderBooks': true,
74
- 'fetchOrders': true,
75
- 'fetchPosition': false,
76
- 'fetchPositionMode': false,
77
- 'fetchPositions': false,
78
- 'fetchPositionsRisk': false,
79
- 'fetchPremiumIndexOHLCV': false,
80
- 'fetchTicker': true,
81
- 'fetchTickers': true,
82
- 'fetchTrades': true,
83
- 'fetchTradingFee': false,
84
- 'fetchTradingFees': true,
85
- 'fetchTransactions': false,
86
- 'fetchTransfer': false,
87
- 'fetchTransfers': false,
88
- 'fetchWithdrawal': true,
89
- 'fetchWithdrawals': true,
90
- 'reduceMargin': false,
91
- 'setLeverage': false,
92
- 'setMarginMode': false,
93
- 'setPositionMode': false,
94
- 'transfer': false,
95
- 'withdraw': true,
96
- },
97
- 'timeframes': {
98
- '1m': '1m',
99
- '5m': '5m',
100
- '15m': '15m',
101
- '1h': '1h',
102
- '4h': '4h',
103
- '1d': '1d',
104
- '1w': '1w',
105
- },
106
- 'urls': {
107
- 'logo': 'https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg',
108
- 'test': {
109
- 'rest': 'https://api.sandbox.hollaex.com',
110
- },
111
- 'api': {
112
- 'rest': 'https://api.hollaex.com',
113
- },
114
- 'www': 'https://hollaex.com',
115
- 'doc': 'https://apidocs.hollaex.com',
116
- 'referral': 'https://pro.hollaex.com/signup?affiliation_code=QSWA6G',
117
- },
118
- 'precisionMode': number.TICK_SIZE,
119
- 'requiredCredentials': {
120
- 'apiKey': true,
121
- 'secret': true,
122
- },
123
- 'api': {
124
- 'public': {
125
- 'get': {
126
- 'health': 1,
127
- 'constants': 1,
128
- 'kit': 1,
129
- 'tiers': 1,
130
- 'ticker': 1,
131
- 'tickers': 1,
132
- 'orderbook': 1,
133
- 'orderbooks': 1,
134
- 'trades': 1,
135
- 'chart': 1,
136
- 'charts': 1,
137
- // TradingView
138
- 'udf/config': 1,
139
- 'udf/history': 1,
140
- 'udf/symbols': 1,
141
- },
142
- },
143
- 'private': {
144
- 'get': {
145
- 'user': 1,
146
- 'user/balance': 1,
147
- 'user/deposits': 1,
148
- 'user/withdrawals': 1,
149
- 'user/withdrawal/fee': 1,
150
- 'user/trades': 1,
151
- 'orders': 1,
152
- 'order': 1,
153
- },
154
- 'post': {
155
- 'user/withdrawal': 1,
156
- 'order': 1,
157
- },
158
- 'delete': {
159
- 'order/all': 1,
160
- 'order': 1,
161
- },
162
- },
163
- },
164
- 'fees': {
165
- 'trading': {
166
- 'tierBased': true,
167
- 'percentage': true,
168
- 'taker': 0.001,
169
- 'maker': 0.001,
170
- },
171
- },
172
- 'exceptions': {
173
- 'broad': {
174
- 'Invalid token': errors.AuthenticationError,
175
- 'Order not found': errors.OrderNotFound,
176
- 'Insufficient balance': errors.InsufficientFunds,
177
- 'Error 1001 - Order rejected. Order could not be submitted as this order was set to a post only order.': errors.OrderImmediatelyFillable,
178
- },
179
- 'exact': {
180
- '400': errors.BadRequest,
181
- '403': errors.AuthenticationError,
182
- '404': errors.BadRequest,
183
- '405': errors.BadRequest,
184
- '410': errors.BadRequest,
185
- '429': errors.BadRequest,
186
- '500': errors.NetworkError,
187
- '503': errors.NetworkError,
188
- },
189
- },
190
- 'options': {
191
- // how many seconds before the authenticated request expires
192
- 'api-expires': this.parseToInt(this.timeout / 1000),
193
- 'networks': {
194
- 'BTC': 'btc',
195
- 'ETH': 'eth',
196
- 'ERC20': 'eth',
197
- 'TRX': 'trx',
198
- 'TRC20': 'trx',
199
- 'XRP': 'xrp',
200
- 'XLM': 'xlm',
201
- 'BNB': 'bnb',
202
- 'MATIC': 'matic',
203
- },
204
- },
205
- });
206
- }
207
- async fetchMarkets(params = {}) {
208
- /**
209
- * @method
210
- * @name hollaex#fetchMarkets
211
- * @description retrieves data on all markets for hollaex
212
- * @param {object} [params] extra parameters specific to the exchange API endpoint
213
- * @returns {object[]} an array of objects representing market data
214
- */
215
- const response = await this.publicGetConstants(params);
216
- //
217
- // {
218
- // "coins": {
219
- // "xmr": {
220
- // "id": 7,
221
- // "fullname": "Monero",
222
- // "symbol": "xmr",
223
- // "active": true,
224
- // "allow_deposit": true,
225
- // "allow_withdrawal": true,
226
- // "withdrawal_fee": 0.02,
227
- // "min": 0.001,
228
- // "max": 100000,
229
- // "increment_unit": 0.001,
230
- // "deposit_limits": { '1': 0, '2': 0, '3': 0, '4': 0, "5": 0, "6": 0 },
231
- // "withdrawal_limits": { '1': 10, '2': 15, '3': 100, '4': 100, '5': 200, '6': 300, '7': 350, '8': 400, "9": 500, "10": -1 },
232
- // "created_at": "2019-12-09T07:14:02.720Z",
233
- // "updated_at": "2020-01-16T12:12:53.162Z"
234
- // },
235
- // // ...
236
- // },
237
- // "pairs": {
238
- // "btc-usdt": {
239
- // "id": 2,
240
- // "name": "btc-usdt",
241
- // "pair_base": "btc",
242
- // "pair_2": "usdt",
243
- // "taker_fees": { '1': 0.3, '2': 0.25, '3': 0.2, '4': 0.18, '5': 0.1, '6': 0.09, '7': 0.08, '8': 0.06, "9": 0.04, "10": 0 },
244
- // "maker_fees": { '1': 0.1, '2': 0.08, '3': 0.05, '4': 0.03, '5': 0, '6': 0, '7': 0, '8': 0, "9": 0, "10": 0 },
245
- // "min_size": 0.0001,
246
- // "max_size": 1000,
247
- // "min_price": 100,
248
- // "max_price": 100000,
249
- // "increment_size": 0.0001,
250
- // "increment_price": 0.05,
251
- // "active": true,
252
- // "created_at": "2019-12-09T07:15:54.537Z",
253
- // "updated_at": "2019-12-09T07:15:54.537Z"
254
- // },
255
- // },
256
- // "config": { tiers: 10 },
257
- // "status": true
258
- // }
259
- //
260
- const pairs = this.safeValue(response, 'pairs', {});
261
- const keys = Object.keys(pairs);
262
- const result = [];
263
- for (let i = 0; i < keys.length; i++) {
264
- const key = keys[i];
265
- const market = pairs[key];
266
- const baseId = this.safeString(market, 'pair_base');
267
- const quoteId = this.safeString(market, 'pair_2');
268
- const base = this.commonCurrencyCode(baseId.toUpperCase());
269
- const quote = this.commonCurrencyCode(quoteId.toUpperCase());
270
- result.push({
271
- 'id': this.safeString(market, 'name'),
272
- 'symbol': base + '/' + quote,
273
- 'base': base,
274
- 'quote': quote,
275
- 'settle': undefined,
276
- 'baseId': baseId,
277
- 'quoteId': quoteId,
278
- 'settleId': undefined,
279
- 'type': 'spot',
280
- 'spot': true,
281
- 'margin': false,
282
- 'swap': false,
283
- 'future': false,
284
- 'option': false,
285
- 'active': this.safeValue(market, 'active'),
286
- 'contract': false,
287
- 'linear': undefined,
288
- 'inverse': undefined,
289
- 'contractSize': undefined,
290
- 'expiry': undefined,
291
- 'expiryDatetime': undefined,
292
- 'strike': undefined,
293
- 'optionType': undefined,
294
- 'precision': {
295
- 'amount': this.safeNumber(market, 'increment_size'),
296
- 'price': this.safeNumber(market, 'increment_price'),
297
- },
298
- 'limits': {
299
- 'leverage': {
300
- 'min': undefined,
301
- 'max': undefined,
302
- },
303
- 'amount': {
304
- 'min': this.safeNumber(market, 'min_size'),
305
- 'max': this.safeNumber(market, 'max_size'),
306
- },
307
- 'price': {
308
- 'min': this.safeNumber(market, 'min_price'),
309
- 'max': this.safeNumber(market, 'max_price'),
310
- },
311
- 'cost': {
312
- 'min': undefined,
313
- 'max': undefined,
314
- },
315
- },
316
- 'created': this.parse8601(this.safeString(market, 'created_at')),
317
- 'info': market,
318
- });
319
- }
320
- return result;
321
- }
322
- async fetchCurrencies(params = {}) {
323
- /**
324
- * @method
325
- * @name hollaex#fetchCurrencies
326
- * @description fetches all available currencies on an exchange
327
- * @see https://apidocs.hollaex.com/#constants
328
- * @param {object} [params] extra parameters specific to the exchange API endpoint
329
- * @returns {object} an associative dictionary of currencies
330
- */
331
- const response = await this.publicGetConstants(params);
332
- //
333
- // {
334
- // "coins":{
335
- // "bch":{
336
- // "id":4,
337
- // "fullname":"Bitcoin Cash",
338
- // "symbol":"bch",
339
- // "active":true,
340
- // "verified":true,
341
- // "allow_deposit":true,
342
- // "allow_withdrawal":true,
343
- // "withdrawal_fee":0.0001,
344
- // "min":0.001,
345
- // "max":100000,
346
- // "increment_unit":0.001,
347
- // "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
348
- // "code":"bch",
349
- // "is_public":true,
350
- // "meta":{},
351
- // "estimated_price":null,
352
- // "description":null,
353
- // "type":"blockchain",
354
- // "network":null,
355
- // "standard":null,
356
- // "issuer":"HollaEx",
357
- // "withdrawal_fees":null,
358
- // "created_at":"2019-08-09T10:45:43.367Z",
359
- // "updated_at":"2021-12-13T03:08:32.372Z",
360
- // "created_by":1,
361
- // "owner_id":1
362
- // },
363
- // },
364
- // "network":"https://api.hollaex.network"
365
- // }
366
- //
367
- const coins = this.safeValue(response, 'coins', {});
368
- const keys = Object.keys(coins);
369
- const result = {};
370
- for (let i = 0; i < keys.length; i++) {
371
- const key = keys[i];
372
- const currency = coins[key];
373
- const id = this.safeString(currency, 'symbol');
374
- const numericId = this.safeInteger(currency, 'id');
375
- const code = this.safeCurrencyCode(id);
376
- const name = this.safeString(currency, 'fullname');
377
- const depositEnabled = this.safeValue(currency, 'allow_deposit');
378
- const withdrawEnabled = this.safeValue(currency, 'allow_withdrawal');
379
- const isActive = this.safeValue(currency, 'active');
380
- const active = isActive && depositEnabled && withdrawEnabled;
381
- const fee = this.safeNumber(currency, 'withdrawal_fee');
382
- const withdrawalLimits = this.safeValue(currency, 'withdrawal_limits', []);
383
- result[code] = {
384
- 'id': id,
385
- 'numericId': numericId,
386
- 'code': code,
387
- 'info': currency,
388
- 'name': name,
389
- 'active': active,
390
- 'deposit': depositEnabled,
391
- 'withdraw': withdrawEnabled,
392
- 'fee': fee,
393
- 'precision': this.safeNumber(currency, 'increment_unit'),
394
- 'limits': {
395
- 'amount': {
396
- 'min': this.safeNumber(currency, 'min'),
397
- 'max': this.safeNumber(currency, 'max'),
398
- },
399
- 'withdraw': {
400
- 'min': undefined,
401
- 'max': this.safeValue(withdrawalLimits, 0),
402
- },
403
- },
404
- 'networks': {},
405
- };
406
- }
407
- return result;
408
- }
409
- async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
410
- /**
411
- * @method
412
- * @name hollaex#fetchOrderBooks
413
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
414
- * @param {string[]|undefined} symbols not used by hollaex fetchOrderBooks ()
415
- * @param {int} [limit] not used by hollaex fetchOrderBooks ()
416
- * @param {object} [params] extra parameters specific to the exchange API endpoint
417
- * @returns {object} a dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbol
418
- */
419
- await this.loadMarkets();
420
- const response = await this.publicGetOrderbooks(params);
421
- const result = {};
422
- const marketIds = Object.keys(response);
423
- for (let i = 0; i < marketIds.length; i++) {
424
- const marketId = marketIds[i];
425
- const orderbook = response[marketId];
426
- const symbol = this.safeSymbol(marketId, undefined, '-');
427
- const timestamp = this.parse8601(this.safeString(orderbook, 'timestamp'));
428
- result[symbol] = this.parseOrderBook(response[marketId], symbol, timestamp);
429
- }
430
- return result;
431
- }
432
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
433
- /**
434
- * @method
435
- * @name hollaex#fetchOrderBook
436
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
437
- * @param {string} symbol unified symbol of the market to fetch the order book for
438
- * @param {int} [limit] the maximum amount of order book entries to return
439
- * @param {object} [params] extra parameters specific to the exchange API endpoint
440
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
441
- */
442
- await this.loadMarkets();
443
- const market = this.market(symbol);
444
- const request = {
445
- 'symbol': market['id'],
446
- };
447
- const response = await this.publicGetOrderbooks(this.extend(request, params));
448
- //
449
- // {
450
- // "btc-usdt": {
451
- // "bids": [
452
- // [ 8836.4, 1.022 ],
453
- // [ 8800, 0.0668 ],
454
- // [ 8797.75, 0.2398 ],
455
- // ],
456
- // "asks": [
457
- // [ 8839.35, 1.5334 ],
458
- // [ 8852.6, 0.0579 ],
459
- // [ 8860.45, 0.1815 ],
460
- // ],
461
- // "timestamp": "2020-03-03T02:27:25.147Z"
462
- // },
463
- // "eth-usdt": {},
464
- // // ...
465
- // }
466
- //
467
- const orderbook = this.safeValue(response, market['id']);
468
- const timestamp = this.parse8601(this.safeString(orderbook, 'timestamp'));
469
- return this.parseOrderBook(orderbook, market['symbol'], timestamp);
470
- }
471
- async fetchTicker(symbol, params = {}) {
472
- /**
473
- * @method
474
- * @name hollaex#fetchTicker
475
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
476
- * @param {string} symbol unified symbol of the market to fetch the ticker for
477
- * @param {object} [params] extra parameters specific to the exchange API endpoint
478
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
479
- */
480
- await this.loadMarkets();
481
- const market = this.market(symbol);
482
- const request = {
483
- 'symbol': market['id'],
484
- };
485
- const response = await this.publicGetTicker(this.extend(request, params));
486
- //
487
- // {
488
- // "open": 8615.55,
489
- // "close": 8841.05,
490
- // "high": 8921.1,
491
- // "low": 8607,
492
- // "last": 8841.05,
493
- // "volume": 20.2802,
494
- // "timestamp": "2020-03-03T03:11:18.964Z"
495
- // }
496
- //
497
- return this.parseTicker(response, market);
498
- }
499
- async fetchTickers(symbols = undefined, params = {}) {
500
- /**
501
- * @method
502
- * @name hollaex#fetchTickers
503
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
504
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
505
- * @param {object} [params] extra parameters specific to the exchange API endpoint
506
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
507
- */
508
- await this.loadMarkets();
509
- symbols = this.marketSymbols(symbols);
510
- const response = await this.publicGetTickers(params);
511
- //
512
- // {
513
- // "bch-usdt": {
514
- // "time": "2020-03-02T04:29:45.011Z",
515
- // "open": 341.65,
516
- // "close":337.9,
517
- // "high":341.65,
518
- // "low":337.3,
519
- // "last":337.9,
520
- // "volume":0.054,
521
- // "symbol":"bch-usdt"
522
- // },
523
- // // ...
524
- // }
525
- //
526
- return this.parseTickers(response, symbols);
527
- }
528
- parseTickers(response, symbols = undefined, params = {}) {
529
- const result = {};
530
- const keys = Object.keys(response);
531
- for (let i = 0; i < keys.length; i++) {
532
- const key = keys[i];
533
- const ticker = response[key];
534
- const marketId = this.safeString(ticker, 'symbol', key);
535
- const market = this.safeMarket(marketId, undefined, '-');
536
- const symbol = market['symbol'];
537
- result[symbol] = this.extend(this.parseTicker(ticker, market), params);
538
- }
539
- return this.filterByArrayTickers(result, 'symbol', symbols);
540
- }
541
- parseTicker(ticker, market = undefined) {
542
- //
543
- // fetchTicker
544
- //
545
- // {
546
- // "open": 8615.55,
547
- // "close": 8841.05,
548
- // "high": 8921.1,
549
- // "low": 8607,
550
- // "last": 8841.05,
551
- // "volume": 20.2802,
552
- // "timestamp": "2020-03-03T03:11:18.964Z",
553
- // }
554
- //
555
- // fetchTickers
556
- //
557
- // {
558
- // "time": "2020-03-02T04:29:45.011Z",
559
- // "open": 341.65,
560
- // "close": 337.9,
561
- // "high": 341.65,
562
- // "low": 337.3,
563
- // "last": 337.9,
564
- // "volume": 0.054,
565
- // "symbol": "bch-usdt"
566
- // }
567
- //
568
- const marketId = this.safeString(ticker, 'symbol');
569
- market = this.safeMarket(marketId, market, '-');
570
- const symbol = market['symbol'];
571
- const timestamp = this.parse8601(this.safeString2(ticker, 'time', 'timestamp'));
572
- const close = this.safeString(ticker, 'close');
573
- return this.safeTicker({
574
- 'symbol': symbol,
575
- 'info': ticker,
576
- 'timestamp': timestamp,
577
- 'datetime': this.iso8601(timestamp),
578
- 'high': this.safeString(ticker, 'high'),
579
- 'low': this.safeString(ticker, 'low'),
580
- 'bid': undefined,
581
- 'bidVolume': undefined,
582
- 'ask': undefined,
583
- 'askVolume': undefined,
584
- 'vwap': undefined,
585
- 'open': this.safeString(ticker, 'open'),
586
- 'close': close,
587
- 'last': this.safeString(ticker, 'last', close),
588
- 'previousClose': undefined,
589
- 'change': undefined,
590
- 'percentage': undefined,
591
- 'average': undefined,
592
- 'baseVolume': this.safeString(ticker, 'volume'),
593
- 'quoteVolume': undefined,
594
- }, market);
595
- }
596
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
597
- /**
598
- * @method
599
- * @name hollaex#fetchTrades
600
- * @description get the list of most recent trades for a particular symbol
601
- * @param {string} symbol unified symbol of the market to fetch trades for
602
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
603
- * @param {int} [limit] the maximum amount of trades to fetch
604
- * @param {object} [params] extra parameters specific to the exchange API endpoint
605
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
606
- */
607
- await this.loadMarkets();
608
- const market = this.market(symbol);
609
- const request = {
610
- 'symbol': market['id'],
611
- };
612
- const response = await this.publicGetTrades(this.extend(request, params));
613
- //
614
- // {
615
- // "btc-usdt": [
616
- // {
617
- // "size": 0.5,
618
- // "price": 8830,
619
- // "side": "buy",
620
- // "timestamp": "2020-03-03T04:44:33.034Z"
621
- // },
622
- // // ...
623
- // ]
624
- // }
625
- //
626
- const trades = this.safeValue(response, market['id'], []);
627
- return this.parseTrades(trades, market, since, limit);
628
- }
629
- parseTrade(trade, market = undefined) {
630
- //
631
- // fetchTrades (public)
632
- //
633
- // {
634
- // "size": 0.5,
635
- // "price": 8830,
636
- // "side": "buy",
637
- // "timestamp": "2020-03-03T04:44:33.034Z"
638
- // }
639
- //
640
- // fetchMyTrades (private)
641
- // {
642
- // "side":"sell",
643
- // "symbol":"doge-usdt",
644
- // "size":70,
645
- // "price":0.147411,
646
- // "timestamp":"2022-01-26T17:53:34.650Z",
647
- // "order_id":"cba78ecb-4187-4da2-9d2f-c259aa693b5a",
648
- // "fee":0.01031877,"fee_coin":"usdt"
649
- // }
650
- //
651
- const marketId = this.safeString(trade, 'symbol');
652
- market = this.safeMarket(marketId, market, '-');
653
- const symbol = market['symbol'];
654
- const datetime = this.safeString(trade, 'timestamp');
655
- const timestamp = this.parse8601(datetime);
656
- const side = this.safeString(trade, 'side');
657
- const orderId = this.safeString(trade, 'order_id');
658
- const priceString = this.safeString(trade, 'price');
659
- const amountString = this.safeString(trade, 'size');
660
- const feeCostString = this.safeString(trade, 'fee');
661
- let fee = undefined;
662
- if (feeCostString !== undefined) {
663
- fee = {
664
- 'cost': feeCostString,
665
- 'currency': market['quote'],
666
- };
667
- }
668
- return this.safeTrade({
669
- 'info': trade,
670
- 'id': undefined,
671
- 'timestamp': timestamp,
672
- 'datetime': datetime,
673
- 'symbol': symbol,
674
- 'order': orderId,
675
- 'type': undefined,
676
- 'side': side,
677
- 'takerOrMaker': undefined,
678
- 'price': priceString,
679
- 'amount': amountString,
680
- 'cost': undefined,
681
- 'fee': fee,
682
- }, market);
683
- }
684
- async fetchTradingFees(params = {}) {
685
- /**
686
- * @method
687
- * @name hollaex#fetchTradingFees
688
- * @description fetch the trading fees for multiple markets
689
- * @param {object} [params] extra parameters specific to the exchange API endpoint
690
- * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
691
- */
692
- await this.loadMarkets();
693
- const response = await this.publicGetTiers(params);
694
- //
695
- // {
696
- // "1": {
697
- // "id": "1",
698
- // "name": "Silver",
699
- // "icon": '',
700
- // "description": "Your crypto journey starts here! Make your first deposit to start trading, and verify your account to level up!",
701
- // "deposit_limit": "0",
702
- // "withdrawal_limit": "1000",
703
- // "fees": {
704
- // "maker": {
705
- // 'eth-btc': "0.1",
706
- // 'ada-usdt': "0.1",
707
- // ...
708
- // },
709
- // "taker": {
710
- // 'eth-btc': "0.1",
711
- // 'ada-usdt': "0.1",
712
- // ...
713
- // }
714
- // },
715
- // "note": "<ul>\n<li>Login and verify email</li>\n</ul>\n",
716
- // "created_at": "2021-03-22T03:51:39.129Z",
717
- // "updated_at": "2021-11-01T02:51:56.214Z"
718
- // },
719
- // ...
720
- // }
721
- //
722
- const firstTier = this.safeValue(response, '1', {});
723
- const fees = this.safeValue(firstTier, 'fees', {});
724
- const makerFees = this.safeValue(fees, 'maker', {});
725
- const takerFees = this.safeValue(fees, 'taker', {});
726
- const result = {};
727
- for (let i = 0; i < this.symbols.length; i++) {
728
- const symbol = this.symbols[i];
729
- const market = this.market(symbol);
730
- const makerString = this.safeString(makerFees, market['id']);
731
- const takerString = this.safeString(takerFees, market['id']);
732
- result[symbol] = {
733
- 'info': fees,
734
- 'symbol': symbol,
735
- 'maker': this.parseNumber(Precise["default"].stringDiv(makerString, '100')),
736
- 'taker': this.parseNumber(Precise["default"].stringDiv(takerString, '100')),
737
- 'percentage': true,
738
- 'tierBased': true,
739
- };
740
- }
741
- return result;
742
- }
743
- async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
744
- /**
745
- * @method
746
- * @name hollaex#fetchOHLCV
747
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
748
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
749
- * @param {string} timeframe the length of time each candle represents
750
- * @param {int} [since] timestamp in ms of the earliest candle to fetch
751
- * @param {int} [limit] the maximum amount of candles to fetch
752
- * @param {object} [params] extra parameters specific to the exchange API endpoint
753
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
754
- */
755
- await this.loadMarkets();
756
- const market = this.market(symbol);
757
- const request = {
758
- 'symbol': market['id'],
759
- 'resolution': this.safeString(this.timeframes, timeframe, timeframe),
760
- };
761
- const duration = this.parseTimeframe(timeframe);
762
- if (since === undefined) {
763
- if (limit === undefined) {
764
- limit = 1000; // they have no defaults and can actually provide tens of thousands of bars in one request, but we should cap "default" at generous amount
765
- }
766
- const end = this.seconds();
767
- const start = end - duration * limit;
768
- request['to'] = end;
769
- request['from'] = start;
770
- }
771
- else {
772
- if (limit === undefined) {
773
- request['from'] = this.parseToInt(since / 1000);
774
- request['to'] = this.seconds();
775
- }
776
- else {
777
- const start = this.parseToInt(since / 1000);
778
- request['from'] = start;
779
- request['to'] = this.sum(start, duration * limit);
780
- }
781
- }
782
- const response = await this.publicGetChart(this.extend(request, params));
783
- //
784
- // [
785
- // {
786
- // "time":"2020-03-02T20:00:00.000Z",
787
- // "close":8872.1,
788
- // "high":8872.1,
789
- // "low":8858.6,
790
- // "open":8858.6,
791
- // "symbol":"btc-usdt",
792
- // "volume":1.2922
793
- // },
794
- // ]
795
- //
796
- return this.parseOHLCVs(response, market, timeframe, since, limit);
797
- }
798
- parseOHLCV(ohlcv, market = undefined) {
799
- //
800
- // {
801
- // "time":"2020-03-02T20:00:00.000Z",
802
- // "close":8872.1,
803
- // "high":8872.1,
804
- // "low":8858.6,
805
- // "open":8858.6,
806
- // "symbol":"btc-usdt",
807
- // "volume":1.2922
808
- // }
809
- //
810
- return [
811
- this.parse8601(this.safeString(ohlcv, 'time')),
812
- this.safeNumber(ohlcv, 'open'),
813
- this.safeNumber(ohlcv, 'high'),
814
- this.safeNumber(ohlcv, 'low'),
815
- this.safeNumber(ohlcv, 'close'),
816
- this.safeNumber(ohlcv, 'volume'),
817
- ];
818
- }
819
- parseBalance(response) {
820
- const timestamp = this.parse8601(this.safeString(response, 'updated_at'));
821
- const result = {
822
- 'info': response,
823
- 'timestamp': timestamp,
824
- 'datetime': this.iso8601(timestamp),
825
- };
826
- const currencyIds = Object.keys(this.currencies_by_id);
827
- for (let i = 0; i < currencyIds.length; i++) {
828
- const currencyId = currencyIds[i];
829
- const code = this.safeCurrencyCode(currencyId);
830
- const account = this.account();
831
- account['free'] = this.safeString(response, currencyId + '_available');
832
- account['total'] = this.safeString(response, currencyId + '_balance');
833
- result[code] = account;
834
- }
835
- return this.safeBalance(result);
836
- }
837
- async fetchBalance(params = {}) {
838
- /**
839
- * @method
840
- * @name hollaex#fetchBalance
841
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
842
- * @param {object} [params] extra parameters specific to the exchange API endpoint
843
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
844
- */
845
- await this.loadMarkets();
846
- const response = await this.privateGetUserBalance(params);
847
- //
848
- // {
849
- // "updated_at": "2020-03-02T22:27:38.428Z",
850
- // "btc_balance": 0,
851
- // "btc_pending": 0,
852
- // "btc_available": 0,
853
- // "eth_balance": 0,
854
- // "eth_pending": 0,
855
- // "eth_available": 0,
856
- // // ...
857
- // }
858
- //
859
- return this.parseBalance(response);
860
- }
861
- async fetchOpenOrder(id, symbol = undefined, params = {}) {
862
- /**
863
- * @method
864
- * @name hollaex#fetchOpenOrder
865
- * @description fetch an open order by it's id
866
- * @param {string} id order id
867
- * @param {string} symbol not used by hollaex fetchOpenOrder ()
868
- * @param {object} [params] extra parameters specific to the exchange API endpoint
869
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
870
- */
871
- await this.loadMarkets();
872
- const request = {
873
- 'order_id': id,
874
- };
875
- const response = await this.privateGetOrder(this.extend(request, params));
876
- //
877
- // {
878
- // "id": "string",
879
- // "side": "sell",
880
- // "symbol": "xht-usdt",
881
- // "size": 0.1,
882
- // "filled": 0,
883
- // "stop": null,
884
- // "fee": 0,
885
- // "fee_coin": "usdt",
886
- // "type": "limit",
887
- // "price": 1.09,
888
- // "status": "new",
889
- // "created_by": 116,
890
- // "created_at": "2021-02-17T02:32:38.910Z",
891
- // "updated_at": "2021-02-17T02:32:38.910Z",
892
- // "User": {
893
- // "id": 116,
894
- // "email": "fight@club.com",
895
- // "username": "narrator",
896
- // "exchange_id": 176
897
- // }
898
- // }
899
- //
900
- return this.parseOrder(response);
901
- }
902
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
903
- /**
904
- * @method
905
- * @name hollaex#fetchOpenOrders
906
- * @description fetch all unfilled currently open orders
907
- * @param {string} symbol unified market symbol
908
- * @param {int} [since] the earliest time in ms to fetch open orders for
909
- * @param {int} [limit] the maximum number of open orders structures to retrieve
910
- * @param {object} [params] extra parameters specific to the exchange API endpoint
911
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
912
- */
913
- const request = {
914
- 'open': true,
915
- };
916
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
917
- }
918
- async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
919
- /**
920
- * @method
921
- * @name hollaex#fetchClosedOrders
922
- * @description fetches information on multiple closed orders made by the user
923
- * @param {string} symbol unified market symbol of the market orders were made in
924
- * @param {int} [since] the earliest time in ms to fetch orders for
925
- * @param {int} [limit] the maximum number of order structures to retrieve
926
- * @param {object} [params] extra parameters specific to the exchange API endpoint
927
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
928
- */
929
- const request = {
930
- 'open': false,
931
- };
932
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
933
- }
934
- async fetchOrder(id, symbol = undefined, params = {}) {
935
- /**
936
- * @method
937
- * @name hollaex#fetchOrder
938
- * @description fetches information on an order made by the user
939
- * @param {string} symbol unified symbol of the market the order was made in
940
- * @param {object} [params] extra parameters specific to the exchange API endpoint
941
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
942
- */
943
- await this.loadMarkets();
944
- const request = {
945
- 'order_id': id,
946
- };
947
- const response = await this.privateGetOrder(this.extend(request, params));
948
- // {
949
- // "id": "string",
950
- // "side": "sell",
951
- // "symbol": "xht-usdt",
952
- // "size": 0.1,
953
- // "filled": 0,
954
- // "stop": null,
955
- // "fee": 0,
956
- // "fee_coin": "usdt",
957
- // "type": "limit",
958
- // "price": 1.09,
959
- // "status": "new",
960
- // "created_by": 116,
961
- // "created_at": "2021-02-17T02:32:38.910Z",
962
- // "updated_at": "2021-02-17T02:32:38.910Z",
963
- // "User": {
964
- // "id": 116,
965
- // "email": "fight@club.com",
966
- // "username": "narrator",
967
- // "exchange_id": 176
968
- // }
969
- // }
970
- const order = response;
971
- if (order === undefined) {
972
- throw new errors.OrderNotFound(this.id + ' fetchOrder() could not find order id ' + id);
973
- }
974
- return this.parseOrder(order);
975
- }
976
- async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
977
- /**
978
- * @method
979
- * @name hollaex#fetchOrders
980
- * @description fetches information on multiple orders made by the user
981
- * @param {string} symbol unified market symbol of the market orders were made in
982
- * @param {int} [since] the earliest time in ms to fetch orders for
983
- * @param {int} [limit] the maximum number of order structures to retrieve
984
- * @param {object} [params] extra parameters specific to the exchange API endpoint
985
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
986
- */
987
- await this.loadMarkets();
988
- let market = undefined;
989
- const request = {
990
- // 'symbol': market['id'],
991
- // 'side': 'buy', // 'sell'
992
- // 'status': 'new', // 'filled', 'pfilled', 'canceled'
993
- // 'open': true,
994
- // 'limit': limit, // default 50, max 100
995
- // 'page': 1,
996
- // 'order_by': 'created_at', // id, ...
997
- // 'order': 'asc', // 'desc'
998
- // 'start_date': this.iso8601 (since),
999
- // 'end_date': this.iso8601 (this.milliseconds ()),
1000
- };
1001
- if (symbol !== undefined) {
1002
- market = this.market(symbol);
1003
- request['symbol'] = market['id'];
1004
- }
1005
- if (since !== undefined) {
1006
- request['start_date'] = this.iso8601(since);
1007
- }
1008
- if (limit !== undefined) {
1009
- request['limit'] = limit; // default 50, max 100
1010
- }
1011
- const response = await this.privateGetOrders(this.extend(request, params));
1012
- //
1013
- // {
1014
- // "count": 1,
1015
- // "data": [
1016
- // {
1017
- // "id": "string",
1018
- // "side": "sell",
1019
- // "symbol": "xht-usdt",
1020
- // "size": 0.1,
1021
- // "filled": 0,
1022
- // "stop": null,
1023
- // "fee": 0,
1024
- // "fee_coin": "usdt",
1025
- // "type": "limit",
1026
- // "price": 1.09,
1027
- // "status": "new",
1028
- // "created_by": 116,
1029
- // "created_at": "2021-02-17T02:32:38.910Z",
1030
- // "updated_at": "2021-02-17T02:32:38.910Z",
1031
- // "User": {
1032
- // "id": 116,
1033
- // "email": "fight@club.com",
1034
- // "username": "narrator",
1035
- // "exchange_id": 176
1036
- // }
1037
- // }
1038
- // ]
1039
- // }
1040
- //
1041
- const data = this.safeValue(response, 'data', []);
1042
- return this.parseOrders(data, market, since, limit);
1043
- }
1044
- parseOrderStatus(status) {
1045
- const statuses = {
1046
- 'new': 'open',
1047
- 'pfilled': 'open',
1048
- 'filled': 'closed',
1049
- 'canceled': 'canceled',
1050
- };
1051
- return this.safeString(statuses, status, status);
1052
- }
1053
- parseOrder(order, market = undefined) {
1054
- //
1055
- // createOrder, fetchOpenOrder, fetchOpenOrders
1056
- //
1057
- // {
1058
- // "id":"10644b7e-3c90-4ba9-bc3b-188f3a4e9cfd",
1059
- // "created_by":140093,
1060
- // "exchange_id":22,
1061
- // "side":"buy",
1062
- // "symbol":"doge-usdt",
1063
- // "type":"limit",
1064
- // "price":0.05,
1065
- // "size":10,
1066
- // "stop":null,
1067
- // "filled":0,
1068
- // "status":"canceled",
1069
- // "fee":0,
1070
- // "fee_coin":"doge",
1071
- // "meta": { // optional field only returned for postOnly orders
1072
- // "post_only":true
1073
- // },
1074
- // "fee_structure": {
1075
- // "maker":0.1,
1076
- // "taker":0.1
1077
- // },
1078
- // "created_at":"2022-05-31T08:14:14.747Z",
1079
- // "updated_at":"2022-05-31T08:14:23.727Z"
1080
- // }
1081
- //
1082
- const marketId = this.safeString(order, 'symbol');
1083
- const symbol = this.safeSymbol(marketId, market, '-');
1084
- const id = this.safeString(order, 'id');
1085
- const timestamp = this.parse8601(this.safeString(order, 'created_at'));
1086
- const type = this.safeString(order, 'type');
1087
- const side = this.safeString(order, 'side');
1088
- const price = this.safeString(order, 'price');
1089
- const stopPrice = this.safeString(order, 'stop');
1090
- const amount = this.safeString(order, 'size');
1091
- const filled = this.safeString(order, 'filled');
1092
- const status = this.parseOrderStatus(this.safeString(order, 'status'));
1093
- const meta = this.safeValue(order, 'meta', {});
1094
- const postOnly = this.safeValue(meta, 'post_only', false);
1095
- return this.safeOrder({
1096
- 'id': id,
1097
- 'clientOrderId': undefined,
1098
- 'timestamp': timestamp,
1099
- 'datetime': this.iso8601(timestamp),
1100
- 'lastTradeTimestamp': undefined,
1101
- 'status': status,
1102
- 'symbol': symbol,
1103
- 'type': type,
1104
- 'timeInForce': undefined,
1105
- 'postOnly': postOnly,
1106
- 'side': side,
1107
- 'price': price,
1108
- 'stopPrice': stopPrice,
1109
- 'triggerPrice': stopPrice,
1110
- 'amount': amount,
1111
- 'filled': filled,
1112
- 'remaining': undefined,
1113
- 'cost': undefined,
1114
- 'trades': undefined,
1115
- 'fee': undefined,
1116
- 'info': order,
1117
- 'average': undefined,
1118
- }, market);
1119
- }
1120
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1121
- /**
1122
- * @method
1123
- * @name hollaex#createOrder
1124
- * @description create a trade order
1125
- * @param {string} symbol unified symbol of the market to create an order in
1126
- * @param {string} type 'market' or 'limit'
1127
- * @param {string} side 'buy' or 'sell'
1128
- * @param {float} amount how much of currency you want to trade in units of base currency
1129
- * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1130
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1131
- * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1132
- * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
1133
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1134
- */
1135
- await this.loadMarkets();
1136
- const market = this.market(symbol);
1137
- const convertedAmount = parseFloat(this.amountToPrecision(symbol, amount));
1138
- const request = {
1139
- 'symbol': market['id'],
1140
- 'side': side,
1141
- 'size': this.normalizeNumberIfNeeded(convertedAmount),
1142
- 'type': type,
1143
- // 'stop': parseFloat (this.priceToPrecision (symbol, stopPrice)),
1144
- // 'meta': {}, // other options such as post_only
1145
- };
1146
- const stopPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop']);
1147
- const meta = this.safeValue(params, 'meta', {});
1148
- const exchangeSpecificParam = this.safeValue(meta, 'post_only', false);
1149
- const isMarketOrder = type === 'market';
1150
- const postOnly = this.isPostOnly(isMarketOrder, exchangeSpecificParam, params);
1151
- if (!isMarketOrder) {
1152
- const convertedPrice = parseFloat(this.priceToPrecision(symbol, price));
1153
- request['price'] = this.normalizeNumberIfNeeded(convertedPrice);
1154
- }
1155
- if (stopPrice !== undefined) {
1156
- request['stop'] = this.normalizeNumberIfNeeded(parseFloat(this.priceToPrecision(symbol, stopPrice)));
1157
- }
1158
- if (postOnly) {
1159
- request['meta'] = { 'post_only': true };
1160
- }
1161
- params = this.omit(params, ['postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stop']);
1162
- const response = await this.privatePostOrder(this.extend(request, params));
1163
- //
1164
- // {
1165
- // "fee": 0,
1166
- // "meta": {},
1167
- // "symbol": "xht-usdt",
1168
- // "side": "sell",
1169
- // "size": 0.1,
1170
- // "type": "limit",
1171
- // "price": 1,
1172
- // "fee_structure": {
1173
- // "maker": 0.2,
1174
- // "taker": 0.2
1175
- // },
1176
- // "fee_coin": "usdt",
1177
- // "id": "string",
1178
- // "created_by": 116,
1179
- // "filled": 0,
1180
- // "status": "new",
1181
- // "updated_at": "2021-02-17T03:03:19.231Z",
1182
- // "created_at": "2021-02-17T03:03:19.231Z",
1183
- // "stop": null
1184
- // }
1185
- //
1186
- return this.parseOrder(response, market);
1187
- }
1188
- async cancelOrder(id, symbol = undefined, params = {}) {
1189
- /**
1190
- * @method
1191
- * @name hollaex#cancelOrder
1192
- * @description cancels an open order
1193
- * @param {string} id order id
1194
- * @param {string} symbol unified symbol of the market the order was made in
1195
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1196
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1197
- */
1198
- await this.loadMarkets();
1199
- const request = {
1200
- 'order_id': id,
1201
- };
1202
- const response = await this.privateDeleteOrder(this.extend(request, params));
1203
- //
1204
- // {
1205
- // "title": "string",
1206
- // "symbol": "xht-usdt",
1207
- // "side": "sell",
1208
- // "size": 1,
1209
- // "type": "limit",
1210
- // "price": 0.1,
1211
- // "id": "string",
1212
- // "created_by": 34,
1213
- // "filled": 0
1214
- // }
1215
- //
1216
- return this.parseOrder(response);
1217
- }
1218
- async cancelAllOrders(symbol = undefined, params = {}) {
1219
- /**
1220
- * @method
1221
- * @name hollaex#cancelAllOrders
1222
- * @description cancel all open orders in a market
1223
- * @param {string} symbol unified market symbol of the market to cancel orders in
1224
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1225
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1226
- */
1227
- if (symbol === undefined) {
1228
- throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
1229
- }
1230
- await this.loadMarkets();
1231
- const request = {};
1232
- let market = undefined;
1233
- market = this.market(symbol);
1234
- request['symbol'] = market['id'];
1235
- const response = await this.privateDeleteOrderAll(this.extend(request, params));
1236
- //
1237
- // [
1238
- // {
1239
- // "title": "string",
1240
- // "symbol": "xht-usdt",
1241
- // "side": "sell",
1242
- // "size": 1,
1243
- // "type": "limit",
1244
- // "price": 0.1,
1245
- // "id": "string",
1246
- // "created_by": 34,
1247
- // "filled": 0
1248
- // }
1249
- // ]
1250
- //
1251
- return this.parseOrders(response, market);
1252
- }
1253
- async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1254
- /**
1255
- * @method
1256
- * @name hollaex#fetchMyTrades
1257
- * @description fetch all trades made by the user
1258
- * @param {string} symbol unified market symbol
1259
- * @param {int} [since] the earliest time in ms to fetch trades for
1260
- * @param {int} [limit] the maximum number of trades structures to retrieve
1261
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1262
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1263
- */
1264
- await this.loadMarkets();
1265
- const request = {
1266
- // 'symbol': market['id'],
1267
- // 'limit': 50, // default 50, max 100
1268
- // 'page': 1, // page of data to retrieve
1269
- // 'order_by': 'timestamp', // field to order data
1270
- // 'order': 'asc', // asc or desc
1271
- // 'start_date': 123, // starting date of queried data
1272
- // 'end_date': 321, // ending date of queried data
1273
- };
1274
- let market = undefined;
1275
- if (symbol !== undefined) {
1276
- market = this.market(symbol);
1277
- request['symbol'] = market['id'];
1278
- }
1279
- if (limit !== undefined) {
1280
- request['limit'] = limit; // default 50, max 100
1281
- }
1282
- if (since !== undefined) {
1283
- request['start_date'] = this.iso8601(since);
1284
- }
1285
- const response = await this.privateGetUserTrades(this.extend(request, params));
1286
- //
1287
- // {
1288
- // "count": 1,
1289
- // "data": [
1290
- // {
1291
- // "side": "buy",
1292
- // "symbol": "eth-usdt",
1293
- // "size": 0.086,
1294
- // "price": 226.19,
1295
- // "timestamp": "2020-03-03T08:03:55.459Z",
1296
- // "fee": 0.1
1297
- // }
1298
- // ]
1299
- // }
1300
- //
1301
- const data = this.safeValue(response, 'data', []);
1302
- return this.parseTrades(data, market, since, limit);
1303
- }
1304
- parseDepositAddress(depositAddress, currency = undefined) {
1305
- //
1306
- // {
1307
- // "currency":"usdt",
1308
- // "address":"TECLD9XBH31XpyykdHU3uEAeUK7E6Lrmik",
1309
- // "network":"trx",
1310
- // "standard":null,
1311
- // "is_valid":true,
1312
- // "created_at":"2021-05-12T02:43:05.446Z"
1313
- // }
1314
- //
1315
- let address = this.safeString(depositAddress, 'address');
1316
- let tag = undefined;
1317
- if (address !== undefined) {
1318
- const parts = address.split(':');
1319
- address = this.safeString(parts, 0);
1320
- tag = this.safeString(parts, 1);
1321
- }
1322
- this.checkAddress(address);
1323
- const currencyId = this.safeString(depositAddress, 'currency');
1324
- currency = this.safeCurrency(currencyId, currency);
1325
- const network = this.safeString(depositAddress, 'network');
1326
- return {
1327
- 'currency': currency['code'],
1328
- 'address': address,
1329
- 'tag': tag,
1330
- 'network': network,
1331
- 'info': depositAddress,
1332
- };
1333
- }
1334
- async fetchDepositAddresses(codes = undefined, params = {}) {
1335
- /**
1336
- * @method
1337
- * @name hollaex#fetchDepositAddresses
1338
- * @description fetch deposit addresses for multiple currencies and chain types
1339
- * @param {string[]|undefined} codes list of unified currency codes, default is undefined
1340
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1341
- * @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
1342
- */
1343
- await this.loadMarkets();
1344
- const network = this.safeString(params, 'network');
1345
- params = this.omit(params, 'network');
1346
- const response = await this.privateGetUser(params);
1347
- //
1348
- // {
1349
- // "id":620,
1350
- // "email":"igor.kroitor@gmail.com",
1351
- // "full_name":"",
1352
- // "gender":false,
1353
- // "nationality":"",
1354
- // "dob":null,
1355
- // "phone_number":"",
1356
- // "address":{"city":"","address":"","country":"","postal_code":""},
1357
- // "id_data":{"note":"","type":"","number":"","status":0,"issued_date":"","expiration_date":""},
1358
- // "bank_account":[],
1359
- // "crypto_wallet":{},
1360
- // "verification_level":1,
1361
- // "email_verified":true,
1362
- // "otp_enabled":true,
1363
- // "activated":true,
1364
- // "username":"igor.kroitor",
1365
- // "affiliation_code":"QSWA6G",
1366
- // "settings":{
1367
- // "chat":{"set_username":false},
1368
- // "risk":{"popup_warning":false,"order_portfolio_percentage":20},
1369
- // "audio":{"public_trade":false,"order_completed":true,"order_partially_completed":true},
1370
- // "language":"en",
1371
- // "interface":{"theme":"white","order_book_levels":10},
1372
- // "notification":{"popup_order_completed":true,"popup_order_confirmation":true,"popup_order_partially_filled":true}
1373
- // },
1374
- // "affiliation_rate":0,
1375
- // "network_id":10620,
1376
- // "discount":0,
1377
- // "created_at":"2021-03-24T02:37:57.379Z",
1378
- // "updated_at":"2021-03-24T02:37:57.379Z",
1379
- // "balance":{
1380
- // "btc_balance":0,
1381
- // "btc_available":0,
1382
- // "eth_balance":0.000914,
1383
- // "eth_available":0.000914,
1384
- // "updated_at":"2020-03-04T04:03:27.174Z
1385
- // "},
1386
- // "wallet":[
1387
- // {"currency":"usdt","address":"TECLD9XBH31XpyykdHU3uEAeUK7E6Lrmik","network":"trx","standard":null,"is_valid":true,"created_at":"2021-05-12T02:43:05.446Z"},
1388
- // {"currency":"xrp","address":"rGcSzmuRx8qngPRnrvpCKkP9V4njeCPGCv:286741597","network":"xrp","standard":null,"is_valid":true,"created_at":"2021-05-12T02:49:01.273Z"}
1389
- // ]
1390
- // }
1391
- //
1392
- const wallet = this.safeValue(response, 'wallet', []);
1393
- const addresses = (network === undefined) ? wallet : this.filterBy(wallet, 'network', network);
1394
- return this.parseDepositAddresses(addresses, codes);
1395
- }
1396
- async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1397
- /**
1398
- * @method
1399
- * @name hollaex#fetchDeposits
1400
- * @description fetch all deposits made to an account
1401
- * @param {string} code unified currency code
1402
- * @param {int} [since] the earliest time in ms to fetch deposits for
1403
- * @param {int} [limit] the maximum number of deposits structures to retrieve
1404
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1405
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1406
- */
1407
- await this.loadMarkets();
1408
- const request = {
1409
- // 'currency': currency['id'],
1410
- // 'limit': 50, // default 50, max 100
1411
- // 'page': 1, // page of data to retrieve
1412
- // 'order_by': 'timestamp', // field to order data
1413
- // 'order': 'asc', // asc or desc
1414
- // 'start_date': 123, // starting date of queried data
1415
- // 'end_date': 321, // ending date of queried data
1416
- };
1417
- let currency = undefined;
1418
- if (code !== undefined) {
1419
- currency = this.currency(code);
1420
- request['currency'] = currency['id'];
1421
- }
1422
- if (limit !== undefined) {
1423
- request['limit'] = limit; // default 50, max 100
1424
- }
1425
- if (since !== undefined) {
1426
- request['start_date'] = this.iso8601(since);
1427
- }
1428
- const response = await this.privateGetUserDeposits(this.extend(request, params));
1429
- //
1430
- // {
1431
- // "count": 1,
1432
- // "data": [
1433
- // {
1434
- // "id": 539,
1435
- // "amount": 20,
1436
- // "fee": 0,
1437
- // "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
1438
- // "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
1439
- // "status": true,
1440
- // "dismissed": false,
1441
- // "rejected": false,
1442
- // "description": "",
1443
- // "type": "deposit",
1444
- // "currency": "usdt",
1445
- // "created_at": "2020-03-03T07:56:36.198Z",
1446
- // "updated_at": "2020-03-03T08:00:05.674Z",
1447
- // "user_id": 620
1448
- // }
1449
- // ]
1450
- // }
1451
- //
1452
- const data = this.safeValue(response, 'data', []);
1453
- return this.parseTransactions(data, currency, since, limit);
1454
- }
1455
- async fetchWithdrawal(id, code = undefined, params = {}) {
1456
- /**
1457
- * @method
1458
- * @name hollaex#fetchWithdrawal
1459
- * @description fetch data on a currency withdrawal via the withdrawal id
1460
- * @param {string} id withdrawal id
1461
- * @param {string} code unified currency code of the currency withdrawn, default is undefined
1462
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1463
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1464
- */
1465
- await this.loadMarkets();
1466
- const request = {
1467
- 'transaction_id': id,
1468
- };
1469
- let currency = undefined;
1470
- if (code !== undefined) {
1471
- currency = this.currency(code);
1472
- request['currency'] = currency['id'];
1473
- }
1474
- const response = await this.privateGetUserWithdrawals(this.extend(request, params));
1475
- //
1476
- // {
1477
- // "count": 1,
1478
- // "data": [
1479
- // {
1480
- // "id": 539,
1481
- // "amount": 20,
1482
- // "fee": 0,
1483
- // "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
1484
- // "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
1485
- // "status": true,
1486
- // "dismissed": false,
1487
- // "rejected": false,
1488
- // "description": "",
1489
- // "type": "withdrawal",
1490
- // "currency": "usdt",
1491
- // "created_at": "2020-03-03T07:56:36.198Z",
1492
- // "updated_at": "2020-03-03T08:00:05.674Z",
1493
- // "user_id": 620
1494
- // }
1495
- // ]
1496
- // }
1497
- //
1498
- const data = this.safeValue(response, 'data', []);
1499
- const transaction = this.safeValue(data, 0, {});
1500
- return this.parseTransaction(transaction, currency);
1501
- }
1502
- async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1503
- /**
1504
- * @method
1505
- * @name hollaex#fetchWithdrawals
1506
- * @description fetch all withdrawals made from an account
1507
- * @param {string} code unified currency code
1508
- * @param {int} [since] the earliest time in ms to fetch withdrawals for
1509
- * @param {int} [limit] the maximum number of withdrawals structures to retrieve
1510
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1511
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1512
- */
1513
- await this.loadMarkets();
1514
- const request = {
1515
- // 'currency': currency['id'],
1516
- // 'limit': 50, // default 50, max 100
1517
- // 'page': 1, // page of data to retrieve
1518
- // 'order_by': 'timestamp', // field to order data
1519
- // 'order': 'asc', // asc or desc
1520
- // 'start_date': 123, // starting date of queried data
1521
- // 'end_date': 321, // ending date of queried data
1522
- };
1523
- let currency = undefined;
1524
- if (code !== undefined) {
1525
- currency = this.currency(code);
1526
- request['currency'] = currency['id'];
1527
- }
1528
- if (limit !== undefined) {
1529
- request['limit'] = limit; // default 50, max 100
1530
- }
1531
- if (since !== undefined) {
1532
- request['start_date'] = this.iso8601(since);
1533
- }
1534
- const response = await this.privateGetUserWithdrawals(this.extend(request, params));
1535
- //
1536
- // {
1537
- // "count": 1,
1538
- // "data": [
1539
- // {
1540
- // "id": 539,
1541
- // "amount": 20,
1542
- // "fee": 0,
1543
- // "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
1544
- // "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
1545
- // "status": true,
1546
- // "dismissed": false,
1547
- // "rejected": false,
1548
- // "description": "",
1549
- // "type": "withdrawal",
1550
- // "currency": "usdt",
1551
- // "created_at": "2020-03-03T07:56:36.198Z",
1552
- // "updated_at": "2020-03-03T08:00:05.674Z",
1553
- // "user_id": 620
1554
- // }
1555
- // ]
1556
- // }
1557
- //
1558
- const data = this.safeValue(response, 'data', []);
1559
- return this.parseTransactions(data, currency, since, limit);
1560
- }
1561
- parseTransaction(transaction, currency = undefined) {
1562
- //
1563
- // fetchWithdrawals, fetchDeposits
1564
- //
1565
- // {
1566
- // "id": 539,
1567
- // "amount": 20,
1568
- // "fee": 0,
1569
- // "address": "0x5c0cc98270d7089408fcbcc8e2131287f5be2306",
1570
- // "transaction_id": "0xd4006327a5ec2c41adbdcf566eaaba6597c3d45906abe78ea1a4a022647c2e28",
1571
- // "status": true,
1572
- // "dismissed": false,
1573
- // "rejected": false,
1574
- // "description": "",
1575
- // "type": "withdrawal",
1576
- // "currency": "usdt",
1577
- // "created_at": "2020-03-03T07:56:36.198Z",
1578
- // "updated_at": "2020-03-03T08:00:05.674Z",
1579
- // "user_id": 620
1580
- // }
1581
- //
1582
- // withdraw
1583
- //
1584
- // {
1585
- // "message": "Withdrawal request is in the queue and will be processed.",
1586
- // "transaction_id": "1d1683c3-576a-4d53-8ff5-27c93fd9758a",
1587
- // "amount": 1,
1588
- // "currency": "xht",
1589
- // "fee": 0,
1590
- // "fee_coin": "xht"
1591
- // }
1592
- //
1593
- const id = this.safeString(transaction, 'id');
1594
- const txid = this.safeString(transaction, 'transaction_id');
1595
- const timestamp = this.parse8601(this.safeString(transaction, 'created_at'));
1596
- const updated = this.parse8601(this.safeString(transaction, 'updated_at'));
1597
- const type = this.safeString(transaction, 'type');
1598
- const amount = this.safeNumber(transaction, 'amount');
1599
- let address = this.safeString(transaction, 'address');
1600
- let addressTo = undefined;
1601
- const addressFrom = undefined;
1602
- let tag = undefined;
1603
- let tagTo = undefined;
1604
- const tagFrom = undefined;
1605
- if (address !== undefined) {
1606
- const parts = address.split(':');
1607
- address = this.safeString(parts, 0);
1608
- tag = this.safeString(parts, 1);
1609
- addressTo = address;
1610
- tagTo = tag;
1611
- }
1612
- const currencyId = this.safeString(transaction, 'currency');
1613
- currency = this.safeCurrency(currencyId, currency);
1614
- let status = this.safeValue(transaction, 'status');
1615
- const dismissed = this.safeValue(transaction, 'dismissed');
1616
- const rejected = this.safeValue(transaction, 'rejected');
1617
- if (status) {
1618
- status = 'ok';
1619
- }
1620
- else if (dismissed) {
1621
- status = 'canceled';
1622
- }
1623
- else if (rejected) {
1624
- status = 'failed';
1625
- }
1626
- else {
1627
- status = 'pending';
1628
- }
1629
- const feeCurrencyId = this.safeString(transaction, 'fee_coin');
1630
- const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId, currency);
1631
- const feeCost = this.safeNumber(transaction, 'fee');
1632
- let fee = undefined;
1633
- if (feeCost !== undefined) {
1634
- fee = {
1635
- 'currency': feeCurrencyCode,
1636
- 'cost': feeCost,
1637
- };
1638
- }
1639
- return {
1640
- 'info': transaction,
1641
- 'id': id,
1642
- 'txid': txid,
1643
- 'timestamp': timestamp,
1644
- 'datetime': this.iso8601(timestamp),
1645
- 'network': undefined,
1646
- 'addressFrom': addressFrom,
1647
- 'address': address,
1648
- 'addressTo': addressTo,
1649
- 'tagFrom': tagFrom,
1650
- 'tag': tag,
1651
- 'tagTo': tagTo,
1652
- 'type': type,
1653
- 'amount': amount,
1654
- 'currency': currency['code'],
1655
- 'status': status,
1656
- 'updated': updated,
1657
- 'comment': this.safeString(transaction, 'message'),
1658
- 'internal': undefined,
1659
- 'fee': fee,
1660
- };
1661
- }
1662
- async withdraw(code, amount, address, tag = undefined, params = {}) {
1663
- /**
1664
- * @method
1665
- * @name hollaex#withdraw
1666
- * @description make a withdrawal
1667
- * @param {string} code unified currency code
1668
- * @param {float} amount the amount to withdraw
1669
- * @param {string} address the address to withdraw to
1670
- * @param {string} tag
1671
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1672
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1673
- */
1674
- [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1675
- this.checkAddress(address);
1676
- await this.loadMarkets();
1677
- const currency = this.currency(code);
1678
- if (tag !== undefined) {
1679
- address += ':' + tag;
1680
- }
1681
- const network = this.safeString(params, 'network');
1682
- if (network === undefined) {
1683
- throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a network parameter');
1684
- }
1685
- params = this.omit(params, 'network');
1686
- const request = {
1687
- 'currency': currency['id'],
1688
- 'amount': amount,
1689
- 'address': address,
1690
- 'network': this.networkCodeToId(network, code),
1691
- };
1692
- const response = await this.privatePostUserWithdrawal(this.extend(request, params));
1693
- //
1694
- // {
1695
- // "message": "Withdrawal request is in the queue and will be processed.",
1696
- // "transaction_id": "1d1683c3-576a-4d53-8ff5-27c93fd9758a",
1697
- // "amount": 1,
1698
- // "currency": "xht",
1699
- // "fee": 0,
1700
- // "fee_coin": "xht"
1701
- // }
1702
- //
1703
- return this.parseTransaction(response, currency);
1704
- }
1705
- parseDepositWithdrawFee(fee, currency = undefined) {
1706
- //
1707
- // "bch":{
1708
- // "id":4,
1709
- // "fullname":"Bitcoin Cash",
1710
- // "symbol":"bch",
1711
- // "active":true,
1712
- // "verified":true,
1713
- // "allow_deposit":true,
1714
- // "allow_withdrawal":true,
1715
- // "withdrawal_fee":0.0001,
1716
- // "min":0.001,
1717
- // "max":100000,
1718
- // "increment_unit":0.001,
1719
- // "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
1720
- // "code":"bch",
1721
- // "is_public":true,
1722
- // "meta":{},
1723
- // "estimated_price":null,
1724
- // "description":null,
1725
- // "type":"blockchain",
1726
- // "network":null,
1727
- // "standard":null,
1728
- // "issuer":"HollaEx",
1729
- // "withdrawal_fees":null,
1730
- // "created_at":"2019-08-09T10:45:43.367Z",
1731
- // "updated_at":"2021-12-13T03:08:32.372Z",
1732
- // "created_by":1,
1733
- // "owner_id":1
1734
- // }
1735
- //
1736
- const result = {
1737
- 'info': fee,
1738
- 'withdraw': {
1739
- 'fee': undefined,
1740
- 'percentage': undefined,
1741
- },
1742
- 'deposit': {
1743
- 'fee': undefined,
1744
- 'percentage': undefined,
1745
- },
1746
- 'networks': {},
1747
- };
1748
- const allowWithdrawal = this.safeValue(fee, 'allow_withdrawal');
1749
- if (allowWithdrawal) {
1750
- result['withdraw'] = { 'fee': this.safeNumber(fee, 'withdrawal_fee'), 'percentage': false };
1751
- }
1752
- const withdrawalFees = this.safeValue(fee, 'withdrawal_fees');
1753
- if (withdrawalFees !== undefined) {
1754
- const keys = Object.keys(withdrawalFees);
1755
- const keysLength = keys.length;
1756
- for (let i = 0; i < keysLength; i++) {
1757
- const key = keys[i];
1758
- const value = withdrawalFees[key];
1759
- const currencyId = this.safeString(value, 'symbol');
1760
- const currencyCode = this.safeCurrencyCode(currencyId);
1761
- const networkCode = this.networkIdToCode(key, currencyCode);
1762
- const networkCodeUpper = networkCode.toUpperCase(); // default to the upper case network code
1763
- const withdrawalFee = this.safeNumber(value, 'value');
1764
- result['networks'][networkCodeUpper] = {
1765
- 'deposit': undefined,
1766
- 'withdraw': withdrawalFee,
1767
- };
1768
- }
1769
- }
1770
- return result;
1771
- }
1772
- async fetchDepositWithdrawFees(codes = undefined, params = {}) {
1773
- /**
1774
- * @method
1775
- * @name hollaex#fetchDepositWithdrawFees
1776
- * @description fetch deposit and withdraw fees
1777
- * @see https://apidocs.hollaex.com/#constants
1778
- * @param {string[]|undefined} codes list of unified currency codes
1779
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1780
- * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1781
- */
1782
- const response = await this.publicGetConstants(params);
1783
- //
1784
- // {
1785
- // "coins":{
1786
- // "bch":{
1787
- // "id":4,
1788
- // "fullname":"Bitcoin Cash",
1789
- // "symbol":"bch",
1790
- // "active":true,
1791
- // "verified":true,
1792
- // "allow_deposit":true,
1793
- // "allow_withdrawal":true,
1794
- // "withdrawal_fee":0.0001,
1795
- // "min":0.001,
1796
- // "max":100000,
1797
- // "increment_unit":0.001,
1798
- // "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
1799
- // "code":"bch",
1800
- // "is_public":true,
1801
- // "meta":{},
1802
- // "estimated_price":null,
1803
- // "description":null,
1804
- // "type":"blockchain",
1805
- // "network":null,
1806
- // "standard":null,
1807
- // "issuer":"HollaEx",
1808
- // "withdrawal_fees":null,
1809
- // "created_at":"2019-08-09T10:45:43.367Z",
1810
- // "updated_at":"2021-12-13T03:08:32.372Z",
1811
- // "created_by":1,
1812
- // "owner_id":1
1813
- // },
1814
- // },
1815
- // "network":"https://api.hollaex.network"
1816
- // }
1817
- //
1818
- const coins = this.safeValue(response, 'coins');
1819
- return this.parseDepositWithdrawFees(coins, codes, 'symbol');
1820
- }
1821
- normalizeNumberIfNeeded(number) {
1822
- if (this.isRoundNumber(number)) {
1823
- number = parseInt(number);
1824
- }
1825
- return number;
1826
- }
1827
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1828
- const query = this.omit(params, this.extractParams(path));
1829
- path = '/' + this.version + '/' + this.implodeParams(path, params);
1830
- if ((method === 'GET') || (method === 'DELETE')) {
1831
- if (Object.keys(query).length) {
1832
- path += '?' + this.urlencode(query);
1833
- }
1834
- }
1835
- const url = this.urls['api']['rest'] + path;
1836
- if (api === 'private') {
1837
- this.checkRequiredCredentials();
1838
- const defaultExpires = this.safeInteger2(this.options, 'api-expires', 'expires', this.parseToInt(this.timeout / 1000));
1839
- const expires = this.sum(this.seconds(), defaultExpires);
1840
- const expiresString = expires.toString();
1841
- let auth = method + path + expiresString;
1842
- headers = {
1843
- 'api-key': this.apiKey,
1844
- 'api-expires': expiresString,
1845
- };
1846
- if (method === 'POST') {
1847
- headers['Content-type'] = 'application/json';
1848
- if (Object.keys(query).length) {
1849
- body = this.json(query);
1850
- auth += body;
1851
- }
1852
- }
1853
- const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256);
1854
- headers['api-signature'] = signature;
1855
- }
1856
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1857
- }
1858
- handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1859
- if (response === undefined) {
1860
- return undefined;
1861
- }
1862
- if ((code >= 400) && (code <= 503)) {
1863
- //
1864
- // { "message": "Invalid token" }
1865
- //
1866
- // different errors return the same code eg:
1867
- //
1868
- // { "message":"Error 1001 - Order rejected. Order could not be submitted as this order was set to a post only order." }
1869
- //
1870
- // { "message":"Error 1001 - POST ONLY order can not be of type market" }
1871
- //
1872
- const feedback = this.id + ' ' + body;
1873
- const message = this.safeString(response, 'message');
1874
- this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
1875
- const status = code.toString();
1876
- this.throwExactlyMatchedException(this.exceptions['exact'], status, feedback);
1877
- }
1878
- return undefined;
1879
- }
1880
- }
1881
-
1882
- module.exports = hollaex;