ccxt 4.2.11 → 4.2.13

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 (392) hide show
  1. package/README.md +5 -5
  2. package/build.sh +2 -2
  3. package/dist/ccxt.browser.js +1347 -490
  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 +2209 -0
  125. package/dist/cjs/js/src/binance.js +9736 -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 +3807 -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 +8291 -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 +3424 -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 +7072 -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 +9049 -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 +761 -0
  185. package/dist/cjs/js/src/indodax.js +1069 -0
  186. package/dist/cjs/js/src/kraken.js +2857 -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 +2851 -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 +7330 -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 +4722 -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 +1608 -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 +1867 -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 +2765 -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/js/ccxt.d.ts +1 -1
  329. package/js/ccxt.js +1 -1
  330. package/js/src/abstract/bigone.d.ts +18 -0
  331. package/js/src/abstract/binance.d.ts +2 -0
  332. package/js/src/abstract/binancecoinm.d.ts +2 -0
  333. package/js/src/abstract/binanceus.d.ts +2 -0
  334. package/js/src/abstract/binanceusdm.d.ts +2 -0
  335. package/js/src/abstract/bingx.d.ts +2 -0
  336. package/js/src/abstract/bybit.d.ts +1 -0
  337. package/js/src/abstract/gate.d.ts +11 -0
  338. package/js/src/abstract/gateio.d.ts +11 -0
  339. package/js/src/abstract/okx.d.ts +1 -0
  340. package/js/src/alpaca.js +18 -18
  341. package/js/src/base/Exchange.d.ts +5 -1
  342. package/js/src/base/Exchange.js +101 -12
  343. package/js/src/bigone.d.ts +3 -2
  344. package/js/src/bigone.js +429 -167
  345. package/js/src/binance.js +48 -34
  346. package/js/src/bingx.js +115 -38
  347. package/js/src/bitfinex.d.ts +2 -2
  348. package/js/src/bitfinex.js +2 -3
  349. package/js/src/bitget.js +33 -13
  350. package/js/src/bitmart.d.ts +2 -2
  351. package/js/src/bitmart.js +5 -5
  352. package/js/src/bitmex.js +1 -0
  353. package/js/src/bybit.js +2 -0
  354. package/js/src/coinbase.d.ts +26 -3
  355. package/js/src/coinbase.js +176 -26
  356. package/js/src/coinlist.js +3 -4
  357. package/js/src/coinone.js +1 -1
  358. package/js/src/coinsph.js +2 -3
  359. package/js/src/deribit.js +1 -0
  360. package/js/src/gate.d.ts +4 -4
  361. package/js/src/gate.js +96 -59
  362. package/js/src/gemini.js +1 -1
  363. package/js/src/hitbtc.d.ts +4 -4
  364. package/js/src/hitbtc.js +2 -3
  365. package/js/src/htx.d.ts +1 -0
  366. package/js/src/htx.js +29 -7
  367. package/js/src/huobijp.js +2 -3
  368. package/js/src/independentreserve.js +7 -5
  369. package/js/src/kraken.js +3 -6
  370. package/js/src/lbank.js +59 -33
  371. package/js/src/mexc.js +2 -1
  372. package/js/src/oceanex.js +1 -1
  373. package/js/src/okx.js +14 -3
  374. package/js/src/phemex.js +9 -2
  375. package/js/src/pro/binance.d.ts +2 -23
  376. package/js/src/pro/binance.js +58 -22
  377. package/js/src/pro/coinbase.d.ts +2 -2
  378. package/js/src/pro/coinbase.js +4 -1
  379. package/js/src/pro/coinbasepro.d.ts +2 -2
  380. package/js/src/pro/hitbtc.d.ts +2 -2
  381. package/js/src/pro/kraken.js +1 -1
  382. package/js/src/pro/okx.d.ts +1 -0
  383. package/js/src/pro/okx.js +52 -2
  384. package/js/src/pro/poloniex.d.ts +2 -2
  385. package/js/src/probit.js +4 -2
  386. package/js/src/upbit.d.ts +3 -101
  387. package/js/src/upbit.js +12 -12
  388. package/js/src/wavesexchange.js +1 -1
  389. package/js/src/woo.d.ts +2 -0
  390. package/js/src/woo.js +52 -0
  391. package/package.json +1 -1
  392. package/skip-tests.json +5 -0
