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,1867 +0,0 @@
1
- 'use strict';
2
-
3
- var probit$1 = require('./abstract/probit.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 probit
12
- * @augments Exchange
13
- */
14
- class probit extends probit$1 {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'probit',
18
- 'name': 'ProBit',
19
- 'countries': ['SC', 'KR'],
20
- 'rateLimit': 50,
21
- 'pro': true,
22
- 'has': {
23
- 'CORS': true,
24
- 'spot': true,
25
- 'margin': false,
26
- 'swap': false,
27
- 'future': false,
28
- 'option': false,
29
- 'addMargin': false,
30
- 'cancelOrder': true,
31
- 'createMarketBuyOrderWithCost': true,
32
- 'createMarketOrder': true,
33
- 'createMarketOrderWithCost': false,
34
- 'createMarketSellOrderWithCost': false,
35
- 'createOrder': true,
36
- 'createReduceOnlyOrder': false,
37
- 'createStopLimitOrder': false,
38
- 'createStopMarketOrder': false,
39
- 'createStopOrder': false,
40
- 'fetchBalance': true,
41
- 'fetchBorrowRateHistories': false,
42
- 'fetchBorrowRateHistory': false,
43
- 'fetchClosedOrders': true,
44
- 'fetchCrossBorrowRate': false,
45
- 'fetchCrossBorrowRates': false,
46
- 'fetchCurrencies': true,
47
- 'fetchDepositAddress': true,
48
- 'fetchDepositAddresses': true,
49
- 'fetchDeposits': true,
50
- 'fetchDepositsWithdrawals': true,
51
- 'fetchFundingHistory': false,
52
- 'fetchFundingRate': false,
53
- 'fetchFundingRateHistory': false,
54
- 'fetchFundingRates': false,
55
- 'fetchIndexOHLCV': false,
56
- 'fetchIsolatedBorrowRate': false,
57
- 'fetchIsolatedBorrowRates': false,
58
- 'fetchLeverage': false,
59
- 'fetchLeverageTiers': false,
60
- 'fetchMarginMode': false,
61
- 'fetchMarkets': true,
62
- 'fetchMarkOHLCV': false,
63
- 'fetchMyTrades': true,
64
- 'fetchOHLCV': true,
65
- 'fetchOpenInterestHistory': false,
66
- 'fetchOpenOrders': true,
67
- 'fetchOrder': true,
68
- 'fetchOrderBook': true,
69
- 'fetchPosition': false,
70
- 'fetchPositionMode': false,
71
- 'fetchPositions': false,
72
- 'fetchPositionsRisk': false,
73
- 'fetchPremiumIndexOHLCV': false,
74
- 'fetchTicker': true,
75
- 'fetchTickers': true,
76
- 'fetchTime': true,
77
- 'fetchTrades': true,
78
- 'fetchTradingFee': false,
79
- 'fetchTradingFees': false,
80
- 'fetchTransactions': 'emulated',
81
- 'fetchTransfer': false,
82
- 'fetchTransfers': false,
83
- 'fetchWithdrawal': false,
84
- 'fetchWithdrawals': true,
85
- 'reduceMargin': false,
86
- 'setLeverage': false,
87
- 'setMarginMode': false,
88
- 'setPositionMode': false,
89
- 'signIn': true,
90
- 'transfer': false,
91
- 'withdraw': true,
92
- },
93
- 'timeframes': {
94
- '1m': '1m',
95
- '3m': '3m',
96
- '5m': '5m',
97
- '10m': '10m',
98
- '15m': '15m',
99
- '30m': '30m',
100
- '1h': '1h',
101
- '4h': '4h',
102
- '6h': '6h',
103
- '12h': '12h',
104
- '1d': '1D',
105
- '1w': '1W',
106
- '1M': '1M',
107
- },
108
- 'version': 'v1',
109
- 'urls': {
110
- 'logo': 'https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg',
111
- 'api': {
112
- 'accounts': 'https://accounts.probit.com',
113
- 'public': 'https://api.probit.com/api/exchange',
114
- 'private': 'https://api.probit.com/api/exchange',
115
- },
116
- 'www': 'https://www.probit.com',
117
- 'doc': [
118
- 'https://docs-en.probit.com',
119
- 'https://docs-ko.probit.com',
120
- ],
121
- 'fees': 'https://support.probit.com/hc/en-us/articles/360020968611-Trading-Fees',
122
- 'referral': 'https://www.probit.com/r/34608773',
123
- },
124
- 'api': {
125
- 'public': {
126
- 'get': {
127
- 'market': 1,
128
- 'currency': 1,
129
- 'currency_with_platform': 1,
130
- 'time': 1,
131
- 'ticker': 1,
132
- 'order_book': 1,
133
- 'trade': 1,
134
- 'candle': 1,
135
- },
136
- },
137
- 'private': {
138
- 'post': {
139
- 'new_order': 2,
140
- 'cancel_order': 1,
141
- 'withdrawal': 2,
142
- },
143
- 'get': {
144
- 'balance': 1,
145
- 'order': 1,
146
- 'open_order': 1,
147
- 'order_history': 1,
148
- 'trade_history': 1,
149
- 'deposit_address': 1,
150
- 'transfer/payment': 1,
151
- },
152
- },
153
- 'accounts': {
154
- 'post': {
155
- 'token': 1,
156
- },
157
- },
158
- },
159
- 'fees': {
160
- 'trading': {
161
- 'tierBased': false,
162
- 'percentage': true,
163
- 'maker': this.parseNumber('0.002'),
164
- 'taker': this.parseNumber('0.002'),
165
- },
166
- },
167
- 'exceptions': {
168
- 'exact': {
169
- 'UNAUTHORIZED': errors.AuthenticationError,
170
- 'INVALID_ARGUMENT': errors.BadRequest,
171
- 'TRADING_UNAVAILABLE': errors.ExchangeNotAvailable,
172
- 'NOT_ENOUGH_BALANCE': errors.InsufficientFunds,
173
- 'NOT_ALLOWED_COMBINATION': errors.BadRequest,
174
- 'INVALID_ORDER': errors.InvalidOrder,
175
- 'RATE_LIMIT_EXCEEDED': errors.RateLimitExceeded,
176
- 'MARKET_UNAVAILABLE': errors.ExchangeNotAvailable,
177
- 'INVALID_MARKET': errors.BadSymbol,
178
- 'MARKET_CLOSED': errors.BadSymbol,
179
- 'MARKET_NOT_FOUND': errors.BadSymbol,
180
- 'INVALID_CURRENCY': errors.BadRequest,
181
- 'TOO_MANY_OPEN_ORDERS': errors.DDoSProtection,
182
- 'DUPLICATE_ADDRESS': errors.InvalidAddress,
183
- 'invalid_grant': errors.AuthenticationError, // {"error":"invalid_grant"}
184
- },
185
- },
186
- 'requiredCredentials': {
187
- 'apiKey': true,
188
- 'secret': true,
189
- },
190
- 'precisionMode': number.TICK_SIZE,
191
- 'options': {
192
- 'createMarketBuyOrderRequiresPrice': true,
193
- 'timeInForce': {
194
- 'limit': 'gtc',
195
- 'market': 'ioc',
196
- },
197
- 'networks': {
198
- 'BEP20': 'BSC',
199
- 'ERC20': 'ETH',
200
- 'TRC20': 'TRON',
201
- },
202
- },
203
- 'commonCurrencies': {
204
- 'AUTO': 'Cube',
205
- 'AZU': 'Azultec',
206
- 'BCC': 'BCC',
207
- 'BDP': 'BidiPass',
208
- 'BIRD': 'Birdchain',
209
- 'BTCBEAR': 'BEAR',
210
- 'BTCBULL': 'BULL',
211
- 'CBC': 'CryptoBharatCoin',
212
- 'CHE': 'Chellit',
213
- 'CLR': 'Color Platform',
214
- 'CTK': 'Cryptyk',
215
- 'CTT': 'Castweet',
216
- 'DIP': 'Dipper',
217
- 'DKT': 'DAKOTA',
218
- 'EGC': 'EcoG9coin',
219
- 'EPS': 'Epanus',
220
- 'FX': 'Fanzy',
221
- 'GDT': 'Gorilla Diamond',
222
- 'GM': 'GM Holding',
223
- 'GOGOL': 'GOL',
224
- 'GOL': 'Goldofir',
225
- 'GRB': 'Global Reward Bank',
226
- 'HBC': 'Hybrid Bank Cash',
227
- 'HUSL': 'The Hustle App',
228
- 'LAND': 'Landbox',
229
- 'LBK': 'Legal Block',
230
- 'ORC': 'Oracle System',
231
- 'PXP': 'PIXSHOP COIN',
232
- 'PYE': 'CreamPYE',
233
- 'ROOK': 'Reckoon',
234
- 'SOC': 'Soda Coin',
235
- 'SST': 'SocialSwap',
236
- 'TCT': 'Top Coin Token',
237
- 'TOR': 'Torex',
238
- 'TPAY': 'Tetra Pay',
239
- 'UNI': 'UNICORN Token',
240
- 'UNISWAP': 'UNI',
241
- },
242
- });
243
- }
244
- async fetchMarkets(params = {}) {
245
- /**
246
- * @method
247
- * @name probit#fetchMarkets
248
- * @see https://docs-en.probit.com/reference/market
249
- * @description retrieves data on all markets for probit
250
- * @param {object} [params] extra parameters specific to the exchange API endpoint
251
- * @returns {object[]} an array of objects representing market data
252
- */
253
- const response = await this.publicGetMarket(params);
254
- //
255
- // {
256
- // "data":[
257
- // {
258
- // "id":"MONA-USDT",
259
- // "base_currency_id":"MONA",
260
- // "quote_currency_id":"USDT",
261
- // "min_price":"0.001",
262
- // "max_price":"9999999999999999",
263
- // "price_increment":"0.001",
264
- // "min_quantity":"0.0001",
265
- // "max_quantity":"9999999999999999",
266
- // "quantity_precision":4,
267
- // "min_cost":"1",
268
- // "max_cost":"9999999999999999",
269
- // "cost_precision":8,
270
- // "taker_fee_rate":"0.2",
271
- // "maker_fee_rate":"0.2",
272
- // "show_in_ui":true,
273
- // "closed":false
274
- // },
275
- // ]
276
- // }
277
- //
278
- const markets = this.safeValue(response, 'data', []);
279
- return this.parseMarkets(markets);
280
- }
281
- parseMarket(market) {
282
- const id = this.safeString(market, 'id');
283
- const baseId = this.safeString(market, 'base_currency_id');
284
- const quoteId = this.safeString(market, 'quote_currency_id');
285
- const base = this.safeCurrencyCode(baseId);
286
- const quote = this.safeCurrencyCode(quoteId);
287
- const closed = this.safeValue(market, 'closed', false);
288
- const takerFeeRate = this.safeString(market, 'taker_fee_rate');
289
- const taker = Precise["default"].stringDiv(takerFeeRate, '100');
290
- const makerFeeRate = this.safeString(market, 'maker_fee_rate');
291
- const maker = Precise["default"].stringDiv(makerFeeRate, '100');
292
- return {
293
- 'id': id,
294
- 'symbol': base + '/' + quote,
295
- 'base': base,
296
- 'quote': quote,
297
- 'settle': undefined,
298
- 'baseId': baseId,
299
- 'quoteId': quoteId,
300
- 'settleId': undefined,
301
- 'type': 'spot',
302
- 'spot': true,
303
- 'margin': false,
304
- 'swap': false,
305
- 'future': false,
306
- 'option': false,
307
- 'active': !closed,
308
- 'contract': false,
309
- 'linear': undefined,
310
- 'inverse': undefined,
311
- 'taker': this.parseNumber(taker),
312
- 'maker': this.parseNumber(maker),
313
- 'contractSize': undefined,
314
- 'expiry': undefined,
315
- 'expiryDatetime': undefined,
316
- 'strike': undefined,
317
- 'optionType': undefined,
318
- 'precision': {
319
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantity_precision'))),
320
- 'price': this.safeNumber(market, 'price_increment'),
321
- 'cost': this.parseNumber(this.parsePrecision(this.safeString(market, 'cost_precision'))),
322
- },
323
- 'limits': {
324
- 'leverage': {
325
- 'min': undefined,
326
- 'max': undefined,
327
- },
328
- 'amount': {
329
- 'min': this.safeNumber(market, 'min_quantity'),
330
- 'max': this.safeNumber(market, 'max_quantity'),
331
- },
332
- 'price': {
333
- 'min': this.safeNumber(market, 'min_price'),
334
- 'max': this.safeNumber(market, 'max_price'),
335
- },
336
- 'cost': {
337
- 'min': this.safeNumber(market, 'min_cost'),
338
- 'max': this.safeNumber(market, 'max_cost'),
339
- },
340
- },
341
- 'created': undefined,
342
- 'info': market,
343
- };
344
- }
345
- async fetchCurrencies(params = {}) {
346
- /**
347
- * @method
348
- * @name probit#fetchCurrencies
349
- * @see https://docs-en.probit.com/reference/currency
350
- * @description fetches all available currencies on an exchange
351
- * @param {object} [params] extra parameters specific to the exchange API endpoint
352
- * @returns {object} an associative dictionary of currencies
353
- */
354
- const response = await this.publicGetCurrencyWithPlatform(params);
355
- //
356
- // {
357
- // "data":[
358
- // {
359
- // "id":"USDT",
360
- // "display_name":{"ko-kr":"테더","en-us":"Tether"},
361
- // "show_in_ui":true,
362
- // "platform":[
363
- // {
364
- // "id":"ETH",
365
- // "priority":1,
366
- // "deposit":true,
367
- // "withdrawal":true,
368
- // "currency_id":"USDT",
369
- // "precision":6,
370
- // "min_confirmation_count":15,
371
- // "require_destination_tag":false,
372
- // "display_name":{"name":{"ko-kr":"ERC-20","en-us":"ERC-20"}},
373
- // "min_deposit_amount":"0",
374
- // "min_withdrawal_amount":"1",
375
- // "withdrawal_fee":[
376
- // {"amount":"0.01","priority":2,"currency_id":"ETH"},
377
- // {"amount":"1.5","priority":1,"currency_id":"USDT"},
378
- // ],
379
- // "deposit_fee":{},
380
- // "suspended_reason":"",
381
- // "deposit_suspended":false,
382
- // "withdrawal_suspended":false
383
- // },
384
- // {
385
- // "id":"OMNI",
386
- // "priority":2,
387
- // "deposit":true,
388
- // "withdrawal":true,
389
- // "currency_id":"USDT",
390
- // "precision":6,
391
- // "min_confirmation_count":3,
392
- // "require_destination_tag":false,
393
- // "display_name":{"name":{"ko-kr":"OMNI","en-us":"OMNI"}},
394
- // "min_deposit_amount":"0",
395
- // "min_withdrawal_amount":"5",
396
- // "withdrawal_fee":[{"amount":"5","priority":1,"currency_id":"USDT"}],
397
- // "deposit_fee":{},
398
- // "suspended_reason":"wallet_maintenance",
399
- // "deposit_suspended":false,
400
- // "withdrawal_suspended":false
401
- // }
402
- // ],
403
- // "stakeable":false,
404
- // "unstakeable":false,
405
- // "auto_stake":false,
406
- // "auto_stake_amount":"0"
407
- // }
408
- // ]
409
- // }
410
- //
411
- const currencies = this.safeValue(response, 'data', []);
412
- const result = {};
413
- for (let i = 0; i < currencies.length; i++) {
414
- const currency = currencies[i];
415
- const id = this.safeString(currency, 'id');
416
- const code = this.safeCurrencyCode(id);
417
- const displayName = this.safeValue(currency, 'display_name');
418
- const name = this.safeString(displayName, 'en-us');
419
- const platforms = this.safeValue(currency, 'platform', []);
420
- const platformsByPriority = this.sortBy(platforms, 'priority');
421
- let platform = undefined;
422
- const networkList = {};
423
- for (let j = 0; j < platformsByPriority.length; j++) {
424
- const network = platformsByPriority[j];
425
- const networkId = this.safeString(network, 'id');
426
- const networkCode = this.networkIdToCode(networkId);
427
- const currentDepositSuspended = this.safeValue(network, 'deposit_suspended');
428
- const currentWithdrawalSuspended = this.safeValue(network, 'withdrawal_suspended');
429
- const currentDeposit = !currentDepositSuspended;
430
- const currentWithdraw = !currentWithdrawalSuspended;
431
- const currentActive = currentDeposit && currentWithdraw;
432
- if (currentActive) {
433
- platform = network;
434
- }
435
- const precision = this.parsePrecision(this.safeString(network, 'precision'));
436
- const withdrawFee = this.safeValue(network, 'withdrawal_fee', []);
437
- let networkFee = this.safeValue(withdrawFee, 0, {});
438
- for (let k = 0; k < withdrawFee.length; k++) {
439
- const withdrawPlatform = withdrawFee[k];
440
- const feeCurrencyId = this.safeString(withdrawPlatform, 'currency_id');
441
- if (feeCurrencyId === id) {
442
- networkFee = withdrawPlatform;
443
- break;
444
- }
445
- }
446
- networkList[networkCode] = {
447
- 'id': networkId,
448
- 'network': networkCode,
449
- 'active': currentActive,
450
- 'deposit': currentDeposit,
451
- 'withdraw': currentWithdraw,
452
- 'fee': this.safeNumber(networkFee, 'amount'),
453
- 'precision': this.parseNumber(precision),
454
- 'limits': {
455
- 'withdraw': {
456
- 'min': this.safeNumber(network, 'min_withdrawal_amount'),
457
- 'max': undefined,
458
- },
459
- 'deposit': {
460
- 'min': this.safeNumber(network, 'min_deposit_amount'),
461
- 'max': undefined,
462
- },
463
- },
464
- 'info': network,
465
- };
466
- }
467
- if (platform === undefined) {
468
- platform = this.safeValue(platformsByPriority, 0, {});
469
- }
470
- const depositSuspended = this.safeValue(platform, 'deposit_suspended');
471
- const withdrawalSuspended = this.safeValue(platform, 'withdrawal_suspended');
472
- const deposit = !depositSuspended;
473
- const withdraw = !withdrawalSuspended;
474
- const active = deposit && withdraw;
475
- const withdrawalFees = this.safeValue(platform, 'withdrawal_fee', {});
476
- const fees = [];
477
- // sometimes the withdrawal fee is an empty object
478
- // [ { 'amount': '0.015', 'priority': 1, 'currency_id': 'ETH' }, {} ]
479
- for (let j = 0; j < withdrawalFees.length; j++) {
480
- const withdrawalFeeInner = withdrawalFees[j];
481
- const amount = this.safeNumber(withdrawalFeeInner, 'amount');
482
- const priority = this.safeInteger(withdrawalFeeInner, 'priority');
483
- if ((amount !== undefined) && (priority !== undefined)) {
484
- fees.push(withdrawalFeeInner);
485
- }
486
- }
487
- const withdrawalFeesByPriority = this.sortBy(fees, 'priority');
488
- const withdrawalFee = this.safeValue(withdrawalFeesByPriority, 0, {});
489
- const fee = this.safeNumber(withdrawalFee, 'amount');
490
- result[code] = {
491
- 'id': id,
492
- 'code': code,
493
- 'info': currency,
494
- 'name': name,
495
- 'active': active,
496
- 'deposit': deposit,
497
- 'withdraw': withdraw,
498
- 'fee': fee,
499
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(platform, 'precision'))),
500
- 'limits': {
501
- 'amount': {
502
- 'min': undefined,
503
- 'max': undefined,
504
- },
505
- 'deposit': {
506
- 'min': this.safeNumber(platform, 'min_deposit_amount'),
507
- 'max': undefined,
508
- },
509
- 'withdraw': {
510
- 'min': this.safeNumber(platform, 'min_withdrawal_amount'),
511
- 'max': undefined,
512
- },
513
- },
514
- 'networks': networkList,
515
- };
516
- }
517
- return result;
518
- }
519
- parseBalance(response) {
520
- const result = {
521
- 'info': response,
522
- 'timestamp': undefined,
523
- 'datetime': undefined,
524
- };
525
- const data = this.safeValue(response, 'data', []);
526
- for (let i = 0; i < data.length; i++) {
527
- const balance = data[i];
528
- const currencyId = this.safeString(balance, 'currency_id');
529
- const code = this.safeCurrencyCode(currencyId);
530
- const account = this.account();
531
- account['total'] = this.safeString(balance, 'total');
532
- account['free'] = this.safeString(balance, 'available');
533
- result[code] = account;
534
- }
535
- return this.safeBalance(result);
536
- }
537
- async fetchBalance(params = {}) {
538
- /**
539
- * @method
540
- * @name probit#fetchBalance
541
- * @see https://docs-en.probit.com/reference/balance
542
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
543
- * @param {object} [params] extra parameters specific to the exchange API endpoint
544
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
545
- */
546
- await this.loadMarkets();
547
- const response = await this.privateGetBalance(params);
548
- //
549
- // {
550
- // "data": [
551
- // {
552
- // "currency_id":"XRP",
553
- // "total":"100",
554
- // "available":"0",
555
- // }
556
- // ]
557
- // }
558
- //
559
- return this.parseBalance(response);
560
- }
561
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
562
- /**
563
- * @method
564
- * @name probit#fetchOrderBook
565
- * @see https://docs-en.probit.com/reference/order_book
566
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
567
- * @param {string} symbol unified symbol of the market to fetch the order book for
568
- * @param {int} [limit] the maximum amount of order book entries to return
569
- * @param {object} [params] extra parameters specific to the exchange API endpoint
570
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
571
- */
572
- await this.loadMarkets();
573
- const market = this.market(symbol);
574
- const request = {
575
- 'market_id': market['id'],
576
- };
577
- const response = await this.publicGetOrderBook(this.extend(request, params));
578
- //
579
- // {
580
- // data: [
581
- // { side: 'buy', price: '0.000031', quantity: '10' },
582
- // { side: 'buy', price: '0.00356007', quantity: '4.92156877' },
583
- // { side: 'sell', price: '0.1857', quantity: '0.17' },
584
- // ]
585
- // }
586
- //
587
- const data = this.safeValue(response, 'data', []);
588
- const dataBySide = this.groupBy(data, 'side');
589
- return this.parseOrderBook(dataBySide, market['symbol'], undefined, 'buy', 'sell', 'price', 'quantity');
590
- }
591
- async fetchTickers(symbols = undefined, params = {}) {
592
- /**
593
- * @method
594
- * @name probit#fetchTickers
595
- * @see https://docs-en.probit.com/reference/ticker
596
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
597
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
598
- * @param {object} [params] extra parameters specific to the exchange API endpoint
599
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
600
- */
601
- await this.loadMarkets();
602
- const request = {};
603
- if (symbols !== undefined) {
604
- const marketIds = this.marketIds(symbols);
605
- request['market_ids'] = marketIds.join(',');
606
- }
607
- const response = await this.publicGetTicker(this.extend(request, params));
608
- //
609
- // {
610
- // "data":[
611
- // {
612
- // "last":"0.022902",
613
- // "low":"0.021693",
614
- // "high":"0.024093",
615
- // "change":"-0.000047",
616
- // "base_volume":"15681.986",
617
- // "quote_volume":"360.514403624",
618
- // "market_id":"ETH-BTC",
619
- // "time":"2020-04-12T18:43:38.000Z"
620
- // }
621
- // ]
622
- // }
623
- //
624
- const data = this.safeValue(response, 'data', []);
625
- return this.parseTickers(data, symbols);
626
- }
627
- async fetchTicker(symbol, params = {}) {
628
- /**
629
- * @method
630
- * @name probit#fetchTicker
631
- * @see https://docs-en.probit.com/reference/ticker
632
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
633
- * @param {string} symbol unified symbol of the market to fetch the ticker for
634
- * @param {object} [params] extra parameters specific to the exchange API endpoint
635
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
636
- */
637
- await this.loadMarkets();
638
- const market = this.market(symbol);
639
- const request = {
640
- 'market_ids': market['id'],
641
- };
642
- const response = await this.publicGetTicker(this.extend(request, params));
643
- //
644
- // {
645
- // "data":[
646
- // {
647
- // "last":"0.022902",
648
- // "low":"0.021693",
649
- // "high":"0.024093",
650
- // "change":"-0.000047",
651
- // "base_volume":"15681.986",
652
- // "quote_volume":"360.514403624",
653
- // "market_id":"ETH-BTC",
654
- // "time":"2020-04-12T18:43:38.000Z"
655
- // }
656
- // ]
657
- // }
658
- //
659
- const data = this.safeValue(response, 'data', []);
660
- const ticker = this.safeValue(data, 0);
661
- if (ticker === undefined) {
662
- throw new errors.BadResponse(this.id + ' fetchTicker() returned an empty response');
663
- }
664
- return this.parseTicker(ticker, market);
665
- }
666
- parseTicker(ticker, market = undefined) {
667
- //
668
- // {
669
- // "last":"0.022902",
670
- // "low":"0.021693",
671
- // "high":"0.024093",
672
- // "change":"-0.000047",
673
- // "base_volume":"15681.986",
674
- // "quote_volume":"360.514403624",
675
- // "market_id":"ETH-BTC",
676
- // "time":"2020-04-12T18:43:38.000Z"
677
- // }
678
- //
679
- const timestamp = this.parse8601(this.safeString(ticker, 'time'));
680
- const marketId = this.safeString(ticker, 'market_id');
681
- const symbol = this.safeSymbol(marketId, market, '-');
682
- const close = this.safeString(ticker, 'last');
683
- const change = this.safeString(ticker, 'change');
684
- const baseVolume = this.safeString(ticker, 'base_volume');
685
- const quoteVolume = this.safeString(ticker, 'quote_volume');
686
- return this.safeTicker({
687
- 'symbol': symbol,
688
- 'timestamp': timestamp,
689
- 'datetime': this.iso8601(timestamp),
690
- 'high': this.safeString(ticker, 'high'),
691
- 'low': this.safeString(ticker, 'low'),
692
- 'bid': undefined,
693
- 'bidVolume': undefined,
694
- 'ask': undefined,
695
- 'askVolume': undefined,
696
- 'vwap': undefined,
697
- 'open': undefined,
698
- 'close': close,
699
- 'last': close,
700
- 'previousClose': undefined,
701
- 'change': change,
702
- 'percentage': undefined,
703
- 'average': undefined,
704
- 'baseVolume': baseVolume,
705
- 'quoteVolume': quoteVolume,
706
- 'info': ticker,
707
- }, market);
708
- }
709
- async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
710
- /**
711
- * @method
712
- * @name probit#fetchMyTrades
713
- * @see https://docs-en.probit.com/reference/trade
714
- * @description fetch all trades made by the user
715
- * @param {string} symbol unified market symbol
716
- * @param {int} [since] the earliest time in ms to fetch trades for
717
- * @param {int} [limit] the maximum number of trades structures to retrieve
718
- * @param {object} [params] extra parameters specific to the exchange API endpoint
719
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
720
- */
721
- await this.loadMarkets();
722
- let market = undefined;
723
- const now = this.milliseconds();
724
- const request = {
725
- 'limit': 100,
726
- 'start_time': this.iso8601(now - 31536000000),
727
- 'end_time': this.iso8601(now),
728
- };
729
- if (symbol !== undefined) {
730
- market = this.market(symbol);
731
- request['market_id'] = market['id'];
732
- }
733
- if (since !== undefined) {
734
- request['start_time'] = this.iso8601(since);
735
- request['end_time'] = this.iso8601(Math.min(now, since + 31536000000));
736
- }
737
- if (limit !== undefined) {
738
- request['limit'] = limit;
739
- }
740
- const response = await this.privateGetTradeHistory(this.extend(request, params));
741
- //
742
- // {
743
- // "data": [
744
- // {
745
- // "id":"BTC-USDT:183566",
746
- // "order_id":"17209376",
747
- // "side":"sell",
748
- // "fee_amount":"0.657396569175",
749
- // "fee_currency_id":"USDT",
750
- // "status":"settled",
751
- // "price":"6573.96569175",
752
- // "quantity":"0.1",
753
- // "cost":"657.396569175",
754
- // "time":"2018-08-10T06:06:46.000Z",
755
- // "market_id":"BTC-USDT"
756
- // }
757
- // ]
758
- // }
759
- //
760
- const data = this.safeValue(response, 'data', []);
761
- return this.parseTrades(data, market, since, limit);
762
- }
763
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
764
- /**
765
- * @method
766
- * @name probit#fetchTrades
767
- * @see https://docs-en.probit.com/reference/trade-1
768
- * @description get the list of most recent trades for a particular symbol
769
- * @param {string} symbol unified symbol of the market to fetch trades for
770
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
771
- * @param {int} [limit] the maximum amount of trades to fetch
772
- * @param {object} [params] extra parameters specific to the exchange API endpoint
773
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
774
- */
775
- await this.loadMarkets();
776
- const market = this.market(symbol);
777
- const request = {
778
- 'market_id': market['id'],
779
- 'start_time': '1970-01-01T00:00:00.000Z',
780
- 'end_time': this.iso8601(this.milliseconds()),
781
- };
782
- if (since !== undefined) {
783
- request['start_time'] = this.iso8601(since);
784
- }
785
- if (limit !== undefined) {
786
- request['limit'] = Math.min(limit, 1000);
787
- }
788
- else {
789
- request['limit'] = 1000; // required to set any value
790
- }
791
- const response = await this.publicGetTrade(this.extend(request, params));
792
- //
793
- // {
794
- // "data":[
795
- // {
796
- // "id":"ETH-BTC:3331886",
797
- // "price":"0.022981",
798
- // "quantity":"12.337",
799
- // "time":"2020-04-12T20:55:42.371Z",
800
- // "side":"sell",
801
- // "tick_direction":"down"
802
- // },
803
- // {
804
- // "id":"ETH-BTC:3331885",
805
- // "price":"0.022982",
806
- // "quantity":"6.472",
807
- // "time":"2020-04-12T20:55:39.652Z",
808
- // "side":"sell",
809
- // "tick_direction":"down"
810
- // }
811
- // ]
812
- // }
813
- //
814
- const data = this.safeValue(response, 'data', []);
815
- return this.parseTrades(data, market, since, limit);
816
- }
817
- parseTrade(trade, market = undefined) {
818
- //
819
- // fetchTrades (public)
820
- //
821
- // {
822
- // "id":"ETH-BTC:3331886",
823
- // "price":"0.022981",
824
- // "quantity":"12.337",
825
- // "time":"2020-04-12T20:55:42.371Z",
826
- // "side":"sell",
827
- // "tick_direction":"down"
828
- // }
829
- //
830
- // fetchMyTrades (private)
831
- //
832
- // {
833
- // "id":"BTC-USDT:183566",
834
- // "order_id":"17209376",
835
- // "side":"sell",
836
- // "fee_amount":"0.657396569175",
837
- // "fee_currency_id":"USDT",
838
- // "status":"settled",
839
- // "price":"6573.96569175",
840
- // "quantity":"0.1",
841
- // "cost":"657.396569175",
842
- // "time":"2018-08-10T06:06:46.000Z",
843
- // "market_id":"BTC-USDT"
844
- // }
845
- //
846
- const timestamp = this.parse8601(this.safeString(trade, 'time'));
847
- const id = this.safeString(trade, 'id');
848
- let marketId = undefined;
849
- if (id !== undefined) {
850
- const parts = id.split(':');
851
- marketId = this.safeString(parts, 0);
852
- }
853
- marketId = this.safeString(trade, 'market_id', marketId);
854
- const symbol = this.safeSymbol(marketId, market, '-');
855
- const side = this.safeString(trade, 'side');
856
- const priceString = this.safeString(trade, 'price');
857
- const amountString = this.safeString(trade, 'quantity');
858
- const orderId = this.safeString(trade, 'order_id');
859
- const feeCostString = this.safeString(trade, 'fee_amount');
860
- let fee = undefined;
861
- if (feeCostString !== undefined) {
862
- const feeCurrencyId = this.safeString(trade, 'fee_currency_id');
863
- const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
864
- fee = {
865
- 'cost': feeCostString,
866
- 'currency': feeCurrencyCode,
867
- };
868
- }
869
- return this.safeTrade({
870
- 'id': id,
871
- 'info': trade,
872
- 'timestamp': timestamp,
873
- 'datetime': this.iso8601(timestamp),
874
- 'symbol': symbol,
875
- 'order': orderId,
876
- 'type': undefined,
877
- 'side': side,
878
- 'takerOrMaker': undefined,
879
- 'price': priceString,
880
- 'amount': amountString,
881
- 'cost': undefined,
882
- 'fee': fee,
883
- }, market);
884
- }
885
- async fetchTime(params = {}) {
886
- /**
887
- * @method
888
- * @name probit#fetchTime
889
- * @see https://docs-en.probit.com/reference/time
890
- * @description fetches the current integer timestamp in milliseconds from the exchange server
891
- * @param {object} [params] extra parameters specific to the exchange API endpoint
892
- * @returns {int} the current integer timestamp in milliseconds from the exchange server
893
- */
894
- const response = await this.publicGetTime(params);
895
- //
896
- // { "data":"2020-04-12T18:54:25.390Z" }
897
- //
898
- const timestamp = this.parse8601(this.safeString(response, 'data'));
899
- return timestamp;
900
- }
901
- normalizeOHLCVTimestamp(timestamp, timeframe, after = false) {
902
- const duration = this.parseTimeframe(timeframe);
903
- if (timeframe === '1M') {
904
- const iso8601 = this.iso8601(timestamp);
905
- const parts = iso8601.split('-');
906
- const year = this.safeString(parts, 0);
907
- const month = this.safeInteger(parts, 1);
908
- let monthString = undefined;
909
- if (after) {
910
- monthString = this.sum(month, 1).toString();
911
- }
912
- if (month < 10) {
913
- monthString = '0' + month.toString();
914
- }
915
- return year + '-' + monthString + '-01T00:00:00.000Z';
916
- }
917
- else if (timeframe === '1w') {
918
- timestamp = this.parseToInt(timestamp / 1000);
919
- const firstSunday = 259200; // 1970-01-04T00:00:00.000Z
920
- const difference = timestamp - firstSunday;
921
- const numWeeks = Math.floor(difference / duration);
922
- let previousSunday = this.sum(firstSunday, numWeeks * duration);
923
- if (after) {
924
- previousSunday = this.sum(previousSunday, duration);
925
- }
926
- return this.iso8601(previousSunday * 1000);
927
- }
928
- else {
929
- timestamp = this.parseToInt(timestamp / 1000);
930
- timestamp = duration * this.parseToInt(timestamp / duration);
931
- if (after) {
932
- timestamp = this.sum(timestamp, duration);
933
- }
934
- return this.iso8601(timestamp * 1000);
935
- }
936
- }
937
- async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
938
- /**
939
- * @method
940
- * @name probit#fetchOHLCV
941
- * @see https://docs-en.probit.com/reference/candle
942
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
943
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
944
- * @param {string} timeframe the length of time each candle represents
945
- * @param {int} [since] timestamp in ms of the earliest candle to fetch
946
- * @param {int} [limit] the maximum amount of candles to fetch
947
- * @param {object} [params] extra parameters specific to the exchange API endpoint
948
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
949
- */
950
- await this.loadMarkets();
951
- const market = this.market(symbol);
952
- const interval = this.safeString(this.timeframes, timeframe, timeframe);
953
- limit = (limit === undefined) ? 100 : limit;
954
- let requestLimit = this.sum(limit, 1);
955
- requestLimit = Math.min(1000, requestLimit); // max 1000
956
- const request = {
957
- 'market_ids': market['id'],
958
- 'interval': interval,
959
- 'sort': 'asc',
960
- 'limit': requestLimit, // max 1000
961
- };
962
- const now = this.milliseconds();
963
- const duration = this.parseTimeframe(timeframe);
964
- let startTime = since;
965
- let endTime = now;
966
- if (since === undefined) {
967
- if (limit === undefined) {
968
- limit = requestLimit;
969
- }
970
- startTime = now - limit * duration * 1000;
971
- }
972
- else {
973
- if (limit === undefined) {
974
- endTime = now;
975
- }
976
- else {
977
- endTime = this.sum(since, this.sum(limit, 1) * duration * 1000);
978
- }
979
- }
980
- const startTimeNormalized = this.normalizeOHLCVTimestamp(startTime, timeframe);
981
- const endTimeNormalized = this.normalizeOHLCVTimestamp(endTime, timeframe, true);
982
- request['start_time'] = startTimeNormalized;
983
- request['end_time'] = endTimeNormalized;
984
- const response = await this.publicGetCandle(this.extend(request, params));
985
- //
986
- // {
987
- // "data":[
988
- // {
989
- // "market_id":"ETH-BTC",
990
- // "open":"0.02811",
991
- // "close":"0.02811",
992
- // "low":"0.02811",
993
- // "high":"0.02811",
994
- // "base_volume":"0.0005",
995
- // "quote_volume":"0.000014055",
996
- // "start_time":"2018-11-30T18:19:00.000Z",
997
- // "end_time":"2018-11-30T18:20:00.000Z"
998
- // },
999
- // ]
1000
- // }
1001
- //
1002
- const data = this.safeValue(response, 'data', []);
1003
- return this.parseOHLCVs(data, market, timeframe, since, limit);
1004
- }
1005
- parseOHLCV(ohlcv, market = undefined) {
1006
- //
1007
- // {
1008
- // "market_id":"ETH-BTC",
1009
- // "open":"0.02811",
1010
- // "close":"0.02811",
1011
- // "low":"0.02811",
1012
- // "high":"0.02811",
1013
- // "base_volume":"0.0005",
1014
- // "quote_volume":"0.000014055",
1015
- // "start_time":"2018-11-30T18:19:00.000Z",
1016
- // "end_time":"2018-11-30T18:20:00.000Z"
1017
- // }
1018
- //
1019
- return [
1020
- this.parse8601(this.safeString(ohlcv, 'start_time')),
1021
- this.safeNumber(ohlcv, 'open'),
1022
- this.safeNumber(ohlcv, 'high'),
1023
- this.safeNumber(ohlcv, 'low'),
1024
- this.safeNumber(ohlcv, 'close'),
1025
- this.safeNumber(ohlcv, 'base_volume'),
1026
- ];
1027
- }
1028
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1029
- /**
1030
- * @method
1031
- * @name probit#fetchOpenOrders
1032
- * @see https://docs-en.probit.com/reference/open_order-1
1033
- * @description fetch all unfilled currently open orders
1034
- * @param {string} symbol unified market symbol
1035
- * @param {int} [since] the earliest time in ms to fetch open orders for
1036
- * @param {int} [limit] the maximum number of open orders structures to retrieve
1037
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1038
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1039
- */
1040
- await this.loadMarkets();
1041
- since = this.parse8601(since);
1042
- const request = {};
1043
- let market = undefined;
1044
- if (symbol !== undefined) {
1045
- market = this.market(symbol);
1046
- request['market_id'] = market['id'];
1047
- }
1048
- const response = await this.privateGetOpenOrder(this.extend(request, params));
1049
- const data = this.safeValue(response, 'data');
1050
- return this.parseOrders(data, market, since, limit);
1051
- }
1052
- async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1053
- /**
1054
- * @method
1055
- * @name probit#fetchClosedOrders
1056
- * @see https://docs-en.probit.com/reference/order
1057
- * @description fetches information on multiple closed orders made by the user
1058
- * @param {string} symbol unified market symbol of the market orders were made in
1059
- * @param {int} [since] the earliest time in ms to fetch orders for
1060
- * @param {int} [limit] the maximum number of order structures to retrieve
1061
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1062
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1063
- */
1064
- await this.loadMarkets();
1065
- const request = {
1066
- 'start_time': this.iso8601(0),
1067
- 'end_time': this.iso8601(this.milliseconds()),
1068
- 'limit': 100,
1069
- };
1070
- let market = undefined;
1071
- if (symbol !== undefined) {
1072
- market = this.market(symbol);
1073
- request['market_id'] = market['id'];
1074
- }
1075
- if (since) {
1076
- request['start_time'] = this.iso8601(since);
1077
- }
1078
- if (limit) {
1079
- request['limit'] = limit;
1080
- }
1081
- const response = await this.privateGetOrderHistory(this.extend(request, params));
1082
- const data = this.safeValue(response, 'data');
1083
- return this.parseOrders(data, market, since, limit);
1084
- }
1085
- async fetchOrder(id, symbol = undefined, params = {}) {
1086
- /**
1087
- * @method
1088
- * @name probit#fetchOrder
1089
- * @see https://docs-en.probit.com/reference/order-3
1090
- * @description fetches information on an order made by the user
1091
- * @param {string} symbol unified symbol of the market the order was made in
1092
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1093
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1094
- */
1095
- if (symbol === undefined) {
1096
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1097
- }
1098
- await this.loadMarkets();
1099
- const market = this.market(symbol);
1100
- const request = {
1101
- 'market_id': market['id'],
1102
- };
1103
- const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
1104
- if (clientOrderId !== undefined) {
1105
- request['client_order_id'] = clientOrderId;
1106
- }
1107
- else {
1108
- request['order_id'] = id;
1109
- }
1110
- const query = this.omit(params, ['clientOrderId', 'client_order_id']);
1111
- const response = await this.privateGetOrder(this.extend(request, query));
1112
- const data = this.safeValue(response, 'data', []);
1113
- const order = this.safeValue(data, 0);
1114
- return this.parseOrder(order, market);
1115
- }
1116
- parseOrderStatus(status) {
1117
- const statuses = {
1118
- 'open': 'open',
1119
- 'cancelled': 'canceled',
1120
- 'filled': 'closed',
1121
- };
1122
- return this.safeString(statuses, status, status);
1123
- }
1124
- parseOrder(order, market = undefined) {
1125
- //
1126
- // {
1127
- // id,
1128
- // user_id,
1129
- // market_id,
1130
- // "type": "orderType",
1131
- // "side": "side",
1132
- // quantity,
1133
- // limit_price,
1134
- // "time_in_force": "timeInForce",
1135
- // filled_cost,
1136
- // filled_quantity,
1137
- // open_quantity,
1138
- // cancelled_quantity,
1139
- // "status": "orderStatus",
1140
- // "time": "date",
1141
- // client_order_id,
1142
- // }
1143
- //
1144
- const status = this.parseOrderStatus(this.safeString(order, 'status'));
1145
- const id = this.safeString(order, 'id');
1146
- const type = this.safeString(order, 'type');
1147
- const side = this.safeString(order, 'side');
1148
- const marketId = this.safeString(order, 'market_id');
1149
- const symbol = this.safeSymbol(marketId, market, '-');
1150
- const timestamp = this.parse8601(this.safeString(order, 'time'));
1151
- let price = this.safeString(order, 'limit_price');
1152
- const filled = this.safeString(order, 'filled_quantity');
1153
- let remaining = this.safeString(order, 'open_quantity');
1154
- const canceledAmount = this.safeString(order, 'cancelled_quantity');
1155
- if (canceledAmount !== undefined) {
1156
- remaining = Precise["default"].stringAdd(remaining, canceledAmount);
1157
- }
1158
- const amount = this.safeString(order, 'quantity', Precise["default"].stringAdd(filled, remaining));
1159
- const cost = this.safeString2(order, 'filled_cost', 'cost');
1160
- if (type === 'market') {
1161
- price = undefined;
1162
- }
1163
- const clientOrderId = this.safeString(order, 'client_order_id');
1164
- const timeInForce = this.safeStringUpper(order, 'time_in_force');
1165
- return this.safeOrder({
1166
- 'id': id,
1167
- 'info': order,
1168
- 'clientOrderId': clientOrderId,
1169
- 'timestamp': timestamp,
1170
- 'datetime': this.iso8601(timestamp),
1171
- 'lastTradeTimestamp': undefined,
1172
- 'symbol': symbol,
1173
- 'type': type,
1174
- 'timeInForce': timeInForce,
1175
- 'side': side,
1176
- 'status': status,
1177
- 'price': price,
1178
- 'stopPrice': undefined,
1179
- 'triggerPrice': undefined,
1180
- 'amount': amount,
1181
- 'filled': filled,
1182
- 'remaining': remaining,
1183
- 'average': undefined,
1184
- 'cost': cost,
1185
- 'fee': undefined,
1186
- 'trades': undefined,
1187
- }, market);
1188
- }
1189
- costToPrecision(symbol, cost) {
1190
- return this.decimalToPrecision(cost, number.TRUNCATE, this.markets[symbol]['precision']['cost'], this.precisionMode);
1191
- }
1192
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1193
- /**
1194
- * @method
1195
- * @name probit#createOrder
1196
- * @description create a trade order
1197
- * @see https://docs-en.probit.com/reference/order-1
1198
- * @param {string} symbol unified symbol of the market to create an order in
1199
- * @param {string} type 'market' or 'limit'
1200
- * @param {string} side 'buy' or 'sell'
1201
- * @param {float} amount how much you want to trade in units of the base currency
1202
- * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1203
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1204
- * @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount for market buy orders
1205
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1206
- */
1207
- await this.loadMarkets();
1208
- const market = this.market(symbol);
1209
- const options = this.safeValue(this.options, 'timeInForce');
1210
- const defaultTimeInForce = this.safeValue(options, type);
1211
- const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force', defaultTimeInForce);
1212
- const request = {
1213
- 'market_id': market['id'],
1214
- 'type': type,
1215
- 'side': side,
1216
- 'time_in_force': timeInForce,
1217
- };
1218
- const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
1219
- if (clientOrderId !== undefined) {
1220
- request['client_order_id'] = clientOrderId;
1221
- }
1222
- let quoteAmount = undefined;
1223
- if (type === 'limit') {
1224
- request['limit_price'] = this.priceToPrecision(symbol, price);
1225
- request['quantity'] = this.amountToPrecision(symbol, amount);
1226
- }
1227
- else if (type === 'market') {
1228
- // for market buy it requires the amount of quote currency to spend
1229
- if (side === 'buy') {
1230
- let createMarketBuyOrderRequiresPrice = true;
1231
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1232
- const cost = this.safeString(params, 'cost');
1233
- params = this.omit(params, 'cost');
1234
- if (cost !== undefined) {
1235
- quoteAmount = this.costToPrecision(symbol, cost);
1236
- }
1237
- else if (createMarketBuyOrderRequiresPrice) {
1238
- if (price === undefined) {
1239
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
1240
- }
1241
- else {
1242
- const amountString = this.numberToString(amount);
1243
- const priceString = this.numberToString(price);
1244
- const costRequest = Precise["default"].stringMul(amountString, priceString);
1245
- quoteAmount = this.costToPrecision(symbol, costRequest);
1246
- }
1247
- }
1248
- else {
1249
- quoteAmount = this.costToPrecision(symbol, amount);
1250
- }
1251
- request['cost'] = quoteAmount;
1252
- }
1253
- else {
1254
- request['quantity'] = this.amountToPrecision(symbol, amount);
1255
- }
1256
- }
1257
- const query = this.omit(params, ['timeInForce', 'time_in_force', 'clientOrderId', 'client_order_id']);
1258
- const response = await this.privatePostNewOrder(this.extend(request, query));
1259
- //
1260
- // {
1261
- // "data": {
1262
- // id,
1263
- // user_id,
1264
- // market_id,
1265
- // "type": "orderType",
1266
- // "side": "side",
1267
- // quantity,
1268
- // limit_price,
1269
- // "time_in_force": "timeInForce",
1270
- // filled_cost,
1271
- // filled_quantity,
1272
- // open_quantity,
1273
- // cancelled_quantity,
1274
- // "status": "orderStatus",
1275
- // "time": "date",
1276
- // client_order_id,
1277
- // }
1278
- // }
1279
- //
1280
- const data = this.safeValue(response, 'data');
1281
- const order = this.parseOrder(data, market);
1282
- // a workaround for incorrect huge amounts
1283
- // returned by the exchange on market buys
1284
- if ((type === 'market') && (side === 'buy')) {
1285
- order['amount'] = undefined;
1286
- order['cost'] = this.parseNumber(quoteAmount);
1287
- order['remaining'] = undefined;
1288
- }
1289
- return order;
1290
- }
1291
- async cancelOrder(id, symbol = undefined, params = {}) {
1292
- /**
1293
- * @method
1294
- * @name probit#cancelOrder
1295
- * @see https://docs-en.probit.com/reference/order-2
1296
- * @description cancels an open order
1297
- * @param {string} id order id
1298
- * @param {string} symbol unified symbol of the market the order was made in
1299
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1300
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1301
- */
1302
- if (symbol === undefined) {
1303
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1304
- }
1305
- await this.loadMarkets();
1306
- const market = this.market(symbol);
1307
- const request = {
1308
- 'market_id': market['id'],
1309
- 'order_id': id,
1310
- };
1311
- const response = await this.privatePostCancelOrder(this.extend(request, params));
1312
- const data = this.safeValue(response, 'data');
1313
- return this.parseOrder(data);
1314
- }
1315
- parseDepositAddress(depositAddress, currency = undefined) {
1316
- const address = this.safeString(depositAddress, 'address');
1317
- const tag = this.safeString(depositAddress, 'destination_tag');
1318
- const currencyId = this.safeString(depositAddress, 'currency_id');
1319
- currency = this.safeCurrency(currencyId, currency);
1320
- const code = currency['code'];
1321
- const network = this.safeString(depositAddress, 'platform_id');
1322
- this.checkAddress(address);
1323
- return {
1324
- 'currency': code,
1325
- 'address': address,
1326
- 'tag': tag,
1327
- 'network': network,
1328
- 'info': depositAddress,
1329
- };
1330
- }
1331
- async fetchDepositAddress(code, params = {}) {
1332
- /**
1333
- * @method
1334
- * @name probit#fetchDepositAddress
1335
- * @see https://docs-en.probit.com/reference/deposit_address
1336
- * @description fetch the deposit address for a currency associated with this account
1337
- * @param {string} code unified currency code
1338
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1339
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1340
- */
1341
- await this.loadMarkets();
1342
- const currency = this.currency(code);
1343
- const request = {
1344
- 'currency_id': currency['id'],
1345
- // 'platform_id': 'TRON', (undocumented)
1346
- };
1347
- const networks = this.safeValue(this.options, 'networks', {});
1348
- let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
1349
- network = this.safeString(networks, network, network); // handle ERC20>ETH alias
1350
- if (network !== undefined) {
1351
- request['platform_id'] = network;
1352
- params = this.omit(params, 'platform_id');
1353
- }
1354
- const response = await this.privateGetDepositAddress(this.extend(request, params));
1355
- //
1356
- // without 'platform_id'
1357
- // {
1358
- // "data":[
1359
- // {
1360
- // "currency_id":"ETH",
1361
- // "address":"0x12e2caf3c4051ba1146e612f532901a423a9898a",
1362
- // "destination_tag":null
1363
- // }
1364
- // ]
1365
- // }
1366
- //
1367
- // with 'platform_id'
1368
- // {
1369
- // "data":[
1370
- // {
1371
- // "platform_id":"TRON",
1372
- // "address":"TDQLMxBTa6MzuoZ6deSGZkqET3Ek8v7uC6",
1373
- // "destination_tag":null
1374
- // }
1375
- // ]
1376
- // }
1377
- //
1378
- const data = this.safeValue(response, 'data', []);
1379
- const firstAddress = this.safeValue(data, 0);
1380
- if (firstAddress === undefined) {
1381
- throw new errors.InvalidAddress(this.id + ' fetchDepositAddress() returned an empty response');
1382
- }
1383
- return this.parseDepositAddress(firstAddress, currency);
1384
- }
1385
- async fetchDepositAddresses(codes = undefined, params = {}) {
1386
- /**
1387
- * @method
1388
- * @name probit#fetchDepositAddresses
1389
- * @see https://docs-en.probit.com/reference/deposit_address
1390
- * @description fetch deposit addresses for multiple currencies and chain types
1391
- * @param {string[]|undefined} codes list of unified currency codes, default is undefined
1392
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1393
- * @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
1394
- */
1395
- await this.loadMarkets();
1396
- const request = {};
1397
- if (codes) {
1398
- const currencyIds = [];
1399
- for (let i = 0; i < codes.length; i++) {
1400
- const currency = this.currency(codes[i]);
1401
- currencyIds.push(currency['id']);
1402
- }
1403
- request['currency_id'] = codes.join(',');
1404
- }
1405
- const response = await this.privateGetDepositAddress(this.extend(request, params));
1406
- const data = this.safeValue(response, 'data', []);
1407
- return this.parseDepositAddresses(data, codes);
1408
- }
1409
- async withdraw(code, amount, address, tag = undefined, params = {}) {
1410
- /**
1411
- * @method
1412
- * @name probit#withdraw
1413
- * @see https://docs-en.probit.com/reference/withdrawal
1414
- * @description make a withdrawal
1415
- * @param {string} code unified currency code
1416
- * @param {float} amount the amount to withdraw
1417
- * @param {string} address the address to withdraw to
1418
- * @param {string} tag
1419
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1420
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1421
- */
1422
- [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1423
- // In order to use this method
1424
- // you need to allow API withdrawal from the API Settings Page, and
1425
- // and register the list of withdrawal addresses and destination tags on the API Settings page
1426
- // you can only withdraw to the registered addresses using the API
1427
- this.checkAddress(address);
1428
- await this.loadMarkets();
1429
- const currency = this.currency(code);
1430
- if (tag === undefined) {
1431
- tag = '';
1432
- }
1433
- const request = {
1434
- 'currency_id': currency['id'],
1435
- // 'platform_id': 'ETH', // if omitted it will use the default platform for the currency
1436
- 'address': address,
1437
- 'destination_tag': tag,
1438
- 'amount': this.numberToString(amount),
1439
- // which currency to pay the withdrawal fees
1440
- // only applicable for currencies that accepts multiple withdrawal fee options
1441
- // 'fee_currency_id': 'ETH', // if omitted it will use the default fee policy for each currency
1442
- // whether the amount field includes fees
1443
- // 'include_fee': false, // makes sense only when fee_currency_id is equal to currency_id
1444
- };
1445
- const networks = this.safeValue(this.options, 'networks', {});
1446
- let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
1447
- network = this.safeString(networks, network, network); // handle ERC20>ETH alias
1448
- if (network !== undefined) {
1449
- request['platform_id'] = network;
1450
- params = this.omit(params, 'network');
1451
- }
1452
- const response = await this.privatePostWithdrawal(this.extend(request, params));
1453
- const data = this.safeValue(response, 'data');
1454
- return this.parseTransaction(data, currency);
1455
- }
1456
- async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1457
- /**
1458
- * @method
1459
- * @name probit#fetchDeposits
1460
- * @description fetch all deposits made to an account
1461
- * @param {string} code unified currency code
1462
- * @param {int} [since] the earliest time in ms to fetch deposits for
1463
- * @param {int} [limit] the maximum number of transaction structures to retrieve
1464
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1465
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1466
- */
1467
- const request = {
1468
- 'type': 'deposit',
1469
- };
1470
- const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
1471
- return result;
1472
- }
1473
- async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1474
- /**
1475
- * @method
1476
- * @name probit#fetchWithdrawals
1477
- * @description fetch all withdrawals made to an account
1478
- * @param {string} code unified currency code
1479
- * @param {int} [since] the earliest time in ms to fetch withdrawals for
1480
- * @param {int} [limit] the maximum number of transaction structures to retrieve
1481
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1482
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1483
- */
1484
- const request = {
1485
- 'type': 'withdrawal',
1486
- };
1487
- const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
1488
- return result;
1489
- }
1490
- async fetchTransactions(code = undefined, since = undefined, limit = undefined, params = {}) {
1491
- /**
1492
- * @method
1493
- * @name probit#fetchTransactions
1494
- * @deprecated
1495
- * @description use fetchDepositsWithdrawals instead
1496
- * @see https://docs-en.probit.com/reference/transferpayment
1497
- * @param {string} code unified currency code
1498
- * @param {int} [since] the earliest time in ms to fetch transactions for
1499
- * @param {int} [limit] the maximum number of transaction structures to retrieve
1500
- * @param {int} [params.until] the latest time in ms to fetch transactions for
1501
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1502
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1503
- */
1504
- await this.loadMarkets();
1505
- let currency = undefined;
1506
- const request = {};
1507
- if (code !== undefined) {
1508
- currency = this.currency(code);
1509
- request['currency_id'] = currency['id'];
1510
- }
1511
- if (since !== undefined) {
1512
- request['start_time'] = this.iso8601(since);
1513
- }
1514
- else {
1515
- request['start_time'] = this.iso8601(1);
1516
- }
1517
- const until = this.safeInteger2(params, 'till', 'until');
1518
- if (until !== undefined) {
1519
- request['end_time'] = this.iso8601(until);
1520
- params = this.omit(params, ['until', 'till']);
1521
- }
1522
- else {
1523
- request['end_time'] = this.iso8601(this.milliseconds());
1524
- }
1525
- if (limit !== undefined) {
1526
- request['limit'] = limit;
1527
- }
1528
- else {
1529
- request['limit'] = 100;
1530
- }
1531
- const response = await this.privateGetTransferPayment(this.extend(request, params));
1532
- //
1533
- // {
1534
- // "data": [
1535
- // {
1536
- // "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
1537
- // "type": "deposit",
1538
- // "status": "done",
1539
- // "amount": "0.01",
1540
- // "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
1541
- // "time": "2023-06-14T12:03:11.000Z",
1542
- // "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
1543
- // "currency_id": "ETH",
1544
- // "confirmations":0,
1545
- // "fee": "0",
1546
- // "destination_tag": null,
1547
- // "platform_id": "ETH",
1548
- // "fee_currency_id": "ETH",
1549
- // "payment_service_name":null,
1550
- // "payment_service_display_name":null,
1551
- // "crypto":null
1552
- // }
1553
- // ]
1554
- // }
1555
- //
1556
- const data = this.safeValue(response, 'data', {});
1557
- return this.parseTransactions(data, currency, since, limit);
1558
- }
1559
- parseTransaction(transaction, currency = undefined) {
1560
- //
1561
- // {
1562
- // "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
1563
- // "type": "deposit",
1564
- // "status": "done",
1565
- // "amount": "0.01",
1566
- // "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
1567
- // "time": "2023-06-14T12:03:11.000Z",
1568
- // "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
1569
- // "currency_id": "ETH",
1570
- // "confirmations":0,
1571
- // "fee": "0",
1572
- // "destination_tag": null,
1573
- // "platform_id": "ETH",
1574
- // "fee_currency_id": "ETH",
1575
- // "payment_service_name":null,
1576
- // "payment_service_display_name":null,
1577
- // "crypto":null
1578
- // }
1579
- //
1580
- const id = this.safeString(transaction, 'id');
1581
- const networkId = this.safeString(transaction, 'platform_id');
1582
- const networkCode = this.networkIdToCode(networkId);
1583
- const amount = this.safeNumber(transaction, 'amount');
1584
- const address = this.safeString(transaction, 'address');
1585
- const tag = this.safeString(transaction, 'destination_tag');
1586
- const txid = this.safeString(transaction, 'hash');
1587
- const timestamp = this.parse8601(this.safeString(transaction, 'time'));
1588
- const type = this.safeString(transaction, 'type');
1589
- const currencyId = this.safeString(transaction, 'currency_id');
1590
- const code = this.safeCurrencyCode(currencyId);
1591
- const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
1592
- const feeCost = this.safeNumber(transaction, 'fee');
1593
- let fee = undefined;
1594
- if (feeCost !== undefined && feeCost !== 0) {
1595
- fee = {
1596
- 'currency': code,
1597
- 'cost': feeCost,
1598
- };
1599
- }
1600
- return {
1601
- 'id': id,
1602
- 'currency': code,
1603
- 'amount': amount,
1604
- 'network': networkCode,
1605
- 'addressFrom': undefined,
1606
- 'address': address,
1607
- 'addressTo': address,
1608
- 'tagFrom': undefined,
1609
- 'tag': tag,
1610
- 'tagTo': tag,
1611
- 'status': status,
1612
- 'type': type,
1613
- 'txid': txid,
1614
- 'timestamp': timestamp,
1615
- 'datetime': this.iso8601(timestamp),
1616
- 'updated': undefined,
1617
- 'internal': undefined,
1618
- 'comment': undefined,
1619
- 'fee': fee,
1620
- 'info': transaction,
1621
- };
1622
- }
1623
- parseTransactionStatus(status) {
1624
- const statuses = {
1625
- 'requested': 'pending',
1626
- 'pending': 'pending',
1627
- 'confirming': 'pending',
1628
- 'confirmed': 'pending',
1629
- 'applying': 'pending',
1630
- 'done': 'ok',
1631
- 'cancelled': 'canceled',
1632
- 'cancelling': 'canceled',
1633
- };
1634
- return this.safeString(statuses, status, status);
1635
- }
1636
- async fetchDepositWithdrawFees(codes = undefined, params = {}) {
1637
- /**
1638
- * @method
1639
- * @name probit#fetchDepositWithdrawFees
1640
- * @see https://docs-en.probit.com/reference/currency
1641
- * @description fetch deposit and withdraw fees
1642
- * @param {string[]|undefined} codes list of unified currency codes
1643
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1644
- * @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1645
- */
1646
- await this.loadMarkets();
1647
- const response = await this.publicGetCurrencyWithPlatform(params);
1648
- //
1649
- // {
1650
- // "data": [
1651
- // {
1652
- // "id": "AFX",
1653
- // "display_name": {
1654
- // "ko-kr": "아프릭스",
1655
- // "en-us": "Afrix"
1656
- // },
1657
- // "show_in_ui": true,
1658
- // "platform": [
1659
- // {
1660
- // "id": "ZYN",
1661
- // "priority": 1,
1662
- // "deposit": true,
1663
- // "withdrawal": true,
1664
- // "currency_id": "AFX",
1665
- // "precision": 18,
1666
- // "min_confirmation_count": 60,
1667
- // "require_destination_tag": false,
1668
- // "allow_withdrawal_destination_tag": false,
1669
- // "display_name": {
1670
- // "name": {
1671
- // "ko-kr": "지네코인",
1672
- // "en-us": "Wethio"
1673
- // }
1674
- // },
1675
- // "min_deposit_amount": "0",
1676
- // "min_withdrawal_amount": "0",
1677
- // "withdrawal_fee": [
1678
- // {
1679
- // "currency_id": "ZYN",
1680
- // "amount": "0.5",
1681
- // "priority": 1
1682
- // }
1683
- // ],
1684
- // "deposit_fee": {},
1685
- // "suspended_reason": "",
1686
- // "deposit_suspended": false,
1687
- // "withdrawal_suspended": false,
1688
- // "platform_currency_display_name": {}
1689
- // }
1690
- // ],
1691
- // "internal_transfer": {
1692
- // "suspended_reason": null,
1693
- // "suspended": false
1694
- // },
1695
- // "stakeable": false,
1696
- // "unstakeable": false,
1697
- // "auto_stake": false,
1698
- // "auto_stake_amount": "0"
1699
- // },
1700
- // ]
1701
- // }
1702
- //
1703
- const data = this.safeValue(response, 'data');
1704
- return this.parseDepositWithdrawFees(data, codes, 'id');
1705
- }
1706
- parseDepositWithdrawFee(fee, currency = undefined) {
1707
- //
1708
- // {
1709
- // "id": "USDT",
1710
- // "display_name": { "ko-kr": '테더', "en-us": "Tether" },
1711
- // "show_in_ui": true,
1712
- // "platform": [
1713
- // {
1714
- // "id": "ETH",
1715
- // "priority": "1",
1716
- // "deposit": true,
1717
- // "withdrawal": true,
1718
- // "currency_id": "USDT",
1719
- // "precision": "6",
1720
- // "min_confirmation_count": "15",
1721
- // "require_destination_tag": false,
1722
- // "allow_withdrawal_destination_tag": false,
1723
- // "display_name": [Object],
1724
- // "min_deposit_amount": "0",
1725
- // "min_withdrawal_amount": "1",
1726
- // "withdrawal_fee": [Array],
1727
- // "deposit_fee": {},
1728
- // "suspended_reason": '',
1729
- // "deposit_suspended": false,
1730
- // "withdrawal_suspended": false,
1731
- // "platform_currency_display_name": [Object]
1732
- // },
1733
- // ],
1734
- // "internal_transfer": { suspended_reason: null, suspended: false },
1735
- // "stakeable": false,
1736
- // "unstakeable": false,
1737
- // "auto_stake": false,
1738
- // "auto_stake_amount": "0"
1739
- // }
1740
- //
1741
- const depositWithdrawFee = this.depositWithdrawFee({});
1742
- const platforms = this.safeValue(fee, 'platform', []);
1743
- const depositResult = {
1744
- 'fee': undefined,
1745
- 'percentage': undefined,
1746
- };
1747
- for (let i = 0; i < platforms.length; i++) {
1748
- const network = platforms[i];
1749
- const networkId = this.safeString(network, 'id');
1750
- const networkCode = this.networkIdToCode(networkId, currency['code']);
1751
- const withdrawalFees = this.safeValue(network, 'withdrawal_fee', {});
1752
- const withdrawFee = this.safeNumber(withdrawalFees[0], 'amount');
1753
- if (withdrawalFees.length) {
1754
- const withdrawResult = {
1755
- 'fee': withdrawFee,
1756
- 'percentage': (withdrawFee !== undefined) ? false : undefined,
1757
- };
1758
- if (i === 0) {
1759
- depositWithdrawFee['withdraw'] = withdrawResult;
1760
- }
1761
- depositWithdrawFee['networks'][networkCode] = {
1762
- 'withdraw': withdrawResult,
1763
- 'deposit': depositResult,
1764
- };
1765
- }
1766
- }
1767
- depositWithdrawFee['info'] = fee;
1768
- return depositWithdrawFee;
1769
- }
1770
- nonce() {
1771
- return this.milliseconds();
1772
- }
1773
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1774
- let url = this.urls['api'][api] + '/';
1775
- const query = this.omit(params, this.extractParams(path));
1776
- if (api === 'accounts') {
1777
- this.checkRequiredCredentials();
1778
- url += this.implodeParams(path, params);
1779
- const auth = this.apiKey + ':' + this.secret;
1780
- const auth64 = this.stringToBase64(auth);
1781
- headers = {
1782
- 'Authorization': 'Basic ' + auth64,
1783
- 'Content-Type': 'application/json',
1784
- };
1785
- if (Object.keys(query).length) {
1786
- body = this.json(query);
1787
- }
1788
- }
1789
- else {
1790
- url += this.version + '/';
1791
- if (api === 'public') {
1792
- url += this.implodeParams(path, params);
1793
- if (Object.keys(query).length) {
1794
- url += '?' + this.urlencode(query);
1795
- }
1796
- }
1797
- else if (api === 'private') {
1798
- const now = this.milliseconds();
1799
- this.checkRequiredCredentials();
1800
- const expires = this.safeInteger(this.options, 'expires');
1801
- if ((expires === undefined) || (expires < now)) {
1802
- throw new errors.AuthenticationError(this.id + ' access token expired, call signIn() method');
1803
- }
1804
- const accessToken = this.safeString(this.options, 'accessToken');
1805
- headers = {
1806
- 'Authorization': 'Bearer ' + accessToken,
1807
- };
1808
- url += this.implodeParams(path, params);
1809
- if (method === 'GET') {
1810
- if (Object.keys(query).length) {
1811
- url += '?' + this.urlencode(query);
1812
- }
1813
- }
1814
- else if (Object.keys(query).length) {
1815
- body = this.json(query);
1816
- headers['Content-Type'] = 'application/json';
1817
- }
1818
- }
1819
- }
1820
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1821
- }
1822
- async signIn(params = {}) {
1823
- /**
1824
- * @method
1825
- * @name probit#signIn
1826
- * @see https://docs-en.probit.com/reference/token
1827
- * @description sign in, must be called prior to using other authenticated methods
1828
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1829
- * @returns response from exchange
1830
- */
1831
- this.checkRequiredCredentials();
1832
- const request = {
1833
- 'grant_type': 'client_credentials', // the only supported value
1834
- };
1835
- const response = await this.accountsPostToken(this.extend(request, params));
1836
- //
1837
- // {
1838
- // "access_token": "0ttDv/2hTTn3bLi8GP1gKaneiEQ6+0hOBenPrxNQt2s=",
1839
- // "token_type": "bearer",
1840
- // "expires_in": 900
1841
- // }
1842
- //
1843
- const expiresIn = this.safeInteger(response, 'expires_in');
1844
- const accessToken = this.safeString(response, 'access_token');
1845
- this.options['accessToken'] = accessToken;
1846
- this.options['expires'] = this.sum(this.milliseconds(), expiresIn * 1000);
1847
- return response;
1848
- }
1849
- handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1850
- if (response === undefined) {
1851
- return undefined; // fallback to default error handler
1852
- }
1853
- if ('errorCode' in response) {
1854
- const errorCode = this.safeString(response, 'errorCode');
1855
- const message = this.safeString(response, 'message');
1856
- if (errorCode !== undefined) {
1857
- const feedback = this.id + ' ' + body;
1858
- this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
1859
- this.throwBroadlyMatchedException(this.exceptions['exact'], errorCode, feedback);
1860
- throw new errors.ExchangeError(feedback);
1861
- }
1862
- }
1863
- return undefined;
1864
- }
1865
- }
1866
-
1867
- module.exports = probit;