ccxt 4.2.17 → 4.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/README.md +9 -9
  2. package/dist/ccxt.browser.js +48992 -47725
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +12 -1
  5. package/dist/cjs/src/alpaca.js +18 -18
  6. package/dist/cjs/src/ascendex.js +13 -6
  7. package/dist/cjs/src/base/Exchange.js +266 -27
  8. package/dist/cjs/src/bigone.js +434 -168
  9. package/dist/cjs/src/binance.js +163 -34
  10. package/dist/cjs/src/binanceus.js +8 -0
  11. package/dist/cjs/src/bingx.js +183 -41
  12. package/dist/cjs/src/bitfinex.js +2 -3
  13. package/dist/cjs/src/bitget.js +59 -16
  14. package/dist/cjs/src/bitmart.js +5 -5
  15. package/dist/cjs/src/bitmex.js +4 -6
  16. package/dist/cjs/src/bitpanda.js +5 -1991
  17. package/dist/cjs/src/bitstamp.js +8 -0
  18. package/dist/cjs/src/bybit.js +27 -47
  19. package/dist/cjs/src/coinbase.js +176 -26
  20. package/dist/cjs/src/coincheck.js +1 -0
  21. package/dist/cjs/src/coinex.js +3 -0
  22. package/dist/cjs/src/coinlist.js +13 -6
  23. package/dist/cjs/src/coinone.js +2 -2
  24. package/dist/cjs/src/coinsph.js +4 -5
  25. package/dist/cjs/src/delta.js +7 -1
  26. package/dist/cjs/src/deribit.js +17 -4
  27. package/dist/cjs/src/gate.js +151 -169
  28. package/dist/cjs/src/gemini.js +1 -1
  29. package/dist/cjs/src/hitbtc.js +2 -3
  30. package/dist/cjs/src/htx.js +157 -7
  31. package/dist/cjs/src/huobijp.js +2 -3
  32. package/dist/cjs/src/independentreserve.js +7 -5
  33. package/dist/cjs/src/kraken.js +86 -54
  34. package/dist/cjs/src/kucoin.js +5 -0
  35. package/dist/cjs/src/kucoinfutures.js +131 -77
  36. package/dist/cjs/src/lbank.js +60 -33
  37. package/dist/cjs/src/luno.js +84 -2
  38. package/dist/cjs/src/mexc.js +3 -3
  39. package/dist/cjs/src/oceanex.js +1 -1
  40. package/dist/cjs/src/okx.js +23 -11
  41. package/dist/cjs/{js/src/bitpanda.js → src/onetrading.js} +39 -39
  42. package/dist/cjs/src/phemex.js +37 -27
  43. package/dist/cjs/src/poloniexfutures.js +1 -0
  44. package/dist/cjs/src/pro/binance.js +66 -25
  45. package/dist/cjs/src/pro/bitget.js +1 -1
  46. package/dist/cjs/src/pro/bitpanda.js +5 -1330
  47. package/dist/cjs/src/pro/coinbase.js +4 -1
  48. package/dist/cjs/src/pro/coincheck.js +208 -0
  49. package/dist/cjs/src/pro/hitbtc.js +5 -4
  50. package/dist/cjs/src/pro/htx.js +6 -1
  51. package/dist/cjs/src/pro/kraken.js +1 -1
  52. package/dist/cjs/src/pro/krakenfutures.js +7 -1
  53. package/dist/cjs/src/pro/kucoin.js +46 -36
  54. package/dist/cjs/src/pro/kucoinfutures.js +45 -37
  55. package/dist/cjs/src/pro/lbank.js +881 -0
  56. package/dist/cjs/src/pro/okx.js +52 -2
  57. package/dist/cjs/{js/src/pro/bitpanda.js → src/pro/onetrading.js} +4 -7
  58. package/dist/cjs/src/pro/poloniex.js +2 -2
  59. package/dist/cjs/src/pro/poloniexfutures.js +43 -35
  60. package/dist/cjs/src/pro/woo.js +126 -0
  61. package/dist/cjs/src/probit.js +4 -2
  62. package/dist/cjs/src/upbit.js +12 -12
  63. package/dist/cjs/src/wavesexchange.js +1 -1
  64. package/dist/cjs/src/whitebit.js +1 -0
  65. package/dist/cjs/src/woo.js +56 -0
  66. package/js/ccxt.d.ts +14 -2
  67. package/js/ccxt.js +10 -2
  68. package/js/src/abstract/bitpanda.d.ts +4 -4
  69. package/js/src/abstract/bitstamp.d.ts +8 -0
  70. package/js/src/abstract/gate.d.ts +1 -0
  71. package/js/src/abstract/gateio.d.ts +1 -0
  72. package/js/src/abstract/htx.d.ts +3 -0
  73. package/js/src/abstract/huobi.d.ts +3 -0
  74. package/js/src/abstract/luno.d.ts +1 -0
  75. package/js/src/abstract/onetrading.d.ts +38 -0
  76. package/js/src/ascendex.js +2 -0
  77. package/js/src/base/Exchange.d.ts +2 -3
  78. package/js/src/base/Exchange.js +5 -2
  79. package/js/src/binance.js +7 -1
  80. package/js/src/bingx.d.ts +1 -0
  81. package/js/src/bingx.js +26 -0
  82. package/js/src/bitget.js +22 -3
  83. package/js/src/bitpanda.d.ts +2 -72
  84. package/js/src/bitpanda.js +5 -1991
  85. package/js/src/bitstamp.js +8 -0
  86. package/js/src/bybit.js +21 -47
  87. package/js/src/coincheck.js +1 -0
  88. package/js/src/deribit.js +16 -4
  89. package/js/src/gate.d.ts +1 -0
  90. package/js/src/gate.js +50 -110
  91. package/js/src/htx.js +3 -0
  92. package/js/src/kraken.d.ts +1 -0
  93. package/js/src/kraken.js +40 -39
  94. package/js/src/lbank.js +1 -0
  95. package/js/src/luno.d.ts +3 -1
  96. package/js/src/luno.js +84 -2
  97. package/js/src/mexc.js +1 -2
  98. package/js/src/onetrading.d.ts +74 -0
  99. package/js/src/onetrading.js +2003 -0
  100. package/js/src/poloniexfutures.js +1 -0
  101. package/js/src/pro/binance.js +7 -2
  102. package/js/src/pro/bitget.js +1 -1
  103. package/js/src/pro/bitpanda.d.ts +2 -34
  104. package/js/src/pro/bitpanda.js +5 -1330
  105. package/js/src/pro/coincheck.d.ts +12 -0
  106. package/js/src/pro/coincheck.js +209 -0
  107. package/js/src/pro/kucoin.js +43 -35
  108. package/js/src/pro/kucoinfutures.js +45 -37
  109. package/js/src/pro/lbank.d.ts +29 -0
  110. package/js/src/pro/lbank.js +882 -0
  111. package/js/src/pro/onetrading.d.ts +36 -0
  112. package/js/src/pro/onetrading.js +1339 -0
  113. package/js/src/pro/poloniexfutures.js +43 -35
  114. package/js/src/whitebit.js +1 -0
  115. package/package.json +2 -2
  116. package/rollup.config.js +2 -0
  117. package/skip-tests.json +14 -2
  118. package/test-commonjs.cjs +25 -1
  119. package/dist/cjs/js/ccxt.js +0 -476
  120. package/dist/cjs/js/src/abstract/alpaca.js +0 -9
  121. package/dist/cjs/js/src/abstract/ascendex.js +0 -9
  122. package/dist/cjs/js/src/abstract/bigone.js +0 -9
  123. package/dist/cjs/js/src/abstract/binance.js +0 -9
  124. package/dist/cjs/js/src/abstract/bingx.js +0 -9
  125. package/dist/cjs/js/src/abstract/bit2c.js +0 -9
  126. package/dist/cjs/js/src/abstract/bitbank.js +0 -9
  127. package/dist/cjs/js/src/abstract/bitbns.js +0 -9
  128. package/dist/cjs/js/src/abstract/bitfinex.js +0 -9
  129. package/dist/cjs/js/src/abstract/bitfinex2.js +0 -9
  130. package/dist/cjs/js/src/abstract/bitflyer.js +0 -9
  131. package/dist/cjs/js/src/abstract/bitforex.js +0 -9
  132. package/dist/cjs/js/src/abstract/bitget.js +0 -9
  133. package/dist/cjs/js/src/abstract/bithumb.js +0 -9
  134. package/dist/cjs/js/src/abstract/bitmart.js +0 -9
  135. package/dist/cjs/js/src/abstract/bitmex.js +0 -9
  136. package/dist/cjs/js/src/abstract/bitopro.js +0 -9
  137. package/dist/cjs/js/src/abstract/bitpanda.js +0 -9
  138. package/dist/cjs/js/src/abstract/bitrue.js +0 -9
  139. package/dist/cjs/js/src/abstract/bitso.js +0 -9
  140. package/dist/cjs/js/src/abstract/bitstamp.js +0 -9
  141. package/dist/cjs/js/src/abstract/bitteam.js +0 -9
  142. package/dist/cjs/js/src/abstract/bitvavo.js +0 -9
  143. package/dist/cjs/js/src/abstract/bl3p.js +0 -9
  144. package/dist/cjs/js/src/abstract/blockchaincom.js +0 -9
  145. package/dist/cjs/js/src/abstract/btcalpha.js +0 -9
  146. package/dist/cjs/js/src/abstract/btcbox.js +0 -9
  147. package/dist/cjs/js/src/abstract/btcmarkets.js +0 -9
  148. package/dist/cjs/js/src/abstract/btcturk.js +0 -9
  149. package/dist/cjs/js/src/abstract/bybit.js +0 -9
  150. package/dist/cjs/js/src/abstract/cex.js +0 -9
  151. package/dist/cjs/js/src/abstract/coinbase.js +0 -9
  152. package/dist/cjs/js/src/abstract/coinbasepro.js +0 -9
  153. package/dist/cjs/js/src/abstract/coincheck.js +0 -9
  154. package/dist/cjs/js/src/abstract/coinex.js +0 -9
  155. package/dist/cjs/js/src/abstract/coinlist.js +0 -9
  156. package/dist/cjs/js/src/abstract/coinmate.js +0 -9
  157. package/dist/cjs/js/src/abstract/coinone.js +0 -9
  158. package/dist/cjs/js/src/abstract/coinsph.js +0 -9
  159. package/dist/cjs/js/src/abstract/coinspot.js +0 -9
  160. package/dist/cjs/js/src/abstract/cryptocom.js +0 -9
  161. package/dist/cjs/js/src/abstract/currencycom.js +0 -9
  162. package/dist/cjs/js/src/abstract/delta.js +0 -9
  163. package/dist/cjs/js/src/abstract/deribit.js +0 -9
  164. package/dist/cjs/js/src/abstract/digifinex.js +0 -9
  165. package/dist/cjs/js/src/abstract/exmo.js +0 -9
  166. package/dist/cjs/js/src/abstract/gate.js +0 -9
  167. package/dist/cjs/js/src/abstract/gemini.js +0 -9
  168. package/dist/cjs/js/src/abstract/hitbtc.js +0 -9
  169. package/dist/cjs/js/src/abstract/hollaex.js +0 -9
  170. package/dist/cjs/js/src/abstract/htx.js +0 -9
  171. package/dist/cjs/js/src/abstract/huobijp.js +0 -9
  172. package/dist/cjs/js/src/abstract/idex.js +0 -9
  173. package/dist/cjs/js/src/abstract/independentreserve.js +0 -9
  174. package/dist/cjs/js/src/abstract/indodax.js +0 -9
  175. package/dist/cjs/js/src/abstract/kraken.js +0 -9
  176. package/dist/cjs/js/src/abstract/krakenfutures.js +0 -9
  177. package/dist/cjs/js/src/abstract/kucoin.js +0 -9
  178. package/dist/cjs/js/src/abstract/kucoinfutures.js +0 -9
  179. package/dist/cjs/js/src/abstract/kuna.js +0 -9
  180. package/dist/cjs/js/src/abstract/latoken.js +0 -9
  181. package/dist/cjs/js/src/abstract/lbank.js +0 -9
  182. package/dist/cjs/js/src/abstract/luno.js +0 -9
  183. package/dist/cjs/js/src/abstract/lykke.js +0 -9
  184. package/dist/cjs/js/src/abstract/mercado.js +0 -9
  185. package/dist/cjs/js/src/abstract/mexc.js +0 -9
  186. package/dist/cjs/js/src/abstract/ndax.js +0 -9
  187. package/dist/cjs/js/src/abstract/novadax.js +0 -9
  188. package/dist/cjs/js/src/abstract/oceanex.js +0 -9
  189. package/dist/cjs/js/src/abstract/okcoin.js +0 -9
  190. package/dist/cjs/js/src/abstract/okx.js +0 -9
  191. package/dist/cjs/js/src/abstract/p2b.js +0 -9
  192. package/dist/cjs/js/src/abstract/paymium.js +0 -9
  193. package/dist/cjs/js/src/abstract/phemex.js +0 -9
  194. package/dist/cjs/js/src/abstract/poloniex.js +0 -9
  195. package/dist/cjs/js/src/abstract/poloniexfutures.js +0 -9
  196. package/dist/cjs/js/src/abstract/probit.js +0 -9
  197. package/dist/cjs/js/src/abstract/timex.js +0 -9
  198. package/dist/cjs/js/src/abstract/tokocrypto.js +0 -9
  199. package/dist/cjs/js/src/abstract/upbit.js +0 -9
  200. package/dist/cjs/js/src/abstract/wavesexchange.js +0 -9
  201. package/dist/cjs/js/src/abstract/wazirx.js +0 -9
  202. package/dist/cjs/js/src/abstract/whitebit.js +0 -9
  203. package/dist/cjs/js/src/abstract/woo.js +0 -9
  204. package/dist/cjs/js/src/abstract/yobit.js +0 -9
  205. package/dist/cjs/js/src/abstract/zaif.js +0 -9
  206. package/dist/cjs/js/src/abstract/zonda.js +0 -9
  207. package/dist/cjs/js/src/ace.js +0 -1058
  208. package/dist/cjs/js/src/alpaca.js +0 -1125
  209. package/dist/cjs/js/src/ascendex.js +0 -3365
  210. package/dist/cjs/js/src/base/Exchange.js +0 -5257
  211. package/dist/cjs/js/src/base/Precise.js +0 -263
  212. package/dist/cjs/js/src/base/errors.js +0 -299
  213. package/dist/cjs/js/src/base/functions/crypto.js +0 -78
  214. package/dist/cjs/js/src/base/functions/encode.js +0 -44
  215. package/dist/cjs/js/src/base/functions/generic.js +0 -193
  216. package/dist/cjs/js/src/base/functions/misc.js +0 -96
  217. package/dist/cjs/js/src/base/functions/number.js +0 -297
  218. package/dist/cjs/js/src/base/functions/platform.js +0 -28
  219. package/dist/cjs/js/src/base/functions/rsa.js +0 -34
  220. package/dist/cjs/js/src/base/functions/string.js +0 -48
  221. package/dist/cjs/js/src/base/functions/throttle.js +0 -66
  222. package/dist/cjs/js/src/base/functions/time.js +0 -187
  223. package/dist/cjs/js/src/base/functions/totp.js +0 -24
  224. package/dist/cjs/js/src/base/functions/type.js +0 -162
  225. package/dist/cjs/js/src/base/functions.js +0 -157
  226. package/dist/cjs/js/src/base/ws/Cache.js +0 -254
  227. package/dist/cjs/js/src/base/ws/Client.js +0 -299
  228. package/dist/cjs/js/src/base/ws/Future.js +0 -34
  229. package/dist/cjs/js/src/base/ws/OrderBook.js +0 -107
  230. package/dist/cjs/js/src/base/ws/OrderBookSide.js +0 -281
  231. package/dist/cjs/js/src/base/ws/WsClient.js +0 -69
  232. package/dist/cjs/js/src/bequant.js +0 -33
  233. package/dist/cjs/js/src/bigone.js +0 -2213
  234. package/dist/cjs/js/src/binance.js +0 -9845
  235. package/dist/cjs/js/src/binancecoinm.js +0 -45
  236. package/dist/cjs/js/src/binanceus.js +0 -92
  237. package/dist/cjs/js/src/binanceusdm.js +0 -58
  238. package/dist/cjs/js/src/bingx.js +0 -3846
  239. package/dist/cjs/js/src/bit2c.js +0 -916
  240. package/dist/cjs/js/src/bitbank.js +0 -1000
  241. package/dist/cjs/js/src/bitbay.js +0 -17
  242. package/dist/cjs/js/src/bitbns.js +0 -1220
  243. package/dist/cjs/js/src/bitcoincom.js +0 -17
  244. package/dist/cjs/js/src/bitfinex.js +0 -1670
  245. package/dist/cjs/js/src/bitfinex2.js +0 -2990
  246. package/dist/cjs/js/src/bitflyer.js +0 -1045
  247. package/dist/cjs/js/src/bitforex.js +0 -852
  248. package/dist/cjs/js/src/bitget.js +0 -8295
  249. package/dist/cjs/js/src/bithumb.js +0 -1090
  250. package/dist/cjs/js/src/bitmart.js +0 -4454
  251. package/dist/cjs/js/src/bitmex.js +0 -2881
  252. package/dist/cjs/js/src/bitopro.js +0 -1724
  253. package/dist/cjs/js/src/bitrue.js +0 -3253
  254. package/dist/cjs/js/src/bitso.js +0 -1753
  255. package/dist/cjs/js/src/bitstamp.js +0 -2188
  256. package/dist/cjs/js/src/bitteam.js +0 -2309
  257. package/dist/cjs/js/src/bitvavo.js +0 -1968
  258. package/dist/cjs/js/src/bl3p.js +0 -447
  259. package/dist/cjs/js/src/blockchaincom.js +0 -1160
  260. package/dist/cjs/js/src/btcalpha.js +0 -929
  261. package/dist/cjs/js/src/btcbox.js +0 -565
  262. package/dist/cjs/js/src/btcmarkets.js +0 -1237
  263. package/dist/cjs/js/src/btcturk.js +0 -929
  264. package/dist/cjs/js/src/bybit.js +0 -7650
  265. package/dist/cjs/js/src/cex.js +0 -1693
  266. package/dist/cjs/js/src/coinbase.js +0 -3424
  267. package/dist/cjs/js/src/coinbasepro.js +0 -1866
  268. package/dist/cjs/js/src/coincheck.js +0 -843
  269. package/dist/cjs/js/src/coinex.js +0 -5417
  270. package/dist/cjs/js/src/coinlist.js +0 -2337
  271. package/dist/cjs/js/src/coinmate.js +0 -989
  272. package/dist/cjs/js/src/coinone.js +0 -1185
  273. package/dist/cjs/js/src/coinsph.js +0 -1933
  274. package/dist/cjs/js/src/coinspot.js +0 -548
  275. package/dist/cjs/js/src/cryptocom.js +0 -3007
  276. package/dist/cjs/js/src/currencycom.js +0 -2015
  277. package/dist/cjs/js/src/delta.js +0 -3262
  278. package/dist/cjs/js/src/deribit.js +0 -3306
  279. package/dist/cjs/js/src/digifinex.js +0 -4307
  280. package/dist/cjs/js/src/exmo.js +0 -2645
  281. package/dist/cjs/js/src/fmfwio.js +0 -34
  282. package/dist/cjs/js/src/gate.js +0 -7077
  283. package/dist/cjs/js/src/gateio.js +0 -16
  284. package/dist/cjs/js/src/gemini.js +0 -1801
  285. package/dist/cjs/js/src/hitbtc.js +0 -3660
  286. package/dist/cjs/js/src/hitbtc3.js +0 -19
  287. package/dist/cjs/js/src/hollaex.js +0 -1882
  288. package/dist/cjs/js/src/htx.js +0 -9174
  289. package/dist/cjs/js/src/huobi.js +0 -16
  290. package/dist/cjs/js/src/huobijp.js +0 -1918
  291. package/dist/cjs/js/src/idex.js +0 -1770
  292. package/dist/cjs/js/src/independentreserve.js +0 -761
  293. package/dist/cjs/js/src/indodax.js +0 -1069
  294. package/dist/cjs/js/src/kraken.js +0 -2891
  295. package/dist/cjs/js/src/krakenfutures.js +0 -2407
  296. package/dist/cjs/js/src/kucoin.js +0 -4494
  297. package/dist/cjs/js/src/kucoinfutures.js +0 -2529
  298. package/dist/cjs/js/src/kuna.js +0 -1949
  299. package/dist/cjs/js/src/latoken.js +0 -1729
  300. package/dist/cjs/js/src/lbank.js +0 -2851
  301. package/dist/cjs/js/src/luno.js +0 -1044
  302. package/dist/cjs/js/src/lykke.js +0 -1303
  303. package/dist/cjs/js/src/mercado.js +0 -897
  304. package/dist/cjs/js/src/mexc.js +0 -5407
  305. package/dist/cjs/js/src/ndax.js +0 -2450
  306. package/dist/cjs/js/src/novadax.js +0 -1556
  307. package/dist/cjs/js/src/oceanex.js +0 -964
  308. package/dist/cjs/js/src/okcoin.js +0 -3115
  309. package/dist/cjs/js/src/okx.js +0 -7331
  310. package/dist/cjs/js/src/p2b.js +0 -1243
  311. package/dist/cjs/js/src/paymium.js +0 -597
  312. package/dist/cjs/js/src/phemex.js +0 -4725
  313. package/dist/cjs/js/src/poloniex.js +0 -2356
  314. package/dist/cjs/js/src/poloniexfutures.js +0 -1794
  315. package/dist/cjs/js/src/pro/alpaca.js +0 -714
  316. package/dist/cjs/js/src/pro/ascendex.js +0 -957
  317. package/dist/cjs/js/src/pro/bequant.js +0 -33
  318. package/dist/cjs/js/src/pro/binance.js +0 -2796
  319. package/dist/cjs/js/src/pro/binancecoinm.js +0 -23
  320. package/dist/cjs/js/src/pro/binanceus.js +0 -51
  321. package/dist/cjs/js/src/pro/binanceusdm.js +0 -32
  322. package/dist/cjs/js/src/pro/bingx.js +0 -944
  323. package/dist/cjs/js/src/pro/bitcoincom.js +0 -29
  324. package/dist/cjs/js/src/pro/bitfinex.js +0 -672
  325. package/dist/cjs/js/src/pro/bitfinex2.js +0 -1159
  326. package/dist/cjs/js/src/pro/bitget.js +0 -1733
  327. package/dist/cjs/js/src/pro/bitmart.js +0 -1486
  328. package/dist/cjs/js/src/pro/bitmex.js +0 -1576
  329. package/dist/cjs/js/src/pro/bitopro.js +0 -327
  330. package/dist/cjs/js/src/pro/bitrue.js +0 -462
  331. package/dist/cjs/js/src/pro/bitstamp.js +0 -547
  332. package/dist/cjs/js/src/pro/bitvavo.js +0 -704
  333. package/dist/cjs/js/src/pro/blockchaincom.js +0 -794
  334. package/dist/cjs/js/src/pro/bybit.js +0 -1843
  335. package/dist/cjs/js/src/pro/cex.js +0 -1510
  336. package/dist/cjs/js/src/pro/coinbase.js +0 -561
  337. package/dist/cjs/js/src/pro/coinbasepro.js +0 -968
  338. package/dist/cjs/js/src/pro/coinex.js +0 -1095
  339. package/dist/cjs/js/src/pro/cryptocom.js +0 -1020
  340. package/dist/cjs/js/src/pro/currencycom.js +0 -563
  341. package/dist/cjs/js/src/pro/deribit.js +0 -825
  342. package/dist/cjs/js/src/pro/exmo.js +0 -658
  343. package/dist/cjs/js/src/pro/gate.js +0 -1316
  344. package/dist/cjs/js/src/pro/gateio.js +0 -16
  345. package/dist/cjs/js/src/pro/gemini.js +0 -649
  346. package/dist/cjs/js/src/pro/hitbtc.js +0 -1294
  347. package/dist/cjs/js/src/pro/hollaex.js +0 -597
  348. package/dist/cjs/js/src/pro/htx.js +0 -2388
  349. package/dist/cjs/js/src/pro/huobi.js +0 -16
  350. package/dist/cjs/js/src/pro/huobijp.js +0 -606
  351. package/dist/cjs/js/src/pro/idex.js +0 -714
  352. package/dist/cjs/js/src/pro/independentreserve.js +0 -280
  353. package/dist/cjs/js/src/pro/kraken.js +0 -1364
  354. package/dist/cjs/js/src/pro/krakenfutures.js +0 -1506
  355. package/dist/cjs/js/src/pro/kucoin.js +0 -1054
  356. package/dist/cjs/js/src/pro/kucoinfutures.js +0 -981
  357. package/dist/cjs/js/src/pro/luno.js +0 -322
  358. package/dist/cjs/js/src/pro/mexc.js +0 -1170
  359. package/dist/cjs/js/src/pro/ndax.js +0 -545
  360. package/dist/cjs/js/src/pro/okcoin.js +0 -760
  361. package/dist/cjs/js/src/pro/okx.js +0 -1608
  362. package/dist/cjs/js/src/pro/phemex.js +0 -1511
  363. package/dist/cjs/js/src/pro/poloniex.js +0 -1253
  364. package/dist/cjs/js/src/pro/poloniexfutures.js +0 -1014
  365. package/dist/cjs/js/src/pro/probit.js +0 -586
  366. package/dist/cjs/js/src/pro/upbit.js +0 -234
  367. package/dist/cjs/js/src/pro/wazirx.js +0 -776
  368. package/dist/cjs/js/src/pro/whitebit.js +0 -927
  369. package/dist/cjs/js/src/pro/woo.js +0 -895
  370. package/dist/cjs/js/src/probit.js +0 -1867
  371. package/dist/cjs/js/src/static_dependencies/fflake/browser.js +0 -401
  372. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -195
  373. package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -308
  374. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -554
  375. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -94
  376. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -70
  377. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -91
  378. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -16
  379. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -1760
  380. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -52
  381. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -81
  382. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -376
  383. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -70
  384. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -1580
  385. package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -74
  386. package/dist/cjs/js/src/static_dependencies/noble-curves/_shortw_utils.js +0 -24
  387. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/curve.js +0 -158
  388. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/edwards.js +0 -429
  389. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -176
  390. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/modular.js +0 -324
  391. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/montgomery.js +0 -163
  392. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/utils.js +0 -245
  393. package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +0 -1018
  394. package/dist/cjs/js/src/static_dependencies/noble-curves/ed25519.js +0 -383
  395. package/dist/cjs/js/src/static_dependencies/noble-curves/secp256k1.js +0 -258
  396. package/dist/cjs/js/src/static_dependencies/noble-hashes/_assert.js +0 -53
  397. package/dist/cjs/js/src/static_dependencies/noble-hashes/_sha2.js +0 -120
  398. package/dist/cjs/js/src/static_dependencies/noble-hashes/_u64.js +0 -69
  399. package/dist/cjs/js/src/static_dependencies/noble-hashes/crypto.js +0 -7
  400. package/dist/cjs/js/src/static_dependencies/noble-hashes/hmac.js +0 -83
  401. package/dist/cjs/js/src/static_dependencies/noble-hashes/md5.js +0 -240
  402. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha1.js +0 -91
  403. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha256.js +0 -130
  404. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha3.js +0 -214
  405. package/dist/cjs/js/src/static_dependencies/noble-hashes/sha512.js +0 -239
  406. package/dist/cjs/js/src/static_dependencies/noble-hashes/utils.js +0 -93
  407. package/dist/cjs/js/src/static_dependencies/node-fetch/body.js +0 -354
  408. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/abort-error.js +0 -16
  409. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/base.js +0 -20
  410. package/dist/cjs/js/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -30
  411. package/dist/cjs/js/src/static_dependencies/node-fetch/headers.js +0 -239
  412. package/dist/cjs/js/src/static_dependencies/node-fetch/index.js +0 -372
  413. package/dist/cjs/js/src/static_dependencies/node-fetch/request.js +0 -273
  414. package/dist/cjs/js/src/static_dependencies/node-fetch/response.js +0 -139
  415. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/get-search.js +0 -14
  416. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -16
  417. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is.js +0 -81
  418. package/dist/cjs/js/src/static_dependencies/node-fetch/utils/referrer.js +0 -292
  419. package/dist/cjs/js/src/static_dependencies/proxies/agent-base/index.js +0 -103
  420. package/dist/cjs/js/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -140
  421. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -175
  422. package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -95
  423. package/dist/cjs/js/src/static_dependencies/qs/index.cjs.js +0 -7
  424. package/dist/cjs/js/src/static_dependencies/scure-base/index.js +0 -383
  425. package/dist/cjs/js/src/timex.js +0 -1562
  426. package/dist/cjs/js/src/tokocrypto.js +0 -2542
  427. package/dist/cjs/js/src/upbit.js +0 -1844
  428. package/dist/cjs/js/src/wavesexchange.js +0 -2607
  429. package/dist/cjs/js/src/wazirx.js +0 -953
  430. package/dist/cjs/js/src/whitebit.js +0 -2309
  431. package/dist/cjs/js/src/woo.js +0 -2769
  432. package/dist/cjs/js/src/yobit.js +0 -1314
  433. package/dist/cjs/js/src/zaif.js +0 -736
  434. package/dist/cjs/js/src/zonda.js +0 -1883
  435. package/dist/cjs/src/abstract/bitpanda.js +0 -9
  436. package/test.ts +0 -0
  437. /package/dist/cjs/{js/src/abstract/ace.js → src/abstract/onetrading.js} +0 -0
  438. /package/dist/cjs/{js/src → src}/pro/coinone.js +0 -0
  439. /package/js/src/abstract/{bitpanda.js → onetrading.js} +0 -0