@@ -0,0 +1,2188 @@
1
+ 'use strict';
2
+
3
+ var bitstamp$1 = require('./abstract/bitstamp.js');
4
+ var errors = require('./base/errors.js');
5
+ var Precise = require('./base/Precise.js');
6
+ var number = require('./base/functions/number.js');
7
+ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
8
+
9
+ // ---------------------------------------------------------------------------
10
+ // ---------------------------------------------------------------------------
11
+ /**
12
+ * @class bitstamp
13
+ * @augments Exchange
14
+ */
15
+ class bitstamp extends bitstamp$1 {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'bitstamp',
19
+ 'name': 'Bitstamp',
20
+ 'countries': ['GB'],
21
+ // 8000 requests per 10 minutes = 8000 / 600 = 13.33333333 requests per second => 1000ms / 13.33333333 = 75ms between requests on average
22
+ 'rateLimit': 75,
23
+ 'version': 'v2',
24
+ 'userAgent': this.userAgents['chrome'],
25
+ 'pro': true,
26
+ 'has': {
27
+ 'CORS': true,
28
+ 'spot': true,
29
+ 'margin': false,
30
+ 'swap': false,
31
+ 'future': false,
32
+ 'option': false,
33
+ 'addMargin': false,
34
+ 'cancelAllOrders': true,
35
+ 'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
38
+ 'createOrder': true,
39
+ 'createReduceOnlyOrder': false,
40
+ 'createStopLimitOrder': false,
41
+ 'createStopMarketOrder': false,
42
+ 'createStopOrder': false,
43
+ 'fetchBalance': true,
44
+ 'fetchBorrowRateHistories': false,
45
+ 'fetchBorrowRateHistory': false,
46
+ 'fetchCrossBorrowRate': false,
47
+ 'fetchCrossBorrowRates': false,
48
+ 'fetchCurrencies': true,
49
+ 'fetchDepositAddress': true,
50
+ 'fetchDepositsWithdrawals': true,
51
+ 'fetchDepositWithdrawFee': 'emulated',
52
+ 'fetchDepositWithdrawFees': true,
53
+ 'fetchFundingHistory': false,
54
+ 'fetchFundingRate': false,
55
+ 'fetchFundingRateHistory': false,
56
+ 'fetchFundingRates': false,
57
+ 'fetchIndexOHLCV': false,
58
+ 'fetchIsolatedBorrowRate': false,
59
+ 'fetchIsolatedBorrowRates': false,
60
+ 'fetchLedger': true,
61
+ 'fetchLeverage': false,
62
+ 'fetchMarginMode': false,
63
+ 'fetchMarkets': true,
64
+ 'fetchMarkOHLCV': false,
65
+ 'fetchMyTrades': true,
66
+ 'fetchOHLCV': true,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': true,
69
+ 'fetchOrder': true,
70
+ 'fetchOrderBook': true,
71
+ 'fetchPosition': false,
72
+ 'fetchPositionMode': false,
73
+ 'fetchPositions': false,
74
+ 'fetchPositionsRisk': false,
75
+ 'fetchPremiumIndexOHLCV': false,
76
+ 'fetchTicker': true,
77
+ 'fetchTickers': true,
78
+ 'fetchTrades': true,
79
+ 'fetchTradingFee': true,
80
+ 'fetchTradingFees': true,
81
+ 'fetchTransactionFees': true,
82
+ 'fetchTransactions': 'emulated',
83
+ 'fetchWithdrawals': true,
84
+ 'reduceMargin': false,
85
+ 'setLeverage': false,
86
+ 'setMarginMode': false,
87
+ 'setPositionMode': false,
88
+ 'withdraw': true,
89
+ },
90
+ 'urls': {
91
+ 'logo': 'https://user-images.githubusercontent.com/1294454/27786377-8c8ab57e-5fe9-11e7-8ea4-2b05b6bcceec.jpg',
92
+ 'api': {
93
+ 'public': 'https://www.bitstamp.net/api',
94
+ 'private': 'https://www.bitstamp.net/api',
95
+ },
96
+ 'www': 'https://www.bitstamp.net',
97
+ 'doc': 'https://www.bitstamp.net/api',
98
+ },
99
+ 'timeframes': {
100
+ '1m': '60',
101
+ '3m': '180',
102
+ '5m': '300',
103
+ '15m': '900',
104
+ '30m': '1800',
105
+ '1h': '3600',
106
+ '2h': '7200',
107
+ '4h': '14400',
108
+ '6h': '21600',
109
+ '12h': '43200',
110
+ '1d': '86400',
111
+ '1w': '259200',
112
+ },
113
+ 'requiredCredentials': {
114
+ 'apiKey': true,
115
+ 'secret': true,
116
+ },
117
+ 'api': {
118
+ 'public': {
119
+ 'get': {
120
+ 'ohlc/{pair}/': 1,
121
+ 'order_book/{pair}/': 1,
122
+ 'ticker/': 1,
123
+ 'ticker_hour/{pair}/': 1,
124
+ 'ticker/{pair}/': 1,
125
+ 'transactions/{pair}/': 1,
126
+ 'trading-pairs-info/': 1,
127
+ 'currencies/': 1,
128
+ 'eur_usd/': 1,
129
+ 'travel_rule/vasps/': 1,
130
+ },
131
+ },
132
+ 'private': {
133
+ 'get': {
134
+ 'travel_rule/contacts/': 1,
135
+ 'contacts/{contact_uuid}/': 1,
136
+ 'earn/subscriptions/': 1,
137
+ 'earn/transactions/': 1,
138
+ },
139
+ 'post': {
140
+ 'account_balances/': 1,
141
+ 'account_balances/{currency}/': 1,
142
+ 'balance/': 1,
143
+ 'balance/{pair}/': 1,
144
+ 'bch_withdrawal/': 1,
145
+ 'bch_address/': 1,
146
+ 'user_transactions/': 1,
147
+ 'user_transactions/{pair}/': 1,
148
+ 'crypto-transactions/': 1,
149
+ 'open_orders/all/': 1,
150
+ 'open_orders/{pair}/': 1,
151
+ 'order_status/': 1,
152
+ 'cancel_order/': 1,
153
+ 'cancel_all_orders/': 1,
154
+ 'cancel_all_orders/{pair}/': 1,
155
+ 'buy/{pair}/': 1,
156
+ 'buy/market/{pair}/': 1,
157
+ 'buy/instant/{pair}/': 1,
158
+ 'sell/{pair}/': 1,
159
+ 'sell/market/{pair}/': 1,
160
+ 'sell/instant/{pair}/': 1,
161
+ 'transfer-to-main/': 1,
162
+ 'transfer-from-main/': 1,
163
+ 'my_trading_pairs/': 1,
164
+ 'fees/trading/': 1,
165
+ 'fees/trading/{pair}': 1,
166
+ 'fees/withdrawal/': 1,
167
+ 'fees/withdrawal/{currency}/': 1,
168
+ 'withdrawal-requests/': 1,
169
+ 'withdrawal/open/': 1,
170
+ 'withdrawal/status/': 1,
171
+ 'withdrawal/cancel/': 1,
172
+ 'liquidation_address/new/': 1,
173
+ 'liquidation_address/info/': 1,
174
+ 'btc_unconfirmed/': 1,
175
+ 'websockets_token/': 1,
176
+ // individual coins
177
+ 'btc_withdrawal/': 1,
178
+ 'btc_address/': 1,
179
+ 'ripple_withdrawal/': 1,
180
+ 'ripple_address/': 1,
181
+ 'ltc_withdrawal/': 1,
182
+ 'ltc_address/': 1,
183
+ 'eth_withdrawal/': 1,
184
+ 'eth_address/': 1,
185
+ 'xrp_withdrawal/': 1,
186
+ 'xrp_address/': 1,
187
+ 'xlm_withdrawal/': 1,
188
+ 'xlm_address/': 1,
189
+ 'pax_withdrawal/': 1,
190
+ 'pax_address/': 1,
191
+ 'link_withdrawal/': 1,
192
+ 'link_address/': 1,
193
+ 'usdc_withdrawal/': 1,
194
+ 'usdc_address/': 1,
195
+ 'omg_withdrawal/': 1,
196
+ 'omg_address/': 1,
197
+ 'dai_withdrawal/': 1,
198
+ 'dai_address/': 1,
199
+ 'knc_withdrawal/': 1,
200
+ 'knc_address/': 1,
201
+ 'mkr_withdrawal/': 1,
202
+ 'mkr_address/': 1,
203
+ 'zrx_withdrawal/': 1,
204
+ 'zrx_address/': 1,
205
+ 'gusd_withdrawal/': 1,
206
+ 'gusd_address/': 1,
207
+ 'aave_withdrawal/': 1,
208
+ 'aave_address/': 1,
209
+ 'bat_withdrawal/': 1,
210
+ 'bat_address/': 1,
211
+ 'uma_withdrawal/': 1,
212
+ 'uma_address/': 1,
213
+ 'snx_withdrawal/': 1,
214
+ 'snx_address/': 1,
215
+ 'uni_withdrawal/': 1,
216
+ 'uni_address/': 1,
217
+ 'yfi_withdrawal/': 1,
218
+ 'yfi_address': 1,
219
+ 'audio_withdrawal/': 1,
220
+ 'audio_address/': 1,
221
+ 'crv_withdrawal/': 1,
222
+ 'crv_address/': 1,
223
+ 'algo_withdrawal/': 1,
224
+ 'algo_address/': 1,
225
+ 'comp_withdrawal/': 1,
226
+ 'comp_address/': 1,
227
+ 'grt_withdrawal': 1,
228
+ 'grt_address/': 1,
229
+ 'usdt_withdrawal/': 1,
230
+ 'usdt_address/': 1,
231
+ 'eurt_withdrawal/': 1,
232
+ 'eurt_address/': 1,
233
+ 'matic_withdrawal/': 1,
234
+ 'matic_address/': 1,
235
+ 'sushi_withdrawal/': 1,
236
+ 'sushi_address/': 1,
237
+ 'chz_withdrawal/': 1,
238
+ 'chz_address/': 1,
239
+ 'enj_withdrawal/': 1,
240
+ 'enj_address/': 1,
241
+ 'alpha_withdrawal/': 1,
242
+ 'alpha_address/': 1,
243
+ 'ftt_withdrawal/': 1,
244
+ 'ftt_address/': 1,
245
+ 'storj_withdrawal/': 1,
246
+ 'storj_address/': 1,
247
+ 'axs_withdrawal/': 1,
248
+ 'axs_address/': 1,
249
+ 'sand_withdrawal/': 1,
250
+ 'sand_address/': 1,
251
+ 'hbar_withdrawal/': 1,
252
+ 'hbar_address/': 1,
253
+ 'rgt_withdrawal/': 1,
254
+ 'rgt_address/': 1,
255
+ 'fet_withdrawal/': 1,
256
+ 'fet_address/': 1,
257
+ 'skl_withdrawal/': 1,
258
+ 'skl_address/': 1,
259
+ 'cel_withdrawal/': 1,
260
+ 'cel_address/': 1,
261
+ 'sxp_withdrawal/': 1,
262
+ 'sxp_address/': 1,
263
+ 'ada_withdrawal/': 1,
264
+ 'ada_address/': 1,
265
+ 'slp_withdrawal/': 1,
266
+ 'slp_address/': 1,
267
+ 'ftm_withdrawal/': 1,
268
+ 'ftm_address/': 1,
269
+ 'perp_withdrawal/': 1,
270
+ 'perp_address/': 1,
271
+ 'dydx_withdrawal/': 1,
272
+ 'dydx_address/': 1,
273
+ 'gala_withdrawal/': 1,
274
+ 'gala_address/': 1,
275
+ 'shib_withdrawal/': 1,
276
+ 'shib_address/': 1,
277
+ 'amp_withdrawal/': 1,
278
+ 'amp_address/': 1,
279
+ 'sgb_withdrawal/': 1,
280
+ 'sgb_address/': 1,
281
+ 'avax_withdrawal/': 1,
282
+ 'avax_address/': 1,
283
+ 'wbtc_withdrawal/': 1,
284
+ 'wbtc_address/': 1,
285
+ 'ctsi_withdrawal/': 1,
286
+ 'ctsi_address/': 1,
287
+ 'cvx_withdrawal/': 1,
288
+ 'cvx_address/': 1,
289
+ 'imx_withdrawal/': 1,
290
+ 'imx_address/': 1,
291
+ 'nexo_withdrawal/': 1,
292
+ 'nexo_address/': 1,
293
+ 'ust_withdrawal/': 1,
294
+ 'ust_address/': 1,
295
+ 'ant_withdrawal/': 1,
296
+ 'ant_address/': 1,
297
+ 'gods_withdrawal/': 1,
298
+ 'gods_address/': 1,
299
+ 'rad_withdrawal/': 1,
300
+ 'rad_address/': 1,
301
+ 'band_withdrawal/': 1,
302
+ 'band_address/': 1,
303
+ 'inj_withdrawal/': 1,
304
+ 'inj_address/': 1,
305
+ 'rly_withdrawal/': 1,
306
+ 'rly_address/': 1,
307
+ 'rndr_withdrawal/': 1,
308
+ 'rndr_address/': 1,
309
+ 'vega_withdrawal/': 1,
310
+ 'vega_address/': 1,
311
+ '1inch_withdrawal/': 1,
312
+ '1inch_address/': 1,
313
+ 'ens_withdrawal/': 1,
314
+ 'ens_address/': 1,
315
+ 'mana_withdrawal/': 1,
316
+ 'mana_address/': 1,
317
+ 'lrc_withdrawal/': 1,
318
+ 'lrc_address/': 1,
319
+ 'ape_withdrawal/': 1,
320
+ 'ape_address/': 1,
321
+ 'mpl_withdrawal/': 1,
322
+ 'mpl_address/': 1,
323
+ 'euroc_withdrawal/': 1,
324
+ 'euroc_address/': 1,
325
+ 'sol_withdrawal/': 1,
326
+ 'sol_address/': 1,
327
+ 'dot_withdrawal/': 1,
328
+ 'dot_address/': 1,
329
+ 'near_withdrawal/': 1,
330
+ 'near_address/': 1,
331
+ 'doge_withdrawal/': 1,
332
+ 'doge_address/': 1,
333
+ 'flr_withdrawal/': 1,
334
+ 'flr_address/': 1,
335
+ 'dgld_withdrawal/': 1,
336
+ 'dgld_address/': 1,
337
+ 'ldo_withdrawal/': 1,
338
+ 'ldo_address/': 1,
339
+ 'travel_rule/contacts/': 1,
340
+ 'earn/subscribe/': 1,
341
+ 'earn/subscriptions/setting/': 1,
342
+ 'earn/unsubscribe': 1,
343
+ },
344
+ },
345
+ },
346
+ 'fees': {
347
+ 'trading': {
348
+ 'tierBased': true,
349
+ 'percentage': true,
350
+ 'taker': this.parseNumber('0.005'),
351
+ 'maker': this.parseNumber('0.005'),
352
+ 'tiers': {
353
+ 'taker': [
354
+ [this.parseNumber('0'), this.parseNumber('0.005')],
355
+ [this.parseNumber('20000'), this.parseNumber('0.0025')],
356
+ [this.parseNumber('100000'), this.parseNumber('0.0024')],
357
+ [this.parseNumber('200000'), this.parseNumber('0.0022')],
358
+ [this.parseNumber('400000'), this.parseNumber('0.0020')],
359
+ [this.parseNumber('600000'), this.parseNumber('0.0015')],
360
+ [this.parseNumber('1000000'), this.parseNumber('0.0014')],
361
+ [this.parseNumber('2000000'), this.parseNumber('0.0013')],
362
+ [this.parseNumber('4000000'), this.parseNumber('0.0012')],
363
+ [this.parseNumber('20000000'), this.parseNumber('0.0011')],
364
+ [this.parseNumber('50000000'), this.parseNumber('0.0010')],
365
+ [this.parseNumber('100000000'), this.parseNumber('0.0007')],
366
+ [this.parseNumber('500000000'), this.parseNumber('0.0005')],
367
+ [this.parseNumber('2000000000'), this.parseNumber('0.0003')],
368
+ [this.parseNumber('6000000000'), this.parseNumber('0.0001')],
369
+ [this.parseNumber('20000000000'), this.parseNumber('0.00005')],
370
+ [this.parseNumber('20000000001'), this.parseNumber('0')],
371
+ ],
372
+ 'maker': [
373
+ [this.parseNumber('0'), this.parseNumber('0.005')],
374
+ [this.parseNumber('20000'), this.parseNumber('0.0025')],
375
+ [this.parseNumber('100000'), this.parseNumber('0.0024')],
376
+ [this.parseNumber('200000'), this.parseNumber('0.0022')],
377
+ [this.parseNumber('400000'), this.parseNumber('0.0020')],
378
+ [this.parseNumber('600000'), this.parseNumber('0.0015')],
379
+ [this.parseNumber('1000000'), this.parseNumber('0.0014')],
380
+ [this.parseNumber('2000000'), this.parseNumber('0.0013')],
381
+ [this.parseNumber('4000000'), this.parseNumber('0.0012')],
382
+ [this.parseNumber('20000000'), this.parseNumber('0.0011')],
383
+ [this.parseNumber('50000000'), this.parseNumber('0.0010')],
384
+ [this.parseNumber('100000000'), this.parseNumber('0.0007')],
385
+ [this.parseNumber('500000000'), this.parseNumber('0.0005')],
386
+ [this.parseNumber('2000000000'), this.parseNumber('0.0003')],
387
+ [this.parseNumber('6000000000'), this.parseNumber('0.0001')],
388
+ [this.parseNumber('20000000000'), this.parseNumber('0.00005')],
389
+ [this.parseNumber('20000000001'), this.parseNumber('0')],
390
+ ],
391
+ },
392
+ },
393
+ 'funding': {
394
+ 'tierBased': false,
395
+ 'percentage': false,
396
+ 'withdraw': {},
397
+ 'deposit': {
398
+ 'BTC': 0,
399
+ 'BCH': 0,
400
+ 'LTC': 0,
401
+ 'ETH': 0,
402
+ 'XRP': 0,
403
+ 'XLM': 0,
404
+ 'PAX': 0,
405
+ 'USD': 7.5,
406
+ 'EUR': 0,
407
+ },
408
+ },
409
+ },
410
+ 'precisionMode': number.TICK_SIZE,
411
+ 'commonCurrencies': {
412
+ 'UST': 'USTC',
413
+ },
414
+ 'exceptions': {
415
+ 'exact': {
416
+ 'No permission found': errors.PermissionDenied,
417
+ 'API key not found': errors.AuthenticationError,
418
+ 'IP address not allowed': errors.PermissionDenied,
419
+ 'Invalid nonce': errors.InvalidNonce,
420
+ 'Invalid signature': errors.AuthenticationError,
421
+ 'Authentication failed': errors.AuthenticationError,
422
+ 'Missing key, signature and nonce parameters': errors.AuthenticationError,
423
+ 'Wrong API key format': errors.AuthenticationError,
424
+ 'Your account is frozen': errors.PermissionDenied,
425
+ 'Please update your profile with your FATCA information, before using API.': errors.PermissionDenied,
426
+ 'Order not found.': errors.OrderNotFound,
427
+ 'Price is more than 20% below market price.': errors.InvalidOrder,
428
+ "Bitstamp.net is under scheduled maintenance. We'll be back soon.": errors.OnMaintenance,
429
+ 'Order could not be placed.': errors.ExchangeNotAvailable,
430
+ 'Invalid offset.': errors.BadRequest,
431
+ },
432
+ 'broad': {
433
+ 'Minimum order size is': errors.InvalidOrder,
434
+ 'Check your account balance for details.': errors.InsufficientFunds,
435
+ 'Ensure this value has at least': errors.InvalidAddress,
436
+ 'Ensure that there are no more than': errors.InvalidOrder, // {"status": "error", "reason": {"amount": ["Ensure that there are no more than 0 decimal places."], "__all__": [""]}}
437
+ },
438
+ },
439
+ });
440
+ }
441
+ async fetchMarkets(params = {}) {
442
+ /**
443
+ * @method
444
+ * @name bitstamp#fetchMarkets
445
+ * @description retrieves data on all markets for bitstamp
446
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
447
+ * @returns {object[]} an array of objects representing market data
448
+ */
449
+ const response = await this.fetchMarketsFromCache(params);
450
+ //
451
+ // [
452
+ // {
453
+ // "trading": "Enabled",
454
+ // "base_decimals": 8,
455
+ // "url_symbol": "btcusd",
456
+ // "name": "BTC/USD",
457
+ // "instant_and_market_orders": "Enabled",
458
+ // "minimum_order": "20.0 USD",
459
+ // "counter_decimals": 2,
460
+ // "description": "Bitcoin / U.S. dollar"
461
+ // }
462
+ // ]
463
+ //
464
+ const result = [];
465
+ for (let i = 0; i < response.length; i++) {
466
+ const market = response[i];
467
+ const name = this.safeString(market, 'name');
468
+ let [base, quote] = name.split('/');
469
+ const baseId = base.toLowerCase();
470
+ const quoteId = quote.toLowerCase();
471
+ base = this.safeCurrencyCode(base);
472
+ quote = this.safeCurrencyCode(quote);
473
+ const minimumOrder = this.safeString(market, 'minimum_order');
474
+ const parts = minimumOrder.split(' ');
475
+ const status = this.safeString(market, 'trading');
476
+ result.push({
477
+ 'id': this.safeString(market, 'url_symbol'),
478
+ 'marketId': baseId + '_' + quoteId,
479
+ 'symbol': base + '/' + quote,
480
+ 'base': base,
481
+ 'quote': quote,
482
+ 'settle': undefined,
483
+ 'baseId': baseId,
484
+ 'quoteId': quoteId,
485
+ 'settleId': undefined,
486
+ 'type': 'spot',
487
+ 'spot': true,
488
+ 'margin': false,
489
+ 'future': false,
490
+ 'swap': false,
491
+ 'option': false,
492
+ 'active': (status === 'Enabled'),
493
+ 'contract': false,
494
+ 'linear': undefined,
495
+ 'inverse': undefined,
496
+ 'contractSize': undefined,
497
+ 'expiry': undefined,
498
+ 'expiryDatetime': undefined,
499
+ 'strike': undefined,
500
+ 'optionType': undefined,
501
+ 'precision': {
502
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'base_decimals'))),
503
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'counter_decimals'))),
504
+ },
505
+ 'limits': {
506
+ 'leverage': {
507
+ 'min': undefined,
508
+ 'max': undefined,
509
+ },
510
+ 'amount': {
511
+ 'min': undefined,
512
+ 'max': undefined,
513
+ },
514
+ 'price': {
515
+ 'min': undefined,
516
+ 'max': undefined,
517
+ },
518
+ 'cost': {
519
+ 'min': this.safeNumber(parts, 0),
520
+ 'max': undefined,
521
+ },
522
+ },
523
+ 'created': undefined,
524
+ 'info': market,
525
+ });
526
+ }
527
+ return result;
528
+ }
529
+ constructCurrencyObject(id, code, name, precision, minCost, originalPayload) {
530
+ let currencyType = 'crypto';
531
+ const description = this.describe();
532
+ if (this.isFiat(code)) {
533
+ currencyType = 'fiat';
534
+ }
535
+ const tickSize = this.parseNumber(this.parsePrecision(this.numberToString(precision)));
536
+ return {
537
+ 'id': id,
538
+ 'code': code,
539
+ 'info': originalPayload,
540
+ 'type': currencyType,
541
+ 'name': name,
542
+ 'active': true,
543
+ 'deposit': undefined,
544
+ 'withdraw': undefined,
545
+ 'fee': this.safeNumber(description['fees']['funding']['withdraw'], code),
546
+ 'precision': tickSize,
547
+ 'limits': {
548
+ 'amount': {
549
+ 'min': tickSize,
550
+ 'max': undefined,
551
+ },
552
+ 'price': {
553
+ 'min': tickSize,
554
+ 'max': undefined,
555
+ },
556
+ 'cost': {
557
+ 'min': minCost,
558
+ 'max': undefined,
559
+ },
560
+ 'withdraw': {
561
+ 'min': undefined,
562
+ 'max': undefined,
563
+ },
564
+ },
565
+ 'networks': {},
566
+ };
567
+ }
568
+ async fetchMarketsFromCache(params = {}) {
569
+ // this method is now redundant
570
+ // currencies are now fetched before markets
571
+ const options = this.safeValue(this.options, 'fetchMarkets', {});
572
+ const timestamp = this.safeInteger(options, 'timestamp');
573
+ const expires = this.safeInteger(options, 'expires', 1000);
574
+ const now = this.milliseconds();
575
+ if ((timestamp === undefined) || ((now - timestamp) > expires)) {
576
+ const response = await this.publicGetTradingPairsInfo(params);
577
+ this.options['fetchMarkets'] = this.extend(options, {
578
+ 'response': response,
579
+ 'timestamp': now,
580
+ });
581
+ }
582
+ return this.safeValue(this.options['fetchMarkets'], 'response');
583
+ }
584
+ async fetchCurrencies(params = {}) {
585
+ /**
586
+ * @method
587
+ * @name bitstamp#fetchCurrencies
588
+ * @description fetches all available currencies on an exchange
589
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
590
+ * @returns {object} an associative dictionary of currencies
591
+ */
592
+ const response = await this.fetchMarketsFromCache(params);
593
+ //
594
+ // [
595
+ // {
596
+ // "trading": "Enabled",
597
+ // "base_decimals": 8,
598
+ // "url_symbol": "btcusd",
599
+ // "name": "BTC/USD",
600
+ // "instant_and_market_orders": "Enabled",
601
+ // "minimum_order": "20.0 USD",
602
+ // "counter_decimals": 2,
603
+ // "description": "Bitcoin / U.S. dollar"
604
+ // },
605
+ // ]
606
+ //
607
+ const result = {};
608
+ for (let i = 0; i < response.length; i++) {
609
+ const market = response[i];
610
+ const name = this.safeString(market, 'name');
611
+ let [base, quote] = name.split('/');
612
+ const baseId = base.toLowerCase();
613
+ const quoteId = quote.toLowerCase();
614
+ base = this.safeCurrencyCode(base);
615
+ quote = this.safeCurrencyCode(quote);
616
+ const description = this.safeString(market, 'description');
617
+ const [baseDescription, quoteDescription] = description.split(' / ');
618
+ const minimumOrder = this.safeString(market, 'minimum_order');
619
+ const parts = minimumOrder.split(' ');
620
+ const cost = parts[0];
621
+ if (!(base in result)) {
622
+ const baseDecimals = this.safeInteger(market, 'base_decimals');
623
+ result[base] = this.constructCurrencyObject(baseId, base, baseDescription, baseDecimals, undefined, market);
624
+ }
625
+ if (!(quote in result)) {
626
+ const counterDecimals = this.safeInteger(market, 'counter_decimals');
627
+ result[quote] = this.constructCurrencyObject(quoteId, quote, quoteDescription, counterDecimals, this.parseNumber(cost), market);
628
+ }
629
+ }
630
+ return result;
631
+ }
632
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
633
+ /**
634
+ * @method
635
+ * @name bitstamp#fetchOrderBook
636
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
637
+ * @param {string} symbol unified symbol of the market to fetch the order book for
638
+ * @param {int} [limit] the maximum amount of order book entries to return
639
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
640
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
641
+ */
642
+ await this.loadMarkets();
643
+ const market = this.market(symbol);
644
+ const request = {
645
+ 'pair': market['id'],
646
+ };
647
+ const response = await this.publicGetOrderBookPair(this.extend(request, params));
648
+ //
649
+ // {
650
+ // "timestamp": "1583652948",
651
+ // "microtimestamp": "1583652948955826",
652
+ // "bids": [
653
+ // [ "8750.00", "1.33685271" ],
654
+ // [ "8749.39", "0.07700000" ],
655
+ // [ "8746.98", "0.07400000" ],
656
+ // ]
657
+ // "asks": [
658
+ // [ "8754.10", "1.51995636" ],
659
+ // [ "8754.71", "1.40000000" ],
660
+ // [ "8754.72", "2.50000000" ],
661
+ // ]
662
+ // }
663
+ //
664
+ const microtimestamp = this.safeInteger(response, 'microtimestamp');
665
+ const timestamp = this.parseToInt(microtimestamp / 1000);
666
+ const orderbook = this.parseOrderBook(response, market['symbol'], timestamp);
667
+ orderbook['nonce'] = microtimestamp;
668
+ return orderbook;
669
+ }
670
+ parseTicker(ticker, market = undefined) {
671
+ //
672
+ // {
673
+ // "timestamp": "1686068944",
674
+ // "high": "26252",
675
+ // "last": "26216",
676
+ // "bid": "26208",
677
+ // "vwap": "25681",
678
+ // "volume": "3563.13819902",
679
+ // "low": "25350",
680
+ // "ask": "26211",
681
+ // "open": "25730",
682
+ // "open_24": "25895",
683
+ // "percent_change_24": "1.24",
684
+ // "pair": "BTC/USD"
685
+ // }
686
+ //
687
+ const marketId = this.safeString(ticker, 'pair');
688
+ const symbol = this.safeSymbol(marketId, market, undefined);
689
+ const timestamp = this.safeTimestamp(ticker, 'timestamp');
690
+ const vwap = this.safeString(ticker, 'vwap');
691
+ const baseVolume = this.safeString(ticker, 'volume');
692
+ const quoteVolume = Precise["default"].stringMul(baseVolume, vwap);
693
+ const last = this.safeString(ticker, 'last');
694
+ return this.safeTicker({
695
+ 'symbol': symbol,
696
+ 'timestamp': timestamp,
697
+ 'datetime': this.iso8601(timestamp),
698
+ 'high': this.safeString(ticker, 'high'),
699
+ 'low': this.safeString(ticker, 'low'),
700
+ 'bid': this.safeString(ticker, 'bid'),
701
+ 'bidVolume': undefined,
702
+ 'ask': this.safeString(ticker, 'ask'),
703
+ 'askVolume': undefined,
704
+ 'vwap': vwap,
705
+ 'open': this.safeString(ticker, 'open'),
706
+ 'close': last,
707
+ 'last': last,
708
+ 'previousClose': undefined,
709
+ 'change': undefined,
710
+ 'percentage': undefined,
711
+ 'average': undefined,
712
+ 'baseVolume': baseVolume,
713
+ 'quoteVolume': quoteVolume,
714
+ 'info': ticker,
715
+ }, market);
716
+ }
717
+ async fetchTicker(symbol, params = {}) {
718
+ /**
719
+ * @method
720
+ * @name bitstamp#fetchTicker
721
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
722
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
723
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
724
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
725
+ */
726
+ await this.loadMarkets();
727
+ const market = this.market(symbol);
728
+ const request = {
729
+ 'pair': market['id'],
730
+ };
731
+ const ticker = await this.publicGetTickerPair(this.extend(request, params));
732
+ //
733
+ // {
734
+ // "timestamp": "1686068944",
735
+ // "high": "26252",
736
+ // "last": "26216",
737
+ // "bid": "26208",
738
+ // "vwap": "25681",
739
+ // "volume": "3563.13819902",
740
+ // "low": "25350",
741
+ // "ask": "26211",
742
+ // "open": "25730",
743
+ // "open_24": "25895",
744
+ // "percent_change_24": "1.24"
745
+ // }
746
+ //
747
+ return this.parseTicker(ticker, market);
748
+ }
749
+ async fetchTickers(symbols = undefined, params = {}) {
750
+ /**
751
+ * @method
752
+ * @name bitstamp#fetchTickers
753
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
754
+ * @see https://www.bitstamp.net/api/#all-tickers
755
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
756
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
757
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
758
+ */
759
+ await this.loadMarkets();
760
+ const response = await this.publicGetTicker(params);
761
+ //
762
+ // {
763
+ // "timestamp": "1686068944",
764
+ // "high": "26252",
765
+ // "last": "26216",
766
+ // "bid": "26208",
767
+ // "vwap": "25681",
768
+ // "volume": "3563.13819902",
769
+ // "low": "25350",
770
+ // "ask": "26211",
771
+ // "open": "25730",
772
+ // "open_24": "25895",
773
+ // "percent_change_24": "1.24",
774
+ // "pair": "BTC/USD"
775
+ // }
776
+ //
777
+ return this.parseTickers(response, symbols);
778
+ }
779
+ getCurrencyIdFromTransaction(transaction) {
780
+ //
781
+ // {
782
+ // "fee": "0.00000000",
783
+ // "btc_usd": "0.00",
784
+ // "datetime": XXX,
785
+ // "usd": 0.0,
786
+ // "btc": 0.0,
787
+ // "eth": "0.05000000",
788
+ // "type": "0",
789
+ // "id": XXX,
790
+ // "eur": 0.0
791
+ // }
792
+ //
793
+ const currencyId = this.safeStringLower(transaction, 'currency');
794
+ if (currencyId !== undefined) {
795
+ return currencyId;
796
+ }
797
+ transaction = this.omit(transaction, [
798
+ 'fee',
799
+ 'price',
800
+ 'datetime',
801
+ 'type',
802
+ 'status',
803
+ 'id',
804
+ ]);
805
+ const ids = Object.keys(transaction);
806
+ for (let i = 0; i < ids.length; i++) {
807
+ const id = ids[i];
808
+ if (id.indexOf('_') < 0) {
809
+ const value = this.safeNumber(transaction, id);
810
+ if ((value !== undefined) && (value !== 0)) {
811
+ return id;
812
+ }
813
+ }
814
+ }
815
+ return undefined;
816
+ }
817
+ getMarketFromTrade(trade) {
818
+ trade = this.omit(trade, [
819
+ 'fee',
820
+ 'price',
821
+ 'datetime',
822
+ 'tid',
823
+ 'type',
824
+ 'order_id',
825
+ 'side',
826
+ ]);
827
+ const currencyIds = Object.keys(trade);
828
+ const numCurrencyIds = currencyIds.length;
829
+ if (numCurrencyIds > 2) {
830
+ throw new errors.ExchangeError(this.id + ' getMarketFromTrade() too many keys: ' + this.json(currencyIds) + ' in the trade: ' + this.json(trade));
831
+ }
832
+ if (numCurrencyIds === 2) {
833
+ let marketId = currencyIds[0] + currencyIds[1];
834
+ if (marketId in this.markets_by_id) {
835
+ return this.safeMarket(marketId);
836
+ }
837
+ marketId = currencyIds[1] + currencyIds[0];
838
+ if (marketId in this.markets_by_id) {
839
+ return this.safeMarket(marketId);
840
+ }
841
+ }
842
+ return undefined;
843
+ }
844
+ parseTrade(trade, market = undefined) {
845
+ //
846
+ // fetchTrades (public)
847
+ //
848
+ // {
849
+ // "date": "1637845199",
850
+ // "tid": "209895701",
851
+ // "amount": "0.00500000",
852
+ // "type": "0", // Transaction type: 0 - buy; 1 - sell
853
+ // "price": "4451.25"
854
+ // }
855
+ //
856
+ // fetchMyTrades, trades returned within fetchOrder (private)
857
+ //
858
+ // {
859
+ // "fee": "0.11128",
860
+ // "eth_usdt": 4451.25,
861
+ // "datetime": "2021-11-25 12:59:59.322000",
862
+ // "usdt": "-22.26",
863
+ // "order_id": 1429545880227846,
864
+ // "usd": 0,
865
+ // "btc": 0,
866
+ // "eth": "0.00500000",
867
+ // "type": "2", // Transaction type: 0 - deposit; 1 - withdrawal; 2 - market trade; 14 - sub account transfer; 25 - credited with staked assets; 26 - sent assets to staking; 27 - staking reward; 32 - referral reward; 35 - inter account transfer.
868
+ // "id": 209895701,
869
+ // "eur": 0
870
+ // }
871
+ //
872
+ // from fetchOrder (private)
873
+ //
874
+ // {
875
+ // "fee": "0.11128",
876
+ // "price": "4451.25000000",
877
+ // "datetime": "2021-11-25 12:59:59.322000",
878
+ // "usdt": "22.25625000",
879
+ // "tid": 209895701,
880
+ // "eth": "0.00500000",
881
+ // "type": 2 // Transaction type: 0 - deposit; 1 - withdrawal; 2 - market trade
882
+ // }
883
+ //
884
+ const id = this.safeString2(trade, 'id', 'tid');
885
+ let symbol = undefined;
886
+ let side = undefined;
887
+ let priceString = this.safeString(trade, 'price');
888
+ let amountString = this.safeString(trade, 'amount');
889
+ const orderId = this.safeString(trade, 'order_id');
890
+ const type = undefined;
891
+ let costString = this.safeString(trade, 'cost');
892
+ let rawMarketId = undefined;
893
+ if (market === undefined) {
894
+ const keys = Object.keys(trade);
895
+ for (let i = 0; i < keys.length; i++) {
896
+ const currentKey = keys[i];
897
+ if (currentKey !== 'order_id' && currentKey.indexOf('_') >= 0) {
898
+ rawMarketId = currentKey;
899
+ market = this.safeMarket(rawMarketId, market, '_');
900
+ }
901
+ }
902
+ }
903
+ // if the market is still not defined
904
+ // try to deduce it from used keys
905
+ if (market === undefined) {
906
+ market = this.getMarketFromTrade(trade);
907
+ }
908
+ const feeCostString = this.safeString(trade, 'fee');
909
+ const feeCurrency = market['quote'];
910
+ const priceId = (rawMarketId !== undefined) ? rawMarketId : market['marketId'];
911
+ priceString = this.safeString(trade, priceId, priceString);
912
+ amountString = this.safeString(trade, market['baseId'], amountString);
913
+ costString = this.safeString(trade, market['quoteId'], costString);
914
+ symbol = market['symbol'];
915
+ const datetimeString = this.safeString2(trade, 'date', 'datetime');
916
+ let timestamp = undefined;
917
+ if (datetimeString !== undefined) {
918
+ if (datetimeString.indexOf(' ') >= 0) {
919
+ // iso8601
920
+ timestamp = this.parse8601(datetimeString);
921
+ }
922
+ else {
923
+ // string unix epoch in seconds
924
+ timestamp = parseInt(datetimeString);
925
+ timestamp = timestamp * 1000;
926
+ }
927
+ }
928
+ // if it is a private trade
929
+ if ('id' in trade) {
930
+ if (amountString !== undefined) {
931
+ const isAmountNeg = Precise["default"].stringLt(amountString, '0');
932
+ if (isAmountNeg) {
933
+ side = 'sell';
934
+ amountString = Precise["default"].stringNeg(amountString);
935
+ }
936
+ else {
937
+ side = 'buy';
938
+ }
939
+ }
940
+ }
941
+ else {
942
+ side = this.safeString(trade, 'type');
943
+ if (side === '1') {
944
+ side = 'sell';
945
+ }
946
+ else if (side === '0') {
947
+ side = 'buy';
948
+ }
949
+ else {
950
+ side = undefined;
951
+ }
952
+ }
953
+ if (costString !== undefined) {
954
+ costString = Precise["default"].stringAbs(costString);
955
+ }
956
+ let fee = undefined;
957
+ if (feeCostString !== undefined) {
958
+ fee = {
959
+ 'cost': feeCostString,
960
+ 'currency': feeCurrency,
961
+ };
962
+ }
963
+ return this.safeTrade({
964
+ 'id': id,
965
+ 'info': trade,
966
+ 'timestamp': timestamp,
967
+ 'datetime': this.iso8601(timestamp),
968
+ 'symbol': symbol,
969
+ 'order': orderId,
970
+ 'type': type,
971
+ 'side': side,
972
+ 'takerOrMaker': undefined,
973
+ 'price': priceString,
974
+ 'amount': amountString,
975
+ 'cost': costString,
976
+ 'fee': fee,
977
+ }, market);
978
+ }
979
+ async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
980
+ /**
981
+ * @method
982
+ * @name bitstamp#fetchTrades
983
+ * @description get the list of most recent trades for a particular symbol
984
+ * @param {string} symbol unified symbol of the market to fetch trades for
985
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
986
+ * @param {int} [limit] the maximum amount of trades to fetch
987
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
988
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
989
+ */
990
+ await this.loadMarkets();
991
+ const market = this.market(symbol);
992
+ const request = {
993
+ 'pair': market['id'],
994
+ 'time': 'hour',
995
+ };
996
+ const response = await this.publicGetTransactionsPair(this.extend(request, params));
997
+ //
998
+ // [
999
+ // {
1000
+ // "date": "1551814435",
1001
+ // "tid": "83581898",
1002
+ // "price": "0.03532850",
1003
+ // "type": "1",
1004
+ // "amount": "0.85945907"
1005
+ // },
1006
+ // {
1007
+ // "date": "1551814434",
1008
+ // "tid": "83581896",
1009
+ // "price": "0.03532851",
1010
+ // "type": "1",
1011
+ // "amount": "11.34130961"
1012
+ // },
1013
+ // ]
1014
+ //
1015
+ return this.parseTrades(response, market, since, limit);
1016
+ }
1017
+ parseOHLCV(ohlcv, market = undefined) {
1018
+ //
1019
+ // {
1020
+ // "high": "9064.77",
1021
+ // "timestamp": "1593961440",
1022
+ // "volume": "18.49436608",
1023
+ // "low": "9040.87",
1024
+ // "close": "9064.77",
1025
+ // "open": "9040.87"
1026
+ // }
1027
+ //
1028
+ return [
1029
+ this.safeTimestamp(ohlcv, 'timestamp'),
1030
+ this.safeNumber(ohlcv, 'open'),
1031
+ this.safeNumber(ohlcv, 'high'),
1032
+ this.safeNumber(ohlcv, 'low'),
1033
+ this.safeNumber(ohlcv, 'close'),
1034
+ this.safeNumber(ohlcv, 'volume'),
1035
+ ];
1036
+ }
1037
+ async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
1038
+ /**
1039
+ * @method
1040
+ * @name bitstamp#fetchOHLCV
1041
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1042
+ * @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
1043
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1044
+ * @param {string} timeframe the length of time each candle represents
1045
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
1046
+ * @param {int} [limit] the maximum amount of candles to fetch
1047
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1048
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1049
+ */
1050
+ await this.loadMarkets();
1051
+ const market = this.market(symbol);
1052
+ const request = {
1053
+ 'pair': market['id'],
1054
+ 'step': this.safeString(this.timeframes, timeframe, timeframe),
1055
+ };
1056
+ const duration = this.parseTimeframe(timeframe);
1057
+ if (limit === undefined) {
1058
+ if (since === undefined) {
1059
+ request['limit'] = 1000; // we need to specify an allowed amount of `limit` if no `since` is set and there is no default limit by exchange
1060
+ }
1061
+ else {
1062
+ limit = 1000;
1063
+ const start = this.parseToInt(since / 1000);
1064
+ request['start'] = start;
1065
+ request['end'] = this.sum(start, duration * (limit - 1));
1066
+ request['limit'] = limit;
1067
+ }
1068
+ }
1069
+ else {
1070
+ if (since !== undefined) {
1071
+ const start = this.parseToInt(since / 1000);
1072
+ request['start'] = start;
1073
+ request['end'] = this.sum(start, duration * (limit - 1));
1074
+ }
1075
+ request['limit'] = Math.min(limit, 1000); // min 1, max 1000
1076
+ }
1077
+ const response = await this.publicGetOhlcPair(this.extend(request, params));
1078
+ //
1079
+ // {
1080
+ // "data": {
1081
+ // "pair": "BTC/USD",
1082
+ // "ohlc": [
1083
+ // {"high": "9064.77", "timestamp": "1593961440", "volume": "18.49436608", "low": "9040.87", "close": "9064.77", "open": "9040.87"},
1084
+ // {"high": "9071.59", "timestamp": "1593961500", "volume": "3.48631711", "low": "9058.76", "close": "9061.07", "open": "9064.66"},
1085
+ // {"high": "9067.33", "timestamp": "1593961560", "volume": "0.04142833", "low": "9061.94", "close": "9061.94", "open": "9067.33"},
1086
+ // ],
1087
+ // }
1088
+ // }
1089
+ //
1090
+ const data = this.safeValue(response, 'data', {});
1091
+ const ohlc = this.safeValue(data, 'ohlc', []);
1092
+ return this.parseOHLCVs(ohlc, market, timeframe, since, limit);
1093
+ }
1094
+ parseBalance(response) {
1095
+ const result = {
1096
+ 'info': response,
1097
+ 'timestamp': undefined,
1098
+ 'datetime': undefined,
1099
+ };
1100
+ const codes = Object.keys(this.currencies);
1101
+ for (let i = 0; i < codes.length; i++) {
1102
+ const code = codes[i];
1103
+ const currency = this.currency(code);
1104
+ const currencyId = currency['id'];
1105
+ const account = this.account();
1106
+ account['free'] = this.safeString(response, currencyId + '_available');
1107
+ account['used'] = this.safeString(response, currencyId + '_reserved');
1108
+ account['total'] = this.safeString(response, currencyId + '_balance');
1109
+ result[code] = account;
1110
+ }
1111
+ return this.safeBalance(result);
1112
+ }
1113
+ async fetchBalance(params = {}) {
1114
+ /**
1115
+ * @method
1116
+ * @name bitstamp#fetchBalance
1117
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
1118
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1119
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1120
+ */
1121
+ await this.loadMarkets();
1122
+ const response = await this.privatePostBalance(params);
1123
+ //
1124
+ // {
1125
+ // "aave_available": "0.00000000",
1126
+ // "aave_balance": "0.00000000",
1127
+ // "aave_reserved": "0.00000000",
1128
+ // "aave_withdrawal_fee": "0.07000000",
1129
+ // "aavebtc_fee": "0.000",
1130
+ // "aaveeur_fee": "0.000",
1131
+ // "aaveusd_fee": "0.000",
1132
+ // "bat_available": "0.00000000",
1133
+ // "bat_balance": "0.00000000",
1134
+ // "bat_reserved": "0.00000000",
1135
+ // "bat_withdrawal_fee": "5.00000000",
1136
+ // "batbtc_fee": "0.000",
1137
+ // "bateur_fee": "0.000",
1138
+ // "batusd_fee": "0.000",
1139
+ // }
1140
+ //
1141
+ return this.parseBalance(response);
1142
+ }
1143
+ async fetchTradingFee(symbol, params = {}) {
1144
+ /**
1145
+ * @method
1146
+ * @name bitstamp#fetchTradingFee
1147
+ * @description fetch the trading fees for a market
1148
+ * @param {string} symbol unified market symbol
1149
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1150
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
1151
+ */
1152
+ await this.loadMarkets();
1153
+ const market = this.market(symbol);
1154
+ const request = {
1155
+ 'pair': market['id'],
1156
+ };
1157
+ const response = await this.privatePostBalancePair(this.extend(request, params));
1158
+ return this.parseTradingFee(response, market);
1159
+ }
1160
+ parseTradingFee(fee, market = undefined) {
1161
+ market = this.safeMarket(undefined, market);
1162
+ const feeString = this.safeString(fee, market['id'] + '_fee');
1163
+ const dividedFeeString = Precise["default"].stringDiv(feeString, '100');
1164
+ const tradeFee = this.parseNumber(dividedFeeString);
1165
+ return {
1166
+ 'info': fee,
1167
+ 'symbol': market['symbol'],
1168
+ 'maker': tradeFee,
1169
+ 'taker': tradeFee,
1170
+ };
1171
+ }
1172
+ parseTradingFees(fees) {
1173
+ const result = { 'info': fees };
1174
+ const symbols = this.symbols;
1175
+ for (let i = 0; i < symbols.length; i++) {
1176
+ const symbol = symbols[i];
1177
+ const market = this.market(symbol);
1178
+ const fee = this.parseTradingFee(fees, market);
1179
+ result[symbol] = fee;
1180
+ }
1181
+ return result;
1182
+ }
1183
+ async fetchTradingFees(params = {}) {
1184
+ /**
1185
+ * @method
1186
+ * @name bitstamp#fetchTradingFees
1187
+ * @description fetch the trading fees for multiple markets
1188
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1189
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
1190
+ */
1191
+ await this.loadMarkets();
1192
+ const response = await this.privatePostBalance(params);
1193
+ return this.parseTradingFees(response);
1194
+ }
1195
+ async fetchTransactionFees(codes = undefined, params = {}) {
1196
+ /**
1197
+ * @method
1198
+ * @name bitstamp#fetchTransactionFees
1199
+ * @deprecated
1200
+ * @description please use fetchDepositWithdrawFees instead
1201
+ * @see https://www.bitstamp.net/api/#balance
1202
+ * @param {string[]|undefined} codes list of unified currency codes
1203
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1204
+ * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1205
+ */
1206
+ await this.loadMarkets();
1207
+ const balance = await this.privatePostBalance(params);
1208
+ return this.parseTransactionFees(balance);
1209
+ }
1210
+ parseTransactionFees(response, codes = undefined) {
1211
+ //
1212
+ // {
1213
+ // "yfi_available": "0.00000000",
1214
+ // "yfi_balance": "0.00000000",
1215
+ // "yfi_reserved": "0.00000000",
1216
+ // "yfi_withdrawal_fee": "0.00070000",
1217
+ // "yfieur_fee": "0.000",
1218
+ // "yfiusd_fee": "0.000",
1219
+ // "zrx_available": "0.00000000",
1220
+ // "zrx_balance": "0.00000000",
1221
+ // "zrx_reserved": "0.00000000",
1222
+ // "zrx_withdrawal_fee": "12.00000000",
1223
+ // "zrxeur_fee": "0.000",
1224
+ // "zrxusd_fee": "0.000",
1225
+ // ...
1226
+ // }
1227
+ //
1228
+ if (codes === undefined) {
1229
+ codes = Object.keys(this.currencies);
1230
+ }
1231
+ const result = {};
1232
+ let mainCurrencyId = undefined;
1233
+ const ids = Object.keys(response);
1234
+ for (let i = 0; i < ids.length; i++) {
1235
+ const id = ids[i];
1236
+ const currencyId = id.split('_')[0];
1237
+ const code = this.safeCurrencyCode(currencyId);
1238
+ if (codes !== undefined && !this.inArray(code, codes)) {
1239
+ continue;
1240
+ }
1241
+ if (id.indexOf('_available') >= 0) {
1242
+ mainCurrencyId = currencyId;
1243
+ result[code] = {
1244
+ 'deposit': undefined,
1245
+ 'withdraw': undefined,
1246
+ 'info': {},
1247
+ };
1248
+ }
1249
+ if (currencyId === mainCurrencyId) {
1250
+ result[code]['info'][id] = this.safeNumber(response, id);
1251
+ }
1252
+ if (id.indexOf('_withdrawal_fee') >= 0) {
1253
+ result[code]['withdraw'] = this.safeNumber(response, id);
1254
+ }
1255
+ }
1256
+ return result;
1257
+ }
1258
+ async fetchDepositWithdrawFees(codes = undefined, params = {}) {
1259
+ /**
1260
+ * @method
1261
+ * @name bitstamp#fetchDepositWithdrawFees
1262
+ * @description fetch deposit and withdraw fees
1263
+ * @see https://www.bitstamp.net/api/#balance
1264
+ * @param {string[]|undefined} codes list of unified currency codes
1265
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1266
+ * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
1267
+ */
1268
+ await this.loadMarkets();
1269
+ const response = await this.privatePostBalance(params);
1270
+ //
1271
+ // {
1272
+ // "yfi_available": "0.00000000",
1273
+ // "yfi_balance": "0.00000000",
1274
+ // "yfi_reserved": "0.00000000",
1275
+ // "yfi_withdrawal_fee": "0.00070000",
1276
+ // "yfieur_fee": "0.000",
1277
+ // "yfiusd_fee": "0.000",
1278
+ // "zrx_available": "0.00000000",
1279
+ // "zrx_balance": "0.00000000",
1280
+ // "zrx_reserved": "0.00000000",
1281
+ // "zrx_withdrawal_fee": "12.00000000",
1282
+ // "zrxeur_fee": "0.000",
1283
+ // "zrxusd_fee": "0.000",
1284
+ // ...
1285
+ // }
1286
+ //
1287
+ return this.parseDepositWithdrawFees(response, codes);
1288
+ }
1289
+ parseDepositWithdrawFees(response, codes = undefined, currencyIdKey = undefined) {
1290
+ //
1291
+ // {
1292
+ // "yfi_available": "0.00000000",
1293
+ // "yfi_balance": "0.00000000",
1294
+ // "yfi_reserved": "0.00000000",
1295
+ // "yfi_withdrawal_fee": "0.00070000",
1296
+ // "yfieur_fee": "0.000",
1297
+ // "yfiusd_fee": "0.000",
1298
+ // "zrx_available": "0.00000000",
1299
+ // "zrx_balance": "0.00000000",
1300
+ // "zrx_reserved": "0.00000000",
1301
+ // "zrx_withdrawal_fee": "12.00000000",
1302
+ // "zrxeur_fee": "0.000",
1303
+ // "zrxusd_fee": "0.000",
1304
+ // ...
1305
+ // }
1306
+ //
1307
+ const result = {};
1308
+ const ids = Object.keys(response);
1309
+ for (let i = 0; i < ids.length; i++) {
1310
+ const id = ids[i];
1311
+ const currencyId = id.split('_')[0];
1312
+ const code = this.safeCurrencyCode(currencyId);
1313
+ const dictValue = this.safeNumber(response, id);
1314
+ if (codes !== undefined && !this.inArray(code, codes)) {
1315
+ continue;
1316
+ }
1317
+ if (id.indexOf('_available') >= 0) {
1318
+ result[code] = this.depositWithdrawFee({});
1319
+ }
1320
+ if (id.indexOf('_withdrawal_fee') >= 0) {
1321
+ result[code]['withdraw']['fee'] = dictValue;
1322
+ }
1323
+ const resultValue = this.safeValue(result, code);
1324
+ if (resultValue !== undefined) {
1325
+ result[code]['info'][id] = dictValue;
1326
+ }
1327
+ }
1328
+ return result;
1329
+ }
1330
+ async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1331
+ /**
1332
+ * @method
1333
+ * @name bitstamp#createOrder
1334
+ * @description create a trade order
1335
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantBuyOrder
1336
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketBuyOrder
1337
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitBuyOrder
1338
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantSellOrder
1339
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketSellOrder
1340
+ * @see https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder
1341
+ * @param {string} symbol unified symbol of the market to create an order in
1342
+ * @param {string} type 'market' or 'limit'
1343
+ * @param {string} side 'buy' or 'sell'
1344
+ * @param {float} amount how much of currency you want to trade in units of base currency
1345
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1346
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1347
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1348
+ */
1349
+ await this.loadMarkets();
1350
+ const market = this.market(symbol);
1351
+ const request = {
1352
+ 'pair': market['id'],
1353
+ 'amount': this.amountToPrecision(symbol, amount),
1354
+ };
1355
+ const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
1356
+ if (clientOrderId !== undefined) {
1357
+ request['client_order_id'] = clientOrderId;
1358
+ params = this.omit(params, ['clientOrderId']);
1359
+ }
1360
+ let response = undefined;
1361
+ const capitalizedSide = this.capitalize(side);
1362
+ if (type === 'market') {
1363
+ if (capitalizedSide === 'Buy') {
1364
+ response = await this.privatePostBuyMarketPair(this.extend(request, params));
1365
+ }
1366
+ else {
1367
+ response = await this.privatePostSellMarketPair(this.extend(request, params));
1368
+ }
1369
+ }
1370
+ else if (type === 'instant') {
1371
+ if (capitalizedSide === 'Buy') {
1372
+ response = await this.privatePostBuyInstantPair(this.extend(request, params));
1373
+ }
1374
+ else {
1375
+ response = await this.privatePostSellInstantPair(this.extend(request, params));
1376
+ }
1377
+ }
1378
+ else {
1379
+ request['price'] = this.priceToPrecision(symbol, price);
1380
+ if (capitalizedSide === 'Buy') {
1381
+ response = await this.privatePostBuyPair(this.extend(request, params));
1382
+ }
1383
+ else {
1384
+ response = await this.privatePostSellPair(this.extend(request, params));
1385
+ }
1386
+ }
1387
+ const order = this.parseOrder(response, market);
1388
+ order['type'] = type;
1389
+ return order;
1390
+ }
1391
+ async cancelOrder(id, symbol = undefined, params = {}) {
1392
+ /**
1393
+ * @method
1394
+ * @name bitstamp#cancelOrder
1395
+ * @description cancels an open order
1396
+ * @param {string} id order id
1397
+ * @param {string} symbol unified symbol of the market the order was made in
1398
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1399
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1400
+ */
1401
+ await this.loadMarkets();
1402
+ const request = {
1403
+ 'id': id,
1404
+ };
1405
+ return await this.privatePostCancelOrder(this.extend(request, params));
1406
+ }
1407
+ async cancelAllOrders(symbol = undefined, params = {}) {
1408
+ /**
1409
+ * @method
1410
+ * @name bitstamp#cancelAllOrders
1411
+ * @description cancel all open orders
1412
+ * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1413
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1414
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1415
+ */
1416
+ await this.loadMarkets();
1417
+ let market = undefined;
1418
+ const request = {};
1419
+ let response = undefined;
1420
+ if (symbol !== undefined) {
1421
+ market = this.market(symbol);
1422
+ request['pair'] = market['id'];
1423
+ response = await this.privatePostCancelAllOrdersPair(this.extend(request, params));
1424
+ }
1425
+ else {
1426
+ response = await this.privatePostCancelAllOrders(this.extend(request, params));
1427
+ }
1428
+ return response;
1429
+ }
1430
+ parseOrderStatus(status) {
1431
+ const statuses = {
1432
+ 'In Queue': 'open',
1433
+ 'Open': 'open',
1434
+ 'Finished': 'closed',
1435
+ 'Canceled': 'canceled',
1436
+ };
1437
+ return this.safeString(statuses, status, status);
1438
+ }
1439
+ async fetchOrderStatus(id, symbol = undefined, params = {}) {
1440
+ await this.loadMarkets();
1441
+ const clientOrderId = this.safeValue2(params, 'client_order_id', 'clientOrderId');
1442
+ const request = {};
1443
+ if (clientOrderId !== undefined) {
1444
+ request['client_order_id'] = clientOrderId;
1445
+ params = this.omit(params, ['client_order_id', 'clientOrderId']);
1446
+ }
1447
+ else {
1448
+ request['id'] = id;
1449
+ }
1450
+ const response = await this.privatePostOrderStatus(this.extend(request, params));
1451
+ return this.parseOrderStatus(this.safeString(response, 'status'));
1452
+ }
1453
+ async fetchOrder(id, symbol = undefined, params = {}) {
1454
+ /**
1455
+ * @method
1456
+ * @name bitstamp#fetchOrder
1457
+ * @description fetches information on an order made by the user
1458
+ * @param {string} symbol unified symbol of the market the order was made in
1459
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1460
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1461
+ */
1462
+ await this.loadMarkets();
1463
+ let market = undefined;
1464
+ if (symbol !== undefined) {
1465
+ market = this.market(symbol);
1466
+ }
1467
+ const clientOrderId = this.safeValue2(params, 'client_order_id', 'clientOrderId');
1468
+ const request = {};
1469
+ if (clientOrderId !== undefined) {
1470
+ request['client_order_id'] = clientOrderId;
1471
+ params = this.omit(params, ['client_order_id', 'clientOrderId']);
1472
+ }
1473
+ else {
1474
+ request['id'] = id;
1475
+ }
1476
+ const response = await this.privatePostOrderStatus(this.extend(request, params));
1477
+ //
1478
+ // {
1479
+ // "status": "Finished",
1480
+ // "id": 1429545880227846,
1481
+ // "amount_remaining": "0.00000000",
1482
+ // "transactions": [
1483
+ // {
1484
+ // "fee": "0.11128",
1485
+ // "price": "4451.25000000",
1486
+ // "datetime": "2021-11-25 12:59:59.322000",
1487
+ // "usdt": "22.25625000",
1488
+ // "tid": 209895701,
1489
+ // "eth": "0.00500000",
1490
+ // "type": 2
1491
+ // }
1492
+ // ]
1493
+ // }
1494
+ //
1495
+ return this.parseOrder(response, market);
1496
+ }
1497
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1498
+ /**
1499
+ * @method
1500
+ * @name bitstamp#fetchMyTrades
1501
+ * @description fetch all trades made by the user
1502
+ * @param {string} symbol unified market symbol
1503
+ * @param {int} [since] the earliest time in ms to fetch trades for
1504
+ * @param {int} [limit] the maximum number of trades structures to retrieve
1505
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1506
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1507
+ */
1508
+ await this.loadMarkets();
1509
+ const request = {};
1510
+ let method = 'privatePostUserTransactions';
1511
+ let market = undefined;
1512
+ if (symbol !== undefined) {
1513
+ market = this.market(symbol);
1514
+ request['pair'] = market['id'];
1515
+ method += 'Pair';
1516
+ }
1517
+ if (limit !== undefined) {
1518
+ request['limit'] = limit;
1519
+ }
1520
+ const response = await this[method](this.extend(request, params));
1521
+ const result = this.filterBy(response, 'type', '2');
1522
+ return this.parseTrades(result, market, since, limit);
1523
+ }
1524
+ async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1525
+ /**
1526
+ * @method
1527
+ * @name bitstamp#fetchDepositsWithdrawals
1528
+ * @description fetch history of deposits and withdrawals
1529
+ * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
1530
+ * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
1531
+ * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
1532
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1533
+ * @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1534
+ */
1535
+ await this.loadMarkets();
1536
+ const request = {};
1537
+ if (limit !== undefined) {
1538
+ request['limit'] = limit;
1539
+ }
1540
+ const response = await this.privatePostUserTransactions(this.extend(request, params));
1541
+ //
1542
+ // [
1543
+ // {
1544
+ // "fee": "0.00000000",
1545
+ // "btc_usd": "0.00",
1546
+ // "id": 1234567894,
1547
+ // "usd": 0,
1548
+ // "btc": 0,
1549
+ // "datetime": "2018-09-08 09:00:31",
1550
+ // "type": "1",
1551
+ // "xrp": "-20.00000000",
1552
+ // "eur": 0,
1553
+ // },
1554
+ // {
1555
+ // "fee": "0.00000000",
1556
+ // "btc_usd": "0.00",
1557
+ // "id": 1134567891,
1558
+ // "usd": 0,
1559
+ // "btc": 0,
1560
+ // "datetime": "2018-09-07 18:47:52",
1561
+ // "type": "0",
1562
+ // "xrp": "20.00000000",
1563
+ // "eur": 0,
1564
+ // },
1565
+ // ]
1566
+ //
1567
+ let currency = undefined;
1568
+ if (code !== undefined) {
1569
+ currency = this.currency(code);
1570
+ }
1571
+ const transactions = this.filterByArray(response, 'type', ['0', '1'], false);
1572
+ return this.parseTransactions(transactions, currency, since, limit);
1573
+ }
1574
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1575
+ /**
1576
+ * @method
1577
+ * @name bitstamp#fetchWithdrawals
1578
+ * @description fetch all withdrawals made from an account
1579
+ * @param {string} code unified currency code
1580
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
1581
+ * @param {int} [limit] the maximum number of withdrawals structures to retrieve
1582
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1583
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1584
+ */
1585
+ await this.loadMarkets();
1586
+ const request = {};
1587
+ if (since !== undefined) {
1588
+ request['timedelta'] = this.milliseconds() - since;
1589
+ }
1590
+ else {
1591
+ request['timedelta'] = 50000000; // use max bitstamp approved value
1592
+ }
1593
+ const response = await this.privatePostWithdrawalRequests(this.extend(request, params));
1594
+ //
1595
+ // [
1596
+ // {
1597
+ // "status": 2,
1598
+ // "datetime": "2018-10-17 10:58:13",
1599
+ // "currency": "BTC",
1600
+ // "amount": "0.29669259",
1601
+ // "address": "aaaaa",
1602
+ // "type": 1,
1603
+ // "id": 111111,
1604
+ // "transaction_id": "xxxx",
1605
+ // },
1606
+ // {
1607
+ // "status": 2,
1608
+ // "datetime": "2018-10-17 10:55:17",
1609
+ // "currency": "ETH",
1610
+ // "amount": "1.11010664",
1611
+ // "address": "aaaa",
1612
+ // "type": 16,
1613
+ // "id": 222222,
1614
+ // "transaction_id": "xxxxx",
1615
+ // },
1616
+ // ]
1617
+ //
1618
+ return this.parseTransactions(response, undefined, since, limit);
1619
+ }
1620
+ parseTransaction(transaction, currency = undefined) {
1621
+ //
1622
+ // fetchDepositsWithdrawals
1623
+ //
1624
+ // {
1625
+ // "fee": "0.00000000",
1626
+ // "btc_usd": "0.00",
1627
+ // "id": 1234567894,
1628
+ // "usd": 0,
1629
+ // "btc": 0,
1630
+ // "datetime": "2018-09-08 09:00:31",
1631
+ // "type": "1",
1632
+ // "xrp": "-20.00000000",
1633
+ // "eur": 0,
1634
+ // }
1635
+ //
1636
+ // fetchWithdrawals
1637
+ //
1638
+ // {
1639
+ // "status": 2,
1640
+ // "datetime": "2018-10-17 10:58:13",
1641
+ // "currency": "BTC",
1642
+ // "amount": "0.29669259",
1643
+ // "address": "aaaaa",
1644
+ // "type": 1,
1645
+ // "id": 111111,
1646
+ // "transaction_id": "xxxx",
1647
+ // }
1648
+ //
1649
+ // {
1650
+ // "id": 3386432,
1651
+ // "type": 14,
1652
+ // "amount": "863.21332500",
1653
+ // "status": 2,
1654
+ // "address": "rE1sdh25BJQ3qFwngiTBwaq3zPGGYcrjp1?dt=1455",
1655
+ // "currency": "XRP",
1656
+ // "datetime": "2018-01-05 15:27:55",
1657
+ // "transaction_id": "001743B03B0C79BA166A064AC0142917B050347B4CB23BA2AB4B91B3C5608F4C"
1658
+ // }
1659
+ //
1660
+ const timestamp = this.parse8601(this.safeString(transaction, 'datetime'));
1661
+ const currencyId = this.getCurrencyIdFromTransaction(transaction);
1662
+ const code = this.safeCurrencyCode(currencyId, currency);
1663
+ const feeCost = this.safeString(transaction, 'fee');
1664
+ let feeCurrency = undefined;
1665
+ let amount = undefined;
1666
+ if ('amount' in transaction) {
1667
+ amount = this.safeString(transaction, 'amount');
1668
+ }
1669
+ else if (currency !== undefined) {
1670
+ amount = this.safeString(transaction, currency['id'], amount);
1671
+ feeCurrency = currency['code'];
1672
+ }
1673
+ else if ((code !== undefined) && (currencyId !== undefined)) {
1674
+ amount = this.safeString(transaction, currencyId, amount);
1675
+ feeCurrency = code;
1676
+ }
1677
+ if (amount !== undefined) {
1678
+ // withdrawals have a negative amount
1679
+ amount = Precise["default"].stringAbs(amount);
1680
+ }
1681
+ let status = 'ok';
1682
+ if ('status' in transaction) {
1683
+ status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
1684
+ }
1685
+ let type = undefined;
1686
+ if ('type' in transaction) {
1687
+ // from fetchDepositsWithdrawals
1688
+ const rawType = this.safeString(transaction, 'type');
1689
+ if (rawType === '0') {
1690
+ type = 'deposit';
1691
+ }
1692
+ else if (rawType === '1') {
1693
+ type = 'withdrawal';
1694
+ }
1695
+ }
1696
+ else {
1697
+ // from fetchWithdrawals
1698
+ type = 'withdrawal';
1699
+ }
1700
+ let tag = undefined;
1701
+ let address = this.safeString(transaction, 'address');
1702
+ if (address !== undefined) {
1703
+ // dt (destination tag) is embedded into the address field
1704
+ const addressParts = address.split('?dt=');
1705
+ const numParts = addressParts.length;
1706
+ if (numParts > 1) {
1707
+ address = addressParts[0];
1708
+ tag = addressParts[1];
1709
+ }
1710
+ }
1711
+ let fee = {
1712
+ 'currency': undefined,
1713
+ 'cost': undefined,
1714
+ 'rate': undefined,
1715
+ };
1716
+ if (feeCost !== undefined) {
1717
+ fee = {
1718
+ 'currency': feeCurrency,
1719
+ 'cost': feeCost,
1720
+ 'rate': undefined,
1721
+ };
1722
+ }
1723
+ return {
1724
+ 'info': transaction,
1725
+ 'id': this.safeString(transaction, 'id'),
1726
+ 'txid': this.safeString(transaction, 'transaction_id'),
1727
+ 'type': type,
1728
+ 'currency': code,
1729
+ 'network': undefined,
1730
+ 'amount': this.parseNumber(amount),
1731
+ 'status': status,
1732
+ 'timestamp': timestamp,
1733
+ 'datetime': this.iso8601(timestamp),
1734
+ 'address': address,
1735
+ 'addressFrom': undefined,
1736
+ 'addressTo': address,
1737
+ 'tag': tag,
1738
+ 'tagFrom': undefined,
1739
+ 'tagTo': tag,
1740
+ 'updated': undefined,
1741
+ 'comment': undefined,
1742
+ 'internal': undefined,
1743
+ 'fee': fee,
1744
+ };
1745
+ }
1746
+ parseTransactionStatus(status) {
1747
+ //
1748
+ // withdrawals:
1749
+ // 0 (open), 1 (in process), 2 (finished), 3 (canceled) or 4 (failed).
1750
+ //
1751
+ const statuses = {
1752
+ '0': 'pending',
1753
+ '1': 'pending',
1754
+ '2': 'ok',
1755
+ '3': 'canceled',
1756
+ '4': 'failed', // Failed
1757
+ };
1758
+ return this.safeString(statuses, status, status);
1759
+ }
1760
+ parseOrder(order, market = undefined) {
1761
+ //
1762
+ // from fetch order:
1763
+ // { status: "Finished",
1764
+ // "id": 731693945,
1765
+ // "client_order_id": '',
1766
+ // "transactions":
1767
+ // [ { fee: "0.000019",
1768
+ // "price": "0.00015803",
1769
+ // "datetime": "2018-01-07 10:45:34.132551",
1770
+ // "btc": "0.0079015000000000",
1771
+ // "tid": 42777395,
1772
+ // "type": 2,
1773
+ // "xrp": "50.00000000" } ] }
1774
+ //
1775
+ // partially filled order:
1776
+ // { "id": 468646390,
1777
+ // "client_order_id": "",
1778
+ // "status": "Canceled",
1779
+ // "transactions": [{
1780
+ // "eth": "0.23000000",
1781
+ // "fee": "0.09",
1782
+ // "tid": 25810126,
1783
+ // "usd": "69.8947000000000000",
1784
+ // "type": 2,
1785
+ // "price": "303.89000000",
1786
+ // "datetime": "2017-11-11 07:22:20.710567"
1787
+ // }]}
1788
+ //
1789
+ // from create order response:
1790
+ // {
1791
+ // "price": "0.00008012",
1792
+ // "client_order_id": '',
1793
+ // "currency_pair": "XRP/BTC",
1794
+ // "datetime": "2019-01-31 21:23:36",
1795
+ // "amount": "15.00000000",
1796
+ // "type": "0",
1797
+ // "id": "2814205012"
1798
+ // }
1799
+ //
1800
+ const id = this.safeString(order, 'id');
1801
+ const clientOrderId = this.safeString(order, 'client_order_id');
1802
+ let side = this.safeString(order, 'type');
1803
+ if (side !== undefined) {
1804
+ side = (side === '1') ? 'sell' : 'buy';
1805
+ }
1806
+ // there is no timestamp from fetchOrder
1807
+ const timestamp = this.parse8601(this.safeString(order, 'datetime'));
1808
+ const marketId = this.safeStringLower(order, 'currency_pair');
1809
+ const symbol = this.safeSymbol(marketId, market, '/');
1810
+ const status = this.parseOrderStatus(this.safeString(order, 'status'));
1811
+ const amount = this.safeString(order, 'amount');
1812
+ const transactions = this.safeValue(order, 'transactions', []);
1813
+ const price = this.safeString(order, 'price');
1814
+ return this.safeOrder({
1815
+ 'id': id,
1816
+ 'clientOrderId': clientOrderId,
1817
+ 'datetime': this.iso8601(timestamp),
1818
+ 'timestamp': timestamp,
1819
+ 'lastTradeTimestamp': undefined,
1820
+ 'status': status,
1821
+ 'symbol': symbol,
1822
+ 'type': undefined,
1823
+ 'timeInForce': undefined,
1824
+ 'postOnly': undefined,
1825
+ 'side': side,
1826
+ 'price': price,
1827
+ 'stopPrice': undefined,
1828
+ 'triggerPrice': undefined,
1829
+ 'cost': undefined,
1830
+ 'amount': amount,
1831
+ 'filled': undefined,
1832
+ 'remaining': undefined,
1833
+ 'trades': transactions,
1834
+ 'fee': undefined,
1835
+ 'info': order,
1836
+ 'average': undefined,
1837
+ }, market);
1838
+ }
1839
+ parseLedgerEntryType(type) {
1840
+ const types = {
1841
+ '0': 'transaction',
1842
+ '1': 'transaction',
1843
+ '2': 'trade',
1844
+ '14': 'transfer',
1845
+ };
1846
+ return this.safeString(types, type, type);
1847
+ }
1848
+ parseLedgerEntry(item, currency = undefined) {
1849
+ //
1850
+ // [
1851
+ // {
1852
+ // "fee": "0.00000000",
1853
+ // "btc_usd": "0.00",
1854
+ // "id": 1234567894,
1855
+ // "usd": 0,
1856
+ // "btc": 0,
1857
+ // "datetime": "2018-09-08 09:00:31",
1858
+ // "type": "1",
1859
+ // "xrp": "-20.00000000",
1860
+ // "eur": 0,
1861
+ // },
1862
+ // {
1863
+ // "fee": "0.00000000",
1864
+ // "btc_usd": "0.00",
1865
+ // "id": 1134567891,
1866
+ // "usd": 0,
1867
+ // "btc": 0,
1868
+ // "datetime": "2018-09-07 18:47:52",
1869
+ // "type": "0",
1870
+ // "xrp": "20.00000000",
1871
+ // "eur": 0,
1872
+ // },
1873
+ // ]
1874
+ //
1875
+ const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
1876
+ if (type === 'trade') {
1877
+ const parsedTrade = this.parseTrade(item);
1878
+ let market = undefined;
1879
+ const keys = Object.keys(item);
1880
+ for (let i = 0; i < keys.length; i++) {
1881
+ if (keys[i].indexOf('_') >= 0) {
1882
+ const marketId = keys[i].replace('_', '');
1883
+ market = this.safeMarket(marketId, market);
1884
+ }
1885
+ }
1886
+ // if the market is still not defined
1887
+ // try to deduce it from used keys
1888
+ if (market === undefined) {
1889
+ market = this.getMarketFromTrade(item);
1890
+ }
1891
+ const direction = (parsedTrade['side'] === 'buy') ? 'in' : 'out';
1892
+ return {
1893
+ 'id': parsedTrade['id'],
1894
+ 'info': item,
1895
+ 'timestamp': parsedTrade['timestamp'],
1896
+ 'datetime': parsedTrade['datetime'],
1897
+ 'direction': direction,
1898
+ 'account': undefined,
1899
+ 'referenceId': parsedTrade['order'],
1900
+ 'referenceAccount': undefined,
1901
+ 'type': type,
1902
+ 'currency': market['base'],
1903
+ 'amount': parsedTrade['amount'],
1904
+ 'before': undefined,
1905
+ 'after': undefined,
1906
+ 'status': 'ok',
1907
+ 'fee': parsedTrade['fee'],
1908
+ };
1909
+ }
1910
+ else {
1911
+ const parsedTransaction = this.parseTransaction(item, currency);
1912
+ let direction = undefined;
1913
+ if ('amount' in item) {
1914
+ const amount = this.safeString(item, 'amount');
1915
+ direction = Precise["default"].stringGt(amount, '0') ? 'in' : 'out';
1916
+ }
1917
+ else if (('currency' in parsedTransaction) && parsedTransaction['currency'] !== undefined) {
1918
+ const currencyCode = this.safeString(parsedTransaction, 'currency');
1919
+ currency = this.currency(currencyCode);
1920
+ const amount = this.safeString(item, currency['id']);
1921
+ direction = Precise["default"].stringGt(amount, '0') ? 'in' : 'out';
1922
+ }
1923
+ return {
1924
+ 'id': parsedTransaction['id'],
1925
+ 'info': item,
1926
+ 'timestamp': parsedTransaction['timestamp'],
1927
+ 'datetime': parsedTransaction['datetime'],
1928
+ 'direction': direction,
1929
+ 'account': undefined,
1930
+ 'referenceId': parsedTransaction['txid'],
1931
+ 'referenceAccount': undefined,
1932
+ 'type': type,
1933
+ 'currency': parsedTransaction['currency'],
1934
+ 'amount': parsedTransaction['amount'],
1935
+ 'before': undefined,
1936
+ 'after': undefined,
1937
+ 'status': parsedTransaction['status'],
1938
+ 'fee': parsedTransaction['fee'],
1939
+ };
1940
+ }
1941
+ }
1942
+ async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1943
+ /**
1944
+ * @method
1945
+ * @name bitstamp#fetchLedger
1946
+ * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1947
+ * @param {string} code unified currency code, default is undefined
1948
+ * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1949
+ * @param {int} [limit] max number of ledger entrys to return, default is undefined
1950
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1951
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1952
+ */
1953
+ await this.loadMarkets();
1954
+ const request = {};
1955
+ if (limit !== undefined) {
1956
+ request['limit'] = limit;
1957
+ }
1958
+ const response = await this.privatePostUserTransactions(this.extend(request, params));
1959
+ let currency = undefined;
1960
+ if (code !== undefined) {
1961
+ currency = this.currency(code);
1962
+ }
1963
+ return this.parseLedger(response, currency, since, limit);
1964
+ }
1965
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1966
+ /**
1967
+ * @method
1968
+ * @name bitstamp#fetchOpenOrders
1969
+ * @description fetch all unfilled currently open orders
1970
+ * @param {string} symbol unified market symbol
1971
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1972
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1973
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1974
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1975
+ */
1976
+ let market = undefined;
1977
+ await this.loadMarkets();
1978
+ if (symbol !== undefined) {
1979
+ market = this.market(symbol);
1980
+ }
1981
+ const response = await this.privatePostOpenOrdersAll(params);
1982
+ //
1983
+ // [
1984
+ // {
1985
+ // "price": "0.00008012",
1986
+ // "currency_pair": "XRP/BTC",
1987
+ // "client_order_id": '',
1988
+ // "datetime": "2019-01-31 21:23:36",
1989
+ // "amount": "15.00000000",
1990
+ // "type": "0",
1991
+ // "id": "2814205012",
1992
+ // }
1993
+ // ]
1994
+ //
1995
+ return this.parseOrders(response, market, since, limit, {
1996
+ 'status': 'open',
1997
+ 'type': 'limit',
1998
+ });
1999
+ }
2000
+ getCurrencyName(code) {
2001
+ /**
2002
+ * @ignore
2003
+ * @method
2004
+ * @param {string} code Unified currency code
2005
+ * @returns {string} lowercase version of code
2006
+ */
2007
+ return code.toLowerCase();
2008
+ }
2009
+ isFiat(code) {
2010
+ return code === 'USD' || code === 'EUR' || code === 'GBP';
2011
+ }
2012
+ async fetchDepositAddress(code, params = {}) {
2013
+ /**
2014
+ * @method
2015
+ * @name bitstamp#fetchDepositAddress
2016
+ * @description fetch the deposit address for a currency associated with this account
2017
+ * @param {string} code unified currency code
2018
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2019
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
2020
+ */
2021
+ if (this.isFiat(code)) {
2022
+ throw new errors.NotSupported(this.id + ' fiat fetchDepositAddress() for ' + code + ' is not supported!');
2023
+ }
2024
+ const name = this.getCurrencyName(code);
2025
+ const method = 'privatePost' + this.capitalize(name) + 'Address';
2026
+ const response = await this[method](params);
2027
+ const address = this.safeString(response, 'address');
2028
+ const tag = this.safeString2(response, 'memo_id', 'destination_tag');
2029
+ this.checkAddress(address);
2030
+ return {
2031
+ 'currency': code,
2032
+ 'address': address,
2033
+ 'tag': tag,
2034
+ 'network': undefined,
2035
+ 'info': response,
2036
+ };
2037
+ }
2038
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
2039
+ /**
2040
+ * @method
2041
+ * @name bitstamp#withdraw
2042
+ * @description make a withdrawal
2043
+ * @param {string} code unified currency code
2044
+ * @param {float} amount the amount to withdraw
2045
+ * @param {string} address the address to withdraw to
2046
+ * @param {string} tag
2047
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2048
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2049
+ */
2050
+ // For fiat withdrawals please provide all required additional parameters in the 'params'
2051
+ // Check https://www.bitstamp.net/api/ under 'Open bank withdrawal' for list and description.
2052
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
2053
+ await this.loadMarkets();
2054
+ this.checkAddress(address);
2055
+ const request = {
2056
+ 'amount': amount,
2057
+ };
2058
+ let currency = undefined;
2059
+ let method = undefined;
2060
+ if (!this.isFiat(code)) {
2061
+ const name = this.getCurrencyName(code);
2062
+ method = 'privatePost' + this.capitalize(name) + 'Withdrawal';
2063
+ if (code === 'XRP') {
2064
+ if (tag !== undefined) {
2065
+ request['destination_tag'] = tag;
2066
+ }
2067
+ }
2068
+ else if (code === 'XLM' || code === 'HBAR') {
2069
+ if (tag !== undefined) {
2070
+ request['memo_id'] = tag;
2071
+ }
2072
+ }
2073
+ request['address'] = address;
2074
+ }
2075
+ else {
2076
+ method = 'privatePostWithdrawalOpen';
2077
+ currency = this.currency(code);
2078
+ request['iban'] = address;
2079
+ request['account_currency'] = currency['id'];
2080
+ }
2081
+ const response = await this[method](this.extend(request, params));
2082
+ return this.parseTransaction(response, currency);
2083
+ }
2084
+ nonce() {
2085
+ return this.milliseconds();
2086
+ }
2087
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2088
+ let url = this.urls['api'][api] + '/';
2089
+ url += this.version + '/';
2090
+ url += this.implodeParams(path, params);
2091
+ const query = this.omit(params, this.extractParams(path));
2092
+ if (api === 'public') {
2093
+ if (Object.keys(query).length) {
2094
+ url += '?' + this.urlencode(query);
2095
+ }
2096
+ }
2097
+ else {
2098
+ this.checkRequiredCredentials();
2099
+ const xAuth = 'BITSTAMP ' + this.apiKey;
2100
+ const xAuthNonce = this.uuid();
2101
+ const xAuthTimestamp = this.milliseconds().toString();
2102
+ const xAuthVersion = 'v2';
2103
+ let contentType = '';
2104
+ headers = {
2105
+ 'X-Auth': xAuth,
2106
+ 'X-Auth-Nonce': xAuthNonce,
2107
+ 'X-Auth-Timestamp': xAuthTimestamp,
2108
+ 'X-Auth-Version': xAuthVersion,
2109
+ };
2110
+ if (method === 'POST') {
2111
+ if (Object.keys(query).length) {
2112
+ body = this.urlencode(query);
2113
+ contentType = 'application/x-www-form-urlencoded';
2114
+ headers['Content-Type'] = contentType;
2115
+ }
2116
+ else {
2117
+ // sending an empty POST request will trigger
2118
+ // an API0020 error returned by the exchange
2119
+ // therefore for empty requests we send a dummy object
2120
+ // https://github.com/ccxt/ccxt/issues/6846
2121
+ body = this.urlencode({ 'foo': 'bar' });
2122
+ contentType = 'application/x-www-form-urlencoded';
2123
+ headers['Content-Type'] = contentType;
2124
+ }
2125
+ }
2126
+ const authBody = body ? body : '';
2127
+ const auth = xAuth + method + url.replace('https://', '') + contentType + xAuthNonce + xAuthTimestamp + xAuthVersion + authBody;
2128
+ const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256);
2129
+ headers['X-Auth-Signature'] = signature;
2130
+ }
2131
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
2132
+ }
2133
+ handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
2134
+ if (response === undefined) {
2135
+ return undefined;
2136
+ }
2137
+ //
2138
+ // {"error": "No permission found"} // fetchDepositAddress returns this on apiKeys that don't have the permission required
2139
+ // {"status": "error", "reason": {"__all__": ["Minimum order size is 5.0 EUR."]}}
2140
+ // reuse of a nonce gives: { status: 'error', reason: 'Invalid nonce', code: 'API0004' }
2141
+ //
2142
+ const status = this.safeString(response, 'status');
2143
+ const error = this.safeValue(response, 'error');
2144
+ if ((status === 'error') || (error !== undefined)) {
2145
+ let errors$1 = [];
2146
+ if (typeof error === 'string') {
2147
+ errors$1.push(error);
2148
+ }
2149
+ else if (error !== undefined) {
2150
+ const keys = Object.keys(error);
2151
+ for (let i = 0; i < keys.length; i++) {
2152
+ const key = keys[i];
2153
+ const value = this.safeValue(error, key);
2154
+ if (Array.isArray(value)) {
2155
+ errors$1 = this.arrayConcat(errors$1, value);
2156
+ }
2157
+ else {
2158
+ errors$1.push(value);
2159
+ }
2160
+ }
2161
+ }
2162
+ const reasonInner = this.safeValue(response, 'reason', {});
2163
+ if (typeof reasonInner === 'string') {
2164
+ errors$1.push(reasonInner);
2165
+ }
2166
+ else {
2167
+ const all = this.safeValue(reasonInner, '__all__', []);
2168
+ for (let i = 0; i < all.length; i++) {
2169
+ errors$1.push(all[i]);
2170
+ }
2171
+ }
2172
+ const code = this.safeString(response, 'code');
2173
+ if (code === 'API0005') {
2174
+ throw new errors.AuthenticationError(this.id + ' invalid signature, use the uid for the main account if you have subaccounts');
2175
+ }
2176
+ const feedback = this.id + ' ' + body;
2177
+ for (let i = 0; i < errors$1.length; i++) {
2178
+ const value = errors$1[i];
2179
+ this.throwExactlyMatchedException(this.exceptions['exact'], value, feedback);
2180
+ this.throwBroadlyMatchedException(this.exceptions['broad'], value, feedback);
2181
+ }
2182
+ throw new errors.ExchangeError(feedback);
2183
+ }
2184
+ return undefined;
2185
+ }
2186
+ }
2187
+
2188
+ module.exports = bitstamp;