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,1044 +0,0 @@
1
- 'use strict';
2
-
3
- var luno$1 = require('./abstract/luno.js');
4
- var errors = require('./base/errors.js');
5
- var Precise = require('./base/Precise.js');
6
- var number = require('./base/functions/number.js');
7
-
8
- // ---------------------------------------------------------------------------
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class luno
12
- * @augments Exchange
13
- */
14
- class luno extends luno$1 {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'luno',
18
- 'name': 'luno',
19
- 'countries': ['GB', 'SG', 'ZA'],
20
- // 300 calls per minute = 5 calls per second = 1000ms / 5 = 200ms between requests
21
- 'rateLimit': 200,
22
- 'version': '1',
23
- 'pro': true,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': true,
27
- 'margin': false,
28
- 'swap': false,
29
- 'future': false,
30
- 'option': false,
31
- 'addMargin': false,
32
- 'cancelOrder': true,
33
- 'closeAllPositions': false,
34
- 'closePosition': false,
35
- 'createOrder': true,
36
- 'createReduceOnlyOrder': false,
37
- 'fetchAccounts': true,
38
- 'fetchBalance': true,
39
- 'fetchBorrowRateHistory': false,
40
- 'fetchClosedOrders': true,
41
- 'fetchCrossBorrowRate': false,
42
- 'fetchCrossBorrowRates': false,
43
- 'fetchFundingHistory': false,
44
- 'fetchFundingRate': false,
45
- 'fetchFundingRateHistory': false,
46
- 'fetchFundingRates': false,
47
- 'fetchIndexOHLCV': false,
48
- 'fetchIsolatedBorrowRate': false,
49
- 'fetchIsolatedBorrowRates': false,
50
- 'fetchLedger': true,
51
- 'fetchLeverage': false,
52
- 'fetchLeverageTiers': false,
53
- 'fetchMarginMode': false,
54
- 'fetchMarkets': true,
55
- 'fetchMarkOHLCV': false,
56
- 'fetchMyTrades': true,
57
- 'fetchOHLCV': false,
58
- 'fetchOpenInterestHistory': false,
59
- 'fetchOpenOrders': true,
60
- 'fetchOrder': true,
61
- 'fetchOrderBook': true,
62
- 'fetchOrders': true,
63
- 'fetchPosition': false,
64
- 'fetchPositionMode': false,
65
- 'fetchPositions': false,
66
- 'fetchPositionsRisk': false,
67
- 'fetchPremiumIndexOHLCV': false,
68
- 'fetchTicker': true,
69
- 'fetchTickers': true,
70
- 'fetchTrades': true,
71
- 'fetchTradingFee': true,
72
- 'fetchTradingFees': false,
73
- 'reduceMargin': false,
74
- 'setLeverage': false,
75
- 'setMarginMode': false,
76
- 'setPositionMode': false,
77
- },
78
- 'urls': {
79
- 'referral': 'https://www.luno.com/invite/44893A',
80
- 'logo': 'https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg',
81
- 'api': {
82
- 'public': 'https://api.luno.com/api',
83
- 'private': 'https://api.luno.com/api',
84
- 'exchange': 'https://api.luno.com/api/exchange',
85
- },
86
- 'www': 'https://www.luno.com',
87
- 'doc': [
88
- 'https://www.luno.com/en/api',
89
- 'https://npmjs.org/package/bitx',
90
- 'https://github.com/bausmeier/node-bitx',
91
- ],
92
- },
93
- 'api': {
94
- 'exchange': {
95
- 'get': {
96
- 'markets': 1,
97
- },
98
- },
99
- 'public': {
100
- 'get': {
101
- 'orderbook': 1,
102
- 'orderbook_top': 1,
103
- 'ticker': 1,
104
- 'tickers': 1,
105
- 'trades': 1,
106
- },
107
- },
108
- 'private': {
109
- 'get': {
110
- 'accounts/{id}/pending': 1,
111
- 'accounts/{id}/transactions': 1,
112
- 'balance': 1,
113
- 'beneficiaries': 1,
114
- 'fee_info': 1,
115
- 'funding_address': 1,
116
- 'listorders': 1,
117
- 'listtrades': 1,
118
- 'send_fee': 1,
119
- 'orders/{id}': 1,
120
- 'withdrawals': 1,
121
- 'withdrawals/{id}': 1,
122
- 'transfers': 1,
123
- // GET /api/exchange/1/move
124
- // GET /api/exchange/1/move/list_moves
125
- // GET /api/exchange/1/candles
126
- // GET /api/exchange/1/transfers
127
- // GET /api/exchange/2/listorders
128
- // GET /api/exchange/2/orders/{id}
129
- // GET /api/exchange/3/order
130
- },
131
- 'post': {
132
- 'accounts': 1,
133
- 'address/validate': 1,
134
- 'postorder': 1,
135
- 'marketorder': 1,
136
- 'stoporder': 1,
137
- 'funding_address': 1,
138
- 'withdrawals': 1,
139
- 'send': 1,
140
- 'oauth2/grant': 1,
141
- // POST /api/exchange/1/move
142
- },
143
- 'put': {
144
- 'accounts/{id}/name': 1,
145
- },
146
- 'delete': {
147
- 'withdrawals/{id}': 1,
148
- },
149
- },
150
- },
151
- 'fees': {
152
- 'trading': {
153
- 'tierBased': true,
154
- 'percentage': true,
155
- 'taker': this.parseNumber('0.001'),
156
- 'maker': this.parseNumber('0'),
157
- },
158
- },
159
- 'precisionMode': number.TICK_SIZE,
160
- });
161
- }
162
- async fetchMarkets(params = {}) {
163
- /**
164
- * @method
165
- * @name luno#fetchMarkets
166
- * @description retrieves data on all markets for luno
167
- * @param {object} [params] extra parameters specific to the exchange API endpoint
168
- * @returns {object[]} an array of objects representing market data
169
- */
170
- const response = await this.exchangeGetMarkets(params);
171
- //
172
- // {
173
- // "markets":[
174
- // {
175
- // "market_id":"BCHXBT",
176
- // "trading_status":"ACTIVE",
177
- // "base_currency":"BCH",
178
- // "counter_currency":"XBT",
179
- // "min_volume":"0.01",
180
- // "max_volume":"100.00",
181
- // "volume_scale":2,
182
- // "min_price":"0.0001",
183
- // "max_price":"1.00",
184
- // "price_scale":6,
185
- // "fee_scale":8,
186
- // },
187
- // ]
188
- // }
189
- //
190
- const result = [];
191
- const markets = this.safeValue(response, 'markets', []);
192
- for (let i = 0; i < markets.length; i++) {
193
- const market = markets[i];
194
- const id = this.safeString(market, 'market_id');
195
- const baseId = this.safeString(market, 'base_currency');
196
- const quoteId = this.safeString(market, 'counter_currency');
197
- const base = this.safeCurrencyCode(baseId);
198
- const quote = this.safeCurrencyCode(quoteId);
199
- const status = this.safeString(market, 'trading_status');
200
- result.push({
201
- 'id': id,
202
- 'symbol': base + '/' + quote,
203
- 'base': base,
204
- 'quote': quote,
205
- 'settle': undefined,
206
- 'baseId': baseId,
207
- 'quoteId': quoteId,
208
- 'settleId': undefined,
209
- 'type': 'spot',
210
- 'spot': true,
211
- 'margin': false,
212
- 'swap': false,
213
- 'future': false,
214
- 'option': false,
215
- 'active': (status === 'ACTIVE'),
216
- 'contract': false,
217
- 'linear': undefined,
218
- 'inverse': undefined,
219
- 'contractSize': undefined,
220
- 'expiry': undefined,
221
- 'expiryDatetime': undefined,
222
- 'strike': undefined,
223
- 'optionType': undefined,
224
- 'precision': {
225
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'volume_scale'))),
226
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'price_scale'))),
227
- },
228
- 'limits': {
229
- 'leverage': {
230
- 'min': undefined,
231
- 'max': undefined,
232
- },
233
- 'amount': {
234
- 'min': this.safeNumber(market, 'min_volume'),
235
- 'max': this.safeNumber(market, 'max_volume'),
236
- },
237
- 'price': {
238
- 'min': this.safeNumber(market, 'min_price'),
239
- 'max': this.safeNumber(market, 'max_price'),
240
- },
241
- 'cost': {
242
- 'min': undefined,
243
- 'max': undefined,
244
- },
245
- },
246
- 'created': undefined,
247
- 'info': market,
248
- });
249
- }
250
- return result;
251
- }
252
- async fetchAccounts(params = {}) {
253
- /**
254
- * @method
255
- * @name luno#fetchAccounts
256
- * @description fetch all the accounts associated with a profile
257
- * @param {object} [params] extra parameters specific to the exchange API endpoint
258
- * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
259
- */
260
- const response = await this.privateGetBalance(params);
261
- const wallets = this.safeValue(response, 'balance', []);
262
- const result = [];
263
- for (let i = 0; i < wallets.length; i++) {
264
- const account = wallets[i];
265
- const accountId = this.safeString(account, 'account_id');
266
- const currencyId = this.safeString(account, 'asset');
267
- const code = this.safeCurrencyCode(currencyId);
268
- result.push({
269
- 'id': accountId,
270
- 'type': undefined,
271
- 'currency': code,
272
- 'info': account,
273
- });
274
- }
275
- return result;
276
- }
277
- parseBalance(response) {
278
- const wallets = this.safeValue(response, 'balance', []);
279
- const result = {
280
- 'info': response,
281
- 'timestamp': undefined,
282
- 'datetime': undefined,
283
- };
284
- for (let i = 0; i < wallets.length; i++) {
285
- const wallet = wallets[i];
286
- const currencyId = this.safeString(wallet, 'asset');
287
- const code = this.safeCurrencyCode(currencyId);
288
- const reserved = this.safeString(wallet, 'reserved');
289
- const unconfirmed = this.safeString(wallet, 'unconfirmed');
290
- const balance = this.safeString(wallet, 'balance');
291
- const reservedUnconfirmed = Precise["default"].stringAdd(reserved, unconfirmed);
292
- const balanceUnconfirmed = Precise["default"].stringAdd(balance, unconfirmed);
293
- if (code in result) {
294
- result[code]['used'] = Precise["default"].stringAdd(result[code]['used'], reservedUnconfirmed);
295
- result[code]['total'] = Precise["default"].stringAdd(result[code]['total'], balanceUnconfirmed);
296
- }
297
- else {
298
- const account = this.account();
299
- account['used'] = reservedUnconfirmed;
300
- account['total'] = balanceUnconfirmed;
301
- result[code] = account;
302
- }
303
- }
304
- return this.safeBalance(result);
305
- }
306
- async fetchBalance(params = {}) {
307
- /**
308
- * @method
309
- * @name luno#fetchBalance
310
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
311
- * @param {object} [params] extra parameters specific to the exchange API endpoint
312
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
313
- */
314
- await this.loadMarkets();
315
- const response = await this.privateGetBalance(params);
316
- //
317
- // {
318
- // "balance": [
319
- // {'account_id': '119...1336','asset': 'XBT','balance': '0.00','reserved': '0.00',"unconfirmed": "0.00"},
320
- // {'account_id': '66...289','asset': 'XBT','balance': '0.00','reserved': '0.00',"unconfirmed": "0.00"},
321
- // {'account_id': '718...5300','asset': 'ETH','balance': '0.00','reserved': '0.00',"unconfirmed": "0.00"},
322
- // {'account_id': '818...7072','asset': 'ZAR','balance': '0.001417','reserved': '0.00',"unconfirmed": "0.00"}]}
323
- // ]
324
- // }
325
- //
326
- return this.parseBalance(response);
327
- }
328
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
329
- /**
330
- * @method
331
- * @name luno#fetchOrderBook
332
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
333
- * @param {string} symbol unified symbol of the market to fetch the order book for
334
- * @param {int} [limit] the maximum amount of order book entries to return
335
- * @param {object} [params] extra parameters specific to the exchange API endpoint
336
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
337
- */
338
- await this.loadMarkets();
339
- const market = this.market(symbol);
340
- const request = {
341
- 'pair': market['id'],
342
- };
343
- let response = undefined;
344
- if (limit !== undefined && limit <= 100) {
345
- response = await this.publicGetOrderbookTop(this.extend(request, params));
346
- }
347
- else {
348
- response = await this.publicGetOrderbook(this.extend(request, params));
349
- }
350
- const timestamp = this.safeInteger(response, 'timestamp');
351
- return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
352
- }
353
- parseOrderStatus(status) {
354
- const statuses = {
355
- // todo add other statuses
356
- 'PENDING': 'open',
357
- };
358
- return this.safeString(statuses, status, status);
359
- }
360
- parseOrder(order, market = undefined) {
361
- //
362
- // {
363
- // "base": "string",
364
- // "completed_timestamp": "string",
365
- // "counter": "string",
366
- // "creation_timestamp": "string",
367
- // "expiration_timestamp": "string",
368
- // "fee_base": "string",
369
- // "fee_counter": "string",
370
- // "limit_price": "string",
371
- // "limit_volume": "string",
372
- // "order_id": "string",
373
- // "pair": "string",
374
- // "state": "PENDING",
375
- // "type": "BID"
376
- // }
377
- //
378
- const timestamp = this.safeInteger(order, 'creation_timestamp');
379
- let status = this.parseOrderStatus(this.safeString(order, 'state'));
380
- status = (status === 'open') ? status : status;
381
- let side = undefined;
382
- const orderType = this.safeString(order, 'type');
383
- if ((orderType === 'ASK') || (orderType === 'SELL')) {
384
- side = 'sell';
385
- }
386
- else if ((orderType === 'BID') || (orderType === 'BUY')) {
387
- side = 'buy';
388
- }
389
- const marketId = this.safeString(order, 'pair');
390
- market = this.safeMarket(marketId, market);
391
- const price = this.safeString(order, 'limit_price');
392
- const amount = this.safeString(order, 'limit_volume');
393
- const quoteFee = this.safeNumber(order, 'fee_counter');
394
- const baseFee = this.safeNumber(order, 'fee_base');
395
- const filled = this.safeString(order, 'base');
396
- const cost = this.safeString(order, 'counter');
397
- let fee = undefined;
398
- if (quoteFee !== undefined) {
399
- fee = {
400
- 'cost': quoteFee,
401
- 'currency': market['quote'],
402
- };
403
- }
404
- else if (baseFee !== undefined) {
405
- fee = {
406
- 'cost': baseFee,
407
- 'currency': market['base'],
408
- };
409
- }
410
- const id = this.safeString(order, 'order_id');
411
- return this.safeOrder({
412
- 'id': id,
413
- 'clientOrderId': undefined,
414
- 'datetime': this.iso8601(timestamp),
415
- 'timestamp': timestamp,
416
- 'lastTradeTimestamp': undefined,
417
- 'status': status,
418
- 'symbol': market['symbol'],
419
- 'type': undefined,
420
- 'timeInForce': undefined,
421
- 'postOnly': undefined,
422
- 'side': side,
423
- 'price': price,
424
- 'stopPrice': undefined,
425
- 'triggerPrice': undefined,
426
- 'amount': amount,
427
- 'filled': filled,
428
- 'cost': cost,
429
- 'remaining': undefined,
430
- 'trades': undefined,
431
- 'fee': fee,
432
- 'info': order,
433
- 'average': undefined,
434
- }, market);
435
- }
436
- async fetchOrder(id, symbol = undefined, params = {}) {
437
- /**
438
- * @method
439
- * @name luno#fetchOrder
440
- * @description fetches information on an order made by the user
441
- * @param {string} symbol not used by luno fetchOrder
442
- * @param {object} [params] extra parameters specific to the exchange API endpoint
443
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
444
- */
445
- await this.loadMarkets();
446
- const request = {
447
- 'id': id,
448
- };
449
- const response = await this.privateGetOrdersId(this.extend(request, params));
450
- return this.parseOrder(response);
451
- }
452
- async fetchOrdersByState(state = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
453
- await this.loadMarkets();
454
- const request = {};
455
- let market = undefined;
456
- if (state !== undefined) {
457
- request['state'] = state;
458
- }
459
- if (symbol !== undefined) {
460
- market = this.market(symbol);
461
- request['pair'] = market['id'];
462
- }
463
- const response = await this.privateGetListorders(this.extend(request, params));
464
- const orders = this.safeValue(response, 'orders', []);
465
- return this.parseOrders(orders, market, since, limit);
466
- }
467
- async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
468
- /**
469
- * @method
470
- * @name luno#fetchOrders
471
- * @description fetches information on multiple orders made by the user
472
- * @param {string} symbol unified market symbol of the market orders were made in
473
- * @param {int} [since] the earliest time in ms to fetch orders for
474
- * @param {int} [limit] the maximum number of order structures to retrieve
475
- * @param {object} [params] extra parameters specific to the exchange API endpoint
476
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
477
- */
478
- return await this.fetchOrdersByState(undefined, symbol, since, limit, params);
479
- }
480
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
481
- /**
482
- * @method
483
- * @name luno#fetchOpenOrders
484
- * @description fetch all unfilled currently open orders
485
- * @param {string} symbol unified market symbol
486
- * @param {int} [since] the earliest time in ms to fetch open orders for
487
- * @param {int} [limit] the maximum number of open orders structures to retrieve
488
- * @param {object} [params] extra parameters specific to the exchange API endpoint
489
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
490
- */
491
- return await this.fetchOrdersByState('PENDING', symbol, since, limit, params);
492
- }
493
- async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
494
- /**
495
- * @method
496
- * @name luno#fetchClosedOrders
497
- * @description fetches information on multiple closed orders made by the user
498
- * @param {string} symbol unified market symbol of the market orders were made in
499
- * @param {int} [since] the earliest time in ms to fetch orders for
500
- * @param {int} [limit] the maximum number of order structures to retrieve
501
- * @param {object} [params] extra parameters specific to the exchange API endpoint
502
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
503
- */
504
- return await this.fetchOrdersByState('COMPLETE', symbol, since, limit, params);
505
- }
506
- parseTicker(ticker, market = undefined) {
507
- // {
508
- // "pair":"XBTAUD",
509
- // "timestamp":1642201439301,
510
- // "bid":"59972.30000000",
511
- // "ask":"59997.99000000",
512
- // "last_trade":"59997.99000000",
513
- // "rolling_24_hour_volume":"1.89510000",
514
- // "status":"ACTIVE"
515
- // }
516
- const timestamp = this.safeInteger(ticker, 'timestamp');
517
- const marketId = this.safeString(ticker, 'pair');
518
- const symbol = this.safeSymbol(marketId, market);
519
- const last = this.safeString(ticker, 'last_trade');
520
- return this.safeTicker({
521
- 'symbol': symbol,
522
- 'timestamp': timestamp,
523
- 'datetime': this.iso8601(timestamp),
524
- 'high': undefined,
525
- 'low': undefined,
526
- 'bid': this.safeString(ticker, 'bid'),
527
- 'bidVolume': undefined,
528
- 'ask': this.safeString(ticker, 'ask'),
529
- 'askVolume': undefined,
530
- 'vwap': undefined,
531
- 'open': undefined,
532
- 'close': last,
533
- 'last': last,
534
- 'previousClose': undefined,
535
- 'change': undefined,
536
- 'percentage': undefined,
537
- 'average': undefined,
538
- 'baseVolume': this.safeString(ticker, 'rolling_24_hour_volume'),
539
- 'quoteVolume': undefined,
540
- 'info': ticker,
541
- }, market);
542
- }
543
- async fetchTickers(symbols = undefined, params = {}) {
544
- /**
545
- * @method
546
- * @name luno#fetchTickers
547
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
548
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
549
- * @param {object} [params] extra parameters specific to the exchange API endpoint
550
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
551
- */
552
- await this.loadMarkets();
553
- symbols = this.marketSymbols(symbols);
554
- const response = await this.publicGetTickers(params);
555
- const tickers = this.indexBy(response['tickers'], 'pair');
556
- const ids = Object.keys(tickers);
557
- const result = {};
558
- for (let i = 0; i < ids.length; i++) {
559
- const id = ids[i];
560
- const market = this.safeMarket(id);
561
- const symbol = market['symbol'];
562
- const ticker = tickers[id];
563
- result[symbol] = this.parseTicker(ticker, market);
564
- }
565
- return this.filterByArrayTickers(result, 'symbol', symbols);
566
- }
567
- async fetchTicker(symbol, params = {}) {
568
- /**
569
- * @method
570
- * @name luno#fetchTicker
571
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
572
- * @param {string} symbol unified symbol of the market to fetch the ticker for
573
- * @param {object} [params] extra parameters specific to the exchange API endpoint
574
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
575
- */
576
- await this.loadMarkets();
577
- const market = this.market(symbol);
578
- const request = {
579
- 'pair': market['id'],
580
- };
581
- const response = await this.publicGetTicker(this.extend(request, params));
582
- // {
583
- // "pair":"XBTAUD",
584
- // "timestamp":1642201439301,
585
- // "bid":"59972.30000000",
586
- // "ask":"59997.99000000",
587
- // "last_trade":"59997.99000000",
588
- // "rolling_24_hour_volume":"1.89510000",
589
- // "status":"ACTIVE"
590
- // }
591
- return this.parseTicker(response, market);
592
- }
593
- parseTrade(trade, market = undefined) {
594
- //
595
- // fetchTrades (public)
596
- //
597
- // {
598
- // "sequence":276989,
599
- // "timestamp":1648651276949,
600
- // "price":"35773.20000000",
601
- // "volume":"0.00300000",
602
- // "is_buy":false
603
- // }
604
- //
605
- // fetchMyTrades (private)
606
- //
607
- // {
608
- // "pair":"LTCXBT",
609
- // "sequence":3256813,
610
- // "order_id":"BXEX6XHHDT5EGW2",
611
- // "type":"ASK",
612
- // "timestamp":1648652135235,
613
- // "price":"0.002786",
614
- // "volume":"0.10",
615
- // "base":"0.10",
616
- // "counter":"0.0002786",
617
- // "fee_base":"0.0001",
618
- // "fee_counter":"0.00",
619
- // "is_buy":false,
620
- // "client_order_id":""
621
- // }
622
- //
623
- // For public trade data (is_buy === True) indicates 'buy' side but for private trade data
624
- // is_buy indicates maker or taker. The value of "type" (ASK/BID) indicate sell/buy side.
625
- // Private trade data includes ID field which public trade data does not.
626
- const orderId = this.safeString(trade, 'order_id');
627
- const id = this.safeString(trade, 'sequence');
628
- let takerOrMaker = undefined;
629
- let side = undefined;
630
- if (orderId !== undefined) {
631
- const type = this.safeString(trade, 'type');
632
- if ((type === 'ASK') || (type === 'SELL')) {
633
- side = 'sell';
634
- }
635
- else if ((type === 'BID') || (type === 'BUY')) {
636
- side = 'buy';
637
- }
638
- if (side === 'sell' && trade['is_buy']) {
639
- takerOrMaker = 'maker';
640
- }
641
- else if (side === 'buy' && !trade['is_buy']) {
642
- takerOrMaker = 'maker';
643
- }
644
- else {
645
- takerOrMaker = 'taker';
646
- }
647
- }
648
- else {
649
- side = trade['is_buy'] ? 'buy' : 'sell';
650
- }
651
- const feeBaseString = this.safeString(trade, 'fee_base');
652
- const feeCounterString = this.safeString(trade, 'fee_counter');
653
- let feeCurrency = undefined;
654
- let feeCost = undefined;
655
- if (feeBaseString !== undefined) {
656
- if (!Precise["default"].stringEquals(feeBaseString, '0.0')) {
657
- feeCurrency = market['base'];
658
- feeCost = feeBaseString;
659
- }
660
- }
661
- else if (feeCounterString !== undefined) {
662
- if (!Precise["default"].stringEquals(feeCounterString, '0.0')) {
663
- feeCurrency = market['quote'];
664
- feeCost = feeCounterString;
665
- }
666
- }
667
- const timestamp = this.safeInteger(trade, 'timestamp');
668
- return this.safeTrade({
669
- 'info': trade,
670
- 'id': id,
671
- 'timestamp': timestamp,
672
- 'datetime': this.iso8601(timestamp),
673
- 'symbol': market['symbol'],
674
- 'order': orderId,
675
- 'type': undefined,
676
- 'side': side,
677
- 'takerOrMaker': takerOrMaker,
678
- 'price': this.safeString(trade, 'price'),
679
- 'amount': this.safeString2(trade, 'volume', 'base'),
680
- // Does not include potential fee costs
681
- 'cost': this.safeString(trade, 'counter'),
682
- 'fee': {
683
- 'cost': feeCost,
684
- 'currency': feeCurrency,
685
- },
686
- }, market);
687
- }
688
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
689
- /**
690
- * @method
691
- * @name luno#fetchTrades
692
- * @description get the list of most recent trades for a particular symbol
693
- * @param {string} symbol unified symbol of the market to fetch trades for
694
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
695
- * @param {int} [limit] the maximum amount of trades to fetch
696
- * @param {object} [params] extra parameters specific to the exchange API endpoint
697
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
698
- */
699
- await this.loadMarkets();
700
- const market = this.market(symbol);
701
- const request = {
702
- 'pair': market['id'],
703
- };
704
- if (since !== undefined) {
705
- request['since'] = since;
706
- }
707
- const response = await this.publicGetTrades(this.extend(request, params));
708
- //
709
- // {
710
- // "trades":[
711
- // {
712
- // "sequence":276989,
713
- // "timestamp":1648651276949,
714
- // "price":"35773.20000000",
715
- // "volume":"0.00300000",
716
- // "is_buy":false
717
- // },...
718
- // ]
719
- // }
720
- //
721
- const trades = this.safeValue(response, 'trades', []);
722
- return this.parseTrades(trades, market, since, limit);
723
- }
724
- async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
725
- /**
726
- * @method
727
- * @name luno#fetchMyTrades
728
- * @description fetch all trades made by the user
729
- * @param {string} symbol unified market symbol
730
- * @param {int} [since] the earliest time in ms to fetch trades for
731
- * @param {int} [limit] the maximum number of trades structures to retrieve
732
- * @param {object} [params] extra parameters specific to the exchange API endpoint
733
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
734
- */
735
- if (symbol === undefined) {
736
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
737
- }
738
- await this.loadMarkets();
739
- const market = this.market(symbol);
740
- const request = {
741
- 'pair': market['id'],
742
- };
743
- if (since !== undefined) {
744
- request['since'] = since;
745
- }
746
- if (limit !== undefined) {
747
- request['limit'] = limit;
748
- }
749
- const response = await this.privateGetListtrades(this.extend(request, params));
750
- //
751
- // {
752
- // "trades":[
753
- // {
754
- // "pair":"LTCXBT",
755
- // "sequence":3256813,
756
- // "order_id":"BXEX6XHHDT5EGW2",
757
- // "type":"ASK",
758
- // "timestamp":1648652135235,
759
- // "price":"0.002786",
760
- // "volume":"0.10",
761
- // "base":"0.10",
762
- // "counter":"0.0002786",
763
- // "fee_base":"0.0001",
764
- // "fee_counter":"0.00",
765
- // "is_buy":false,
766
- // "client_order_id":""
767
- // },...
768
- // ]
769
- // }
770
- //
771
- const trades = this.safeValue(response, 'trades', []);
772
- return this.parseTrades(trades, market, since, limit);
773
- }
774
- async fetchTradingFee(symbol, params = {}) {
775
- /**
776
- * @method
777
- * @name luno#fetchTradingFee
778
- * @description fetch the trading fees for a market
779
- * @param {string} symbol unified market symbol
780
- * @param {object} [params] extra parameters specific to the exchange API endpoint
781
- * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
782
- */
783
- await this.loadMarkets();
784
- const market = this.market(symbol);
785
- const request = {
786
- 'pair': market['id'],
787
- };
788
- const response = await this.privateGetFeeInfo(this.extend(request, params));
789
- //
790
- // {
791
- // "maker_fee": "0.00250000",
792
- // "taker_fee": "0.00500000",
793
- // "thirty_day_volume": "0"
794
- // }
795
- //
796
- return {
797
- 'info': response,
798
- 'symbol': symbol,
799
- 'maker': this.safeNumber(response, 'maker_fee'),
800
- 'taker': this.safeNumber(response, 'taker_fee'),
801
- };
802
- }
803
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
804
- /**
805
- * @method
806
- * @name luno#createOrder
807
- * @description create a trade order
808
- * @param {string} symbol unified symbol of the market to create an order in
809
- * @param {string} type 'market' or 'limit'
810
- * @param {string} side 'buy' or 'sell'
811
- * @param {float} amount how much of currency you want to trade in units of base currency
812
- * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
813
- * @param {object} [params] extra parameters specific to the exchange API endpoint
814
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
815
- */
816
- await this.loadMarkets();
817
- const market = this.market(symbol);
818
- const request = {
819
- 'pair': market['id'],
820
- };
821
- let response = undefined;
822
- if (type === 'market') {
823
- request['type'] = side.toUpperCase();
824
- // todo add createMarketBuyOrderRequires price logic as it is implemented in the other exchanges
825
- if (side === 'buy') {
826
- request['counter_volume'] = this.amountToPrecision(market['symbol'], amount);
827
- }
828
- else {
829
- request['base_volume'] = this.amountToPrecision(market['symbol'], amount);
830
- }
831
- response = await this.privatePostMarketorder(this.extend(request, params));
832
- }
833
- else {
834
- request['volume'] = this.amountToPrecision(market['symbol'], amount);
835
- request['price'] = this.priceToPrecision(market['symbol'], price);
836
- request['type'] = (side === 'buy') ? 'BID' : 'ASK';
837
- response = await this.privatePostPostorder(this.extend(request, params));
838
- }
839
- return this.safeOrder({
840
- 'info': response,
841
- 'id': response['order_id'],
842
- }, market);
843
- }
844
- async cancelOrder(id, symbol = undefined, params = {}) {
845
- /**
846
- * @method
847
- * @name luno#cancelOrder
848
- * @description cancels an open order
849
- * @param {string} id order id
850
- * @param {string} symbol unified symbol of the market the order was made in
851
- * @param {object} [params] extra parameters specific to the exchange API endpoint
852
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
853
- */
854
- await this.loadMarkets();
855
- const request = {
856
- 'order_id': id,
857
- };
858
- return await this.privatePostStoporder(this.extend(request, params));
859
- }
860
- async fetchLedgerByEntries(code = undefined, entry = undefined, limit = undefined, params = {}) {
861
- // by default without entry number or limit number, return most recent entry
862
- if (entry === undefined) {
863
- entry = -1;
864
- }
865
- if (limit === undefined) {
866
- limit = 1;
867
- }
868
- const since = undefined;
869
- const request = {
870
- 'min_row': entry,
871
- 'max_row': this.sum(entry, limit),
872
- };
873
- return await this.fetchLedger(code, since, limit, this.extend(request, params));
874
- }
875
- async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
876
- /**
877
- * @method
878
- * @name luno#fetchLedger
879
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
880
- * @param {string} code unified currency code, default is undefined
881
- * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
882
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
883
- * @param {object} [params] extra parameters specific to the exchange API endpoint
884
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
885
- */
886
- await this.loadMarkets();
887
- await this.loadAccounts();
888
- let currency = undefined;
889
- let id = this.safeString(params, 'id'); // account id
890
- let min_row = this.safeValue(params, 'min_row');
891
- let max_row = this.safeValue(params, 'max_row');
892
- if (id === undefined) {
893
- if (code === undefined) {
894
- throw new errors.ArgumentsRequired(this.id + ' fetchLedger() requires a currency code argument if no account id specified in params');
895
- }
896
- currency = this.currency(code);
897
- const accountsByCurrencyCode = this.indexBy(this.accounts, 'currency');
898
- const account = this.safeValue(accountsByCurrencyCode, code);
899
- if (account === undefined) {
900
- throw new errors.ExchangeError(this.id + ' fetchLedger() could not find account id for ' + code);
901
- }
902
- id = account['id'];
903
- }
904
- if (min_row === undefined && max_row === undefined) {
905
- max_row = 0; // Default to most recent transactions
906
- min_row = -1000; // Maximum number of records supported
907
- }
908
- else if (min_row === undefined || max_row === undefined) {
909
- throw new errors.ExchangeError(this.id + " fetchLedger() require both params 'max_row' and 'min_row' or neither to be defined");
910
- }
911
- if (limit !== undefined && max_row - min_row > limit) {
912
- if (max_row <= 0) {
913
- min_row = max_row - limit;
914
- }
915
- else if (min_row > 0) {
916
- max_row = min_row + limit;
917
- }
918
- }
919
- if (max_row - min_row > 1000) {
920
- throw new errors.ExchangeError(this.id + " fetchLedger() requires the params 'max_row' - 'min_row' <= 1000");
921
- }
922
- const request = {
923
- 'id': id,
924
- 'min_row': min_row,
925
- 'max_row': max_row,
926
- };
927
- const response = await this.privateGetAccountsIdTransactions(this.extend(params, request));
928
- const entries = this.safeValue(response, 'transactions', []);
929
- return this.parseLedger(entries, currency, since, limit);
930
- }
931
- parseLedgerComment(comment) {
932
- const words = comment.split(' ');
933
- const types = {
934
- 'Withdrawal': 'fee',
935
- 'Trading': 'fee',
936
- 'Payment': 'transaction',
937
- 'Sent': 'transaction',
938
- 'Deposit': 'transaction',
939
- 'Received': 'transaction',
940
- 'Released': 'released',
941
- 'Reserved': 'reserved',
942
- 'Sold': 'trade',
943
- 'Bought': 'trade',
944
- 'Failure': 'failed',
945
- };
946
- let referenceId = undefined;
947
- const firstWord = this.safeString(words, 0);
948
- const thirdWord = this.safeString(words, 2);
949
- const fourthWord = this.safeString(words, 3);
950
- let type = this.safeString(types, firstWord, undefined);
951
- if ((type === undefined) && (thirdWord === 'fee')) {
952
- type = 'fee';
953
- }
954
- if ((type === 'reserved') && (fourthWord === 'order')) {
955
- referenceId = this.safeString(words, 4);
956
- }
957
- return {
958
- 'type': type,
959
- 'referenceId': referenceId,
960
- };
961
- }
962
- parseLedgerEntry(entry, currency = undefined) {
963
- // const details = this.safeValue (entry, 'details', {});
964
- const id = this.safeString(entry, 'row_index');
965
- const account_id = this.safeString(entry, 'account_id');
966
- const timestamp = this.safeInteger(entry, 'timestamp');
967
- const currencyId = this.safeString(entry, 'currency');
968
- const code = this.safeCurrencyCode(currencyId, currency);
969
- const available_delta = this.safeString(entry, 'available_delta');
970
- const balance_delta = this.safeString(entry, 'balance_delta');
971
- const after = this.safeString(entry, 'balance');
972
- const comment = this.safeString(entry, 'description');
973
- let before = after;
974
- let amount = '0.0';
975
- const result = this.parseLedgerComment(comment);
976
- const type = result['type'];
977
- const referenceId = result['referenceId'];
978
- let direction = undefined;
979
- let status = undefined;
980
- if (!Precise["default"].stringEquals(balance_delta, '0.0')) {
981
- before = Precise["default"].stringSub(after, balance_delta);
982
- status = 'ok';
983
- amount = Precise["default"].stringAbs(balance_delta);
984
- }
985
- else if (Precise["default"].stringLt(available_delta, '0.0')) {
986
- status = 'pending';
987
- amount = Precise["default"].stringAbs(available_delta);
988
- }
989
- else if (Precise["default"].stringGt(available_delta, '0.0')) {
990
- status = 'canceled';
991
- amount = Precise["default"].stringAbs(available_delta);
992
- }
993
- if (Precise["default"].stringGt(balance_delta, '0') || Precise["default"].stringGt(available_delta, '0')) {
994
- direction = 'in';
995
- }
996
- else if (Precise["default"].stringLt(balance_delta, '0') || Precise["default"].stringLt(available_delta, '0')) {
997
- direction = 'out';
998
- }
999
- return {
1000
- 'id': id,
1001
- 'direction': direction,
1002
- 'account': account_id,
1003
- 'referenceId': referenceId,
1004
- 'referenceAccount': undefined,
1005
- 'type': type,
1006
- 'currency': code,
1007
- 'amount': this.parseNumber(amount),
1008
- 'timestamp': timestamp,
1009
- 'datetime': this.iso8601(timestamp),
1010
- 'before': this.parseNumber(before),
1011
- 'after': this.parseNumber(after),
1012
- 'status': status,
1013
- 'fee': undefined,
1014
- 'info': entry,
1015
- };
1016
- }
1017
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1018
- let url = this.urls['api'][api] + '/' + this.version + '/' + this.implodeParams(path, params);
1019
- const query = this.omit(params, this.extractParams(path));
1020
- if (Object.keys(query).length) {
1021
- url += '?' + this.urlencode(query);
1022
- }
1023
- if (api === 'private') {
1024
- this.checkRequiredCredentials();
1025
- const auth = this.stringToBase64(this.apiKey + ':' + this.secret);
1026
- headers = {
1027
- 'Authorization': 'Basic ' + auth,
1028
- };
1029
- }
1030
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1031
- }
1032
- handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1033
- if (response === undefined) {
1034
- return undefined;
1035
- }
1036
- const error = this.safeValue(response, 'error');
1037
- if (error !== undefined) {
1038
- throw new errors.ExchangeError(this.id + ' ' + this.json(response));
1039
- }
1040
- return undefined;
1041
- }
1042
- }
1043
-
1044
- module.exports = luno;