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