ccxt 4.2.10 → 4.2.12

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 (383) hide show
  1. package/README.md +5 -5
  2. package/build.sh +4 -4
  3. package/dist/ccxt.browser.js +695 -282
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/_virtual/agent.js +7 -0
  6. package/dist/cjs/_virtual/parse-proxy-response.js +7 -0
  7. package/dist/cjs/_virtual/promisify.js +7 -0
  8. package/dist/cjs/ccxt.js +1 -1
  9. package/dist/cjs/js/ccxt.js +474 -0
  10. package/dist/cjs/js/src/abstract/ace.js +9 -0
  11. package/dist/cjs/js/src/abstract/alpaca.js +9 -0
  12. package/dist/cjs/js/src/abstract/ascendex.js +9 -0
  13. package/dist/cjs/js/src/abstract/bigone.js +9 -0
  14. package/dist/cjs/js/src/abstract/binance.js +9 -0
  15. package/dist/cjs/js/src/abstract/bingx.js +9 -0
  16. package/dist/cjs/js/src/abstract/bit2c.js +9 -0
  17. package/dist/cjs/js/src/abstract/bitbank.js +9 -0
  18. package/dist/cjs/js/src/abstract/bitbns.js +9 -0
  19. package/dist/cjs/js/src/abstract/bitfinex.js +9 -0
  20. package/dist/cjs/js/src/abstract/bitfinex2.js +9 -0
  21. package/dist/cjs/js/src/abstract/bitflyer.js +9 -0
  22. package/dist/cjs/js/src/abstract/bitforex.js +9 -0
  23. package/dist/cjs/js/src/abstract/bitget.js +9 -0
  24. package/dist/cjs/js/src/abstract/bithumb.js +9 -0
  25. package/dist/cjs/js/src/abstract/bitmart.js +9 -0
  26. package/dist/cjs/js/src/abstract/bitmex.js +9 -0
  27. package/dist/cjs/js/src/abstract/bitopro.js +9 -0
  28. package/dist/cjs/js/src/abstract/bitpanda.js +9 -0
  29. package/dist/cjs/js/src/abstract/bitrue.js +9 -0
  30. package/dist/cjs/js/src/abstract/bitso.js +9 -0
  31. package/dist/cjs/js/src/abstract/bitstamp.js +9 -0
  32. package/dist/cjs/js/src/abstract/bitteam.js +9 -0
  33. package/dist/cjs/js/src/abstract/bitvavo.js +9 -0
  34. package/dist/cjs/js/src/abstract/bl3p.js +9 -0
  35. package/dist/cjs/js/src/abstract/blockchaincom.js +9 -0
  36. package/dist/cjs/js/src/abstract/btcalpha.js +9 -0
  37. package/dist/cjs/js/src/abstract/btcbox.js +9 -0
  38. package/dist/cjs/js/src/abstract/btcmarkets.js +9 -0
  39. package/dist/cjs/js/src/abstract/btcturk.js +9 -0
  40. package/dist/cjs/js/src/abstract/bybit.js +9 -0
  41. package/dist/cjs/js/src/abstract/cex.js +9 -0
  42. package/dist/cjs/js/src/abstract/coinbase.js +9 -0
  43. package/dist/cjs/js/src/abstract/coinbasepro.js +9 -0
  44. package/dist/cjs/js/src/abstract/coincheck.js +9 -0
  45. package/dist/cjs/js/src/abstract/coinex.js +9 -0
  46. package/dist/cjs/js/src/abstract/coinlist.js +9 -0
  47. package/dist/cjs/js/src/abstract/coinmate.js +9 -0
  48. package/dist/cjs/js/src/abstract/coinone.js +9 -0
  49. package/dist/cjs/js/src/abstract/coinsph.js +9 -0
  50. package/dist/cjs/js/src/abstract/coinspot.js +9 -0
  51. package/dist/cjs/js/src/abstract/cryptocom.js +9 -0
  52. package/dist/cjs/js/src/abstract/currencycom.js +9 -0
  53. package/dist/cjs/js/src/abstract/delta.js +9 -0
  54. package/dist/cjs/js/src/abstract/deribit.js +9 -0
  55. package/dist/cjs/js/src/abstract/digifinex.js +9 -0
  56. package/dist/cjs/js/src/abstract/exmo.js +9 -0
  57. package/dist/cjs/js/src/abstract/gate.js +9 -0
  58. package/dist/cjs/js/src/abstract/gemini.js +9 -0
  59. package/dist/cjs/js/src/abstract/hitbtc.js +9 -0
  60. package/dist/cjs/js/src/abstract/hollaex.js +9 -0
  61. package/dist/cjs/js/src/abstract/htx.js +9 -0
  62. package/dist/cjs/js/src/abstract/huobijp.js +9 -0
  63. package/dist/cjs/js/src/abstract/idex.js +9 -0
  64. package/dist/cjs/js/src/abstract/independentreserve.js +9 -0
  65. package/dist/cjs/js/src/abstract/indodax.js +9 -0
  66. package/dist/cjs/js/src/abstract/kraken.js +9 -0
  67. package/dist/cjs/js/src/abstract/krakenfutures.js +9 -0
  68. package/dist/cjs/js/src/abstract/kucoin.js +9 -0
  69. package/dist/cjs/js/src/abstract/kucoinfutures.js +9 -0
  70. package/dist/cjs/js/src/abstract/kuna.js +9 -0
  71. package/dist/cjs/js/src/abstract/latoken.js +9 -0
  72. package/dist/cjs/js/src/abstract/lbank.js +9 -0
  73. package/dist/cjs/js/src/abstract/luno.js +9 -0
  74. package/dist/cjs/js/src/abstract/lykke.js +9 -0
  75. package/dist/cjs/js/src/abstract/mercado.js +9 -0
  76. package/dist/cjs/js/src/abstract/mexc.js +9 -0
  77. package/dist/cjs/js/src/abstract/ndax.js +9 -0
  78. package/dist/cjs/js/src/abstract/novadax.js +9 -0
  79. package/dist/cjs/js/src/abstract/oceanex.js +9 -0
  80. package/dist/cjs/js/src/abstract/okcoin.js +9 -0
  81. package/dist/cjs/js/src/abstract/okx.js +9 -0
  82. package/dist/cjs/js/src/abstract/p2b.js +9 -0
  83. package/dist/cjs/js/src/abstract/paymium.js +9 -0
  84. package/dist/cjs/js/src/abstract/phemex.js +9 -0
  85. package/dist/cjs/js/src/abstract/poloniex.js +9 -0
  86. package/dist/cjs/js/src/abstract/poloniexfutures.js +9 -0
  87. package/dist/cjs/js/src/abstract/probit.js +9 -0
  88. package/dist/cjs/js/src/abstract/timex.js +9 -0
  89. package/dist/cjs/js/src/abstract/tokocrypto.js +9 -0
  90. package/dist/cjs/js/src/abstract/upbit.js +9 -0
  91. package/dist/cjs/js/src/abstract/wavesexchange.js +9 -0
  92. package/dist/cjs/js/src/abstract/wazirx.js +9 -0
  93. package/dist/cjs/js/src/abstract/whitebit.js +9 -0
  94. package/dist/cjs/js/src/abstract/woo.js +9 -0
  95. package/dist/cjs/js/src/abstract/yobit.js +9 -0
  96. package/dist/cjs/js/src/abstract/zaif.js +9 -0
  97. package/dist/cjs/js/src/abstract/zonda.js +9 -0
  98. package/dist/cjs/js/src/ace.js +1058 -0
  99. package/dist/cjs/js/src/alpaca.js +1125 -0
  100. package/dist/cjs/js/src/ascendex.js +3360 -0
  101. package/dist/cjs/js/src/base/Exchange.js +5110 -0
  102. package/dist/cjs/js/src/base/Precise.js +263 -0
  103. package/dist/cjs/js/src/base/errors.js +299 -0
  104. package/dist/cjs/js/src/base/functions/crypto.js +78 -0
  105. package/dist/cjs/js/src/base/functions/encode.js +44 -0
  106. package/dist/cjs/js/src/base/functions/generic.js +193 -0
  107. package/dist/cjs/js/src/base/functions/misc.js +96 -0
  108. package/dist/cjs/js/src/base/functions/number.js +297 -0
  109. package/dist/cjs/js/src/base/functions/platform.js +28 -0
  110. package/dist/cjs/js/src/base/functions/rsa.js +34 -0
  111. package/dist/cjs/js/src/base/functions/string.js +48 -0
  112. package/dist/cjs/js/src/base/functions/throttle.js +66 -0
  113. package/dist/cjs/js/src/base/functions/time.js +187 -0
  114. package/dist/cjs/js/src/base/functions/totp.js +24 -0
  115. package/dist/cjs/js/src/base/functions/type.js +162 -0
  116. package/dist/cjs/js/src/base/functions.js +157 -0
  117. package/dist/cjs/js/src/base/ws/Cache.js +254 -0
  118. package/dist/cjs/js/src/base/ws/Client.js +299 -0
  119. package/dist/cjs/js/src/base/ws/Future.js +34 -0
  120. package/dist/cjs/js/src/base/ws/OrderBook.js +107 -0
  121. package/dist/cjs/js/src/base/ws/OrderBookSide.js +281 -0
  122. package/dist/cjs/js/src/base/ws/WsClient.js +69 -0
  123. package/dist/cjs/js/src/bequant.js +33 -0
  124. package/dist/cjs/js/src/bigone.js +2142 -0
  125. package/dist/cjs/js/src/binance.js +9729 -0
  126. package/dist/cjs/js/src/binancecoinm.js +45 -0
  127. package/dist/cjs/js/src/binanceus.js +84 -0
  128. package/dist/cjs/js/src/binanceusdm.js +58 -0
  129. package/dist/cjs/js/src/bingx.js +3737 -0
  130. package/dist/cjs/js/src/bit2c.js +916 -0
  131. package/dist/cjs/js/src/bitbank.js +1000 -0
  132. package/dist/cjs/js/src/bitbay.js +17 -0
  133. package/dist/cjs/js/src/bitbns.js +1220 -0
  134. package/dist/cjs/js/src/bitcoincom.js +17 -0
  135. package/dist/cjs/js/src/bitfinex.js +1670 -0
  136. package/dist/cjs/js/src/bitfinex2.js +2990 -0
  137. package/dist/cjs/js/src/bitflyer.js +1045 -0
  138. package/dist/cjs/js/src/bitforex.js +852 -0
  139. package/dist/cjs/js/src/bitget.js +8284 -0
  140. package/dist/cjs/js/src/bithumb.js +1090 -0
  141. package/dist/cjs/js/src/bitmart.js +4454 -0
  142. package/dist/cjs/js/src/bitmex.js +2884 -0
  143. package/dist/cjs/js/src/bitopro.js +1724 -0
  144. package/dist/cjs/js/src/bitpanda.js +2002 -0
  145. package/dist/cjs/js/src/bitrue.js +3253 -0
  146. package/dist/cjs/js/src/bitso.js +1753 -0
  147. package/dist/cjs/js/src/bitstamp.js +2188 -0
  148. package/dist/cjs/js/src/bitteam.js +2309 -0
  149. package/dist/cjs/js/src/bitvavo.js +1968 -0
  150. package/dist/cjs/js/src/bl3p.js +447 -0
  151. package/dist/cjs/js/src/blockchaincom.js +1160 -0
  152. package/dist/cjs/js/src/btcalpha.js +929 -0
  153. package/dist/cjs/js/src/btcbox.js +565 -0
  154. package/dist/cjs/js/src/btcmarkets.js +1237 -0
  155. package/dist/cjs/js/src/btcturk.js +929 -0
  156. package/dist/cjs/js/src/bybit.js +7646 -0
  157. package/dist/cjs/js/src/cex.js +1693 -0
  158. package/dist/cjs/js/src/coinbase.js +3274 -0
  159. package/dist/cjs/js/src/coinbasepro.js +1866 -0
  160. package/dist/cjs/js/src/coincheck.js +843 -0
  161. package/dist/cjs/js/src/coinex.js +5414 -0
  162. package/dist/cjs/js/src/coinlist.js +2329 -0
  163. package/dist/cjs/js/src/coinmate.js +989 -0
  164. package/dist/cjs/js/src/coinone.js +1185 -0
  165. package/dist/cjs/js/src/coinsph.js +1933 -0
  166. package/dist/cjs/js/src/coinspot.js +548 -0
  167. package/dist/cjs/js/src/cryptocom.js +3007 -0
  168. package/dist/cjs/js/src/currencycom.js +2015 -0
  169. package/dist/cjs/js/src/delta.js +3256 -0
  170. package/dist/cjs/js/src/deribit.js +3306 -0
  171. package/dist/cjs/js/src/digifinex.js +4307 -0
  172. package/dist/cjs/js/src/exmo.js +2645 -0
  173. package/dist/cjs/js/src/fmfwio.js +34 -0
  174. package/dist/cjs/js/src/gate.js +7054 -0
  175. package/dist/cjs/js/src/gateio.js +16 -0
  176. package/dist/cjs/js/src/gemini.js +1801 -0
  177. package/dist/cjs/js/src/hitbtc.js +3660 -0
  178. package/dist/cjs/js/src/hitbtc3.js +19 -0
  179. package/dist/cjs/js/src/hollaex.js +1882 -0
  180. package/dist/cjs/js/src/htx.js +9024 -0
  181. package/dist/cjs/js/src/huobi.js +16 -0
  182. package/dist/cjs/js/src/huobijp.js +1918 -0
  183. package/dist/cjs/js/src/idex.js +1770 -0
  184. package/dist/cjs/js/src/independentreserve.js +759 -0
  185. package/dist/cjs/js/src/indodax.js +1069 -0
  186. package/dist/cjs/js/src/kraken.js +2861 -0
  187. package/dist/cjs/js/src/krakenfutures.js +2407 -0
  188. package/dist/cjs/js/src/kucoin.js +4489 -0
  189. package/dist/cjs/js/src/kucoinfutures.js +2475 -0
  190. package/dist/cjs/js/src/kuna.js +1949 -0
  191. package/dist/cjs/js/src/latoken.js +1729 -0
  192. package/dist/cjs/js/src/lbank.js +2825 -0
  193. package/dist/cjs/js/src/luno.js +1044 -0
  194. package/dist/cjs/js/src/lykke.js +1303 -0
  195. package/dist/cjs/js/src/mercado.js +897 -0
  196. package/dist/cjs/js/src/mexc.js +5407 -0
  197. package/dist/cjs/js/src/ndax.js +2450 -0
  198. package/dist/cjs/js/src/novadax.js +1556 -0
  199. package/dist/cjs/js/src/oceanex.js +964 -0
  200. package/dist/cjs/js/src/okcoin.js +3115 -0
  201. package/dist/cjs/js/src/okx.js +7329 -0
  202. package/dist/cjs/js/src/p2b.js +1243 -0
  203. package/dist/cjs/js/src/paymium.js +597 -0
  204. package/dist/cjs/js/src/phemex.js +4715 -0
  205. package/dist/cjs/js/src/poloniex.js +2356 -0
  206. package/dist/cjs/js/src/poloniexfutures.js +1794 -0
  207. package/dist/cjs/js/src/pro/alpaca.js +714 -0
  208. package/dist/cjs/js/src/pro/ascendex.js +957 -0
  209. package/dist/cjs/js/src/pro/bequant.js +33 -0
  210. package/dist/cjs/js/src/pro/binance.js +2796 -0
  211. package/dist/cjs/js/src/pro/binancecoinm.js +23 -0
  212. package/dist/cjs/js/src/pro/binanceus.js +51 -0
  213. package/dist/cjs/js/src/pro/binanceusdm.js +32 -0
  214. package/dist/cjs/js/src/pro/bingx.js +944 -0
  215. package/dist/cjs/js/src/pro/bitcoincom.js +29 -0
  216. package/dist/cjs/js/src/pro/bitfinex.js +672 -0
  217. package/dist/cjs/js/src/pro/bitfinex2.js +1159 -0
  218. package/dist/cjs/js/src/pro/bitget.js +1733 -0
  219. package/dist/cjs/js/src/pro/bitmart.js +1486 -0
  220. package/dist/cjs/js/src/pro/bitmex.js +1576 -0
  221. package/dist/cjs/js/src/pro/bitopro.js +327 -0
  222. package/dist/cjs/js/src/pro/bitpanda.js +1341 -0
  223. package/dist/cjs/js/src/pro/bitrue.js +462 -0
  224. package/dist/cjs/js/src/pro/bitstamp.js +547 -0
  225. package/dist/cjs/js/src/pro/bitvavo.js +704 -0
  226. package/dist/cjs/js/src/pro/blockchaincom.js +794 -0
  227. package/dist/cjs/js/src/pro/bybit.js +1843 -0
  228. package/dist/cjs/js/src/pro/cex.js +1510 -0
  229. package/dist/cjs/js/src/pro/coinbase.js +561 -0
  230. package/dist/cjs/js/src/pro/coinbasepro.js +968 -0
  231. package/dist/cjs/js/src/pro/coinex.js +1095 -0
  232. package/dist/cjs/js/src/pro/cryptocom.js +1020 -0
  233. package/dist/cjs/js/src/pro/currencycom.js +563 -0
  234. package/dist/cjs/js/src/pro/deribit.js +825 -0
  235. package/dist/cjs/js/src/pro/exmo.js +658 -0
  236. package/dist/cjs/js/src/pro/gate.js +1316 -0
  237. package/dist/cjs/js/src/pro/gateio.js +16 -0
  238. package/dist/cjs/js/src/pro/gemini.js +649 -0
  239. package/dist/cjs/js/src/pro/hitbtc.js +1293 -0
  240. package/dist/cjs/js/src/pro/hollaex.js +597 -0
  241. package/dist/cjs/js/src/pro/htx.js +2383 -0
  242. package/dist/cjs/js/src/pro/huobi.js +16 -0
  243. package/dist/cjs/js/src/pro/huobijp.js +606 -0
  244. package/dist/cjs/js/src/pro/idex.js +714 -0
  245. package/dist/cjs/js/src/pro/independentreserve.js +280 -0
  246. package/dist/cjs/js/src/pro/kraken.js +1364 -0
  247. package/dist/cjs/js/src/pro/krakenfutures.js +1500 -0
  248. package/dist/cjs/js/src/pro/kucoin.js +1052 -0
  249. package/dist/cjs/js/src/pro/kucoinfutures.js +981 -0
  250. package/dist/cjs/js/src/pro/luno.js +322 -0
  251. package/dist/cjs/js/src/pro/mexc.js +1170 -0
  252. package/dist/cjs/js/src/pro/ndax.js +545 -0
  253. package/dist/cjs/js/src/pro/okcoin.js +760 -0
  254. package/dist/cjs/js/src/pro/okx.js +1558 -0
  255. package/dist/cjs/js/src/pro/phemex.js +1511 -0
  256. package/dist/cjs/js/src/pro/poloniex.js +1253 -0
  257. package/dist/cjs/js/src/pro/poloniexfutures.js +1014 -0
  258. package/dist/cjs/js/src/pro/probit.js +586 -0
  259. package/dist/cjs/js/src/pro/upbit.js +234 -0
  260. package/dist/cjs/js/src/pro/wazirx.js +776 -0
  261. package/dist/cjs/js/src/pro/whitebit.js +927 -0
  262. package/dist/cjs/js/src/pro/woo.js +769 -0
  263. package/dist/cjs/js/src/probit.js +1865 -0
  264. package/dist/cjs/js/src/static_dependencies/fflake/browser.js +401 -0
  265. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncrypt.js +195 -0
  266. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +308 -0
  267. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +554 -0
  268. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +94 -0
  269. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +70 -0
  270. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +91 -0
  271. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +16 -0
  272. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1760 -0
  273. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +52 -0
  274. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +81 -0
  275. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +376 -0
  276. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +70 -0
  277. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1580 -0
  278. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +74 -0
  279. package/dist/cjs/js/src/static_dependencies/noble-curves/_shortw_utils.js +24 -0
  280. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/curve.js +158 -0
  281. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/edwards.js +429 -0
  282. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +176 -0
  283. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/modular.js +324 -0
  284. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/montgomery.js +163 -0
  285. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/utils.js +245 -0
  286. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +1018 -0
  287. package/dist/cjs/js/src/static_dependencies/noble-curves/ed25519.js +383 -0
  288. package/dist/cjs/js/src/static_dependencies/noble-curves/secp256k1.js +258 -0
  289. package/dist/cjs/js/src/static_dependencies/noble-hashes/_assert.js +53 -0
  290. package/dist/cjs/js/src/static_dependencies/noble-hashes/_sha2.js +120 -0
  291. package/dist/cjs/js/src/static_dependencies/noble-hashes/_u64.js +69 -0
  292. package/dist/cjs/js/src/static_dependencies/noble-hashes/crypto.js +7 -0
  293. package/dist/cjs/js/src/static_dependencies/noble-hashes/hmac.js +83 -0
  294. package/dist/cjs/js/src/static_dependencies/noble-hashes/md5.js +240 -0
  295. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha1.js +91 -0
  296. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha256.js +130 -0
  297. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha3.js +214 -0
  298. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha512.js +239 -0
  299. package/dist/cjs/js/src/static_dependencies/noble-hashes/utils.js +93 -0
  300. package/dist/cjs/js/src/static_dependencies/node-fetch/body.js +354 -0
  301. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/abort-error.js +16 -0
  302. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/base.js +20 -0
  303. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/fetch-error.js +30 -0
  304. package/dist/cjs/js/src/static_dependencies/node-fetch/headers.js +239 -0
  305. package/dist/cjs/js/src/static_dependencies/node-fetch/index.js +372 -0
  306. package/dist/cjs/js/src/static_dependencies/node-fetch/request.js +273 -0
  307. package/dist/cjs/js/src/static_dependencies/node-fetch/response.js +139 -0
  308. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/get-search.js +14 -0
  309. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is-redirect.js +16 -0
  310. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is.js +81 -0
  311. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/referrer.js +292 -0
  312. package/dist/cjs/js/src/static_dependencies/proxies/agent-base/index.js +103 -0
  313. package/dist/cjs/js/src/static_dependencies/proxies/http-proxy-agent/index.js +140 -0
  314. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/index.js +175 -0
  315. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +95 -0
  316. package/dist/cjs/js/src/static_dependencies/qs/index.cjs.js +7 -0
  317. package/dist/cjs/js/src/static_dependencies/scure-base/index.js +383 -0
  318. package/dist/cjs/js/src/timex.js +1562 -0
  319. package/dist/cjs/js/src/tokocrypto.js +2542 -0
  320. package/dist/cjs/js/src/upbit.js +1844 -0
  321. package/dist/cjs/js/src/wavesexchange.js +2607 -0
  322. package/dist/cjs/js/src/wazirx.js +953 -0
  323. package/dist/cjs/js/src/whitebit.js +2309 -0
  324. package/dist/cjs/js/src/woo.js +2715 -0
  325. package/dist/cjs/js/src/yobit.js +1314 -0
  326. package/dist/cjs/js/src/zaif.js +736 -0
  327. package/dist/cjs/js/src/zonda.js +1883 -0
  328. package/dist/cjs/src/base/Exchange.js +11 -0
  329. package/dist/cjs/src/bingx.js +0 -10
  330. package/dist/cjs/src/bitget.js +14 -5
  331. package/dist/cjs/src/bybit.js +1 -1
  332. package/dist/cjs/src/kucoin.js +29 -5
  333. package/js/ccxt.d.ts +1 -1
  334. package/js/ccxt.js +1 -1
  335. package/js/src/abstract/bigone.d.ts +18 -0
  336. package/js/src/abstract/binance.d.ts +2 -0
  337. package/js/src/abstract/binancecoinm.d.ts +2 -0
  338. package/js/src/abstract/binanceus.d.ts +2 -0
  339. package/js/src/abstract/binanceusdm.d.ts +2 -0
  340. package/js/src/abstract/bybit.d.ts +1 -0
  341. package/js/src/abstract/gate.d.ts +11 -0
  342. package/js/src/abstract/gateio.d.ts +11 -0
  343. package/js/src/alpaca.js +18 -18
  344. package/js/src/base/Exchange.d.ts +6 -1
  345. package/js/src/base/Exchange.js +112 -12
  346. package/js/src/bigone.d.ts +1 -2
  347. package/js/src/bigone.js +340 -145
  348. package/js/src/binance.js +15 -8
  349. package/js/src/bingx.d.ts +0 -1
  350. package/js/src/bingx.js +9 -12
  351. package/js/src/bitfinex.d.ts +2 -2
  352. package/js/src/bitfinex.js +2 -3
  353. package/js/src/bitget.js +35 -13
  354. package/js/src/bitmart.d.ts +2 -2
  355. package/js/src/bitmart.js +3 -3
  356. package/js/src/bitmex.js +1 -0
  357. package/js/src/bybit.js +3 -1
  358. package/js/src/coinlist.js +2 -3
  359. package/js/src/coinsph.js +2 -3
  360. package/js/src/deribit.js +1 -0
  361. package/js/src/gate.d.ts +4 -4
  362. package/js/src/gate.js +22 -3
  363. package/js/src/hitbtc.d.ts +4 -4
  364. package/js/src/hitbtc.js +2 -3
  365. package/js/src/htx.js +4 -7
  366. package/js/src/huobijp.js +2 -3
  367. package/js/src/kraken.js +1 -0
  368. package/js/src/kucoin.js +29 -5
  369. package/js/src/mexc.js +2 -1
  370. package/js/src/okx.js +13 -3
  371. package/js/src/pro/binance.d.ts +2 -23
  372. package/js/src/pro/binance.js +58 -22
  373. package/js/src/pro/coinbase.d.ts +2 -2
  374. package/js/src/pro/coinbase.js +4 -1
  375. package/js/src/pro/coinbasepro.d.ts +2 -2
  376. package/js/src/pro/hitbtc.d.ts +2 -2
  377. package/js/src/pro/poloniex.d.ts +2 -2
  378. package/js/src/upbit.d.ts +3 -101
  379. package/js/src/upbit.js +12 -12
  380. package/js/src/woo.js +2 -0
  381. package/package.json +11 -11
  382. package/skip-tests.json +5 -0
  383. package/tests-manager.sh +2 -2