@@ -1,2213 +0,0 @@
1
- 'use strict';
2
-
3
- var bigone$1 = require('./abstract/bigone.js');
4
- var errors = require('./base/errors.js');
5
- var number = require('./base/functions/number.js');
6
- var rsa = require('./base/functions/rsa.js');
7
- var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
8
- var Precise = require('./base/Precise.js');
9
-
10
- // ---------------------------------------------------------------------------
11
- // ---------------------------------------------------------------------------
12
- /**
13
- * @class bigone
14
- * @augments Exchange
15
- */
16
- class bigone extends bigone$1 {
17
- describe() {
18
- return this.deepExtend(super.describe(), {
19
- 'id': 'bigone',
20
- 'name': 'BigONE',
21
- 'countries': ['CN'],
22
- 'version': 'v3',
23
- 'rateLimit': 1200,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': true,
27
- 'margin': false,
28
- 'swap': undefined,
29
- 'future': undefined,
30
- 'option': false,
31
- 'cancelAllOrders': true,
32
- 'cancelOrder': true,
33
- 'createMarketBuyOrderWithCost': true,
34
- 'createMarketOrderWithCost': false,
35
- 'createMarketSellOrderWithCost': false,
36
- 'createOrder': true,
37
- 'createPostOnlyOrder': true,
38
- 'createStopLimitOrder': true,
39
- 'createStopMarketOrder': true,
40
- 'createStopOrder': true,
41
- 'fetchBalance': true,
42
- 'fetchClosedOrders': true,
43
- 'fetchCurrencies': true,
44
- 'fetchDepositAddress': true,
45
- 'fetchDeposits': true,
46
- 'fetchMarkets': true,
47
- 'fetchMyTrades': true,
48
- 'fetchOHLCV': true,
49
- 'fetchOpenOrders': true,
50
- 'fetchOrder': true,
51
- 'fetchOrderBook': true,
52
- 'fetchOrders': true,
53
- 'fetchTicker': true,
54
- 'fetchTickers': true,
55
- 'fetchTime': true,
56
- 'fetchTrades': true,
57
- 'fetchTradingFee': false,
58
- 'fetchTradingFees': false,
59
- 'fetchTransactionFees': false,
60
- 'fetchWithdrawals': true,
61
- 'transfer': true,
62
- 'withdraw': true,
63
- },
64
- 'timeframes': {
65
- '1m': 'min1',
66
- '5m': 'min5',
67
- '15m': 'min15',
68
- '30m': 'min30',
69
- '1h': 'hour1',
70
- '3h': 'hour3',
71
- '4h': 'hour4',
72
- '6h': 'hour6',
73
- '12h': 'hour12',
74
- '1d': 'day1',
75
- '1w': 'week1',
76
- '1M': 'month1',
77
- },
78
- 'hostname': 'big.one',
79
- 'urls': {
80
- 'logo': 'https://user-images.githubusercontent.com/1294454/69354403-1d532180-0c91-11ea-88ed-44c06cefdf87.jpg',
81
- 'api': {
82
- 'public': 'https://{hostname}/api/v3',
83
- 'private': 'https://{hostname}/api/v3/viewer',
84
- 'contractPublic': 'https://{hostname}/api/contract/v2',
85
- 'contractPrivate': 'https://{hostname}/api/contract/v2',
86
- 'webExchange': 'https://{hostname}/api/',
87
- },
88
- 'www': 'https://big.one',
89
- 'doc': 'https://open.big.one/docs/api.html',
90
- 'fees': 'https://bigone.zendesk.com/hc/en-us/articles/115001933374-BigONE-Fee-Policy',
91
- 'referral': 'https://b1.run/users/new?code=D3LLBVFT',
92
- },
93
- 'api': {
94
- 'public': {
95
- 'get': [
96
- 'ping',
97
- 'asset_pairs',
98
- 'asset_pairs/{asset_pair_name}/depth',
99
- 'asset_pairs/{asset_pair_name}/trades',
100
- 'asset_pairs/{asset_pair_name}/ticker',
101
- 'asset_pairs/{asset_pair_name}/candles',
102
- 'asset_pairs/tickers',
103
- ],
104
- },
105
- 'private': {
106
- 'get': [
107
- 'accounts',
108
- 'fund/accounts',
109
- 'assets/{asset_symbol}/address',
110
- 'orders',
111
- 'orders/{id}',
112
- 'orders/multi',
113
- 'trades',
114
- 'withdrawals',
115
- 'deposits',
116
- ],
117
- 'post': [
118
- 'orders',
119
- 'orders/{id}/cancel',
120
- 'orders/cancel',
121
- 'withdrawals',
122
- 'transfer',
123
- ],
124
- },
125
- 'contractPublic': {
126
- 'get': [
127
- 'symbols',
128
- 'instruments',
129
- 'depth@{symbol}/snapshot',
130
- 'instruments/difference',
131
- 'instruments/prices',
132
- ],
133
- },
134
- 'contractPrivate': {
135
- 'get': [
136
- 'accounts',
137
- 'orders/{id}',
138
- 'orders',
139
- 'orders/opening',
140
- 'orders/count',
141
- 'orders/opening/count',
142
- 'trades',
143
- 'trades/count',
144
- ],
145
- 'post': [
146
- 'orders',
147
- 'orders/batch',
148
- ],
149
- 'put': [
150
- 'positions/{symbol}/margin',
151
- 'positions/{symbol}/risk-limit',
152
- ],
153
- 'delete': [
154
- 'orders/{id}',
155
- 'orders/batch',
156
- ],
157
- },
158
- 'webExchange': {
159
- 'get': [
160
- 'uc/v2/assets',
161
- ],
162
- },
163
- },
164
- 'fees': {
165
- 'trading': {
166
- 'maker': this.parseNumber('0.001'),
167
- 'taker': this.parseNumber('0.001'),
168
- },
169
- 'funding': {
170
- 'withdraw': {},
171
- },
172
- },
173
- 'options': {
174
- 'createMarketBuyOrderRequiresPrice': true,
175
- 'accountsByType': {
176
- 'spot': 'SPOT',
177
- 'fund': 'FUND',
178
- 'funding': 'FUND',
179
- 'future': 'CONTRACT',
180
- 'swap': 'CONTRACT',
181
- },
182
- 'transfer': {
183
- 'fillResponseFromRequest': true,
184
- },
185
- 'exchangeMillisecondsCorrection': -100,
186
- 'fetchCurrencies': {
187
- 'webApiEnable': true,
188
- 'webApiRetries': 5,
189
- 'webApiMuteFailure': true,
190
- },
191
- 'defaultNetwork': 'ERC20',
192
- 'defaultNetworks': {
193
- 'USDT': 'TRC20',
194
- },
195
- 'networks': {
196
- 'ABBC': 'ABBC',
197
- 'ACA': 'Acala',
198
- 'AE': 'Aeternity',
199
- 'ALGO': 'Algorand',
200
- 'APT': 'Aptos',
201
- 'AR': 'Arweave',
202
- 'ASTR': 'Astar',
203
- 'AVAXC': 'Avax',
204
- 'AVAXX': 'AvaxChain',
205
- 'BEAM': 'Beam',
206
- 'BEP20': 'BinanceSmartChain',
207
- 'BITCI': 'BitciChain',
208
- 'BTC': 'Bitcoin',
209
- 'BCH': 'BitcoinCash',
210
- 'BSV': 'BitcoinSV',
211
- 'CELO': 'Celo',
212
- 'CKKB': 'CKB',
213
- 'ATOM': 'Cosmos',
214
- 'CRC20': 'CRO',
215
- 'DASH': 'Dash',
216
- 'DOGE': 'Dogecoin',
217
- 'XEC': 'ECash',
218
- 'EOS': 'EOS',
219
- 'ETH': 'Ethereum',
220
- 'ETC': 'EthereumClassic',
221
- 'ETHW': 'EthereumPow',
222
- 'FTM': 'Fantom',
223
- 'FIL': 'Filecoin',
224
- 'FSN': 'Fusion',
225
- 'GRIN': 'Grin',
226
- 'ONE': 'Harmony',
227
- 'HRC20': 'Hecochain',
228
- 'HBAR': 'Hedera',
229
- 'HNT': 'Helium',
230
- 'ZEN': 'Horizen',
231
- 'IOST': 'IOST',
232
- 'IRIS': 'IRIS',
233
- 'KLAY': 'Klaytn',
234
- 'KSM': 'Kusama',
235
- 'LTC': 'Litecoin',
236
- 'XMR': 'Monero',
237
- 'GLMR': 'Moonbeam',
238
- 'NEAR': 'Near',
239
- 'NEO': 'Neo',
240
- 'NEON3': 'NeoN3',
241
- 'OASIS': 'Oasis',
242
- 'OKC': 'Okexchain',
243
- 'ONT': 'Ontology',
244
- 'OPTIMISM': 'Optimism',
245
- 'DOT': 'Polkadot',
246
- 'MATIC': 'Polygon',
247
- 'QTUM': 'Qtum',
248
- 'REI': 'REI',
249
- 'XRP': 'Ripple',
250
- 'SGB': 'SGB',
251
- 'SDN': 'Shiden',
252
- 'SOL': 'Solana',
253
- 'XLM': 'Stellar',
254
- 'TERA': 'Tera',
255
- 'XTZ': 'Tezos',
256
- 'TRC20': 'Tron',
257
- 'VET': 'Vechain',
258
- 'VSYS': 'VSystems',
259
- 'WAX': 'WAX',
260
- 'ZEC': 'Zcash',
261
- // todo: uncomment after consensus
262
- // 'BITSHARES_OLD': 'Bitshares',
263
- // 'BITSHARES_NEW': 'NewBitshares',
264
- // 'MOBILECOIN': 'Mobilecoin',
265
- // 'LBRY': 'Lbry',
266
- // 'ZEEPIN': 'Zeepin',
267
- // 'WAYFCOIN': 'Wayfcoin',
268
- // 'UCACOIN': 'Ucacoin',
269
- // 'VANILLACASH': 'Vcash',
270
- // 'LAMDEN': 'Lamden',
271
- // 'GXSHARES': 'Gxshares',
272
- // 'ICP': 'Dfinity',
273
- // 'CLOVER': 'Clover',
274
- // 'CLASSZZ': 'Classzz',
275
- // 'CLASSZZ_V2': 'ClasszzV2',
276
- // 'CHAINX_V2': 'ChainxV2',
277
- // 'BITCOINDIAMON': 'BitcoinDiamond',
278
- // 'BITCOINGOLD': 'BitcoinGold',
279
- // 'BUTTRUSTSYSTEM': 'BitTrustSystem',
280
- // 'BYTOM_V2': 'BytomV2',
281
- // 'LIBONOMY': 'Libonomy',
282
- // 'TERRACLASSIC': 'Terra',
283
- // 'TERRA': 'Terra2',
284
- // 'SUPERBITCOIN': 'SuperBitcoin',
285
- // 'SIACLASSIC': 'Sia',
286
- // 'SIACOIN': 'SiaCore',
287
- // 'PARALLELFINANCE': 'Parallel',
288
- // 'PLCULTIMA': 'Plcu',
289
- // 'PLCULTIMA2': 'Plcu2',
290
- // undetermined: XinFin, YAS, Ycash
291
- },
292
- },
293
- 'precisionMode': number.TICK_SIZE,
294
- 'exceptions': {
295
- 'exact': {
296
- '10001': errors.BadRequest,
297
- '10005': errors.ExchangeError,
298
- "Amount's scale must greater than AssetPair's base scale": errors.InvalidOrder,
299
- "Price mulit with amount should larger than AssetPair's min_quote_value": errors.InvalidOrder,
300
- '10007': errors.BadRequest,
301
- '10011': errors.ExchangeError,
302
- '10013': errors.BadSymbol,
303
- '10014': errors.InsufficientFunds,
304
- '10403': errors.PermissionDenied,
305
- '10429': errors.RateLimitExceeded,
306
- '40004': errors.AuthenticationError,
307
- '40103': errors.AuthenticationError,
308
- '40104': errors.AuthenticationError,
309
- '40301': errors.PermissionDenied,
310
- '40302': errors.ExchangeError,
311
- '40601': errors.ExchangeError,
312
- '40602': errors.ExchangeError,
313
- '40603': errors.InsufficientFunds,
314
- '40604': errors.InvalidOrder,
315
- '40605': errors.InvalidOrder,
316
- '40120': errors.InvalidOrder,
317
- '40121': errors.InvalidOrder,
318
- '60100': errors.BadSymbol, // {"code":60100,"message":"Asset pair is suspended"}
319
- },
320
- 'broad': {},
321
- },
322
- 'commonCurrencies': {
323
- 'CRE': 'Cybereits',
324
- 'FXT': 'FXTTOKEN',
325
- 'FREE': 'FreeRossDAO',
326
- 'MBN': 'Mobilian Coin',
327
- 'ONE': 'BigONE Token',
328
- },
329
- });
330
- }
331
- async fetchCurrencies(params = {}) {
332
- /**
333
- * @method
334
- * @name bigone#fetchCurrencies
335
- * @description fetches all available currencies on an exchange
336
- * @param {dict} [params] extra parameters specific to the exchange API endpoint
337
- * @returns {dict} an associative dictionary of currencies
338
- */
339
- // we use undocumented link (possible, less informative alternative is : https://big.one/api/uc/v3/assets/accounts)
340
- const data = await this.fetchWebEndpoint('fetchCurrencies', 'webExchangeGetUcV2Assets', true);
341
- if (data === undefined) {
342
- return undefined;
343
- }
344
- //
345
- // {
346
- // "code": "0",
347
- // "message": "",
348
- // "data": [
349
- // {
350
- // "name": "TetherUS",
351
- // "symbol": "USDT",
352
- // "contract_address": "31",
353
- // "is_deposit_enabled": true,
354
- // "is_withdrawal_enabled": true,
355
- // "is_stub": false,
356
- // "withdrawal_fee": "5.0",
357
- // "is_fiat": false,
358
- // "is_memo_required": false,
359
- // "logo": {
360
- // "default": "https://assets.peatio.com/assets/v1/color/normal/usdt.png",
361
- // "white": "https://assets.peatio.com/assets/v1/white/normal/usdt.png",
362
- // },
363
- // "info_link": null,
364
- // "scale": "12",
365
- // "default_gateway": ..., // one object from "gateways"
366
- // "gateways": [
367
- // {
368
- // "uuid": "f0fa5a85-7f65-428a-b7b7-13aad55c2837",
369
- // "name": "Mixin",
370
- // "kind": "CHAIN",
371
- // "required_confirmations": "0",
372
- // },
373
- // {
374
- // "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
375
- // "name": "Ethereum",
376
- // "kind": "CHAIN",
377
- // "required_confirmations": "18",
378
- // },
379
- // {
380
- // "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
381
- // "name": "Tron",
382
- // "kind": "CHAIN",
383
- // "required_confirmations": "1",
384
- // },
385
- // ...
386
- // ],
387
- // "payments": [],
388
- // "uuid": "17082d1c-0195-4fb6-8779-2cdbcb9eeb3c",
389
- // "binding_gateways": [
390
- // {
391
- // "guid": "07efc37f-d1ec-4bc9-8339-a745256ea2ba",
392
- // "contract_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
393
- // "is_deposit_enabled": true,
394
- // "display_name": "Ethereum(ERC20)",
395
- // "gateway_name": "Ethereum",
396
- // "min_withdrawal_amount": "0.000001",
397
- // "min_internal_withdrawal_amount": "0.00000001",
398
- // "withdrawal_fee": "14",
399
- // "is_withdrawal_enabled": true,
400
- // "min_deposit_amount": "0.000001",
401
- // "is_memo_required": false,
402
- // "withdrawal_scale": "2",
403
- // "gateway": {
404
- // "uuid": "b75446c6-1446-4c8d-b3d1-39f385b0a926",
405
- // "name": "Ethereum",
406
- // "kind": "CHAIN",
407
- // "required_confirmations": "18",
408
- // },
409
- // "scale": "12",
410
- // },
411
- // {
412
- // "guid": "b80a4d13-cac7-4319-842d-b33c3bfab8ec",
413
- // "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
414
- // "is_deposit_enabled": true,
415
- // "display_name": "Tron(TRC20)",
416
- // "gateway_name": "Tron",
417
- // "min_withdrawal_amount": "0.000001",
418
- // "min_internal_withdrawal_amount": "0.00000001",
419
- // "withdrawal_fee": "1",
420
- // "is_withdrawal_enabled": true,
421
- // "min_deposit_amount": "0.000001",
422
- // "is_memo_required": false,
423
- // "withdrawal_scale": "6",
424
- // "gateway": {
425
- // "uuid": "fe9b1b0b-e55c-4017-b5ce-16f524df5fc0",
426
- // "name": "Tron",
427
- // "kind": "CHAIN",
428
- // "required_confirmations": "1",
429
- // },
430
- // "scale": "12",
431
- // },
432
- // ...
433
- // ],
434
- // },
435
- // ...
436
- // ],
437
- // }
438
- //
439
- const currenciesData = this.safeValue(data, 'data', []);
440
- const result = {};
441
- for (let i = 0; i < currenciesData.length; i++) {
442
- const currency = currenciesData[i];
443
- const id = this.safeString(currency, 'symbol');
444
- const code = this.safeCurrencyCode(id);
445
- const name = this.safeString(currency, 'name');
446
- const type = this.safeValue(currency, 'is_fiat') ? 'fiat' : 'crypto';
447
- const networks = {};
448
- const chains = this.safeValue(currency, 'binding_gateways', []);
449
- let currencyMaxPrecision = this.parsePrecision(this.safeString2(currency, 'withdrawal_scale', 'scale'));
450
- let currencyDepositEnabled = undefined;
451
- let currencyWithdrawEnabled = undefined;
452
- for (let j = 0; j < chains.length; j++) {
453
- const chain = chains[j];
454
- const networkId = this.safeString(chain, 'gateway_name');
455
- const networkCode = this.networkIdToCode(networkId);
456
- const deposit = this.safeValue(chain, 'is_deposit_enabled');
457
- const withdraw = this.safeValue(chain, 'is_withdrawal_enabled');
458
- const isActive = (deposit && withdraw);
459
- const minDepositAmount = this.safeString(chain, 'min_deposit_amount');
460
- const minWithdrawalAmount = this.safeString(chain, 'min_withdrawal_amount');
461
- const withdrawalFee = this.safeString(chain, 'withdrawal_fee');
462
- const precision = this.parsePrecision(this.safeString2(chain, 'withdrawal_scale', 'scale'));
463
- networks[networkCode] = {
464
- 'id': networkId,
465
- 'network': networkCode,
466
- 'margin': undefined,
467
- 'deposit': deposit,
468
- 'withdraw': withdraw,
469
- 'active': isActive,
470
- 'fee': this.parseNumber(withdrawalFee),
471
- 'precision': this.parseNumber(precision),
472
- 'limits': {
473
- 'deposit': {
474
- 'min': minDepositAmount,
475
- 'max': undefined,
476
- },
477
- 'withdraw': {
478
- 'min': minWithdrawalAmount,
479
- 'max': undefined,
480
- },
481
- },
482
- 'info': chain,
483
- };
484
- // fill global values
485
- currencyDepositEnabled = (currencyDepositEnabled === undefined) || deposit ? deposit : currencyDepositEnabled;
486
- currencyWithdrawEnabled = (currencyWithdrawEnabled === undefined) || withdraw ? withdraw : currencyWithdrawEnabled;
487
- currencyMaxPrecision = (currencyMaxPrecision === undefined) || Precise["default"].stringGt(currencyMaxPrecision, precision) ? precision : currencyMaxPrecision;
488
- }
489
- result[code] = {
490
- 'id': id,
491
- 'code': code,
492
- 'info': currency,
493
- 'name': name,
494
- 'type': type,
495
- 'active': undefined,
496
- 'deposit': currencyDepositEnabled,
497
- 'withdraw': currencyWithdrawEnabled,
498
- 'fee': undefined,
499
- 'precision': this.parseNumber(currencyMaxPrecision),
500
- 'limits': {
501
- 'amount': {
502
- 'min': undefined,
503
- 'max': undefined,
504
- },
505
- 'withdraw': {
506
- 'min': undefined,
507
- 'max': undefined,
508
- },
509
- },
510
- 'networks': networks,
511
- };
512
- }
513
- return result;
514
- }
515
- async fetchMarkets(params = {}) {
516
- /**
517
- * @method
518
- * @name bigone#fetchMarkets
519
- * @description retrieves data on all markets for bigone
520
- * @param {object} [params] extra parameters specific to the exchange API endpoint
521
- * @returns {object[]} an array of objects representing market data
522
- */
523
- const promises = [this.publicGetAssetPairs(params), this.contractPublicGetSymbols(params)];
524
- const promisesResult = await Promise.all(promises);
525
- const response = promisesResult[0];
526
- const contractResponse = promisesResult[1];
527
- //
528
- // {
529
- // "code":0,
530
- // "data":[
531
- // {
532
- // "id":"01e48809-b42f-4a38-96b1-c4c547365db1",
533
- // "name":"PCX-BTC",
534
- // "quote_scale":7,
535
- // "quote_asset":{
536
- // "id":"0df9c3c3-255a-46d7-ab82-dedae169fba9",
537
- // "symbol":"BTC",
538
- // "name":"Bitcoin",
539
- // },
540
- // "base_asset":{
541
- // "id":"405484f7-4b03-4378-a9c1-2bd718ecab51",
542
- // "symbol":"PCX",
543
- // "name":"ChainX",
544
- // },
545
- // "base_scale":3,
546
- // "min_quote_value":"0.0001",
547
- // "max_quote_value":"35"
548
- // },
549
- // ]
550
- // }
551
- //
552
- //
553
- // [
554
- // {
555
- // "baseCurrency": "BTC",
556
- // "multiplier": 1,
557
- // "enable": true,
558
- // "priceStep": 0.5,
559
- // "maxRiskLimit": 1000,
560
- // "pricePrecision": 1,
561
- // "maintenanceMargin": 0.00500,
562
- // "symbol": "BTCUSD",
563
- // "valuePrecision": 4,
564
- // "minRiskLimit": 100,
565
- // "riskLimit": 100,
566
- // "isInverse": true,
567
- // "riskStep": 1,
568
- // "settleCurrency": "BTC",
569
- // "baseName": "Bitcoin",
570
- // "feePrecision": 8,
571
- // "priceMin": 0.5,
572
- // "priceMax": 1E+6,
573
- // "initialMargin": 0.01000,
574
- // "quoteCurrency": "USD"
575
- // },
576
- // ...
577
- // ]
578
- //
579
- const markets = this.safeValue(response, 'data', []);
580
- const result = [];
581
- for (let i = 0; i < markets.length; i++) {
582
- const market = markets[i];
583
- const baseAsset = this.safeValue(market, 'base_asset', {});
584
- const quoteAsset = this.safeValue(market, 'quote_asset', {});
585
- const baseId = this.safeString(baseAsset, 'symbol');
586
- const quoteId = this.safeString(quoteAsset, 'symbol');
587
- const base = this.safeCurrencyCode(baseId);
588
- const quote = this.safeCurrencyCode(quoteId);
589
- result.push(this.safeMarketStructure({
590
- 'id': this.safeString(market, 'name'),
591
- 'uuid': this.safeString(market, 'id'),
592
- 'symbol': base + '/' + quote,
593
- 'base': base,
594
- 'quote': quote,
595
- 'settle': undefined,
596
- 'baseId': baseId,
597
- 'quoteId': quoteId,
598
- 'settleId': undefined,
599
- 'type': 'spot',
600
- 'spot': true,
601
- 'margin': false,
602
- 'swap': false,
603
- 'future': false,
604
- 'option': false,
605
- 'active': true,
606
- 'contract': false,
607
- 'linear': undefined,
608
- 'inverse': undefined,
609
- 'contractSize': undefined,
610
- 'expiry': undefined,
611
- 'expiryDatetime': undefined,
612
- 'strike': undefined,
613
- 'optionType': undefined,
614
- 'precision': {
615
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'base_scale'))),
616
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quote_scale'))),
617
- },
618
- 'limits': {
619
- 'leverage': {
620
- 'min': undefined,
621
- 'max': undefined,
622
- },
623
- 'amount': {
624
- 'min': undefined,
625
- 'max': undefined,
626
- },
627
- 'price': {
628
- 'min': undefined,
629
- 'max': undefined,
630
- },
631
- 'cost': {
632
- 'min': this.safeNumber(market, 'min_quote_value'),
633
- 'max': this.safeNumber(market, 'max_quote_value'),
634
- },
635
- },
636
- 'created': undefined,
637
- 'info': market,
638
- }));
639
- }
640
- for (let i = 0; i < contractResponse.length; i++) {
641
- const market = contractResponse[i];
642
- const baseId = this.safeString(market, 'baseCurrency');
643
- const quoteId = this.safeString(market, 'quoteCurrency');
644
- const settleId = this.safeString(market, 'settleCurrency');
645
- const marketId = this.safeString(market, 'symbol');
646
- const base = this.safeCurrencyCode(baseId);
647
- const quote = this.safeCurrencyCode(quoteId);
648
- const settle = this.safeCurrencyCode(settleId);
649
- const inverse = this.safeValue(market, 'isInverse');
650
- result.push(this.safeMarketStructure({
651
- 'id': marketId,
652
- 'symbol': base + '/' + quote + ':' + settle,
653
- 'base': base,
654
- 'quote': quote,
655
- 'settle': settle,
656
- 'baseId': baseId,
657
- 'quoteId': quoteId,
658
- 'settleId': settleId,
659
- 'type': 'swap',
660
- 'spot': false,
661
- 'margin': false,
662
- 'swap': true,
663
- 'future': false,
664
- 'option': false,
665
- 'active': this.safeValue(market, 'enable'),
666
- 'contract': true,
667
- 'linear': !inverse,
668
- 'inverse': inverse,
669
- 'contractSize': this.safeNumber(market, 'multiplier'),
670
- 'expiry': undefined,
671
- 'expiryDatetime': undefined,
672
- 'strike': undefined,
673
- 'optionType': undefined,
674
- 'precision': {
675
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'valuePrecision'))),
676
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
677
- },
678
- 'limits': {
679
- 'leverage': {
680
- 'min': undefined,
681
- 'max': undefined,
682
- },
683
- 'amount': {
684
- 'min': undefined,
685
- 'max': undefined,
686
- },
687
- 'price': {
688
- 'min': this.safeNumber(market, 'priceMin'),
689
- 'max': this.safeNumber(market, 'priceMax'),
690
- },
691
- 'cost': {
692
- 'min': this.safeNumber(market, 'initialMargin'),
693
- 'max': undefined,
694
- },
695
- },
696
- 'info': market,
697
- }));
698
- }
699
- return result;
700
- }
701
- parseTicker(ticker, market = undefined) {
702
- //
703
- // spot
704
- //
705
- // {
706
- // "asset_pair_name": "ETH-BTC",
707
- // "bid": {
708
- // "price": "0.021593",
709
- // "order_count": 1,
710
- // "quantity": "0.20936"
711
- // },
712
- // "ask": {
713
- // "price": "0.021613",
714
- // "order_count": 1,
715
- // "quantity": "2.87064"
716
- // },
717
- // "open": "0.021795",
718
- // "high": "0.021795",
719
- // "low": "0.021471",
720
- // "close": "0.021613",
721
- // "volume": "117078.90431",
722
- // "daily_change": "-0.000182"
723
- // }
724
- //
725
- // contract
726
- //
727
- // {
728
- // "usdtPrice": 1.00031998,
729
- // "symbol": "BTCUSD",
730
- // "btcPrice": 34700.4,
731
- // "ethPrice": 1787.83,
732
- // "nextFundingRate": 0.00010,
733
- // "fundingRate": 0.00010,
734
- // "latestPrice": 34708.5,
735
- // "last24hPriceChange": 0.0321,
736
- // "indexPrice": 34700.4,
737
- // "volume24h": 261319063,
738
- // "turnover24h": 8204.129380685496,
739
- // "nextFundingTime": 1698285600000,
740
- // "markPrice": 34702.4646738,
741
- // "last24hMaxPrice": 35127.5,
742
- // "volume24hInUsd": 0.0,
743
- // "openValue": 32.88054722085945,
744
- // "last24hMinPrice": 33552.0,
745
- // "openInterest": 1141372.0
746
- // }
747
- //
748
- const marketType = ('asset_pair_name' in ticker) ? 'spot' : 'swap';
749
- const marketId = this.safeString2(ticker, 'asset_pair_name', 'symbol');
750
- const symbol = this.safeSymbol(marketId, market, '-', marketType);
751
- const close = this.safeString2(ticker, 'close', 'latestPrice');
752
- const bid = this.safeValue(ticker, 'bid', {});
753
- const ask = this.safeValue(ticker, 'ask', {});
754
- return this.safeTicker({
755
- 'symbol': symbol,
756
- 'timestamp': undefined,
757
- 'datetime': undefined,
758
- 'high': this.safeString2(ticker, 'high', 'last24hMaxPrice'),
759
- 'low': this.safeString2(ticker, 'low', 'last24hMinPrice'),
760
- 'bid': this.safeString(bid, 'price'),
761
- 'bidVolume': this.safeString(bid, 'quantity'),
762
- 'ask': this.safeString(ask, 'price'),
763
- 'askVolume': this.safeString(ask, 'quantity'),
764
- 'vwap': undefined,
765
- 'open': this.safeString(ticker, 'open'),
766
- 'close': close,
767
- 'last': close,
768
- 'previousClose': undefined,
769
- 'change': this.safeString2(ticker, 'daily_change', 'last24hPriceChange'),
770
- 'percentage': undefined,
771
- 'average': undefined,
772
- 'baseVolume': this.safeString2(ticker, 'volume', 'volume24h'),
773
- 'quoteVolume': this.safeString(ticker, 'volume24hInUsd'),
774
- 'info': ticker,
775
- }, market);
776
- }
777
- async fetchTicker(symbol, params = {}) {
778
- /**
779
- * @method
780
- * @name bigone#fetchTicker
781
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
782
- * @param {string} symbol unified symbol of the market to fetch the ticker for
783
- * @param {object} [params] extra parameters specific to the exchange API endpoint
784
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
785
- */
786
- await this.loadMarkets();
787
- const market = this.market(symbol);
788
- let type = undefined;
789
- [type, params] = this.handleMarketTypeAndParams('fetchTicker', market, params);
790
- if (type === 'spot') {
791
- const request = {
792
- 'asset_pair_name': market['id'],
793
- };
794
- const response = await this.publicGetAssetPairsAssetPairNameTicker(this.extend(request, params));
795
- //
796
- // {
797
- // "code":0,
798
- // "data":{
799
- // "asset_pair_name":"ETH-BTC",
800
- // "bid":{"price":"0.021593","order_count":1,"quantity":"0.20936"},
801
- // "ask":{"price":"0.021613","order_count":1,"quantity":"2.87064"},
802
- // "open":"0.021795",
803
- // "high":"0.021795",
804
- // "low":"0.021471",
805
- // "close":"0.021613",
806
- // "volume":"117078.90431",
807
- // "daily_change":"-0.000182"
808
- // }
809
- // }
810
- //
811
- const ticker = this.safeValue(response, 'data', {});
812
- return this.parseTicker(ticker, market);
813
- }
814
- else {
815
- const tickers = await this.fetchTickers([symbol], params);
816
- return this.safeValue(tickers, symbol);
817
- }
818
- }
819
- async fetchTickers(symbols = undefined, params = {}) {
820
- /**
821
- * @method
822
- * @name bigone#fetchTickers
823
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
824
- * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
825
- * @param {object} [params] extra parameters specific to the exchange API endpoint
826
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
827
- */
828
- await this.loadMarkets();
829
- let market = undefined;
830
- const symbol = this.safeString(symbols, 0);
831
- if (symbol !== undefined) {
832
- market = this.market(symbol);
833
- }
834
- let type = undefined;
835
- [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
836
- const isSpot = type === 'spot';
837
- const request = {};
838
- symbols = this.marketSymbols(symbols);
839
- let data = undefined;
840
- if (isSpot) {
841
- if (symbols !== undefined) {
842
- const ids = this.marketIds(symbols);
843
- request['pair_names'] = ids.join(',');
844
- }
845
- const response = await this.publicGetAssetPairsTickers(this.extend(request, params));
846
- //
847
- // {
848
- // "code": 0,
849
- // "data": [
850
- // {
851
- // "asset_pair_name": "PCX-BTC",
852
- // "bid": {
853
- // "price": "0.000234",
854
- // "order_count": 1,
855
- // "quantity": "0.518"
856
- // },
857
- // "ask": {
858
- // "price": "0.0002348",
859
- // "order_count": 1,
860
- // "quantity": "2.348"
861
- // },
862
- // "open": "0.0002343",
863
- // "high": "0.0002348",
864
- // "low": "0.0002162",
865
- // "close": "0.0002348",
866
- // "volume": "12887.016",
867
- // "daily_change": "0.0000005"
868
- // },
869
- // ...
870
- // ]
871
- // }
872
- //
873
- data = this.safeValue(response, 'data', []);
874
- }
875
- else {
876
- data = await this.contractPublicGetInstruments(params);
877
- //
878
- // [
879
- // {
880
- // "usdtPrice": 1.00031998,
881
- // "symbol": "BTCUSD",
882
- // "btcPrice": 34700.4,
883
- // "ethPrice": 1787.83,
884
- // "nextFundingRate": 0.00010,
885
- // "fundingRate": 0.00010,
886
- // "latestPrice": 34708.5,
887
- // "last24hPriceChange": 0.0321,
888
- // "indexPrice": 34700.4,
889
- // "volume24h": 261319063,
890
- // "turnover24h": 8204.129380685496,
891
- // "nextFundingTime": 1698285600000,
892
- // "markPrice": 34702.4646738,
893
- // "last24hMaxPrice": 35127.5,
894
- // "volume24hInUsd": 0.0,
895
- // "openValue": 32.88054722085945,
896
- // "last24hMinPrice": 33552.0,
897
- // "openInterest": 1141372.0
898
- // }
899
- // ...
900
- // ]
901
- //
902
- }
903
- const tickers = this.parseTickers(data, symbols);
904
- return this.filterByArrayTickers(tickers, 'symbol', symbols);
905
- }
906
- async fetchTime(params = {}) {
907
- /**
908
- * @method
909
- * @name bigone#fetchTime
910
- * @description fetches the current integer timestamp in milliseconds from the exchange server
911
- * @param {object} [params] extra parameters specific to the exchange API endpoint
912
- * @returns {int} the current integer timestamp in milliseconds from the exchange server
913
- */
914
- const response = await this.publicGetPing(params);
915
- //
916
- // {
917
- // "data": {
918
- // "timestamp": 1527665262168391000
919
- // }
920
- // }
921
- //
922
- const data = this.safeValue(response, 'data', {});
923
- const timestamp = this.safeInteger(data, 'Timestamp');
924
- return this.parseToInt(timestamp / 1000000);
925
- }
926
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
927
- /**
928
- * @method
929
- * @name bigone#fetchOrderBook
930
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
931
- * @param {string} symbol unified symbol of the market to fetch the order book for
932
- * @param {int} [limit] the maximum amount of order book entries to return
933
- * @param {object} [params] extra parameters specific to the exchange API endpoint
934
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
935
- */
936
- await this.loadMarkets();
937
- const market = this.market(symbol);
938
- let response = undefined;
939
- if (market['contract']) {
940
- const request = {
941
- 'symbol': market['id'],
942
- };
943
- response = await this.contractPublicGetDepthSymbolSnapshot(this.extend(request, params));
944
- //
945
- // {
946
- // bids: {
947
- // '20000': '20',
948
- // ...
949
- // '34552': '64851',
950
- // '34526.5': '59594',
951
- // ...
952
- // '34551.5': '29711'
953
- // },
954
- // asks: {
955
- // '34557': '34395',
956
- // ...
957
- // '40000': '20',
958
- // '34611.5': '56024',
959
- // ...
960
- // '34578.5': '66367'
961
- // },
962
- // to: '59737174',
963
- // lastPrice: '34554.5',
964
- // bestPrices: {
965
- // ask: '34557.0',
966
- // bid: '34552.0'
967
- // },
968
- // from: '0'
969
- // }
970
- //
971
- return this.parseContractOrderBook(response, market['symbol'], limit);
972
- }
973
- else {
974
- const request = {
975
- 'asset_pair_name': market['id'],
976
- };
977
- if (limit !== undefined) {
978
- request['limit'] = limit; // default 50, max 200
979
- }
980
- response = await this.publicGetAssetPairsAssetPairNameDepth(this.extend(request, params));
981
- //
982
- // {
983
- // "code":0,
984
- // "data": {
985
- // "asset_pair_name": "EOS-BTC",
986
- // "bids": [
987
- // { "price": "42", "order_count": 4, "quantity": "23.33363711" }
988
- // ],
989
- // "asks": [
990
- // { "price": "45", "order_count": 2, "quantity": "4193.3283464" }
991
- // ]
992
- // }
993
- // }
994
- //
995
- const orderbook = this.safeValue(response, 'data', {});
996
- return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'quantity');
997
- }
998
- }
999
- parseContractBidsAsks(bidsAsks) {
1000
- const bidsAsksKeys = Object.keys(bidsAsks);
1001
- const result = [];
1002
- for (let i = 0; i < bidsAsksKeys.length; i++) {
1003
- const price = bidsAsksKeys[i];
1004
- const amount = bidsAsks[price];
1005
- result.push([this.parseNumber(price), this.parseNumber(amount)]);
1006
- }
1007
- return result;
1008
- }
1009
- parseContractOrderBook(orderbook, symbol, limit = undefined) {
1010
- const responseBids = this.safeValue(orderbook, 'bids');
1011
- const responseAsks = this.safeValue(orderbook, 'asks');
1012
- const bids = this.parseContractBidsAsks(responseBids);
1013
- const asks = this.parseContractBidsAsks(responseAsks);
1014
- return {
1015
- 'symbol': symbol,
1016
- 'bids': this.filterByLimit(this.sortBy(bids, 0, true), limit),
1017
- 'asks': this.filterByLimit(this.sortBy(asks, 0), limit),
1018
- 'timestamp': undefined,
1019
- 'datetime': undefined,
1020
- 'nonce': undefined,
1021
- };
1022
- }
1023
- parseTrade(trade, market = undefined) {
1024
- //
1025
- // fetchTrades (public)
1026
- //
1027
- // {
1028
- // "id": 38199941,
1029
- // "price": "3378.67",
1030
- // "amount": "0.019812",
1031
- // "taker_side": "ASK",
1032
- // "created_at": "2019-01-29T06:05:56Z"
1033
- // }
1034
- //
1035
- // fetchMyTrades (private)
1036
- //
1037
- // {
1038
- // "id": 10854280,
1039
- // "asset_pair_name": "XIN-USDT",
1040
- // "price": "70",
1041
- // "amount": "1",
1042
- // "taker_side": "ASK",
1043
- // "maker_order_id": 58284908,
1044
- // "taker_order_id": 58284909,
1045
- // "maker_fee": "0.0008",
1046
- // "taker_fee": "0.07",
1047
- // "side": "SELF_TRADING",
1048
- // "inserted_at": "2019-04-16T12:00:01Z"
1049
- // },
1050
- //
1051
- // {
1052
- // "id": 10854263,
1053
- // "asset_pair_name": "XIN-USDT",
1054
- // "price": "75.7",
1055
- // "amount": "12.743149",
1056
- // "taker_side": "BID",
1057
- // "maker_order_id": null,
1058
- // "taker_order_id": 58284888,
1059
- // "maker_fee": null,
1060
- // "taker_fee": "0.0025486298",
1061
- // "side": "BID",
1062
- // "inserted_at": "2019-04-15T06:20:57Z"
1063
- // }
1064
- //
1065
- const timestamp = this.parse8601(this.safeString2(trade, 'created_at', 'inserted_at'));
1066
- const priceString = this.safeString(trade, 'price');
1067
- const amountString = this.safeString(trade, 'amount');
1068
- const marketId = this.safeString(trade, 'asset_pair_name');
1069
- market = this.safeMarket(marketId, market, '-');
1070
- let side = this.safeString(trade, 'side');
1071
- const takerSide = this.safeString(trade, 'taker_side');
1072
- let takerOrMaker = undefined;
1073
- if ((takerSide !== undefined) && (side !== undefined) && (side !== 'SELF_TRADING')) {
1074
- takerOrMaker = (takerSide === side) ? 'taker' : 'maker';
1075
- }
1076
- if (side === undefined) {
1077
- // taker side is not related to buy/sell side
1078
- // the following code is probably a mistake
1079
- side = (takerSide === 'ASK') ? 'sell' : 'buy';
1080
- }
1081
- else {
1082
- if (side === 'BID') {
1083
- side = 'buy';
1084
- }
1085
- else if (side === 'ASK') {
1086
- side = 'sell';
1087
- }
1088
- }
1089
- const makerOrderId = this.safeString(trade, 'maker_order_id');
1090
- const takerOrderId = this.safeString(trade, 'taker_order_id');
1091
- let orderId = undefined;
1092
- if (makerOrderId !== undefined) {
1093
- orderId = makerOrderId;
1094
- }
1095
- else if (takerOrderId !== undefined) {
1096
- orderId = takerOrderId;
1097
- }
1098
- const id = this.safeString(trade, 'id');
1099
- const result = {
1100
- 'id': id,
1101
- 'timestamp': timestamp,
1102
- 'datetime': this.iso8601(timestamp),
1103
- 'symbol': market['symbol'],
1104
- 'order': orderId,
1105
- 'type': 'limit',
1106
- 'side': side,
1107
- 'takerOrMaker': takerOrMaker,
1108
- 'price': priceString,
1109
- 'amount': amountString,
1110
- 'cost': undefined,
1111
- 'info': trade,
1112
- };
1113
- let makerCurrencyCode = undefined;
1114
- let takerCurrencyCode = undefined;
1115
- if (takerOrMaker !== undefined) {
1116
- if (side === 'buy') {
1117
- if (takerOrMaker === 'maker') {
1118
- makerCurrencyCode = market['base'];
1119
- takerCurrencyCode = market['quote'];
1120
- }
1121
- else {
1122
- makerCurrencyCode = market['quote'];
1123
- takerCurrencyCode = market['base'];
1124
- }
1125
- }
1126
- else {
1127
- if (takerOrMaker === 'maker') {
1128
- makerCurrencyCode = market['quote'];
1129
- takerCurrencyCode = market['base'];
1130
- }
1131
- else {
1132
- makerCurrencyCode = market['base'];
1133
- takerCurrencyCode = market['quote'];
1134
- }
1135
- }
1136
- }
1137
- else if (side === 'SELF_TRADING') {
1138
- if (takerSide === 'BID') {
1139
- makerCurrencyCode = market['quote'];
1140
- takerCurrencyCode = market['base'];
1141
- }
1142
- else if (takerSide === 'ASK') {
1143
- makerCurrencyCode = market['base'];
1144
- takerCurrencyCode = market['quote'];
1145
- }
1146
- }
1147
- const makerFeeCost = this.safeString(trade, 'maker_fee');
1148
- const takerFeeCost = this.safeString(trade, 'taker_fee');
1149
- if (makerFeeCost !== undefined) {
1150
- if (takerFeeCost !== undefined) {
1151
- result['fees'] = [
1152
- { 'cost': makerFeeCost, 'currency': makerCurrencyCode },
1153
- { 'cost': takerFeeCost, 'currency': takerCurrencyCode },
1154
- ];
1155
- }
1156
- else {
1157
- result['fee'] = { 'cost': makerFeeCost, 'currency': makerCurrencyCode };
1158
- }
1159
- }
1160
- else if (takerFeeCost !== undefined) {
1161
- result['fee'] = { 'cost': takerFeeCost, 'currency': takerCurrencyCode };
1162
- }
1163
- else {
1164
- result['fee'] = undefined;
1165
- }
1166
- return this.safeTrade(result, market);
1167
- }
1168
- async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
1169
- /**
1170
- * @method
1171
- * @name bigone#fetchTrades
1172
- * @description get the list of most recent trades for a particular symbol
1173
- * @param {string} symbol unified symbol of the market to fetch trades for
1174
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
1175
- * @param {int} [limit] the maximum amount of trades to fetch
1176
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1177
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1178
- */
1179
- await this.loadMarkets();
1180
- const market = this.market(symbol);
1181
- if (market['contract']) {
1182
- throw new errors.BadRequest(this.id + ' fetchTrades () can only fetch trades for spot markets');
1183
- }
1184
- const request = {
1185
- 'asset_pair_name': market['id'],
1186
- };
1187
- const response = await this.publicGetAssetPairsAssetPairNameTrades(this.extend(request, params));
1188
- //
1189
- // {
1190
- // "code": 0,
1191
- // "data": [
1192
- // {
1193
- // "id": 38199941,
1194
- // "price": "3378.67",
1195
- // "amount": "0.019812",
1196
- // "taker_side": "ASK",
1197
- // "created_at": "2019-01-29T06:05:56Z"
1198
- // },
1199
- // {
1200
- // "id": 38199934,
1201
- // "price": "3376.14",
1202
- // "amount": "0.019384",
1203
- // "taker_side": "ASK",
1204
- // "created_at": "2019-01-29T06:05:40Z"
1205
- // }
1206
- // ]
1207
- // }
1208
- //
1209
- const trades = this.safeValue(response, 'data', []);
1210
- return this.parseTrades(trades, market, since, limit);
1211
- }
1212
- parseOHLCV(ohlcv, market = undefined) {
1213
- //
1214
- // {
1215
- // "close": "0.021562",
1216
- // "high": "0.021563",
1217
- // "low": "0.02156",
1218
- // "open": "0.021563",
1219
- // "time": "2019-11-21T07:54:00Z",
1220
- // "volume": "59.84376"
1221
- // }
1222
- //
1223
- return [
1224
- this.parse8601(this.safeString(ohlcv, 'time')),
1225
- this.safeNumber(ohlcv, 'open'),
1226
- this.safeNumber(ohlcv, 'high'),
1227
- this.safeNumber(ohlcv, 'low'),
1228
- this.safeNumber(ohlcv, 'close'),
1229
- this.safeNumber(ohlcv, 'volume'),
1230
- ];
1231
- }
1232
- async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
1233
- /**
1234
- * @method
1235
- * @name bigone#fetchOHLCV
1236
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1237
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1238
- * @param {string} timeframe the length of time each candle represents
1239
- * @param {int} [since] timestamp in ms of the earliest candle to fetch
1240
- * @param {int} [limit] the maximum amount of candles to fetch
1241
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1242
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1243
- */
1244
- await this.loadMarkets();
1245
- const market = this.market(symbol);
1246
- if (market['contract']) {
1247
- throw new errors.BadRequest(this.id + ' fetchOHLCV () can only fetch ohlcvs for spot markets');
1248
- }
1249
- if (limit === undefined) {
1250
- limit = 100; // default 100, max 500
1251
- }
1252
- const request = {
1253
- 'asset_pair_name': market['id'],
1254
- 'period': this.safeString(this.timeframes, timeframe, timeframe),
1255
- 'limit': limit,
1256
- };
1257
- if (since !== undefined) {
1258
- // const start = this.parseToInt (since / 1000);
1259
- const duration = this.parseTimeframe(timeframe);
1260
- const end = this.sum(since, limit * duration * 1000);
1261
- request['time'] = this.iso8601(end);
1262
- }
1263
- const response = await this.publicGetAssetPairsAssetPairNameCandles(this.extend(request, params));
1264
- //
1265
- // {
1266
- // "code": 0,
1267
- // "data": [
1268
- // {
1269
- // "close": "0.021656",
1270
- // "high": "0.021658",
1271
- // "low": "0.021652",
1272
- // "open": "0.021652",
1273
- // "time": "2019-11-21T09:30:00Z",
1274
- // "volume": "53.08664"
1275
- // },
1276
- // {
1277
- // "close": "0.021652",
1278
- // "high": "0.021656",
1279
- // "low": "0.021652",
1280
- // "open": "0.021656",
1281
- // "time": "2019-11-21T09:29:00Z",
1282
- // "volume": "88.39861"
1283
- // },
1284
- // ]
1285
- // }
1286
- //
1287
- const data = this.safeValue(response, 'data', []);
1288
- return this.parseOHLCVs(data, market, timeframe, since, limit);
1289
- }
1290
- parseBalance(response) {
1291
- const result = {
1292
- 'info': response,
1293
- 'timestamp': undefined,
1294
- 'datetime': undefined,
1295
- };
1296
- const balances = this.safeValue(response, 'data', []);
1297
- for (let i = 0; i < balances.length; i++) {
1298
- const balance = balances[i];
1299
- const symbol = this.safeString(balance, 'asset_symbol');
1300
- const code = this.safeCurrencyCode(symbol);
1301
- const account = this.account();
1302
- account['total'] = this.safeString(balance, 'balance');
1303
- account['used'] = this.safeString(balance, 'locked_balance');
1304
- result[code] = account;
1305
- }
1306
- return this.safeBalance(result);
1307
- }
1308
- async fetchBalance(params = {}) {
1309
- /**
1310
- * @method
1311
- * @name bigone#fetchBalance
1312
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
1313
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1314
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1315
- */
1316
- await this.loadMarkets();
1317
- const type = this.safeString(params, 'type', '');
1318
- params = this.omit(params, 'type');
1319
- let response = undefined;
1320
- if (type === 'funding' || type === 'fund') {
1321
- response = await this.privateGetFundAccounts(params);
1322
- }
1323
- else {
1324
- response = await this.privateGetAccounts(params);
1325
- }
1326
- //
1327
- // {
1328
- // "code":0,
1329
- // "data":[
1330
- // {"asset_symbol":"NKC","balance":"0","locked_balance":"0"},
1331
- // {"asset_symbol":"UBTC","balance":"0","locked_balance":"0"},
1332
- // {"asset_symbol":"READ","balance":"0","locked_balance":"0"},
1333
- // ],
1334
- // }
1335
- //
1336
- return this.parseBalance(response);
1337
- }
1338
- parseType(type) {
1339
- const types = {
1340
- 'STOP_LIMIT': 'limit',
1341
- 'STOP_MARKET': 'market',
1342
- 'LIMIT': 'limit',
1343
- 'MARKET': 'market',
1344
- };
1345
- return this.safeString(types, type, type);
1346
- }
1347
- parseOrder(order, market = undefined) {
1348
- //
1349
- // {
1350
- // "id": "42154072251",
1351
- // "asset_pair_name": "SOL-USDT",
1352
- // "price": "20",
1353
- // "amount": "0.5",
1354
- // "filled_amount": "0",
1355
- // "avg_deal_price": "0",
1356
- // "side": "ASK",
1357
- // "state": "PENDING",
1358
- // "created_at": "2023-09-13T03:42:00Z",
1359
- // "updated_at": "2023-09-13T03:42:00Z",
1360
- // "type": "LIMIT",
1361
- // "stop_price": "0",
1362
- // "immediate_or_cancel": false,
1363
- // "post_only": false,
1364
- // "client_order_id": ''
1365
- // }
1366
- //
1367
- const id = this.safeString(order, 'id');
1368
- const marketId = this.safeString(order, 'asset_pair_name');
1369
- const symbol = this.safeSymbol(marketId, market, '-');
1370
- const timestamp = this.parse8601(this.safeString(order, 'created_at'));
1371
- let side = this.safeString(order, 'side');
1372
- if (side === 'BID') {
1373
- side = 'buy';
1374
- }
1375
- else {
1376
- side = 'sell';
1377
- }
1378
- let triggerPrice = this.safeString(order, 'stop_price');
1379
- if (Precise["default"].stringEq(triggerPrice, '0')) {
1380
- triggerPrice = undefined;
1381
- }
1382
- const immediateOrCancel = this.safeValue(order, 'immediate_or_cancel');
1383
- let timeInForce = undefined;
1384
- if (immediateOrCancel) {
1385
- timeInForce = 'IOC';
1386
- }
1387
- const type = this.parseType(this.safeString(order, 'type'));
1388
- const price = this.safeString(order, 'price');
1389
- let amount = undefined;
1390
- let filled = undefined;
1391
- let cost = undefined;
1392
- if (type === 'market' && side === 'buy') {
1393
- cost = this.safeString(order, 'filled_amount');
1394
- }
1395
- else {
1396
- amount = this.safeString(order, 'amount');
1397
- filled = this.safeString(order, 'filled_amount');
1398
- }
1399
- return this.safeOrder({
1400
- 'info': order,
1401
- 'id': id,
1402
- 'clientOrderId': this.safeString(order, 'client_order_id'),
1403
- 'timestamp': timestamp,
1404
- 'datetime': this.iso8601(timestamp),
1405
- 'lastTradeTimestamp': this.parse8601(this.safeString(order, 'updated_at')),
1406
- 'symbol': symbol,
1407
- 'type': type,
1408
- 'timeInForce': timeInForce,
1409
- 'postOnly': this.safeValue(order, 'post_only'),
1410
- 'side': side,
1411
- 'price': price,
1412
- 'stopPrice': triggerPrice,
1413
- 'triggerPrice': triggerPrice,
1414
- 'amount': amount,
1415
- 'cost': cost,
1416
- 'average': this.safeString(order, 'avg_deal_price'),
1417
- 'filled': filled,
1418
- 'remaining': undefined,
1419
- 'status': this.parseOrderStatus(this.safeString(order, 'state')),
1420
- 'fee': undefined,
1421
- 'trades': undefined,
1422
- }, market);
1423
- }
1424
- async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1425
- /**
1426
- * @method
1427
- * @name bigone#createMarketBuyOrderWithCost
1428
- * @description create a market buy order by providing the symbol and cost
1429
- * @see https://open.big.one/docs/spot_orders.html#create-order
1430
- * @param {string} symbol unified symbol of the market to create an order in
1431
- * @param {float} cost how much you want to trade in units of the quote currency
1432
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1433
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1434
- */
1435
- await this.loadMarkets();
1436
- const market = this.market(symbol);
1437
- if (!market['spot']) {
1438
- throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
1439
- }
1440
- params['createMarketBuyOrderRequiresPrice'] = false;
1441
- return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1442
- }
1443
- async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1444
- /**
1445
- * @method
1446
- * @name bigone#createOrder
1447
- * @description create a trade order
1448
- * @see https://open.big.one/docs/spot_orders.html#create-order
1449
- * @param {string} symbol unified symbol of the market to create an order in
1450
- * @param {string} type 'market' or 'limit'
1451
- * @param {string} side 'buy' or 'sell'
1452
- * @param {float} amount how much of currency you want to trade in units of base currency
1453
- * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1454
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1455
- * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1456
- * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
1457
- * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
1458
- * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
1459
- *
1460
- * EXCHANGE SPECIFIC PARAMETERS
1461
- * @param {string} operator *stop order only* GTE or LTE (default)
1462
- * @param {string} client_order_id must match ^[a-zA-Z0-9-_]{1,36}$ this regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused
1463
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1464
- */
1465
- await this.loadMarkets();
1466
- const market = this.market(symbol);
1467
- const isBuy = (side === 'buy');
1468
- const requestSide = isBuy ? 'BID' : 'ASK';
1469
- let uppercaseType = type.toUpperCase();
1470
- const isLimit = uppercaseType === 'LIMIT';
1471
- const exchangeSpecificParam = this.safeValue(params, 'post_only', false);
1472
- let postOnly = undefined;
1473
- [postOnly, params] = this.handlePostOnly((uppercaseType === 'MARKET'), exchangeSpecificParam, params);
1474
- const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1475
- const request = {
1476
- 'asset_pair_name': market['id'],
1477
- 'side': requestSide,
1478
- 'amount': this.amountToPrecision(symbol, amount), // order amount, string, required
1479
- // "price": this.priceToPrecision (symbol, price), // order price, string, required
1480
- // "operator": "GTE", // stop orders only, GTE greater than and equal, LTE less than and equal
1481
- // "immediate_or_cancel": false, // limit orders only, must be false when post_only is true
1482
- // "post_only": false, // limit orders only, must be false when immediate_or_cancel is true
1483
- };
1484
- if (isLimit || (uppercaseType === 'STOP_LIMIT')) {
1485
- request['price'] = this.priceToPrecision(symbol, price);
1486
- if (isLimit) {
1487
- const timeInForce = this.safeString(params, 'timeInForce');
1488
- if (timeInForce === 'IOC') {
1489
- request['immediate_or_cancel'] = true;
1490
- }
1491
- if (postOnly) {
1492
- request['post_only'] = true;
1493
- }
1494
- }
1495
- request['amount'] = this.amountToPrecision(symbol, amount);
1496
- }
1497
- else {
1498
- if (isBuy) {
1499
- let createMarketBuyOrderRequiresPrice = true;
1500
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1501
- const cost = this.safeNumber(params, 'cost');
1502
- params = this.omit(params, 'cost');
1503
- if (createMarketBuyOrderRequiresPrice) {
1504
- if ((price === undefined) && (cost === undefined)) {
1505
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
1506
- }
1507
- else {
1508
- const amountString = this.numberToString(amount);
1509
- const priceString = this.numberToString(price);
1510
- const quoteAmount = this.parseToNumeric(Precise["default"].stringMul(amountString, priceString));
1511
- const costRequest = (cost !== undefined) ? cost : quoteAmount;
1512
- request['amount'] = this.costToPrecision(symbol, costRequest);
1513
- }
1514
- }
1515
- else {
1516
- request['amount'] = this.costToPrecision(symbol, amount);
1517
- }
1518
- }
1519
- else {
1520
- request['amount'] = this.amountToPrecision(symbol, amount);
1521
- }
1522
- }
1523
- if (triggerPrice !== undefined) {
1524
- request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1525
- request['operator'] = isBuy ? 'GTE' : 'LTE';
1526
- if (isLimit) {
1527
- uppercaseType = 'STOP_LIMIT';
1528
- }
1529
- else if (uppercaseType === 'MARKET') {
1530
- uppercaseType = 'STOP_MARKET';
1531
- }
1532
- }
1533
- request['type'] = uppercaseType;
1534
- params = this.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce']);
1535
- const response = await this.privatePostOrders(this.extend(request, params));
1536
- //
1537
- // {
1538
- // "id": 10,
1539
- // "asset_pair_name": "EOS-BTC",
1540
- // "price": "10.00",
1541
- // "amount": "10.00",
1542
- // "filled_amount": "9.0",
1543
- // "avg_deal_price": "12.0",
1544
- // "side": "ASK",
1545
- // "state": "FILLED",
1546
- // "created_at":"2019-01-29T06:05:56Z",
1547
- // "updated_at":"2019-01-29T06:05:56Z"
1548
- // }
1549
- //
1550
- const order = this.safeValue(response, 'data');
1551
- return this.parseOrder(order, market);
1552
- }
1553
- async cancelOrder(id, symbol = undefined, params = {}) {
1554
- /**
1555
- * @method
1556
- * @name bigone#cancelOrder
1557
- * @description cancels an open order
1558
- * @param {string} id order id
1559
- * @param {string} symbol Not used by bigone cancelOrder ()
1560
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1561
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1562
- */
1563
- await this.loadMarkets();
1564
- const request = { 'id': id };
1565
- const response = await this.privatePostOrdersIdCancel(this.extend(request, params));
1566
- // {
1567
- // "id": 10,
1568
- // "asset_pair_name": "EOS-BTC",
1569
- // "price": "10.00",
1570
- // "amount": "10.00",
1571
- // "filled_amount": "9.0",
1572
- // "avg_deal_price": "12.0",
1573
- // "side": "ASK",
1574
- // "state": "CANCELLED",
1575
- // "created_at":"2019-01-29T06:05:56Z",
1576
- // "updated_at":"2019-01-29T06:05:56Z"
1577
- // }
1578
- const order = this.safeValue(response, 'data');
1579
- return this.parseOrder(order);
1580
- }
1581
- async cancelAllOrders(symbol = undefined, params = {}) {
1582
- /**
1583
- * @method
1584
- * @name bigone#cancelAllOrders
1585
- * @description cancel all open orders
1586
- * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1587
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1588
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1589
- */
1590
- await this.loadMarkets();
1591
- const market = this.market(symbol);
1592
- const request = {
1593
- 'asset_pair_name': market['id'],
1594
- };
1595
- const response = await this.privatePostOrdersCancel(this.extend(request, params));
1596
- //
1597
- // {
1598
- // "code":0,
1599
- // "data": {
1600
- // "cancelled":[
1601
- // 58272370,
1602
- // 58272377
1603
- // ],
1604
- // "failed": []
1605
- // }
1606
- // }
1607
- //
1608
- return response;
1609
- }
1610
- async fetchOrder(id, symbol = undefined, params = {}) {
1611
- /**
1612
- * @method
1613
- * @name bigone#fetchOrder
1614
- * @description fetches information on an order made by the user
1615
- * @param {string} symbol not used by bigone fetchOrder
1616
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1617
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1618
- */
1619
- await this.loadMarkets();
1620
- const request = { 'id': id };
1621
- const response = await this.privateGetOrdersId(this.extend(request, params));
1622
- const order = this.safeValue(response, 'data', {});
1623
- return this.parseOrder(order);
1624
- }
1625
- async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1626
- /**
1627
- * @method
1628
- * @name bigone#fetchOrders
1629
- * @description fetches information on multiple orders made by the user
1630
- * @param {string} symbol unified market symbol of the market orders were made in
1631
- * @param {int} [since] the earliest time in ms to fetch orders for
1632
- * @param {int} [limit] the maximum number of order structures to retrieve
1633
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1634
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1635
- */
1636
- if (symbol === undefined) {
1637
- throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
1638
- }
1639
- await this.loadMarkets();
1640
- const market = this.market(symbol);
1641
- const request = {
1642
- 'asset_pair_name': market['id'],
1643
- // 'page_token': 'dxzef', // request page after this page token
1644
- // 'side': 'ASK', // 'ASK' or 'BID', optional
1645
- // 'state': 'FILLED', // 'CANCELLED', 'FILLED', 'PENDING'
1646
- // 'limit' 20, // default 20, max 200
1647
- };
1648
- if (limit !== undefined) {
1649
- request['limit'] = limit; // default 20, max 200
1650
- }
1651
- const response = await this.privateGetOrders(this.extend(request, params));
1652
- //
1653
- // {
1654
- // "code":0,
1655
- // "data": [
1656
- // {
1657
- // "id": 10,
1658
- // "asset_pair_name": "ETH-BTC",
1659
- // "price": "10.00",
1660
- // "amount": "10.00",
1661
- // "filled_amount": "9.0",
1662
- // "avg_deal_price": "12.0",
1663
- // "side": "ASK",
1664
- // "state": "FILLED",
1665
- // "created_at":"2019-01-29T06:05:56Z",
1666
- // "updated_at":"2019-01-29T06:05:56Z",
1667
- // },
1668
- // ],
1669
- // "page_token":"dxzef",
1670
- // }
1671
- //
1672
- const orders = this.safeValue(response, 'data', []);
1673
- return this.parseOrders(orders, market, since, limit);
1674
- }
1675
- async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1676
- /**
1677
- * @method
1678
- * @name bigone#fetchMyTrades
1679
- * @description fetch all trades made by the user
1680
- * @param {string} symbol unified market symbol
1681
- * @param {int} [since] the earliest time in ms to fetch trades for
1682
- * @param {int} [limit] the maximum number of trades structures to retrieve
1683
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1684
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1685
- */
1686
- if (symbol === undefined) {
1687
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
1688
- }
1689
- await this.loadMarkets();
1690
- const market = this.market(symbol);
1691
- const request = {
1692
- 'asset_pair_name': market['id'],
1693
- // 'page_token': 'dxzef', // request page after this page token
1694
- };
1695
- if (limit !== undefined) {
1696
- request['limit'] = limit; // default 20, max 200
1697
- }
1698
- const response = await this.privateGetTrades(this.extend(request, params));
1699
- //
1700
- // {
1701
- // "code": 0,
1702
- // "data": [
1703
- // {
1704
- // "id": 10854280,
1705
- // "asset_pair_name": "XIN-USDT",
1706
- // "price": "70",
1707
- // "amount": "1",
1708
- // "taker_side": "ASK",
1709
- // "maker_order_id": 58284908,
1710
- // "taker_order_id": 58284909,
1711
- // "maker_fee": "0.0008",
1712
- // "taker_fee": "0.07",
1713
- // "side": "SELF_TRADING",
1714
- // "inserted_at": "2019-04-16T12:00:01Z"
1715
- // },
1716
- // {
1717
- // "id": 10854263,
1718
- // "asset_pair_name": "XIN-USDT",
1719
- // "price": "75.7",
1720
- // "amount": "12.743149",
1721
- // "taker_side": "BID",
1722
- // "maker_order_id": null,
1723
- // "taker_order_id": 58284888,
1724
- // "maker_fee": null,
1725
- // "taker_fee": "0.0025486298",
1726
- // "side": "BID",
1727
- // "inserted_at": "2019-04-15T06:20:57Z"
1728
- // }
1729
- // ],
1730
- // "page_token":"dxfv"
1731
- // }
1732
- //
1733
- const trades = this.safeValue(response, 'data', []);
1734
- return this.parseTrades(trades, market, since, limit);
1735
- }
1736
- parseOrderStatus(status) {
1737
- const statuses = {
1738
- 'PENDING': 'open',
1739
- 'FILLED': 'closed',
1740
- 'CANCELLED': 'canceled',
1741
- };
1742
- return this.safeString(statuses, status);
1743
- }
1744
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1745
- /**
1746
- * @method
1747
- * @name bigone#fetchOpenOrders
1748
- * @description fetch all unfilled currently open orders
1749
- * @param {string} symbol unified market symbol
1750
- * @param {int} [since] the earliest time in ms to fetch open orders for
1751
- * @param {int} [limit] the maximum number of open orders structures to retrieve
1752
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1753
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1754
- */
1755
- const request = {
1756
- 'state': 'PENDING',
1757
- };
1758
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1759
- }
1760
- async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1761
- /**
1762
- * @method
1763
- * @name bigone#fetchClosedOrders
1764
- * @description fetches information on multiple closed orders made by the user
1765
- * @param {string} symbol unified market symbol of the market orders were made in
1766
- * @param {int} [since] the earliest time in ms to fetch orders for
1767
- * @param {int} [limit] the maximum number of order structures to retrieve
1768
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1769
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1770
- */
1771
- const request = {
1772
- 'state': 'FILLED',
1773
- };
1774
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1775
- }
1776
- nonce() {
1777
- const exchangeTimeCorrection = this.safeInteger(this.options, 'exchangeMillisecondsCorrection', 0) * 1000000;
1778
- return this.sum(this.microseconds() * 1000, exchangeTimeCorrection);
1779
- }
1780
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1781
- const query = this.omit(params, this.extractParams(path));
1782
- const baseUrl = this.implodeHostname(this.urls['api'][api]);
1783
- let url = baseUrl + '/' + this.implodeParams(path, params);
1784
- headers = {};
1785
- if (api === 'public' || api === 'webExchange' || api === 'contractPublic') {
1786
- if (Object.keys(query).length) {
1787
- url += '?' + this.urlencode(query);
1788
- }
1789
- }
1790
- else {
1791
- this.checkRequiredCredentials();
1792
- const nonce = this.nonce().toString();
1793
- const request = {
1794
- 'type': 'OpenAPIV2',
1795
- 'sub': this.apiKey,
1796
- 'nonce': nonce,
1797
- // 'recv_window': '30', // default 30
1798
- };
1799
- const token = rsa.jwt(request, this.encode(this.secret), sha256.sha256);
1800
- headers['Authorization'] = 'Bearer ' + token;
1801
- if (method === 'GET') {
1802
- if (Object.keys(query).length) {
1803
- url += '?' + this.urlencode(query);
1804
- }
1805
- }
1806
- else if (method === 'POST') {
1807
- headers['Content-Type'] = 'application/json';
1808
- body = query;
1809
- }
1810
- }
1811
- headers['User-Agent'] = 'ccxt/' + this.id + '-' + this.version;
1812
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1813
- }
1814
- async fetchDepositAddress(code, params = {}) {
1815
- /**
1816
- * @method
1817
- * @name bigone#fetchDepositAddress
1818
- * @description fetch the deposit address for a currency associated with this account
1819
- * @param {string} code unified currency code
1820
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1821
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
1822
- */
1823
- await this.loadMarkets();
1824
- const currency = this.currency(code);
1825
- const request = {
1826
- 'asset_symbol': currency['id'],
1827
- };
1828
- const [networkCode, paramsOmitted] = this.handleNetworkCodeAndParams(params);
1829
- const response = await this.privateGetAssetsAssetSymbolAddress(this.extend(request, paramsOmitted));
1830
- //
1831
- // the actual response format is not the same as the documented one
1832
- // the data key contains an array in the actual response
1833
- //
1834
- // {
1835
- // "code":0,
1836
- // "message":"",
1837
- // "data":[
1838
- // {
1839
- // "id":5521878,
1840
- // "chain":"Bitcoin",
1841
- // "value":"1GbmyKoikhpiQVZ1C9sbF17mTyvBjeobVe",
1842
- // "memo":""
1843
- // }
1844
- // ]
1845
- // }
1846
- //
1847
- const data = this.safeValue(response, 'data', []);
1848
- const dataLength = data.length;
1849
- if (dataLength < 1) {
1850
- throw new errors.ExchangeError(this.id + ' fetchDepositAddress() returned empty address response');
1851
- }
1852
- const chainsIndexedById = this.indexBy(data, 'chain');
1853
- const selectedNetworkId = this.selectNetworkIdFromRawNetworks(code, networkCode, chainsIndexedById);
1854
- const addressObject = this.safeValue(chainsIndexedById, selectedNetworkId, {});
1855
- const address = this.safeString(addressObject, 'value');
1856
- const tag = this.safeString(addressObject, 'memo');
1857
- this.checkAddress(address);
1858
- return {
1859
- 'currency': code,
1860
- 'address': address,
1861
- 'tag': tag,
1862
- 'network': this.networkIdToCode(selectedNetworkId),
1863
- 'info': response,
1864
- };
1865
- }
1866
- parseTransactionStatus(status) {
1867
- const statuses = {
1868
- // what are other statuses here?
1869
- 'WITHHOLD': 'ok',
1870
- 'UNCONFIRMED': 'pending',
1871
- 'CONFIRMED': 'ok',
1872
- 'COMPLETED': 'ok',
1873
- 'PENDING': 'pending',
1874
- };
1875
- return this.safeString(statuses, status, status);
1876
- }
1877
- parseTransaction(transaction, currency = undefined) {
1878
- //
1879
- // fetchDeposits
1880
- //
1881
- // {
1882
- // "amount": "25.0",
1883
- // "asset_symbol": "BTS"
1884
- // "confirms": 100,
1885
- // "id": 5,
1886
- // "inserted_at": "2018-02-16T11:39:58.000Z",
1887
- // "is_internal": false,
1888
- // "kind": "default",
1889
- // "memo": "",
1890
- // "state": "WITHHOLD",
1891
- // "txid": "72e03037d144dae3d32b68b5045462b1049a0755",
1892
- // "updated_at": "2018-11-09T10:20:09.000Z",
1893
- // }
1894
- //
1895
- // fetchWithdrawals
1896
- //
1897
- // {
1898
- // "amount": "5",
1899
- // "asset_symbol": "ETH",
1900
- // "completed_at": "2018-03-15T16:13:45.610463Z",
1901
- // "customer_id": "10",
1902
- // "id": 10,
1903
- // "inserted_at": "2018-03-15T16:13:45.610463Z",
1904
- // "is_internal": true,
1905
- // "note": "2018-03-15T16:13:45.610463Z",
1906
- // "state": "CONFIRMED",
1907
- // "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7"
1908
- // "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0",
1909
- // }
1910
- //
1911
- // withdraw
1912
- //
1913
- // {
1914
- // "id":1077391,
1915
- // "customer_id":1082679,
1916
- // "amount":"21.9000000000000000",
1917
- // "txid":"",
1918
- // "is_internal":false,
1919
- // "kind":"on_chain",
1920
- // "state":"PENDING",
1921
- // "inserted_at":"2020-06-03T00:50:57+00:00",
1922
- // "updated_at":"2020-06-03T00:50:57+00:00",
1923
- // "memo":"",
1924
- // "target_address":"rDYtYT3dBeuw376rvHqoZBKW3UmvguoBAf",
1925
- // "fee":"0.1000000000000000",
1926
- // "asset_symbol":"XRP"
1927
- // }
1928
- //
1929
- const currencyId = this.safeString(transaction, 'asset_symbol');
1930
- const code = this.safeCurrencyCode(currencyId);
1931
- const id = this.safeString(transaction, 'id');
1932
- const amount = this.safeNumber(transaction, 'amount');
1933
- const status = this.parseTransactionStatus(this.safeString(transaction, 'state'));
1934
- const timestamp = this.parse8601(this.safeString(transaction, 'inserted_at'));
1935
- const updated = this.parse8601(this.safeString2(transaction, 'updated_at', 'completed_at'));
1936
- const txid = this.safeString(transaction, 'txid');
1937
- const address = this.safeString(transaction, 'target_address');
1938
- const tag = this.safeString(transaction, 'memo');
1939
- const type = ('customer_id' in transaction) ? 'withdrawal' : 'deposit';
1940
- const internal = this.safeValue(transaction, 'is_internal');
1941
- return {
1942
- 'info': transaction,
1943
- 'id': id,
1944
- 'txid': txid,
1945
- 'timestamp': timestamp,
1946
- 'datetime': this.iso8601(timestamp),
1947
- 'network': undefined,
1948
- 'addressFrom': undefined,
1949
- 'address': undefined,
1950
- 'addressTo': address,
1951
- 'tagFrom': undefined,
1952
- 'tag': tag,
1953
- 'tagTo': undefined,
1954
- 'type': type,
1955
- 'amount': amount,
1956
- 'currency': code,
1957
- 'status': status,
1958
- 'updated': updated,
1959
- 'fee': undefined,
1960
- 'comment': undefined,
1961
- 'internal': internal,
1962
- };
1963
- }
1964
- async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
1965
- /**
1966
- * @method
1967
- * @name bigone#fetchDeposits
1968
- * @description fetch all deposits made to an account
1969
- * @param {string} code unified currency code
1970
- * @param {int} [since] the earliest time in ms to fetch deposits for
1971
- * @param {int} [limit] the maximum number of deposits structures to retrieve
1972
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1973
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1974
- */
1975
- await this.loadMarkets();
1976
- const request = {
1977
- // 'page_token': 'dxzef', // request page after this page token
1978
- // 'limit': 50, // optional, default 50
1979
- // 'kind': 'string', // optional - air_drop, big_holder_dividend, default, eosc_to_eos, internal, equally_airdrop, referral_mining, one_holder_dividend, single_customer, snapshotted_airdrop, trade_mining
1980
- // 'asset_symbol': 'BTC', // optional
1981
- };
1982
- let currency = undefined;
1983
- if (code !== undefined) {
1984
- currency = this.currency(code);
1985
- request['asset_symbol'] = currency['id'];
1986
- }
1987
- if (limit !== undefined) {
1988
- request['limit'] = limit; // default 50
1989
- }
1990
- const response = await this.privateGetDeposits(this.extend(request, params));
1991
- //
1992
- // {
1993
- // "code": 0,
1994
- // "page_token": "NQ==",
1995
- // "data": [
1996
- // {
1997
- // "id": 5,
1998
- // "amount": "25.0",
1999
- // "confirms": 100,
2000
- // "txid": "72e03037d144dae3d32b68b5045462b1049a0755",
2001
- // "is_internal": false,
2002
- // "inserted_at": "2018-02-16T11:39:58.000Z",
2003
- // "updated_at": "2018-11-09T10:20:09.000Z",
2004
- // "kind": "default",
2005
- // "memo": "",
2006
- // "state": "WITHHOLD",
2007
- // "asset_symbol": "BTS"
2008
- // }
2009
- // ]
2010
- // }
2011
- //
2012
- const deposits = this.safeValue(response, 'data', []);
2013
- return this.parseTransactions(deposits, currency, since, limit);
2014
- }
2015
- async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2016
- /**
2017
- * @method
2018
- * @name bigone#fetchWithdrawals
2019
- * @description fetch all withdrawals made from an account
2020
- * @param {string} code unified currency code
2021
- * @param {int} [since] the earliest time in ms to fetch withdrawals for
2022
- * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2023
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2024
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2025
- */
2026
- await this.loadMarkets();
2027
- const request = {
2028
- // 'page_token': 'dxzef', // request page after this page token
2029
- // 'limit': 50, // optional, default 50
2030
- // 'kind': 'string', // optional - air_drop, big_holder_dividend, default, eosc_to_eos, internal, equally_airdrop, referral_mining, one_holder_dividend, single_customer, snapshotted_airdrop, trade_mining
2031
- // 'asset_symbol': 'BTC', // optional
2032
- };
2033
- let currency = undefined;
2034
- if (code !== undefined) {
2035
- currency = this.currency(code);
2036
- request['asset_symbol'] = currency['id'];
2037
- }
2038
- if (limit !== undefined) {
2039
- request['limit'] = limit; // default 50
2040
- }
2041
- const response = await this.privateGetWithdrawals(this.extend(request, params));
2042
- //
2043
- // {
2044
- // "code": 0,
2045
- // "data": [
2046
- // {
2047
- // "id": 10,
2048
- // "customer_id": "10",
2049
- // "asset_symbol": "ETH",
2050
- // "amount": "5",
2051
- // "state": "CONFIRMED",
2052
- // "note": "2018-03-15T16:13:45.610463Z",
2053
- // "txid": "0x4643bb6b393ac20a6175c713175734a72517c63d6f73a3ca90a15356f2e967da0",
2054
- // "completed_at": "2018-03-15T16:13:45.610463Z",
2055
- // "inserted_at": "2018-03-15T16:13:45.610463Z",
2056
- // "is_internal": true,
2057
- // "target_address": "0x4643bb6b393ac20a6175c713175734a72517c63d6f7"
2058
- // }
2059
- // ],
2060
- // "page_token":"dxvf"
2061
- // }
2062
- //
2063
- const withdrawals = this.safeValue(response, 'data', []);
2064
- return this.parseTransactions(withdrawals, currency, since, limit);
2065
- }
2066
- async transfer(code, amount, fromAccount, toAccount, params = {}) {
2067
- /**
2068
- * @method
2069
- * @name bigone#transfer
2070
- * @description transfer currency internally between wallets on the same account
2071
- * @see https://open.big.one/docs/spot_transfer.html#transfer-of-user
2072
- * @param {string} code unified currency code
2073
- * @param {float} amount amount to transfer
2074
- * @param {string} fromAccount 'SPOT', 'FUND', or 'CONTRACT'
2075
- * @param {string} toAccount 'SPOT', 'FUND', or 'CONTRACT'
2076
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2077
- * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
2078
- */
2079
- await this.loadMarkets();
2080
- const currency = this.currency(code);
2081
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
2082
- const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
2083
- const toId = this.safeString(accountsByType, toAccount, toAccount);
2084
- const guid = this.safeString(params, 'guid', this.uuid());
2085
- const request = {
2086
- 'symbol': currency['id'],
2087
- 'amount': this.currencyToPrecision(code, amount),
2088
- 'from': fromId,
2089
- 'to': toId,
2090
- 'guid': guid,
2091
- // 'type': type, // NORMAL, MASTER_TO_SUB, SUB_TO_MASTER, SUB_INTERNAL, default is NORMAL
2092
- // 'sub_acccunt': '', // when type is NORMAL, it should be empty, and when type is others it is required
2093
- };
2094
- const response = await this.privatePostTransfer(this.extend(request, params));
2095
- //
2096
- // {
2097
- // "code": 0,
2098
- // "data": null
2099
- // }
2100
- //
2101
- const transfer = this.parseTransfer(response, currency);
2102
- const transferOptions = this.safeValue(this.options, 'transfer', {});
2103
- const fillResponseFromRequest = this.safeValue(transferOptions, 'fillResponseFromRequest', true);
2104
- if (fillResponseFromRequest) {
2105
- transfer['fromAccount'] = fromAccount;
2106
- transfer['toAccount'] = toAccount;
2107
- transfer['amount'] = amount;
2108
- transfer['id'] = guid;
2109
- }
2110
- return transfer;
2111
- }
2112
- parseTransfer(transfer, currency = undefined) {
2113
- //
2114
- // {
2115
- // "code": 0,
2116
- // "data": null
2117
- // }
2118
- //
2119
- const code = this.safeNumber(transfer, 'code');
2120
- return {
2121
- 'info': transfer,
2122
- 'id': undefined,
2123
- 'timestamp': undefined,
2124
- 'datetime': undefined,
2125
- 'currency': code,
2126
- 'amount': undefined,
2127
- 'fromAccount': undefined,
2128
- 'toAccount': undefined,
2129
- 'status': this.parseTransferStatus(code),
2130
- };
2131
- }
2132
- parseTransferStatus(status) {
2133
- const statuses = {
2134
- '0': 'ok',
2135
- };
2136
- return this.safeString(statuses, status, 'failed');
2137
- }
2138
- async withdraw(code, amount, address, tag = undefined, params = {}) {
2139
- /**
2140
- * @method
2141
- * @name bigone#withdraw
2142
- * @description make a withdrawal
2143
- * @param {string} code unified currency code
2144
- * @param {float} amount the amount to withdraw
2145
- * @param {string} address the address to withdraw to
2146
- * @param {string} tag
2147
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2148
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2149
- */
2150
- [tag, params] = this.handleWithdrawTagAndParams(tag, params);
2151
- await this.loadMarkets();
2152
- const currency = this.currency(code);
2153
- const request = {
2154
- 'symbol': currency['id'],
2155
- 'target_address': address,
2156
- 'amount': this.currencyToPrecision(code, amount),
2157
- };
2158
- if (tag !== undefined) {
2159
- request['memo'] = tag;
2160
- }
2161
- let networkCode = undefined;
2162
- [networkCode, params] = this.handleNetworkCodeAndParams(params);
2163
- if (networkCode !== undefined) {
2164
- request['gateway_name'] = this.networkCodeToId(networkCode);
2165
- }
2166
- // requires write permission on the wallet
2167
- const response = await this.privatePostWithdrawals(this.extend(request, params));
2168
- //
2169
- // {
2170
- // "code":0,
2171
- // "message":"",
2172
- // "data":{
2173
- // "id":1077391,
2174
- // "customer_id":1082679,
2175
- // "amount":"21.9000000000000000",
2176
- // "txid":"",
2177
- // "is_internal":false,
2178
- // "kind":"on_chain",
2179
- // "state":"PENDING",
2180
- // "inserted_at":"2020-06-03T00:50:57+00:00",
2181
- // "updated_at":"2020-06-03T00:50:57+00:00",
2182
- // "memo":"",
2183
- // "target_address":"rDYtYT3dBeuw376rvHqoZBKW3UmvguoBAf",
2184
- // "fee":"0.1000000000000000",
2185
- // "asset_symbol":"XRP"
2186
- // }
2187
- // }
2188
- //
2189
- const data = this.safeValue(response, 'data', {});
2190
- return this.parseTransaction(data, currency);
2191
- }
2192
- handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
2193
- if (response === undefined) {
2194
- return undefined; // fallback to default error handler
2195
- }
2196
- //
2197
- // {"code":10013,"message":"Resource not found"}
2198
- // {"code":40004,"message":"invalid jwt"}
2199
- //
2200
- const code = this.safeString(response, 'code');
2201
- const message = this.safeString(response, 'message');
2202
- if ((code !== '0') && (code !== undefined)) {
2203
- const feedback = this.id + ' ' + body;
2204
- this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
2205
- this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
2206
- this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
2207
- throw new errors.ExchangeError(feedback); // unknown message
2208
- }
2209
- return undefined;
2210
- }
2211
- }
2212
-
2213
- module.exports = bigone;