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,1045 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var bitflyer$1 = require('./abstract/bitflyer.js');
|
|
4
|
+
var errors = require('./base/errors.js');
|
|
5
|
+
var number = require('./base/functions/number.js');
|
|
6
|
+
var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
|
|
7
|
+
var Precise = require('./base/Precise.js');
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
/**
|
|
12
|
+
* @class bitflyer
|
|
13
|
+
* @augments Exchange
|
|
14
|
+
*/
|
|
15
|
+
class bitflyer extends bitflyer$1 {
|
|
16
|
+
describe() {
|
|
17
|
+
return this.deepExtend(super.describe(), {
|
|
18
|
+
'id': 'bitflyer',
|
|
19
|
+
'name': 'bitFlyer',
|
|
20
|
+
'countries': ['JP'],
|
|
21
|
+
'version': 'v1',
|
|
22
|
+
'rateLimit': 1000,
|
|
23
|
+
'hostname': 'bitflyer.com',
|
|
24
|
+
'has': {
|
|
25
|
+
'CORS': undefined,
|
|
26
|
+
'spot': true,
|
|
27
|
+
'margin': false,
|
|
28
|
+
'swap': undefined,
|
|
29
|
+
'future': undefined,
|
|
30
|
+
'option': false,
|
|
31
|
+
'cancelOrder': true,
|
|
32
|
+
'createOrder': true,
|
|
33
|
+
'fetchBalance': true,
|
|
34
|
+
'fetchClosedOrders': 'emulated',
|
|
35
|
+
'fetchDeposits': true,
|
|
36
|
+
'fetchMarginMode': false,
|
|
37
|
+
'fetchMarkets': true,
|
|
38
|
+
'fetchMyTrades': true,
|
|
39
|
+
'fetchOpenOrders': 'emulated',
|
|
40
|
+
'fetchOrder': 'emulated',
|
|
41
|
+
'fetchOrderBook': true,
|
|
42
|
+
'fetchOrders': true,
|
|
43
|
+
'fetchPositionMode': false,
|
|
44
|
+
'fetchPositions': true,
|
|
45
|
+
'fetchTicker': true,
|
|
46
|
+
'fetchTrades': true,
|
|
47
|
+
'fetchTradingFee': true,
|
|
48
|
+
'fetchTradingFees': false,
|
|
49
|
+
'fetchTransfer': false,
|
|
50
|
+
'fetchTransfers': false,
|
|
51
|
+
'fetchWithdrawals': true,
|
|
52
|
+
'transfer': false,
|
|
53
|
+
'withdraw': true,
|
|
54
|
+
},
|
|
55
|
+
'urls': {
|
|
56
|
+
'logo': 'https://user-images.githubusercontent.com/1294454/28051642-56154182-660e-11e7-9b0d-6042d1e6edd8.jpg',
|
|
57
|
+
'api': {
|
|
58
|
+
'rest': 'https://api.{hostname}',
|
|
59
|
+
},
|
|
60
|
+
'www': 'https://bitflyer.com',
|
|
61
|
+
'doc': 'https://lightning.bitflyer.com/docs?lang=en',
|
|
62
|
+
},
|
|
63
|
+
'api': {
|
|
64
|
+
'public': {
|
|
65
|
+
'get': [
|
|
66
|
+
'getmarkets/usa',
|
|
67
|
+
'getmarkets/eu',
|
|
68
|
+
'getmarkets',
|
|
69
|
+
'getboard',
|
|
70
|
+
'getticker',
|
|
71
|
+
'getexecutions',
|
|
72
|
+
'gethealth',
|
|
73
|
+
'getboardstate',
|
|
74
|
+
'getchats',
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
'private': {
|
|
78
|
+
'get': [
|
|
79
|
+
'getpermissions',
|
|
80
|
+
'getbalance',
|
|
81
|
+
'getbalancehistory',
|
|
82
|
+
'getcollateral',
|
|
83
|
+
'getcollateralhistory',
|
|
84
|
+
'getcollateralaccounts',
|
|
85
|
+
'getaddresses',
|
|
86
|
+
'getcoinins',
|
|
87
|
+
'getcoinouts',
|
|
88
|
+
'getbankaccounts',
|
|
89
|
+
'getdeposits',
|
|
90
|
+
'getwithdrawals',
|
|
91
|
+
'getchildorders',
|
|
92
|
+
'getparentorders',
|
|
93
|
+
'getparentorder',
|
|
94
|
+
'getexecutions',
|
|
95
|
+
'getpositions',
|
|
96
|
+
'gettradingcommission',
|
|
97
|
+
],
|
|
98
|
+
'post': [
|
|
99
|
+
'sendcoin',
|
|
100
|
+
'withdraw',
|
|
101
|
+
'sendchildorder',
|
|
102
|
+
'cancelchildorder',
|
|
103
|
+
'sendparentorder',
|
|
104
|
+
'cancelparentorder',
|
|
105
|
+
'cancelallchildorders',
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
'fees': {
|
|
110
|
+
'trading': {
|
|
111
|
+
'maker': this.parseNumber('0.002'),
|
|
112
|
+
'taker': this.parseNumber('0.002'),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
'precisionMode': number.TICK_SIZE,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
parseExpiryDate(expiry) {
|
|
119
|
+
const day = expiry.slice(0, 2);
|
|
120
|
+
const monthName = expiry.slice(2, 5);
|
|
121
|
+
const year = expiry.slice(5, 9);
|
|
122
|
+
const months = {
|
|
123
|
+
'JAN': '01',
|
|
124
|
+
'FEB': '02',
|
|
125
|
+
'MAR': '03',
|
|
126
|
+
'APR': '04',
|
|
127
|
+
'MAY': '05',
|
|
128
|
+
'JUN': '06',
|
|
129
|
+
'JUL': '07',
|
|
130
|
+
'AUG': '08',
|
|
131
|
+
'SEP': '09',
|
|
132
|
+
'OCT': '10',
|
|
133
|
+
'NOV': '11',
|
|
134
|
+
'DEC': '12',
|
|
135
|
+
};
|
|
136
|
+
const month = this.safeString(months, monthName);
|
|
137
|
+
return this.parse8601(year + '-' + month + '-' + day + 'T00:00:00Z');
|
|
138
|
+
}
|
|
139
|
+
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
140
|
+
// Bitflyer has a different type of conflict in markets, because
|
|
141
|
+
// some of their ids (ETH/BTC and BTC/JPY) are duplicated in US, EU and JP.
|
|
142
|
+
// Since they're the same we just need to return one
|
|
143
|
+
return super.safeMarket(marketId, market, delimiter, 'spot');
|
|
144
|
+
}
|
|
145
|
+
async fetchMarkets(params = {}) {
|
|
146
|
+
/**
|
|
147
|
+
* @method
|
|
148
|
+
* @name bitflyer#fetchMarkets
|
|
149
|
+
* @description retrieves data on all markets for bitflyer
|
|
150
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#market-list
|
|
151
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
152
|
+
* @returns {object[]} an array of objects representing market data
|
|
153
|
+
*/
|
|
154
|
+
const jp_markets = await this.publicGetGetmarkets(params);
|
|
155
|
+
//
|
|
156
|
+
// [
|
|
157
|
+
// // spot
|
|
158
|
+
// { "product_code": "BTC_JPY", "market_type": "Spot" },
|
|
159
|
+
// { "product_code": "BCH_BTC", "market_type": "Spot" },
|
|
160
|
+
// // forex swap
|
|
161
|
+
// { "product_code": "FX_BTC_JPY", "market_type": "FX" },
|
|
162
|
+
// // future
|
|
163
|
+
// {
|
|
164
|
+
// "product_code": "BTCJPY11FEB2022",
|
|
165
|
+
// "alias": "BTCJPY_MAT1WK",
|
|
166
|
+
// "market_type": "Futures",
|
|
167
|
+
// },
|
|
168
|
+
// ];
|
|
169
|
+
//
|
|
170
|
+
const us_markets = await this.publicGetGetmarketsUsa(params);
|
|
171
|
+
//
|
|
172
|
+
// [
|
|
173
|
+
// { "product_code": "BTC_USD", "market_type": "Spot" },
|
|
174
|
+
// { "product_code": "BTC_JPY", "market_type": "Spot" },
|
|
175
|
+
// ];
|
|
176
|
+
//
|
|
177
|
+
const eu_markets = await this.publicGetGetmarketsEu(params);
|
|
178
|
+
//
|
|
179
|
+
// [
|
|
180
|
+
// { "product_code": "BTC_EUR", "market_type": "Spot" },
|
|
181
|
+
// { "product_code": "BTC_JPY", "market_type": "Spot" },
|
|
182
|
+
// ];
|
|
183
|
+
//
|
|
184
|
+
let markets = this.arrayConcat(jp_markets, us_markets);
|
|
185
|
+
markets = this.arrayConcat(markets, eu_markets);
|
|
186
|
+
const result = [];
|
|
187
|
+
for (let i = 0; i < markets.length; i++) {
|
|
188
|
+
const market = markets[i];
|
|
189
|
+
const id = this.safeString(market, 'product_code');
|
|
190
|
+
const currencies = id.split('_');
|
|
191
|
+
const marketType = this.safeString(market, 'market_type');
|
|
192
|
+
const swap = (marketType === 'FX');
|
|
193
|
+
const future = (marketType === 'Futures');
|
|
194
|
+
const spot = !swap && !future;
|
|
195
|
+
let type = 'spot';
|
|
196
|
+
let settle = undefined;
|
|
197
|
+
let baseId = undefined;
|
|
198
|
+
let quoteId = undefined;
|
|
199
|
+
let expiry = undefined;
|
|
200
|
+
if (spot) {
|
|
201
|
+
baseId = this.safeString(currencies, 0);
|
|
202
|
+
quoteId = this.safeString(currencies, 1);
|
|
203
|
+
}
|
|
204
|
+
else if (swap) {
|
|
205
|
+
type = 'swap';
|
|
206
|
+
baseId = this.safeString(currencies, 1);
|
|
207
|
+
quoteId = this.safeString(currencies, 2);
|
|
208
|
+
}
|
|
209
|
+
else if (future) {
|
|
210
|
+
const alias = this.safeString(market, 'alias');
|
|
211
|
+
if (alias === undefined) {
|
|
212
|
+
// no alias:
|
|
213
|
+
// { product_code: 'BTCJPY11MAR2022', market_type: 'Futures' }
|
|
214
|
+
// TODO this will break if there are products with 4 chars
|
|
215
|
+
baseId = id.slice(0, 3);
|
|
216
|
+
quoteId = id.slice(3, 6);
|
|
217
|
+
// last 9 chars are expiry date
|
|
218
|
+
const expiryDate = id.slice(-9);
|
|
219
|
+
expiry = this.parseExpiryDate(expiryDate);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
const splitAlias = alias.split('_');
|
|
223
|
+
const currencyIds = this.safeString(splitAlias, 0);
|
|
224
|
+
baseId = currencyIds.slice(0, -3);
|
|
225
|
+
quoteId = currencyIds.slice(-3);
|
|
226
|
+
const splitId = id.split(currencyIds);
|
|
227
|
+
const expiryDate = this.safeString(splitId, 1);
|
|
228
|
+
expiry = this.parseExpiryDate(expiryDate);
|
|
229
|
+
}
|
|
230
|
+
type = 'future';
|
|
231
|
+
}
|
|
232
|
+
const base = this.safeCurrencyCode(baseId);
|
|
233
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
234
|
+
let symbol = base + '/' + quote;
|
|
235
|
+
let taker = this.fees['trading']['taker'];
|
|
236
|
+
let maker = this.fees['trading']['maker'];
|
|
237
|
+
const contract = swap || future;
|
|
238
|
+
if (contract) {
|
|
239
|
+
maker = 0.0;
|
|
240
|
+
taker = 0.0;
|
|
241
|
+
settle = 'JPY';
|
|
242
|
+
symbol = symbol + ':' + settle;
|
|
243
|
+
if (future) {
|
|
244
|
+
symbol = symbol + '-' + this.yymmdd(expiry);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
result.push({
|
|
248
|
+
'id': id,
|
|
249
|
+
'symbol': symbol,
|
|
250
|
+
'base': base,
|
|
251
|
+
'quote': quote,
|
|
252
|
+
'settle': settle,
|
|
253
|
+
'baseId': baseId,
|
|
254
|
+
'quoteId': quoteId,
|
|
255
|
+
'settleId': undefined,
|
|
256
|
+
'type': type,
|
|
257
|
+
'spot': spot,
|
|
258
|
+
'margin': false,
|
|
259
|
+
'swap': swap,
|
|
260
|
+
'future': future,
|
|
261
|
+
'option': false,
|
|
262
|
+
'active': true,
|
|
263
|
+
'contract': contract,
|
|
264
|
+
'linear': spot ? undefined : true,
|
|
265
|
+
'inverse': spot ? undefined : false,
|
|
266
|
+
'taker': taker,
|
|
267
|
+
'maker': maker,
|
|
268
|
+
'contractSize': undefined,
|
|
269
|
+
'expiry': expiry,
|
|
270
|
+
'expiryDatetime': this.iso8601(expiry),
|
|
271
|
+
'strike': undefined,
|
|
272
|
+
'optionType': undefined,
|
|
273
|
+
'precision': {
|
|
274
|
+
'amount': undefined,
|
|
275
|
+
'price': undefined,
|
|
276
|
+
},
|
|
277
|
+
'limits': {
|
|
278
|
+
'leverage': {
|
|
279
|
+
'min': undefined,
|
|
280
|
+
'max': undefined,
|
|
281
|
+
},
|
|
282
|
+
'amount': {
|
|
283
|
+
'min': undefined,
|
|
284
|
+
'max': undefined,
|
|
285
|
+
},
|
|
286
|
+
'price': {
|
|
287
|
+
'min': undefined,
|
|
288
|
+
'max': undefined,
|
|
289
|
+
},
|
|
290
|
+
'cost': {
|
|
291
|
+
'min': undefined,
|
|
292
|
+
'max': undefined,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
'created': undefined,
|
|
296
|
+
'info': market,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
parseBalance(response) {
|
|
302
|
+
const result = { 'info': response };
|
|
303
|
+
for (let i = 0; i < response.length; i++) {
|
|
304
|
+
const balance = response[i];
|
|
305
|
+
const currencyId = this.safeString(balance, 'currency_code');
|
|
306
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
307
|
+
const account = this.account();
|
|
308
|
+
account['total'] = this.safeString(balance, 'amount');
|
|
309
|
+
account['free'] = this.safeString(balance, 'available');
|
|
310
|
+
result[code] = account;
|
|
311
|
+
}
|
|
312
|
+
return this.safeBalance(result);
|
|
313
|
+
}
|
|
314
|
+
async fetchBalance(params = {}) {
|
|
315
|
+
/**
|
|
316
|
+
* @method
|
|
317
|
+
* @name bitflyer#fetchBalance
|
|
318
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
319
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#get-account-asset-balance
|
|
320
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
321
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
322
|
+
*/
|
|
323
|
+
await this.loadMarkets();
|
|
324
|
+
const response = await this.privateGetGetbalance(params);
|
|
325
|
+
//
|
|
326
|
+
// [
|
|
327
|
+
// {
|
|
328
|
+
// "currency_code": "JPY",
|
|
329
|
+
// "amount": 1024078,
|
|
330
|
+
// "available": 508000
|
|
331
|
+
// },
|
|
332
|
+
// {
|
|
333
|
+
// "currency_code": "BTC",
|
|
334
|
+
// "amount": 10.24,
|
|
335
|
+
// "available": 4.12
|
|
336
|
+
// },
|
|
337
|
+
// {
|
|
338
|
+
// "currency_code": "ETH",
|
|
339
|
+
// "amount": 20.48,
|
|
340
|
+
// "available": 16.38
|
|
341
|
+
// }
|
|
342
|
+
// ]
|
|
343
|
+
//
|
|
344
|
+
return this.parseBalance(response);
|
|
345
|
+
}
|
|
346
|
+
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
347
|
+
/**
|
|
348
|
+
* @method
|
|
349
|
+
* @name bitflyer#fetchOrderBook
|
|
350
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
351
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#order-book
|
|
352
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
353
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
354
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
355
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
356
|
+
*/
|
|
357
|
+
await this.loadMarkets();
|
|
358
|
+
const market = this.market(symbol);
|
|
359
|
+
const request = {
|
|
360
|
+
'product_code': market['id'],
|
|
361
|
+
};
|
|
362
|
+
const orderbook = await this.publicGetGetboard(this.extend(request, params));
|
|
363
|
+
return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price', 'size');
|
|
364
|
+
}
|
|
365
|
+
parseTicker(ticker, market = undefined) {
|
|
366
|
+
const symbol = this.safeSymbol(undefined, market);
|
|
367
|
+
const timestamp = this.parse8601(this.safeString(ticker, 'timestamp'));
|
|
368
|
+
const last = this.safeString(ticker, 'ltp');
|
|
369
|
+
return this.safeTicker({
|
|
370
|
+
'symbol': symbol,
|
|
371
|
+
'timestamp': timestamp,
|
|
372
|
+
'datetime': this.iso8601(timestamp),
|
|
373
|
+
'high': undefined,
|
|
374
|
+
'low': undefined,
|
|
375
|
+
'bid': this.safeString(ticker, 'best_bid'),
|
|
376
|
+
'bidVolume': undefined,
|
|
377
|
+
'ask': this.safeString(ticker, 'best_ask'),
|
|
378
|
+
'askVolume': undefined,
|
|
379
|
+
'vwap': undefined,
|
|
380
|
+
'open': undefined,
|
|
381
|
+
'close': last,
|
|
382
|
+
'last': last,
|
|
383
|
+
'previousClose': undefined,
|
|
384
|
+
'change': undefined,
|
|
385
|
+
'percentage': undefined,
|
|
386
|
+
'average': undefined,
|
|
387
|
+
'baseVolume': this.safeString(ticker, 'volume_by_product'),
|
|
388
|
+
'quoteVolume': undefined,
|
|
389
|
+
'info': ticker,
|
|
390
|
+
}, market);
|
|
391
|
+
}
|
|
392
|
+
async fetchTicker(symbol, params = {}) {
|
|
393
|
+
/**
|
|
394
|
+
* @method
|
|
395
|
+
* @name bitflyer#fetchTicker
|
|
396
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
397
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#ticker
|
|
398
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
399
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
400
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
401
|
+
*/
|
|
402
|
+
await this.loadMarkets();
|
|
403
|
+
const market = this.market(symbol);
|
|
404
|
+
const request = {
|
|
405
|
+
'product_code': market['id'],
|
|
406
|
+
};
|
|
407
|
+
const response = await this.publicGetGetticker(this.extend(request, params));
|
|
408
|
+
return this.parseTicker(response, market);
|
|
409
|
+
}
|
|
410
|
+
parseTrade(trade, market = undefined) {
|
|
411
|
+
//
|
|
412
|
+
// fetchTrades (public) v1
|
|
413
|
+
//
|
|
414
|
+
// {
|
|
415
|
+
// "id":2278466664,
|
|
416
|
+
// "side":"SELL",
|
|
417
|
+
// "price":56810.7,
|
|
418
|
+
// "size":0.08798,
|
|
419
|
+
// "exec_date":"2021-11-19T11:46:39.323",
|
|
420
|
+
// "buy_child_order_acceptance_id":"JRF20211119-114209-236525",
|
|
421
|
+
// "sell_child_order_acceptance_id":"JRF20211119-114639-236919"
|
|
422
|
+
// }
|
|
423
|
+
//
|
|
424
|
+
// fetchMyTrades
|
|
425
|
+
//
|
|
426
|
+
// {
|
|
427
|
+
// "id": 37233,
|
|
428
|
+
// "side": "BUY",
|
|
429
|
+
// "price": 33470,
|
|
430
|
+
// "size": 0.01,
|
|
431
|
+
// "exec_date": "2015-07-07T09:57:40.397",
|
|
432
|
+
// "child_order_id": "JOR20150707-060559-021935",
|
|
433
|
+
// "child_order_acceptance_id": "JRF20150707-060559-396699"
|
|
434
|
+
// "commission": 0,
|
|
435
|
+
// },
|
|
436
|
+
//
|
|
437
|
+
let side = this.safeStringLower(trade, 'side');
|
|
438
|
+
if (side !== undefined) {
|
|
439
|
+
if (side.length < 1) {
|
|
440
|
+
side = undefined;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
let order = undefined;
|
|
444
|
+
if (side !== undefined) {
|
|
445
|
+
const idInner = side + '_child_order_acceptance_id';
|
|
446
|
+
if (idInner in trade) {
|
|
447
|
+
order = trade[idInner];
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (order === undefined) {
|
|
451
|
+
order = this.safeString(trade, 'child_order_acceptance_id');
|
|
452
|
+
}
|
|
453
|
+
const timestamp = this.parse8601(this.safeString(trade, 'exec_date'));
|
|
454
|
+
const priceString = this.safeString(trade, 'price');
|
|
455
|
+
const amountString = this.safeString(trade, 'size');
|
|
456
|
+
const id = this.safeString(trade, 'id');
|
|
457
|
+
market = this.safeMarket(undefined, market);
|
|
458
|
+
return this.safeTrade({
|
|
459
|
+
'id': id,
|
|
460
|
+
'info': trade,
|
|
461
|
+
'timestamp': timestamp,
|
|
462
|
+
'datetime': this.iso8601(timestamp),
|
|
463
|
+
'symbol': market['symbol'],
|
|
464
|
+
'order': order,
|
|
465
|
+
'type': undefined,
|
|
466
|
+
'side': side,
|
|
467
|
+
'takerOrMaker': undefined,
|
|
468
|
+
'price': priceString,
|
|
469
|
+
'amount': amountString,
|
|
470
|
+
'cost': undefined,
|
|
471
|
+
'fee': undefined,
|
|
472
|
+
}, market);
|
|
473
|
+
}
|
|
474
|
+
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
475
|
+
/**
|
|
476
|
+
* @method
|
|
477
|
+
* @name bitflyer#fetchTrades
|
|
478
|
+
* @description get the list of most recent trades for a particular symbol
|
|
479
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#list-executions
|
|
480
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
481
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
482
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
483
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
484
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
485
|
+
*/
|
|
486
|
+
await this.loadMarkets();
|
|
487
|
+
const market = this.market(symbol);
|
|
488
|
+
const request = {
|
|
489
|
+
'product_code': market['id'],
|
|
490
|
+
};
|
|
491
|
+
if (limit !== undefined) {
|
|
492
|
+
request['count'] = limit;
|
|
493
|
+
}
|
|
494
|
+
const response = await this.publicGetGetexecutions(this.extend(request, params));
|
|
495
|
+
//
|
|
496
|
+
// [
|
|
497
|
+
// {
|
|
498
|
+
// "id": 39287,
|
|
499
|
+
// "side": "BUY",
|
|
500
|
+
// "price": 31690,
|
|
501
|
+
// "size": 27.04,
|
|
502
|
+
// "exec_date": "2015-07-08T02:43:34.823",
|
|
503
|
+
// "buy_child_order_acceptance_id": "JRF20150707-200203-452209",
|
|
504
|
+
// "sell_child_order_acceptance_id": "JRF20150708-024334-060234"
|
|
505
|
+
// },
|
|
506
|
+
// ]
|
|
507
|
+
//
|
|
508
|
+
return this.parseTrades(response, market, since, limit);
|
|
509
|
+
}
|
|
510
|
+
async fetchTradingFee(symbol, params = {}) {
|
|
511
|
+
/**
|
|
512
|
+
* @method
|
|
513
|
+
* @name bitflyer#fetchTradingFee
|
|
514
|
+
* @description fetch the trading fees for a market
|
|
515
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#get-trading-commission
|
|
516
|
+
* @param {string} symbol unified market symbol
|
|
517
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
518
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
519
|
+
*/
|
|
520
|
+
await this.loadMarkets();
|
|
521
|
+
const market = this.market(symbol);
|
|
522
|
+
const request = {
|
|
523
|
+
'product_code': market['id'],
|
|
524
|
+
};
|
|
525
|
+
const response = await this.privateGetGettradingcommission(this.extend(request, params));
|
|
526
|
+
//
|
|
527
|
+
// {
|
|
528
|
+
// commission_rate: '0.0020'
|
|
529
|
+
// }
|
|
530
|
+
//
|
|
531
|
+
const fee = this.safeNumber(response, 'commission_rate');
|
|
532
|
+
return {
|
|
533
|
+
'info': response,
|
|
534
|
+
'symbol': market['symbol'],
|
|
535
|
+
'maker': fee,
|
|
536
|
+
'taker': fee,
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
540
|
+
/**
|
|
541
|
+
* @method
|
|
542
|
+
* @name bitflyer#createOrder
|
|
543
|
+
* @description create a trade order
|
|
544
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#send-a-new-order
|
|
545
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
546
|
+
* @param {string} type 'market' or 'limit'
|
|
547
|
+
* @param {string} side 'buy' or 'sell'
|
|
548
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
549
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
550
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
551
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
552
|
+
*/
|
|
553
|
+
await this.loadMarkets();
|
|
554
|
+
const request = {
|
|
555
|
+
'product_code': this.marketId(symbol),
|
|
556
|
+
'child_order_type': type.toUpperCase(),
|
|
557
|
+
'side': side.toUpperCase(),
|
|
558
|
+
'price': price,
|
|
559
|
+
'size': amount,
|
|
560
|
+
};
|
|
561
|
+
const result = await this.privatePostSendchildorder(this.extend(request, params));
|
|
562
|
+
// { "status": - 200, "error_message": "Insufficient funds", "data": null }
|
|
563
|
+
const id = this.safeString(result, 'child_order_acceptance_id');
|
|
564
|
+
return this.safeOrder({
|
|
565
|
+
'id': id,
|
|
566
|
+
'info': result,
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
570
|
+
/**
|
|
571
|
+
* @method
|
|
572
|
+
* @name bitflyer#cancelOrder
|
|
573
|
+
* @description cancels an open order
|
|
574
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#cancel-order
|
|
575
|
+
* @param {string} id order id
|
|
576
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
577
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
578
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
579
|
+
*/
|
|
580
|
+
if (symbol === undefined) {
|
|
581
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
582
|
+
}
|
|
583
|
+
await this.loadMarkets();
|
|
584
|
+
const request = {
|
|
585
|
+
'product_code': this.marketId(symbol),
|
|
586
|
+
'child_order_acceptance_id': id,
|
|
587
|
+
};
|
|
588
|
+
return await this.privatePostCancelchildorder(this.extend(request, params));
|
|
589
|
+
}
|
|
590
|
+
parseOrderStatus(status) {
|
|
591
|
+
const statuses = {
|
|
592
|
+
'ACTIVE': 'open',
|
|
593
|
+
'COMPLETED': 'closed',
|
|
594
|
+
'CANCELED': 'canceled',
|
|
595
|
+
'EXPIRED': 'canceled',
|
|
596
|
+
'REJECTED': 'canceled',
|
|
597
|
+
};
|
|
598
|
+
return this.safeString(statuses, status, status);
|
|
599
|
+
}
|
|
600
|
+
parseOrder(order, market = undefined) {
|
|
601
|
+
const timestamp = this.parse8601(this.safeString(order, 'child_order_date'));
|
|
602
|
+
const price = this.safeString(order, 'price');
|
|
603
|
+
const amount = this.safeString(order, 'size');
|
|
604
|
+
const filled = this.safeString(order, 'executed_size');
|
|
605
|
+
const remaining = this.safeString(order, 'outstanding_size');
|
|
606
|
+
const status = this.parseOrderStatus(this.safeString(order, 'child_order_state'));
|
|
607
|
+
const type = this.safeStringLower(order, 'child_order_type');
|
|
608
|
+
const side = this.safeStringLower(order, 'side');
|
|
609
|
+
const marketId = this.safeString(order, 'product_code');
|
|
610
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
611
|
+
let fee = undefined;
|
|
612
|
+
const feeCost = this.safeNumber(order, 'total_commission');
|
|
613
|
+
if (feeCost !== undefined) {
|
|
614
|
+
fee = {
|
|
615
|
+
'cost': feeCost,
|
|
616
|
+
'currency': undefined,
|
|
617
|
+
'rate': undefined,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
const id = this.safeString(order, 'child_order_acceptance_id');
|
|
621
|
+
return this.safeOrder({
|
|
622
|
+
'id': id,
|
|
623
|
+
'clientOrderId': undefined,
|
|
624
|
+
'info': order,
|
|
625
|
+
'timestamp': timestamp,
|
|
626
|
+
'datetime': this.iso8601(timestamp),
|
|
627
|
+
'lastTradeTimestamp': undefined,
|
|
628
|
+
'status': status,
|
|
629
|
+
'symbol': symbol,
|
|
630
|
+
'type': type,
|
|
631
|
+
'timeInForce': undefined,
|
|
632
|
+
'postOnly': undefined,
|
|
633
|
+
'side': side,
|
|
634
|
+
'price': price,
|
|
635
|
+
'stopPrice': undefined,
|
|
636
|
+
'triggerPrice': undefined,
|
|
637
|
+
'cost': undefined,
|
|
638
|
+
'amount': amount,
|
|
639
|
+
'filled': filled,
|
|
640
|
+
'remaining': remaining,
|
|
641
|
+
'fee': fee,
|
|
642
|
+
'average': undefined,
|
|
643
|
+
'trades': undefined,
|
|
644
|
+
}, market);
|
|
645
|
+
}
|
|
646
|
+
async fetchOrders(symbol = undefined, since = undefined, limit = 100, params = {}) {
|
|
647
|
+
/**
|
|
648
|
+
* @method
|
|
649
|
+
* @name bitflyer#fetchOrders
|
|
650
|
+
* @description fetches information on multiple orders made by the user
|
|
651
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#list-orders
|
|
652
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
653
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
654
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
655
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
656
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
657
|
+
*/
|
|
658
|
+
if (symbol === undefined) {
|
|
659
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
660
|
+
}
|
|
661
|
+
await this.loadMarkets();
|
|
662
|
+
const market = this.market(symbol);
|
|
663
|
+
const request = {
|
|
664
|
+
'product_code': market['id'],
|
|
665
|
+
'count': limit,
|
|
666
|
+
};
|
|
667
|
+
const response = await this.privateGetGetchildorders(this.extend(request, params));
|
|
668
|
+
let orders = this.parseOrders(response, market, since, limit);
|
|
669
|
+
if (symbol !== undefined) {
|
|
670
|
+
orders = this.filterBy(orders, 'symbol', symbol);
|
|
671
|
+
}
|
|
672
|
+
return orders;
|
|
673
|
+
}
|
|
674
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = 100, params = {}) {
|
|
675
|
+
/**
|
|
676
|
+
* @method
|
|
677
|
+
* @name bitflyer#fetchOpenOrders
|
|
678
|
+
* @description fetch all unfilled currently open orders
|
|
679
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#list-orders
|
|
680
|
+
* @param {string} symbol unified market symbol
|
|
681
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
682
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
683
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
684
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
685
|
+
*/
|
|
686
|
+
const request = {
|
|
687
|
+
'child_order_state': 'ACTIVE',
|
|
688
|
+
};
|
|
689
|
+
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
690
|
+
}
|
|
691
|
+
async fetchClosedOrders(symbol = undefined, since = undefined, limit = 100, params = {}) {
|
|
692
|
+
/**
|
|
693
|
+
* @method
|
|
694
|
+
* @name bitflyer#fetchClosedOrders
|
|
695
|
+
* @description fetches information on multiple closed orders made by the user
|
|
696
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#list-orders
|
|
697
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
698
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
699
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
700
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
701
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
702
|
+
*/
|
|
703
|
+
const request = {
|
|
704
|
+
'child_order_state': 'COMPLETED',
|
|
705
|
+
};
|
|
706
|
+
return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
|
|
707
|
+
}
|
|
708
|
+
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
709
|
+
/**
|
|
710
|
+
* @method
|
|
711
|
+
* @name bitflyer#fetchOrder
|
|
712
|
+
* @description fetches information on an order made by the user
|
|
713
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#list-orders
|
|
714
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
715
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
716
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
717
|
+
*/
|
|
718
|
+
if (symbol === undefined) {
|
|
719
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
720
|
+
}
|
|
721
|
+
const orders = await this.fetchOrders(symbol);
|
|
722
|
+
const ordersById = this.indexBy(orders, 'id');
|
|
723
|
+
if (id in ordersById) {
|
|
724
|
+
return ordersById[id];
|
|
725
|
+
}
|
|
726
|
+
throw new errors.OrderNotFound(this.id + ' No order found with id ' + id);
|
|
727
|
+
}
|
|
728
|
+
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
729
|
+
/**
|
|
730
|
+
* @method
|
|
731
|
+
* @name bitflyer#fetchMyTrades
|
|
732
|
+
* @description fetch all trades made by the user
|
|
733
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#list-executions
|
|
734
|
+
* @param {string} symbol unified market symbol
|
|
735
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
736
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
737
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
738
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
739
|
+
*/
|
|
740
|
+
if (symbol === undefined) {
|
|
741
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
742
|
+
}
|
|
743
|
+
await this.loadMarkets();
|
|
744
|
+
const market = this.market(symbol);
|
|
745
|
+
const request = {
|
|
746
|
+
'product_code': market['id'],
|
|
747
|
+
};
|
|
748
|
+
if (limit !== undefined) {
|
|
749
|
+
request['count'] = limit;
|
|
750
|
+
}
|
|
751
|
+
const response = await this.privateGetGetexecutions(this.extend(request, params));
|
|
752
|
+
//
|
|
753
|
+
// [
|
|
754
|
+
// {
|
|
755
|
+
// "id": 37233,
|
|
756
|
+
// "side": "BUY",
|
|
757
|
+
// "price": 33470,
|
|
758
|
+
// "size": 0.01,
|
|
759
|
+
// "exec_date": "2015-07-07T09:57:40.397",
|
|
760
|
+
// "child_order_id": "JOR20150707-060559-021935",
|
|
761
|
+
// "child_order_acceptance_id": "JRF20150707-060559-396699"
|
|
762
|
+
// "commission": 0,
|
|
763
|
+
// },
|
|
764
|
+
// ]
|
|
765
|
+
//
|
|
766
|
+
return this.parseTrades(response, market, since, limit);
|
|
767
|
+
}
|
|
768
|
+
async fetchPositions(symbols = undefined, params = {}) {
|
|
769
|
+
/**
|
|
770
|
+
* @method
|
|
771
|
+
* @name bitflyer#fetchPositions
|
|
772
|
+
* @description fetch all open positions
|
|
773
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#get-open-interest-summary
|
|
774
|
+
* @param {string[]} symbols list of unified market symbols
|
|
775
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
776
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
777
|
+
*/
|
|
778
|
+
if (symbols === undefined) {
|
|
779
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchPositions() requires a `symbols` argument, exactly one symbol in an array');
|
|
780
|
+
}
|
|
781
|
+
await this.loadMarkets();
|
|
782
|
+
const request = {
|
|
783
|
+
'product_code': this.marketIds(symbols),
|
|
784
|
+
};
|
|
785
|
+
const response = await this.privateGetGetpositions(this.extend(request, params));
|
|
786
|
+
//
|
|
787
|
+
// [
|
|
788
|
+
// {
|
|
789
|
+
// "product_code": "FX_BTC_JPY",
|
|
790
|
+
// "side": "BUY",
|
|
791
|
+
// "price": 36000,
|
|
792
|
+
// "size": 10,
|
|
793
|
+
// "commission": 0,
|
|
794
|
+
// "swap_point_accumulate": -35,
|
|
795
|
+
// "require_collateral": 120000,
|
|
796
|
+
// "open_date": "2015-11-03T10:04:45.011",
|
|
797
|
+
// "leverage": 3,
|
|
798
|
+
// "pnl": 965,
|
|
799
|
+
// "sfd": -0.5
|
|
800
|
+
// }
|
|
801
|
+
// ]
|
|
802
|
+
//
|
|
803
|
+
// todo unify parsePosition/parsePositions
|
|
804
|
+
return response;
|
|
805
|
+
}
|
|
806
|
+
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
807
|
+
/**
|
|
808
|
+
* @method
|
|
809
|
+
* @name bitflyer#withdraw
|
|
810
|
+
* @description make a withdrawal
|
|
811
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#withdrawing-funds
|
|
812
|
+
* @param {string} code unified currency code
|
|
813
|
+
* @param {float} amount the amount to withdraw
|
|
814
|
+
* @param {string} address the address to withdraw to
|
|
815
|
+
* @param {string} tag
|
|
816
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
817
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
818
|
+
*/
|
|
819
|
+
this.checkAddress(address);
|
|
820
|
+
await this.loadMarkets();
|
|
821
|
+
if (code !== 'JPY' && code !== 'USD' && code !== 'EUR') {
|
|
822
|
+
throw new errors.ExchangeError(this.id + ' allows withdrawing JPY, USD, EUR only, ' + code + ' is not supported');
|
|
823
|
+
}
|
|
824
|
+
const currency = this.currency(code);
|
|
825
|
+
const request = {
|
|
826
|
+
'currency_code': currency['id'],
|
|
827
|
+
'amount': amount,
|
|
828
|
+
// 'bank_account_id': 1234,
|
|
829
|
+
};
|
|
830
|
+
const response = await this.privatePostWithdraw(this.extend(request, params));
|
|
831
|
+
//
|
|
832
|
+
// {
|
|
833
|
+
// "message_id": "69476620-5056-4003-bcbe-42658a2b041b"
|
|
834
|
+
// }
|
|
835
|
+
//
|
|
836
|
+
return this.parseTransaction(response, currency);
|
|
837
|
+
}
|
|
838
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
839
|
+
/**
|
|
840
|
+
* @method
|
|
841
|
+
* @name bitflyer#fetchDeposits
|
|
842
|
+
* @description fetch all deposits made to an account
|
|
843
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#get-crypto-assets-deposit-history
|
|
844
|
+
* @param {string} code unified currency code
|
|
845
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
846
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
847
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
848
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
849
|
+
*/
|
|
850
|
+
await this.loadMarkets();
|
|
851
|
+
let currency = undefined;
|
|
852
|
+
const request = {};
|
|
853
|
+
if (code !== undefined) {
|
|
854
|
+
currency = this.currency(code);
|
|
855
|
+
}
|
|
856
|
+
if (limit !== undefined) {
|
|
857
|
+
request['count'] = limit; // default 100
|
|
858
|
+
}
|
|
859
|
+
const response = await this.privateGetGetcoinins(this.extend(request, params));
|
|
860
|
+
//
|
|
861
|
+
// [
|
|
862
|
+
// {
|
|
863
|
+
// "id": 100,
|
|
864
|
+
// "order_id": "CDP20151227-024141-055555",
|
|
865
|
+
// "currency_code": "BTC",
|
|
866
|
+
// "amount": 0.00002,
|
|
867
|
+
// "address": "1WriteySQufKZ2pVuM1oMhPrTtTVFq35j",
|
|
868
|
+
// "tx_hash": "9f92ee65a176bb9545f7becb8706c50d07d4cee5ffca34d8be3ef11d411405ae",
|
|
869
|
+
// "status": "COMPLETED",
|
|
870
|
+
// "event_date": "2015-11-27T08:59:20.301"
|
|
871
|
+
// }
|
|
872
|
+
// ]
|
|
873
|
+
//
|
|
874
|
+
return this.parseTransactions(response, currency, since, limit);
|
|
875
|
+
}
|
|
876
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
877
|
+
/**
|
|
878
|
+
* @method
|
|
879
|
+
* @name bitflyer#fetchWithdrawals
|
|
880
|
+
* @description fetch all withdrawals made from an account
|
|
881
|
+
* @see https://lightning.bitflyer.com/docs?lang=en#get-crypto-assets-transaction-history
|
|
882
|
+
* @param {string} code unified currency code
|
|
883
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
884
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
885
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
886
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
887
|
+
*/
|
|
888
|
+
await this.loadMarkets();
|
|
889
|
+
let currency = undefined;
|
|
890
|
+
const request = {};
|
|
891
|
+
if (code !== undefined) {
|
|
892
|
+
currency = this.currency(code);
|
|
893
|
+
}
|
|
894
|
+
if (limit !== undefined) {
|
|
895
|
+
request['count'] = limit; // default 100
|
|
896
|
+
}
|
|
897
|
+
const response = await this.privateGetGetcoinouts(this.extend(request, params));
|
|
898
|
+
//
|
|
899
|
+
// [
|
|
900
|
+
// {
|
|
901
|
+
// "id": 500,
|
|
902
|
+
// "order_id": "CWD20151224-014040-077777",
|
|
903
|
+
// "currency_code": "BTC",
|
|
904
|
+
// "amount": 0.1234,
|
|
905
|
+
// "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
|
|
906
|
+
// "tx_hash": "724c07dfd4044abcb390b0412c3e707dd5c4f373f0a52b3bd295ce32b478c60a",
|
|
907
|
+
// "fee": 0.0005,
|
|
908
|
+
// "additional_fee": 0.0001,
|
|
909
|
+
// "status": "COMPLETED",
|
|
910
|
+
// "event_date": "2015-12-24T01:40:40.397"
|
|
911
|
+
// }
|
|
912
|
+
// ]
|
|
913
|
+
//
|
|
914
|
+
return this.parseTransactions(response, currency, since, limit);
|
|
915
|
+
}
|
|
916
|
+
parseDepositStatus(status) {
|
|
917
|
+
const statuses = {
|
|
918
|
+
'PENDING': 'pending',
|
|
919
|
+
'COMPLETED': 'ok',
|
|
920
|
+
};
|
|
921
|
+
return this.safeString(statuses, status, status);
|
|
922
|
+
}
|
|
923
|
+
parseWithdrawalStatus(status) {
|
|
924
|
+
const statuses = {
|
|
925
|
+
'PENDING': 'pending',
|
|
926
|
+
'COMPLETED': 'ok',
|
|
927
|
+
};
|
|
928
|
+
return this.safeString(statuses, status, status);
|
|
929
|
+
}
|
|
930
|
+
parseTransaction(transaction, currency = undefined) {
|
|
931
|
+
//
|
|
932
|
+
// fetchDeposits
|
|
933
|
+
//
|
|
934
|
+
// {
|
|
935
|
+
// "id": 100,
|
|
936
|
+
// "order_id": "CDP20151227-024141-055555",
|
|
937
|
+
// "currency_code": "BTC",
|
|
938
|
+
// "amount": 0.00002,
|
|
939
|
+
// "address": "1WriteySQufKZ2pVuM1oMhPrTtTVFq35j",
|
|
940
|
+
// "tx_hash": "9f92ee65a176bb9545f7becb8706c50d07d4cee5ffca34d8be3ef11d411405ae",
|
|
941
|
+
// "status": "COMPLETED",
|
|
942
|
+
// "event_date": "2015-11-27T08:59:20.301"
|
|
943
|
+
// }
|
|
944
|
+
//
|
|
945
|
+
// fetchWithdrawals
|
|
946
|
+
//
|
|
947
|
+
// {
|
|
948
|
+
// "id": 500,
|
|
949
|
+
// "order_id": "CWD20151224-014040-077777",
|
|
950
|
+
// "currency_code": "BTC",
|
|
951
|
+
// "amount": 0.1234,
|
|
952
|
+
// "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
|
|
953
|
+
// "tx_hash": "724c07dfd4044abcb390b0412c3e707dd5c4f373f0a52b3bd295ce32b478c60a",
|
|
954
|
+
// "fee": 0.0005,
|
|
955
|
+
// "additional_fee": 0.0001,
|
|
956
|
+
// "status": "COMPLETED",
|
|
957
|
+
// "event_date": "2015-12-24T01:40:40.397"
|
|
958
|
+
// }
|
|
959
|
+
//
|
|
960
|
+
// withdraw
|
|
961
|
+
//
|
|
962
|
+
// {
|
|
963
|
+
// "message_id": "69476620-5056-4003-bcbe-42658a2b041b"
|
|
964
|
+
// }
|
|
965
|
+
//
|
|
966
|
+
const id = this.safeString2(transaction, 'id', 'message_id');
|
|
967
|
+
const address = this.safeString(transaction, 'address');
|
|
968
|
+
const currencyId = this.safeString(transaction, 'currency_code');
|
|
969
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
970
|
+
const timestamp = this.parse8601(this.safeString(transaction, 'event_date'));
|
|
971
|
+
const amount = this.safeNumber(transaction, 'amount');
|
|
972
|
+
const txId = this.safeString(transaction, 'tx_hash');
|
|
973
|
+
const rawStatus = this.safeString(transaction, 'status');
|
|
974
|
+
let type = undefined;
|
|
975
|
+
let status = undefined;
|
|
976
|
+
let fee = undefined;
|
|
977
|
+
if ('fee' in transaction) {
|
|
978
|
+
type = 'withdrawal';
|
|
979
|
+
status = this.parseWithdrawalStatus(rawStatus);
|
|
980
|
+
const feeCost = this.safeString(transaction, 'fee');
|
|
981
|
+
const additionalFee = this.safeString(transaction, 'additional_fee');
|
|
982
|
+
fee = { 'currency': code, 'cost': this.parseNumber(Precise["default"].stringAdd(feeCost, additionalFee)) };
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
type = 'deposit';
|
|
986
|
+
status = this.parseDepositStatus(rawStatus);
|
|
987
|
+
}
|
|
988
|
+
return {
|
|
989
|
+
'info': transaction,
|
|
990
|
+
'id': id,
|
|
991
|
+
'txid': txId,
|
|
992
|
+
'timestamp': timestamp,
|
|
993
|
+
'datetime': this.iso8601(timestamp),
|
|
994
|
+
'network': undefined,
|
|
995
|
+
'address': address,
|
|
996
|
+
'addressTo': address,
|
|
997
|
+
'addressFrom': undefined,
|
|
998
|
+
'tag': undefined,
|
|
999
|
+
'tagTo': undefined,
|
|
1000
|
+
'tagFrom': undefined,
|
|
1001
|
+
'type': type,
|
|
1002
|
+
'amount': amount,
|
|
1003
|
+
'currency': code,
|
|
1004
|
+
'status': status,
|
|
1005
|
+
'updated': undefined,
|
|
1006
|
+
'comment': undefined,
|
|
1007
|
+
'internal': undefined,
|
|
1008
|
+
'fee': fee,
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
1012
|
+
let request = '/' + this.version + '/';
|
|
1013
|
+
if (api === 'private') {
|
|
1014
|
+
request += 'me/';
|
|
1015
|
+
}
|
|
1016
|
+
request += path;
|
|
1017
|
+
if (method === 'GET') {
|
|
1018
|
+
if (Object.keys(params).length) {
|
|
1019
|
+
request += '?' + this.urlencode(params);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
const baseUrl = this.implodeHostname(this.urls['api']['rest']);
|
|
1023
|
+
const url = baseUrl + request;
|
|
1024
|
+
if (api === 'private') {
|
|
1025
|
+
this.checkRequiredCredentials();
|
|
1026
|
+
const nonce = this.nonce().toString();
|
|
1027
|
+
let auth = [nonce, method, request].join('');
|
|
1028
|
+
if (Object.keys(params).length) {
|
|
1029
|
+
if (method !== 'GET') {
|
|
1030
|
+
body = this.json(params);
|
|
1031
|
+
auth += body;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
headers = {
|
|
1035
|
+
'ACCESS-KEY': this.apiKey,
|
|
1036
|
+
'ACCESS-TIMESTAMP': nonce,
|
|
1037
|
+
'ACCESS-SIGN': this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256),
|
|
1038
|
+
'Content-Type': 'application/json',
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
module.exports = bitflyer;
|