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