@@ -0,0 +1,1865 @@
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
+ 'limit': 100,
780
+ 'start_time': '1970-01-01T00:00:00.000Z',
781
+ 'end_time': this.iso8601(this.milliseconds()),
782
+ };
783
+ if (since !== undefined) {
784
+ request['start_time'] = this.iso8601(since);
785
+ }
786
+ if (limit !== undefined) {
787
+ request['limit'] = Math.min(limit, 10000);
788
+ }
789
+ const response = await this.publicGetTrade(this.extend(request, params));
790
+ //
791
+ // {
792
+ // "data":[
793
+ // {
794
+ // "id":"ETH-BTC:3331886",
795
+ // "price":"0.022981",
796
+ // "quantity":"12.337",
797
+ // "time":"2020-04-12T20:55:42.371Z",
798
+ // "side":"sell",
799
+ // "tick_direction":"down"
800
+ // },
801
+ // {
802
+ // "id":"ETH-BTC:3331885",
803
+ // "price":"0.022982",
804
+ // "quantity":"6.472",
805
+ // "time":"2020-04-12T20:55:39.652Z",
806
+ // "side":"sell",
807
+ // "tick_direction":"down"
808
+ // }
809
+ // ]
810
+ // }
811
+ //
812
+ const data = this.safeValue(response, 'data', []);
813
+ return this.parseTrades(data, market, since, limit);
814
+ }
815
+ parseTrade(trade, market = undefined) {
816
+ //
817
+ // fetchTrades (public)
818
+ //
819
+ // {
820
+ // "id":"ETH-BTC:3331886",
821
+ // "price":"0.022981",
822
+ // "quantity":"12.337",
823
+ // "time":"2020-04-12T20:55:42.371Z",
824
+ // "side":"sell",
825
+ // "tick_direction":"down"
826
+ // }
827
+ //
828
+ // fetchMyTrades (private)
829
+ //
830
+ // {
831
+ // "id":"BTC-USDT:183566",
832
+ // "order_id":"17209376",
833
+ // "side":"sell",
834
+ // "fee_amount":"0.657396569175",
835
+ // "fee_currency_id":"USDT",
836
+ // "status":"settled",
837
+ // "price":"6573.96569175",
838
+ // "quantity":"0.1",
839
+ // "cost":"657.396569175",
840
+ // "time":"2018-08-10T06:06:46.000Z",
841
+ // "market_id":"BTC-USDT"
842
+ // }
843
+ //
844
+ const timestamp = this.parse8601(this.safeString(trade, 'time'));
845
+ const id = this.safeString(trade, 'id');
846
+ let marketId = undefined;
847
+ if (id !== undefined) {
848
+ const parts = id.split(':');
849
+ marketId = this.safeString(parts, 0);
850
+ }
851
+ marketId = this.safeString(trade, 'market_id', marketId);
852
+ const symbol = this.safeSymbol(marketId, market, '-');
853
+ const side = this.safeString(trade, 'side');
854
+ const priceString = this.safeString(trade, 'price');
855
+ const amountString = this.safeString(trade, 'quantity');
856
+ const orderId = this.safeString(trade, 'order_id');
857
+ const feeCostString = this.safeString(trade, 'fee_amount');
858
+ let fee = undefined;
859
+ if (feeCostString !== undefined) {
860
+ const feeCurrencyId = this.safeString(trade, 'fee_currency_id');
861
+ const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
862
+ fee = {
863
+ 'cost': feeCostString,
864
+ 'currency': feeCurrencyCode,
865
+ };
866
+ }
867
+ return this.safeTrade({
868
+ 'id': id,
869
+ 'info': trade,
870
+ 'timestamp': timestamp,
871
+ 'datetime': this.iso8601(timestamp),
872
+ 'symbol': symbol,
873
+ 'order': orderId,
874
+ 'type': undefined,
875
+ 'side': side,
876
+ 'takerOrMaker': undefined,
877
+ 'price': priceString,
878
+ 'amount': amountString,
879
+ 'cost': undefined,
880
+ 'fee': fee,
881
+ }, market);
882
+ }
883
+ async fetchTime(params = {}) {
884
+ /**
885
+ * @method
886
+ * @name probit#fetchTime
887
+ * @see https://docs-en.probit.com/reference/time
888
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
889
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
890
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
891
+ */
892
+ const response = await this.publicGetTime(params);
893
+ //
894
+ // { "data":"2020-04-12T18:54:25.390Z" }
895
+ //
896
+ const timestamp = this.parse8601(this.safeString(response, 'data'));
897
+ return timestamp;
898
+ }
899
+ normalizeOHLCVTimestamp(timestamp, timeframe, after = false) {
900
+ const duration = this.parseTimeframe(timeframe);
901
+ if (timeframe === '1M') {
902
+ const iso8601 = this.iso8601(timestamp);
903
+ const parts = iso8601.split('-');
904
+ const year = this.safeString(parts, 0);
905
+ const month = this.safeInteger(parts, 1);
906
+ let monthString = undefined;
907
+ if (after) {
908
+ monthString = this.sum(month, 1).toString();
909
+ }
910
+ if (month < 10) {
911
+ monthString = '0' + month.toString();
912
+ }
913
+ return year + '-' + monthString + '-01T00:00:00.000Z';
914
+ }
915
+ else if (timeframe === '1w') {
916
+ timestamp = this.parseToInt(timestamp / 1000);
917
+ const firstSunday = 259200; // 1970-01-04T00:00:00.000Z
918
+ const difference = timestamp - firstSunday;
919
+ const numWeeks = Math.floor(difference / duration);
920
+ let previousSunday = this.sum(firstSunday, numWeeks * duration);
921
+ if (after) {
922
+ previousSunday = this.sum(previousSunday, duration);
923
+ }
924
+ return this.iso8601(previousSunday * 1000);
925
+ }
926
+ else {
927
+ timestamp = this.parseToInt(timestamp / 1000);
928
+ timestamp = duration * this.parseToInt(timestamp / duration);
929
+ if (after) {
930
+ timestamp = this.sum(timestamp, duration);
931
+ }
932
+ return this.iso8601(timestamp * 1000);
933
+ }
934
+ }
935
+ async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
936
+ /**
937
+ * @method
938
+ * @name probit#fetchOHLCV
939
+ * @see https://docs-en.probit.com/reference/candle
940
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
941
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
942
+ * @param {string} timeframe the length of time each candle represents
943
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
944
+ * @param {int} [limit] the maximum amount of candles to fetch
945
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
946
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
947
+ */
948
+ await this.loadMarkets();
949
+ const market = this.market(symbol);
950
+ const interval = this.safeString(this.timeframes, timeframe, timeframe);
951
+ limit = (limit === undefined) ? 100 : limit;
952
+ let requestLimit = this.sum(limit, 1);
953
+ requestLimit = Math.min(1000, requestLimit); // max 1000
954
+ const request = {
955
+ 'market_ids': market['id'],
956
+ 'interval': interval,
957
+ 'sort': 'asc',
958
+ 'limit': requestLimit, // max 1000
959
+ };
960
+ const now = this.milliseconds();
961
+ const duration = this.parseTimeframe(timeframe);
962
+ let startTime = since;
963
+ let endTime = now;
964
+ if (since === undefined) {
965
+ if (limit === undefined) {
966
+ limit = requestLimit;
967
+ }
968
+ startTime = now - limit * duration * 1000;
969
+ }
970
+ else {
971
+ if (limit === undefined) {
972
+ endTime = now;
973
+ }
974
+ else {
975
+ endTime = this.sum(since, this.sum(limit, 1) * duration * 1000);
976
+ }
977
+ }
978
+ const startTimeNormalized = this.normalizeOHLCVTimestamp(startTime, timeframe);
979
+ const endTimeNormalized = this.normalizeOHLCVTimestamp(endTime, timeframe, true);
980
+ request['start_time'] = startTimeNormalized;
981
+ request['end_time'] = endTimeNormalized;
982
+ const response = await this.publicGetCandle(this.extend(request, params));
983
+ //
984
+ // {
985
+ // "data":[
986
+ // {
987
+ // "market_id":"ETH-BTC",
988
+ // "open":"0.02811",
989
+ // "close":"0.02811",
990
+ // "low":"0.02811",
991
+ // "high":"0.02811",
992
+ // "base_volume":"0.0005",
993
+ // "quote_volume":"0.000014055",
994
+ // "start_time":"2018-11-30T18:19:00.000Z",
995
+ // "end_time":"2018-11-30T18:20:00.000Z"
996
+ // },
997
+ // ]
998
+ // }
999
+ //
1000
+ const data = this.safeValue(response, 'data', []);
1001
+ return this.parseOHLCVs(data, market, timeframe, since, limit);
1002
+ }
1003
+ parseOHLCV(ohlcv, market = undefined) {
1004
+ //
1005
+ // {
1006
+ // "market_id":"ETH-BTC",
1007
+ // "open":"0.02811",
1008
+ // "close":"0.02811",
1009
+ // "low":"0.02811",
1010
+ // "high":"0.02811",
1011
+ // "base_volume":"0.0005",
1012
+ // "quote_volume":"0.000014055",
1013
+ // "start_time":"2018-11-30T18:19:00.000Z",
1014
+ // "end_time":"2018-11-30T18:20:00.000Z"
1015
+ // }
1016
+ //
1017
+ return [
1018
+ this.parse8601(this.safeString(ohlcv, 'start_time')),
1019
+ this.safeNumber(ohlcv, 'open'),
1020
+ this.safeNumber(ohlcv, 'high'),
1021
+ this.safeNumber(ohlcv, 'low'),
1022
+ this.safeNumber(ohlcv, 'close'),
1023
+ this.safeNumber(ohlcv, 'base_volume'),
1024
+ ];
1025
+ }
1026
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1027
+ /**
1028
+ * @method
1029
+ * @name probit#fetchOpenOrders
1030
+ * @see https://docs-en.probit.com/reference/open_order-1
1031
+ * @description fetch all unfilled currently open orders
1032
+ * @param {string} symbol unified market symbol
1033
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1034
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1035
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1036
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1037
+ */
1038
+ await this.loadMarkets();
1039
+ since = this.parse8601(since);
1040
+ const request = {};
1041
+ let market = undefined;
1042
+ if (symbol !== undefined) {
1043
+ market = this.market(symbol);
1044
+ request['market_id'] = market['id'];
1045
+ }
1046
+ const response = await this.privateGetOpenOrder(this.extend(request, params));
1047
+ const data = this.safeValue(response, 'data');
1048
+ return this.parseOrders(data, market, since, limit);
1049
+ }
1050
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1051
+ /**
1052
+ * @method
1053
+ * @name probit#fetchClosedOrders
1054
+ * @see https://docs-en.probit.com/reference/order
1055
+ * @description fetches information on multiple closed orders made by the user
1056
+ * @param {string} symbol unified market symbol of the market orders were made in
1057
+ * @param {int} [since] the earliest time in ms to fetch orders for
1058
+ * @param {int} [limit] the maximum number of order structures to retrieve
1059
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1060
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1061
+ */
1062
+ await this.loadMarkets();
1063
+ const request = {
1064
+ 'start_time': this.iso8601(0),
1065
+ 'end_time': this.iso8601(this.milliseconds()),
1066
+ 'limit': 100,
1067
+ };
1068
+ let market = undefined;
1069
+ if (symbol !== undefined) {
1070
+ market = this.market(symbol);
1071
+ request['market_id'] = market['id'];
1072
+ }
1073
+ if (since) {
1074
+ request['start_time'] = this.iso8601(since);
1075
+ }
1076
+ if (limit) {
1077
+ request['limit'] = limit;
1078
+ }
1079
+ const response = await this.privateGetOrderHistory(this.extend(request, params));
1080
+ const data = this.safeValue(response, 'data');
1081
+ return this.parseOrders(data, market, since, limit);
1082
+ }
1083
+ async fetchOrder(id, symbol = undefined, params = {}) {
1084
+ /**
1085
+ * @method
1086
+ * @name probit#fetchOrder
1087
+ * @see https://docs-en.probit.com/reference/order-3
1088
+ * @description fetches information on an order made by the user
1089
+ * @param {string} symbol unified symbol of the market the order was made in
1090
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1091
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1092
+ */
1093
+ if (symbol === undefined) {
1094
+ throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1095
+ }
1096
+ await this.loadMarkets();
1097
+ const market = this.market(symbol);
1098
+ const request = {
1099
+ 'market_id': market['id'],
1100
+ };
1101
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
1102
+ if (clientOrderId !== undefined) {
1103
+ request['client_order_id'] = clientOrderId;
1104
+ }
1105
+ else {
1106
+ request['order_id'] = id;
1107
+ }
1108
+ const query = this.omit(params, ['clientOrderId', 'client_order_id']);
1109
+ const response = await this.privateGetOrder(this.extend(request, query));
1110
+ const data = this.safeValue(response, 'data', []);
1111
+ const order = this.safeValue(data, 0);
1112
+ return this.parseOrder(order, market);
1113
+ }
1114
+ parseOrderStatus(status) {
1115
+ const statuses = {
1116
+ 'open': 'open',
1117
+ 'cancelled': 'canceled',
1118
+ 'filled': 'closed',
1119
+ };
1120
+ return this.safeString(statuses, status, status);
1121
+ }
1122
+ parseOrder(order, market = undefined) {
1123
+ //
1124
+ // {
1125
+ // id,
1126
+ // user_id,
1127
+ // market_id,
1128
+ // "type": "orderType",
1129
+ // "side": "side",
1130
+ // quantity,
1131
+ // limit_price,
1132
+ // "time_in_force": "timeInForce",
1133
+ // filled_cost,
1134
+ // filled_quantity,
1135
+ // open_quantity,
1136
+ // cancelled_quantity,
1137
+ // "status": "orderStatus",
1138
+ // "time": "date",
1139
+ // client_order_id,
1140
+ // }
1141
+ //
1142
+ const status = this.parseOrderStatus(this.safeString(order, 'status'));
1143
+ const id = this.safeString(order, 'id');
1144
+ const type = this.safeString(order, 'type');
1145
+ const side = this.safeString(order, 'side');
1146
+ const marketId = this.safeString(order, 'market_id');
1147
+ const symbol = this.safeSymbol(marketId, market, '-');
1148
+ const timestamp = this.parse8601(this.safeString(order, 'time'));
1149
+ let price = this.safeString(order, 'limit_price');
1150
+ const filled = this.safeString(order, 'filled_quantity');
1151
+ let remaining = this.safeString(order, 'open_quantity');
1152
+ const canceledAmount = this.safeString(order, 'cancelled_quantity');
1153
+ if (canceledAmount !== undefined) {
1154
+ remaining = Precise["default"].stringAdd(remaining, canceledAmount);
1155
+ }
1156
+ const amount = this.safeString(order, 'quantity', Precise["default"].stringAdd(filled, remaining));
1157
+ const cost = this.safeString2(order, 'filled_cost', 'cost');
1158
+ if (type === 'market') {
1159
+ price = undefined;
1160
+ }
1161
+ const clientOrderId = this.safeString(order, 'client_order_id');
1162
+ const timeInForce = this.safeStringUpper(order, 'time_in_force');
1163
+ return this.safeOrder({
1164
+ 'id': id,
1165
+ 'info': order,
1166
+ 'clientOrderId': clientOrderId,
1167
+ 'timestamp': timestamp,
1168
+ 'datetime': this.iso8601(timestamp),
1169
+ 'lastTradeTimestamp': undefined,
1170
+ 'symbol': symbol,
1171
+ 'type': type,
1172
+ 'timeInForce': timeInForce,
1173
+ 'side': side,
1174
+ 'status': status,
1175
+ 'price': price,
1176
+ 'stopPrice': undefined,
1177
+ 'triggerPrice': undefined,
1178
+ 'amount': amount,
1179
+ 'filled': filled,
1180
+ 'remaining': remaining,
1181
+ 'average': undefined,
1182
+ 'cost': cost,
1183
+ 'fee': undefined,
1184
+ 'trades': undefined,
1185
+ }, market);
1186
+ }
1187
+ costToPrecision(symbol, cost) {
1188
+ return this.decimalToPrecision(cost, number.TRUNCATE, this.markets[symbol]['precision']['cost'], this.precisionMode);
1189
+ }
1190
+ async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1191
+ /**
1192
+ * @method
1193
+ * @name probit#createOrder
1194
+ * @description create a trade order
1195
+ * @see https://docs-en.probit.com/reference/order-1
1196
+ * @param {string} symbol unified symbol of the market to create an order in
1197
+ * @param {string} type 'market' or 'limit'
1198
+ * @param {string} side 'buy' or 'sell'
1199
+ * @param {float} amount how much you want to trade in units of the base currency
1200
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1201
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1202
+ * @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount for market buy orders
1203
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1204
+ */
1205
+ await this.loadMarkets();
1206
+ const market = this.market(symbol);
1207
+ const options = this.safeValue(this.options, 'timeInForce');
1208
+ const defaultTimeInForce = this.safeValue(options, type);
1209
+ const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force', defaultTimeInForce);
1210
+ const request = {
1211
+ 'market_id': market['id'],
1212
+ 'type': type,
1213
+ 'side': side,
1214
+ 'time_in_force': timeInForce,
1215
+ };
1216
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
1217
+ if (clientOrderId !== undefined) {
1218
+ request['client_order_id'] = clientOrderId;
1219
+ }
1220
+ let quoteAmount = undefined;
1221
+ if (type === 'limit') {
1222
+ request['limit_price'] = this.priceToPrecision(symbol, price);
1223
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1224
+ }
1225
+ else if (type === 'market') {
1226
+ // for market buy it requires the amount of quote currency to spend
1227
+ if (side === 'buy') {
1228
+ let createMarketBuyOrderRequiresPrice = true;
1229
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1230
+ const cost = this.safeString(params, 'cost');
1231
+ params = this.omit(params, 'cost');
1232
+ if (cost !== undefined) {
1233
+ quoteAmount = this.costToPrecision(symbol, cost);
1234
+ }
1235
+ else if (createMarketBuyOrderRequiresPrice) {
1236
+ if (price === undefined) {
1237
+ 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');
1238
+ }
1239
+ else {
1240
+ const amountString = this.numberToString(amount);
1241
+ const priceString = this.numberToString(price);
1242
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1243
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1244
+ }
1245
+ }
1246
+ else {
1247
+ quoteAmount = this.costToPrecision(symbol, amount);
1248
+ }
1249
+ request['cost'] = quoteAmount;
1250
+ }
1251
+ else {
1252
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1253
+ }
1254
+ }
1255
+ const query = this.omit(params, ['timeInForce', 'time_in_force', 'clientOrderId', 'client_order_id']);
1256
+ const response = await this.privatePostNewOrder(this.extend(request, query));
1257
+ //
1258
+ // {
1259
+ // "data": {
1260
+ // id,
1261
+ // user_id,
1262
+ // market_id,
1263
+ // "type": "orderType",
1264
+ // "side": "side",
1265
+ // quantity,
1266
+ // limit_price,
1267
+ // "time_in_force": "timeInForce",
1268
+ // filled_cost,
1269
+ // filled_quantity,
1270
+ // open_quantity,
1271
+ // cancelled_quantity,
1272
+ // "status": "orderStatus",
1273
+ // "time": "date",
1274
+ // client_order_id,
1275
+ // }
1276
+ // }
1277
+ //
1278
+ const data = this.safeValue(response, 'data');
1279
+ const order = this.parseOrder(data, market);
1280
+ // a workaround for incorrect huge amounts
1281
+ // returned by the exchange on market buys
1282
+ if ((type === 'market') && (side === 'buy')) {
1283
+ order['amount'] = undefined;
1284
+ order['cost'] = this.parseNumber(quoteAmount);
1285
+ order['remaining'] = undefined;
1286
+ }
1287
+ return order;
1288
+ }
1289
+ async cancelOrder(id, symbol = undefined, params = {}) {
1290
+ /**
1291
+ * @method
1292
+ * @name probit#cancelOrder
1293
+ * @see https://docs-en.probit.com/reference/order-2
1294
+ * @description cancels an open order
1295
+ * @param {string} id order id
1296
+ * @param {string} symbol unified symbol of the market the order was made in
1297
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1298
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1299
+ */
1300
+ if (symbol === undefined) {
1301
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1302
+ }
1303
+ await this.loadMarkets();
1304
+ const market = this.market(symbol);
1305
+ const request = {
1306
+ 'market_id': market['id'],
1307
+ 'order_id': id,
1308
+ };
1309
+ const response = await this.privatePostCancelOrder(this.extend(request, params));
1310
+ const data = this.safeValue(response, 'data');
1311
+ return this.parseOrder(data);
1312
+ }
1313
+ parseDepositAddress(depositAddress, currency = undefined) {
1314
+ const address = this.safeString(depositAddress, 'address');
1315
+ const tag = this.safeString(depositAddress, 'destination_tag');
1316
+ const currencyId = this.safeString(depositAddress, 'currency_id');
1317
+ currency = this.safeCurrency(currencyId, currency);
1318
+ const code = currency['code'];
1319
+ const network = this.safeString(depositAddress, 'platform_id');
1320
+ this.checkAddress(address);
1321
+ return {
1322
+ 'currency': code,
1323
+ 'address': address,
1324
+ 'tag': tag,
1325
+ 'network': network,
1326
+ 'info': depositAddress,
1327
+ };
1328
+ }
1329
+ async fetchDepositAddress(code, params = {}) {
1330
+ /**
1331
+ * @method
1332
+ * @name probit#fetchDepositAddress
1333
+ * @see https://docs-en.probit.com/reference/deposit_address
1334
+ * @description fetch the deposit address for a currency associated with this account
1335
+ * @param {string} code unified currency code
1336
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1337
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1338
+ */
1339
+ await this.loadMarkets();
1340
+ const currency = this.currency(code);
1341
+ const request = {
1342
+ 'currency_id': currency['id'],
1343
+ // 'platform_id': 'TRON', (undocumented)
1344
+ };
1345
+ const networks = this.safeValue(this.options, 'networks', {});
1346
+ let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
1347
+ network = this.safeString(networks, network, network); // handle ERC20>ETH alias
1348
+ if (network !== undefined) {
1349
+ request['platform_id'] = network;
1350
+ params = this.omit(params, 'platform_id');
1351
+ }
1352
+ const response = await this.privateGetDepositAddress(this.extend(request, params));
1353
+ //
1354
+ // without 'platform_id'
1355
+ // {
1356
+ // "data":[
1357
+ // {
1358
+ // "currency_id":"ETH",
1359
+ // "address":"0x12e2caf3c4051ba1146e612f532901a423a9898a",
1360
+ // "destination_tag":null
1361
+ // }
1362
+ // ]
1363
+ // }
1364
+ //
1365
+ // with 'platform_id'
1366
+ // {
1367
+ // "data":[
1368
+ // {
1369
+ // "platform_id":"TRON",
1370
+ // "address":"TDQLMxBTa6MzuoZ6deSGZkqET3Ek8v7uC6",
1371
+ // "destination_tag":null
1372
+ // }
1373
+ // ]
1374
+ // }
1375
+ //
1376
+ const data = this.safeValue(response, 'data', []);
1377
+ const firstAddress = this.safeValue(data, 0);
1378
+ if (firstAddress === undefined) {
1379
+ throw new errors.InvalidAddress(this.id + ' fetchDepositAddress() returned an empty response');
1380
+ }
1381
+ return this.parseDepositAddress(firstAddress, currency);
1382
+ }
1383
+ async fetchDepositAddresses(codes = undefined, params = {}) {
1384
+ /**
1385
+ * @method
1386
+ * @name probit#fetchDepositAddresses
1387
+ * @see https://docs-en.probit.com/reference/deposit_address
1388
+ * @description fetch deposit addresses for multiple currencies and chain types
1389
+ * @param {string[]|undefined} codes list of unified currency codes, default is undefined
1390
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1391
+ * @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
1392
+ */
1393
+ await this.loadMarkets();
1394
+ const request = {};
1395
+ if (codes) {
1396
+ const currencyIds = [];
1397
+ for (let i = 0; i < codes.length; i++) {
1398
+ const currency = this.currency(codes[i]);
1399
+ currencyIds.push(currency['id']);
1400
+ }
1401
+ request['currency_id'] = codes.join(',');
1402
+ }
1403
+ const response = await this.privateGetDepositAddress(this.extend(request, params));
1404
+ const data = this.safeValue(response, 'data', []);
1405
+ return this.parseDepositAddresses(data, codes);
1406
+ }
1407
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
1408
+ /**
1409
+ * @method
1410
+ * @name probit#withdraw
1411
+ * @see https://docs-en.probit.com/reference/withdrawal
1412
+ * @description make a withdrawal
1413
+ * @param {string} code unified currency code
1414
+ * @param {float} amount the amount to withdraw
1415
+ * @param {string} address the address to withdraw to
1416
+ * @param {string} tag
1417
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1418
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1419
+ */
1420
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1421
+ // In order to use this method
1422
+ // you need to allow API withdrawal from the API Settings Page, and
1423
+ // and register the list of withdrawal addresses and destination tags on the API Settings page
1424
+ // you can only withdraw to the registered addresses using the API
1425
+ this.checkAddress(address);
1426
+ await this.loadMarkets();
1427
+ const currency = this.currency(code);
1428
+ if (tag === undefined) {
1429
+ tag = '';
1430
+ }
1431
+ const request = {
1432
+ 'currency_id': currency['id'],
1433
+ // 'platform_id': 'ETH', // if omitted it will use the default platform for the currency
1434
+ 'address': address,
1435
+ 'destination_tag': tag,
1436
+ 'amount': this.numberToString(amount),
1437
+ // which currency to pay the withdrawal fees
1438
+ // only applicable for currencies that accepts multiple withdrawal fee options
1439
+ // 'fee_currency_id': 'ETH', // if omitted it will use the default fee policy for each currency
1440
+ // whether the amount field includes fees
1441
+ // 'include_fee': false, // makes sense only when fee_currency_id is equal to currency_id
1442
+ };
1443
+ const networks = this.safeValue(this.options, 'networks', {});
1444
+ let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
1445
+ network = this.safeString(networks, network, network); // handle ERC20>ETH alias
1446
+ if (network !== undefined) {
1447
+ request['platform_id'] = network;
1448
+ params = this.omit(params, 'network');
1449
+ }
1450
+ const response = await this.privatePostWithdrawal(this.extend(request, params));
1451
+ const data = this.safeValue(response, 'data');
1452
+ return this.parseTransaction(data, currency);
1453
+ }
1454
+ async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1455
+ /**
1456
+ * @method
1457
+ * @name probit#fetchDeposits
1458
+ * @description fetch all deposits made to an account
1459
+ * @param {string} code unified currency code
1460
+ * @param {int} [since] the earliest time in ms to fetch deposits for
1461
+ * @param {int} [limit] the maximum number of transaction structures to retrieve
1462
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1463
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1464
+ */
1465
+ const request = {
1466
+ 'type': 'deposit',
1467
+ };
1468
+ const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
1469
+ return result;
1470
+ }
1471
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1472
+ /**
1473
+ * @method
1474
+ * @name probit#fetchWithdrawals
1475
+ * @description fetch all withdrawals made to an account
1476
+ * @param {string} code unified currency code
1477
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
1478
+ * @param {int} [limit] the maximum number of transaction structures to retrieve
1479
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1480
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1481
+ */
1482
+ const request = {
1483
+ 'type': 'withdrawal',
1484
+ };
1485
+ const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
1486
+ return result;
1487
+ }
1488
+ async fetchTransactions(code = undefined, since = undefined, limit = undefined, params = {}) {
1489
+ /**
1490
+ * @method
1491
+ * @name probit#fetchTransactions
1492
+ * @deprecated
1493
+ * @description use fetchDepositsWithdrawals instead
1494
+ * @see https://docs-en.probit.com/reference/transferpayment
1495
+ * @param {string} code unified currency code
1496
+ * @param {int} [since] the earliest time in ms to fetch transactions for
1497
+ * @param {int} [limit] the maximum number of transaction structures to retrieve
1498
+ * @param {int} [params.until] the latest time in ms to fetch transactions for
1499
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1500
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1501
+ */
1502
+ await this.loadMarkets();
1503
+ let currency = undefined;
1504
+ const request = {};
1505
+ if (code !== undefined) {
1506
+ currency = this.currency(code);
1507
+ request['currency_id'] = currency['id'];
1508
+ }
1509
+ if (since !== undefined) {
1510
+ request['start_time'] = this.iso8601(since);
1511
+ }
1512
+ else {
1513
+ request['start_time'] = this.iso8601(1);
1514
+ }
1515
+ const until = this.safeInteger2(params, 'till', 'until');
1516
+ if (until !== undefined) {
1517
+ request['end_time'] = this.iso8601(until);
1518
+ params = this.omit(params, ['until', 'till']);
1519
+ }
1520
+ else {
1521
+ request['end_time'] = this.iso8601(this.milliseconds());
1522
+ }
1523
+ if (limit !== undefined) {
1524
+ request['limit'] = limit;
1525
+ }
1526
+ else {
1527
+ request['limit'] = 100;
1528
+ }
1529
+ const response = await this.privateGetTransferPayment(this.extend(request, params));
1530
+ //
1531
+ // {
1532
+ // "data": [
1533
+ // {
1534
+ // "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
1535
+ // "type": "deposit",
1536
+ // "status": "done",
1537
+ // "amount": "0.01",
1538
+ // "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
1539
+ // "time": "2023-06-14T12:03:11.000Z",
1540
+ // "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
1541
+ // "currency_id": "ETH",
1542
+ // "confirmations":0,
1543
+ // "fee": "0",
1544
+ // "destination_tag": null,
1545
+ // "platform_id": "ETH",
1546
+ // "fee_currency_id": "ETH",
1547
+ // "payment_service_name":null,
1548
+ // "payment_service_display_name":null,
1549
+ // "crypto":null
1550
+ // }
1551
+ // ]
1552
+ // }
1553
+ //
1554
+ const data = this.safeValue(response, 'data', {});
1555
+ return this.parseTransactions(data, currency, since, limit);
1556
+ }
1557
+ parseTransaction(transaction, currency = undefined) {
1558
+ //
1559
+ // {
1560
+ // "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
1561
+ // "type": "deposit",
1562
+ // "status": "done",
1563
+ // "amount": "0.01",
1564
+ // "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
1565
+ // "time": "2023-06-14T12:03:11.000Z",
1566
+ // "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
1567
+ // "currency_id": "ETH",
1568
+ // "confirmations":0,
1569
+ // "fee": "0",
1570
+ // "destination_tag": null,
1571
+ // "platform_id": "ETH",
1572
+ // "fee_currency_id": "ETH",
1573
+ // "payment_service_name":null,
1574
+ // "payment_service_display_name":null,
1575
+ // "crypto":null
1576
+ // }
1577
+ //
1578
+ const id = this.safeString(transaction, 'id');
1579
+ const networkId = this.safeString(transaction, 'platform_id');
1580
+ const networkCode = this.networkIdToCode(networkId);
1581
+ const amount = this.safeNumber(transaction, 'amount');
1582
+ const address = this.safeString(transaction, 'address');
1583
+ const tag = this.safeString(transaction, 'destination_tag');
1584
+ const txid = this.safeString(transaction, 'hash');
1585
+ const timestamp = this.parse8601(this.safeString(transaction, 'time'));
1586
+ const type = this.safeString(transaction, 'type');
1587
+ const currencyId = this.safeString(transaction, 'currency_id');
1588
+ const code = this.safeCurrencyCode(currencyId);
1589
+ const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
1590
+ const feeCost = this.safeNumber(transaction, 'fee');
1591
+ let fee = undefined;
1592
+ if (feeCost !== undefined && feeCost !== 0) {
1593
+ fee = {
1594
+ 'currency': code,
1595
+ 'cost': feeCost,
1596
+ };
1597
+ }
1598
+ return {
1599
+ 'id': id,
1600
+ 'currency': code,
1601
+ 'amount': amount,
1602
+ 'network': networkCode,
1603
+ 'addressFrom': undefined,
1604
+ 'address': address,
1605
+ 'addressTo': address,
1606
+ 'tagFrom': undefined,
1607
+ 'tag': tag,
1608
+ 'tagTo': tag,
1609
+ 'status': status,
1610
+ 'type': type,
1611
+ 'txid': txid,
1612
+ 'timestamp': timestamp,
1613
+ 'datetime': this.iso8601(timestamp),
1614
+ 'updated': undefined,
1615
+ 'internal': undefined,
1616
+ 'comment': undefined,
1617
+ 'fee': fee,
1618
+ 'info': transaction,
1619
+ };
1620
+ }
1621
+ parseTransactionStatus(status) {
1622
+ const statuses = {
1623
+ 'requested': 'pending',
1624
+ 'pending': 'pending',
1625
+ 'confirming': 'pending',
1626
+ 'confirmed': 'pending',
1627
+ 'applying': 'pending',
1628
+ 'done': 'ok',
1629
+ 'cancelled': 'canceled',
1630
+ 'cancelling': 'canceled',
1631
+ };
1632
+ return this.safeString(statuses, status, status);
1633
+ }
1634
+ async fetchDepositWithdrawFees(codes = undefined, params = {}) {
1635
+ /**
1636
+ * @method
1637
+ * @name probit#fetchDepositWithdrawFees
1638
+ * @see https://docs-en.probit.com/reference/currency
1639
+ * @description fetch deposit and withdraw fees
1640
+ * @param {string[]|undefined} codes list of unified currency codes
1641
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1642
+ * @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1643
+ */
1644
+ await this.loadMarkets();
1645
+ const response = await this.publicGetCurrencyWithPlatform(params);
1646
+ //
1647
+ // {
1648
+ // "data": [
1649
+ // {
1650
+ // "id": "AFX",
1651
+ // "display_name": {
1652
+ // "ko-kr": "아프릭스",
1653
+ // "en-us": "Afrix"
1654
+ // },
1655
+ // "show_in_ui": true,
1656
+ // "platform": [
1657
+ // {
1658
+ // "id": "ZYN",
1659
+ // "priority": 1,
1660
+ // "deposit": true,
1661
+ // "withdrawal": true,
1662
+ // "currency_id": "AFX",
1663
+ // "precision": 18,
1664
+ // "min_confirmation_count": 60,
1665
+ // "require_destination_tag": false,
1666
+ // "allow_withdrawal_destination_tag": false,
1667
+ // "display_name": {
1668
+ // "name": {
1669
+ // "ko-kr": "지네코인",
1670
+ // "en-us": "Wethio"
1671
+ // }
1672
+ // },
1673
+ // "min_deposit_amount": "0",
1674
+ // "min_withdrawal_amount": "0",
1675
+ // "withdrawal_fee": [
1676
+ // {
1677
+ // "currency_id": "ZYN",
1678
+ // "amount": "0.5",
1679
+ // "priority": 1
1680
+ // }
1681
+ // ],
1682
+ // "deposit_fee": {},
1683
+ // "suspended_reason": "",
1684
+ // "deposit_suspended": false,
1685
+ // "withdrawal_suspended": false,
1686
+ // "platform_currency_display_name": {}
1687
+ // }
1688
+ // ],
1689
+ // "internal_transfer": {
1690
+ // "suspended_reason": null,
1691
+ // "suspended": false
1692
+ // },
1693
+ // "stakeable": false,
1694
+ // "unstakeable": false,
1695
+ // "auto_stake": false,
1696
+ // "auto_stake_amount": "0"
1697
+ // },
1698
+ // ]
1699
+ // }
1700
+ //
1701
+ const data = this.safeValue(response, 'data');
1702
+ return this.parseDepositWithdrawFees(data, codes, 'id');
1703
+ }
1704
+ parseDepositWithdrawFee(fee, currency = undefined) {
1705
+ //
1706
+ // {
1707
+ // "id": "USDT",
1708
+ // "display_name": { "ko-kr": '테더', "en-us": "Tether" },
1709
+ // "show_in_ui": true,
1710
+ // "platform": [
1711
+ // {
1712
+ // "id": "ETH",
1713
+ // "priority": "1",
1714
+ // "deposit": true,
1715
+ // "withdrawal": true,
1716
+ // "currency_id": "USDT",
1717
+ // "precision": "6",
1718
+ // "min_confirmation_count": "15",
1719
+ // "require_destination_tag": false,
1720
+ // "allow_withdrawal_destination_tag": false,
1721
+ // "display_name": [Object],
1722
+ // "min_deposit_amount": "0",
1723
+ // "min_withdrawal_amount": "1",
1724
+ // "withdrawal_fee": [Array],
1725
+ // "deposit_fee": {},
1726
+ // "suspended_reason": '',
1727
+ // "deposit_suspended": false,
1728
+ // "withdrawal_suspended": false,
1729
+ // "platform_currency_display_name": [Object]
1730
+ // },
1731
+ // ],
1732
+ // "internal_transfer": { suspended_reason: null, suspended: false },
1733
+ // "stakeable": false,
1734
+ // "unstakeable": false,
1735
+ // "auto_stake": false,
1736
+ // "auto_stake_amount": "0"
1737
+ // }
1738
+ //
1739
+ const depositWithdrawFee = this.depositWithdrawFee({});
1740
+ const platforms = this.safeValue(fee, 'platform', []);
1741
+ const depositResult = {
1742
+ 'fee': undefined,
1743
+ 'percentage': undefined,
1744
+ };
1745
+ for (let i = 0; i < platforms.length; i++) {
1746
+ const network = platforms[i];
1747
+ const networkId = this.safeString(network, 'id');
1748
+ const networkCode = this.networkIdToCode(networkId, currency['code']);
1749
+ const withdrawalFees = this.safeValue(network, 'withdrawal_fee', {});
1750
+ const withdrawFee = this.safeNumber(withdrawalFees[0], 'amount');
1751
+ if (withdrawalFees.length) {
1752
+ const withdrawResult = {
1753
+ 'fee': withdrawFee,
1754
+ 'percentage': (withdrawFee !== undefined) ? false : undefined,
1755
+ };
1756
+ if (i === 0) {
1757
+ depositWithdrawFee['withdraw'] = withdrawResult;
1758
+ }
1759
+ depositWithdrawFee['networks'][networkCode] = {
1760
+ 'withdraw': withdrawResult,
1761
+ 'deposit': depositResult,
1762
+ };
1763
+ }
1764
+ }
1765
+ depositWithdrawFee['info'] = fee;
1766
+ return depositWithdrawFee;
1767
+ }
1768
+ nonce() {
1769
+ return this.milliseconds();
1770
+ }
1771
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1772
+ let url = this.urls['api'][api] + '/';
1773
+ const query = this.omit(params, this.extractParams(path));
1774
+ if (api === 'accounts') {
1775
+ this.checkRequiredCredentials();
1776
+ url += this.implodeParams(path, params);
1777
+ const auth = this.apiKey + ':' + this.secret;
1778
+ const auth64 = this.stringToBase64(auth);
1779
+ headers = {
1780
+ 'Authorization': 'Basic ' + auth64,
1781
+ 'Content-Type': 'application/json',
1782
+ };
1783
+ if (Object.keys(query).length) {
1784
+ body = this.json(query);
1785
+ }
1786
+ }
1787
+ else {
1788
+ url += this.version + '/';
1789
+ if (api === 'public') {
1790
+ url += this.implodeParams(path, params);
1791
+ if (Object.keys(query).length) {
1792
+ url += '?' + this.urlencode(query);
1793
+ }
1794
+ }
1795
+ else if (api === 'private') {
1796
+ const now = this.milliseconds();
1797
+ this.checkRequiredCredentials();
1798
+ const expires = this.safeInteger(this.options, 'expires');
1799
+ if ((expires === undefined) || (expires < now)) {
1800
+ throw new errors.AuthenticationError(this.id + ' access token expired, call signIn() method');
1801
+ }
1802
+ const accessToken = this.safeString(this.options, 'accessToken');
1803
+ headers = {
1804
+ 'Authorization': 'Bearer ' + accessToken,
1805
+ };
1806
+ url += this.implodeParams(path, params);
1807
+ if (method === 'GET') {
1808
+ if (Object.keys(query).length) {
1809
+ url += '?' + this.urlencode(query);
1810
+ }
1811
+ }
1812
+ else if (Object.keys(query).length) {
1813
+ body = this.json(query);
1814
+ headers['Content-Type'] = 'application/json';
1815
+ }
1816
+ }
1817
+ }
1818
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1819
+ }
1820
+ async signIn(params = {}) {
1821
+ /**
1822
+ * @method
1823
+ * @name probit#signIn
1824
+ * @see https://docs-en.probit.com/reference/token
1825
+ * @description sign in, must be called prior to using other authenticated methods
1826
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1827
+ * @returns response from exchange
1828
+ */
1829
+ this.checkRequiredCredentials();
1830
+ const request = {
1831
+ 'grant_type': 'client_credentials', // the only supported value
1832
+ };
1833
+ const response = await this.accountsPostToken(this.extend(request, params));
1834
+ //
1835
+ // {
1836
+ // "access_token": "0ttDv/2hTTn3bLi8GP1gKaneiEQ6+0hOBenPrxNQt2s=",
1837
+ // "token_type": "bearer",
1838
+ // "expires_in": 900
1839
+ // }
1840
+ //
1841
+ const expiresIn = this.safeInteger(response, 'expires_in');
1842
+ const accessToken = this.safeString(response, 'access_token');
1843
+ this.options['accessToken'] = accessToken;
1844
+ this.options['expires'] = this.sum(this.milliseconds(), expiresIn * 1000);
1845
+ return response;
1846
+ }
1847
+ handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1848
+ if (response === undefined) {
1849
+ return undefined; // fallback to default error handler
1850
+ }
1851
+ if ('errorCode' in response) {
1852
+ const errorCode = this.safeString(response, 'errorCode');
1853
+ const message = this.safeString(response, 'message');
1854
+ if (errorCode !== undefined) {
1855
+ const feedback = this.id + ' ' + body;
1856
+ this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
1857
+ this.throwBroadlyMatchedException(this.exceptions['exact'], errorCode, feedback);
1858
+ throw new errors.ExchangeError(feedback);
1859
+ }
1860
+ }
1861
+ return undefined;
1862
+ }
1863
+ }
1864
+
1865
+ module.exports = probit;