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,1867 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var probit$1 = require('./abstract/probit.js');
|
|
4
|
+
var errors = require('./base/errors.js');
|
|
5
|
+
var Precise = require('./base/Precise.js');
|
|
6
|
+
var number = require('./base/functions/number.js');
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* @class probit
|
|
12
|
+
* @augments Exchange
|
|
13
|
+
*/
|
|
14
|
+
class probit extends probit$1 {
|
|
15
|
+
describe() {
|
|
16
|
+
return this.deepExtend(super.describe(), {
|
|
17
|
+
'id': 'probit',
|
|
18
|
+
'name': 'ProBit',
|
|
19
|
+
'countries': ['SC', 'KR'],
|
|
20
|
+
'rateLimit': 50,
|
|
21
|
+
'pro': true,
|
|
22
|
+
'has': {
|
|
23
|
+
'CORS': true,
|
|
24
|
+
'spot': true,
|
|
25
|
+
'margin': false,
|
|
26
|
+
'swap': false,
|
|
27
|
+
'future': false,
|
|
28
|
+
'option': false,
|
|
29
|
+
'addMargin': false,
|
|
30
|
+
'cancelOrder': true,
|
|
31
|
+
'createMarketBuyOrderWithCost': true,
|
|
32
|
+
'createMarketOrder': true,
|
|
33
|
+
'createMarketOrderWithCost': false,
|
|
34
|
+
'createMarketSellOrderWithCost': false,
|
|
35
|
+
'createOrder': true,
|
|
36
|
+
'createReduceOnlyOrder': false,
|
|
37
|
+
'createStopLimitOrder': false,
|
|
38
|
+
'createStopMarketOrder': false,
|
|
39
|
+
'createStopOrder': false,
|
|
40
|
+
'fetchBalance': true,
|
|
41
|
+
'fetchBorrowRateHistories': false,
|
|
42
|
+
'fetchBorrowRateHistory': false,
|
|
43
|
+
'fetchClosedOrders': true,
|
|
44
|
+
'fetchCrossBorrowRate': false,
|
|
45
|
+
'fetchCrossBorrowRates': false,
|
|
46
|
+
'fetchCurrencies': true,
|
|
47
|
+
'fetchDepositAddress': true,
|
|
48
|
+
'fetchDepositAddresses': true,
|
|
49
|
+
'fetchDeposits': true,
|
|
50
|
+
'fetchDepositsWithdrawals': true,
|
|
51
|
+
'fetchFundingHistory': false,
|
|
52
|
+
'fetchFundingRate': false,
|
|
53
|
+
'fetchFundingRateHistory': false,
|
|
54
|
+
'fetchFundingRates': false,
|
|
55
|
+
'fetchIndexOHLCV': false,
|
|
56
|
+
'fetchIsolatedBorrowRate': false,
|
|
57
|
+
'fetchIsolatedBorrowRates': false,
|
|
58
|
+
'fetchLeverage': false,
|
|
59
|
+
'fetchLeverageTiers': false,
|
|
60
|
+
'fetchMarginMode': false,
|
|
61
|
+
'fetchMarkets': true,
|
|
62
|
+
'fetchMarkOHLCV': false,
|
|
63
|
+
'fetchMyTrades': true,
|
|
64
|
+
'fetchOHLCV': true,
|
|
65
|
+
'fetchOpenInterestHistory': false,
|
|
66
|
+
'fetchOpenOrders': true,
|
|
67
|
+
'fetchOrder': true,
|
|
68
|
+
'fetchOrderBook': true,
|
|
69
|
+
'fetchPosition': false,
|
|
70
|
+
'fetchPositionMode': false,
|
|
71
|
+
'fetchPositions': false,
|
|
72
|
+
'fetchPositionsRisk': false,
|
|
73
|
+
'fetchPremiumIndexOHLCV': false,
|
|
74
|
+
'fetchTicker': true,
|
|
75
|
+
'fetchTickers': true,
|
|
76
|
+
'fetchTime': true,
|
|
77
|
+
'fetchTrades': true,
|
|
78
|
+
'fetchTradingFee': false,
|
|
79
|
+
'fetchTradingFees': false,
|
|
80
|
+
'fetchTransactions': 'emulated',
|
|
81
|
+
'fetchTransfer': false,
|
|
82
|
+
'fetchTransfers': false,
|
|
83
|
+
'fetchWithdrawal': false,
|
|
84
|
+
'fetchWithdrawals': true,
|
|
85
|
+
'reduceMargin': false,
|
|
86
|
+
'setLeverage': false,
|
|
87
|
+
'setMarginMode': false,
|
|
88
|
+
'setPositionMode': false,
|
|
89
|
+
'signIn': true,
|
|
90
|
+
'transfer': false,
|
|
91
|
+
'withdraw': true,
|
|
92
|
+
},
|
|
93
|
+
'timeframes': {
|
|
94
|
+
'1m': '1m',
|
|
95
|
+
'3m': '3m',
|
|
96
|
+
'5m': '5m',
|
|
97
|
+
'10m': '10m',
|
|
98
|
+
'15m': '15m',
|
|
99
|
+
'30m': '30m',
|
|
100
|
+
'1h': '1h',
|
|
101
|
+
'4h': '4h',
|
|
102
|
+
'6h': '6h',
|
|
103
|
+
'12h': '12h',
|
|
104
|
+
'1d': '1D',
|
|
105
|
+
'1w': '1W',
|
|
106
|
+
'1M': '1M',
|
|
107
|
+
},
|
|
108
|
+
'version': 'v1',
|
|
109
|
+
'urls': {
|
|
110
|
+
'logo': 'https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg',
|
|
111
|
+
'api': {
|
|
112
|
+
'accounts': 'https://accounts.probit.com',
|
|
113
|
+
'public': 'https://api.probit.com/api/exchange',
|
|
114
|
+
'private': 'https://api.probit.com/api/exchange',
|
|
115
|
+
},
|
|
116
|
+
'www': 'https://www.probit.com',
|
|
117
|
+
'doc': [
|
|
118
|
+
'https://docs-en.probit.com',
|
|
119
|
+
'https://docs-ko.probit.com',
|
|
120
|
+
],
|
|
121
|
+
'fees': 'https://support.probit.com/hc/en-us/articles/360020968611-Trading-Fees',
|
|
122
|
+
'referral': 'https://www.probit.com/r/34608773',
|
|
123
|
+
},
|
|
124
|
+
'api': {
|
|
125
|
+
'public': {
|
|
126
|
+
'get': {
|
|
127
|
+
'market': 1,
|
|
128
|
+
'currency': 1,
|
|
129
|
+
'currency_with_platform': 1,
|
|
130
|
+
'time': 1,
|
|
131
|
+
'ticker': 1,
|
|
132
|
+
'order_book': 1,
|
|
133
|
+
'trade': 1,
|
|
134
|
+
'candle': 1,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
'private': {
|
|
138
|
+
'post': {
|
|
139
|
+
'new_order': 2,
|
|
140
|
+
'cancel_order': 1,
|
|
141
|
+
'withdrawal': 2,
|
|
142
|
+
},
|
|
143
|
+
'get': {
|
|
144
|
+
'balance': 1,
|
|
145
|
+
'order': 1,
|
|
146
|
+
'open_order': 1,
|
|
147
|
+
'order_history': 1,
|
|
148
|
+
'trade_history': 1,
|
|
149
|
+
'deposit_address': 1,
|
|
150
|
+
'transfer/payment': 1,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
'accounts': {
|
|
154
|
+
'post': {
|
|
155
|
+
'token': 1,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
'fees': {
|
|
160
|
+
'trading': {
|
|
161
|
+
'tierBased': false,
|
|
162
|
+
'percentage': true,
|
|
163
|
+
'maker': this.parseNumber('0.002'),
|
|
164
|
+
'taker': this.parseNumber('0.002'),
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
'exceptions': {
|
|
168
|
+
'exact': {
|
|
169
|
+
'UNAUTHORIZED': errors.AuthenticationError,
|
|
170
|
+
'INVALID_ARGUMENT': errors.BadRequest,
|
|
171
|
+
'TRADING_UNAVAILABLE': errors.ExchangeNotAvailable,
|
|
172
|
+
'NOT_ENOUGH_BALANCE': errors.InsufficientFunds,
|
|
173
|
+
'NOT_ALLOWED_COMBINATION': errors.BadRequest,
|
|
174
|
+
'INVALID_ORDER': errors.InvalidOrder,
|
|
175
|
+
'RATE_LIMIT_EXCEEDED': errors.RateLimitExceeded,
|
|
176
|
+
'MARKET_UNAVAILABLE': errors.ExchangeNotAvailable,
|
|
177
|
+
'INVALID_MARKET': errors.BadSymbol,
|
|
178
|
+
'MARKET_CLOSED': errors.BadSymbol,
|
|
179
|
+
'MARKET_NOT_FOUND': errors.BadSymbol,
|
|
180
|
+
'INVALID_CURRENCY': errors.BadRequest,
|
|
181
|
+
'TOO_MANY_OPEN_ORDERS': errors.DDoSProtection,
|
|
182
|
+
'DUPLICATE_ADDRESS': errors.InvalidAddress,
|
|
183
|
+
'invalid_grant': errors.AuthenticationError, // {"error":"invalid_grant"}
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
'requiredCredentials': {
|
|
187
|
+
'apiKey': true,
|
|
188
|
+
'secret': true,
|
|
189
|
+
},
|
|
190
|
+
'precisionMode': number.TICK_SIZE,
|
|
191
|
+
'options': {
|
|
192
|
+
'createMarketBuyOrderRequiresPrice': true,
|
|
193
|
+
'timeInForce': {
|
|
194
|
+
'limit': 'gtc',
|
|
195
|
+
'market': 'ioc',
|
|
196
|
+
},
|
|
197
|
+
'networks': {
|
|
198
|
+
'BEP20': 'BSC',
|
|
199
|
+
'ERC20': 'ETH',
|
|
200
|
+
'TRC20': 'TRON',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
'commonCurrencies': {
|
|
204
|
+
'AUTO': 'Cube',
|
|
205
|
+
'AZU': 'Azultec',
|
|
206
|
+
'BCC': 'BCC',
|
|
207
|
+
'BDP': 'BidiPass',
|
|
208
|
+
'BIRD': 'Birdchain',
|
|
209
|
+
'BTCBEAR': 'BEAR',
|
|
210
|
+
'BTCBULL': 'BULL',
|
|
211
|
+
'CBC': 'CryptoBharatCoin',
|
|
212
|
+
'CHE': 'Chellit',
|
|
213
|
+
'CLR': 'Color Platform',
|
|
214
|
+
'CTK': 'Cryptyk',
|
|
215
|
+
'CTT': 'Castweet',
|
|
216
|
+
'DIP': 'Dipper',
|
|
217
|
+
'DKT': 'DAKOTA',
|
|
218
|
+
'EGC': 'EcoG9coin',
|
|
219
|
+
'EPS': 'Epanus',
|
|
220
|
+
'FX': 'Fanzy',
|
|
221
|
+
'GDT': 'Gorilla Diamond',
|
|
222
|
+
'GM': 'GM Holding',
|
|
223
|
+
'GOGOL': 'GOL',
|
|
224
|
+
'GOL': 'Goldofir',
|
|
225
|
+
'GRB': 'Global Reward Bank',
|
|
226
|
+
'HBC': 'Hybrid Bank Cash',
|
|
227
|
+
'HUSL': 'The Hustle App',
|
|
228
|
+
'LAND': 'Landbox',
|
|
229
|
+
'LBK': 'Legal Block',
|
|
230
|
+
'ORC': 'Oracle System',
|
|
231
|
+
'PXP': 'PIXSHOP COIN',
|
|
232
|
+
'PYE': 'CreamPYE',
|
|
233
|
+
'ROOK': 'Reckoon',
|
|
234
|
+
'SOC': 'Soda Coin',
|
|
235
|
+
'SST': 'SocialSwap',
|
|
236
|
+
'TCT': 'Top Coin Token',
|
|
237
|
+
'TOR': 'Torex',
|
|
238
|
+
'TPAY': 'Tetra Pay',
|
|
239
|
+
'UNI': 'UNICORN Token',
|
|
240
|
+
'UNISWAP': 'UNI',
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async fetchMarkets(params = {}) {
|
|
245
|
+
/**
|
|
246
|
+
* @method
|
|
247
|
+
* @name probit#fetchMarkets
|
|
248
|
+
* @see https://docs-en.probit.com/reference/market
|
|
249
|
+
* @description retrieves data on all markets for probit
|
|
250
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
251
|
+
* @returns {object[]} an array of objects representing market data
|
|
252
|
+
*/
|
|
253
|
+
const response = await this.publicGetMarket(params);
|
|
254
|
+
//
|
|
255
|
+
// {
|
|
256
|
+
// "data":[
|
|
257
|
+
// {
|
|
258
|
+
// "id":"MONA-USDT",
|
|
259
|
+
// "base_currency_id":"MONA",
|
|
260
|
+
// "quote_currency_id":"USDT",
|
|
261
|
+
// "min_price":"0.001",
|
|
262
|
+
// "max_price":"9999999999999999",
|
|
263
|
+
// "price_increment":"0.001",
|
|
264
|
+
// "min_quantity":"0.0001",
|
|
265
|
+
// "max_quantity":"9999999999999999",
|
|
266
|
+
// "quantity_precision":4,
|
|
267
|
+
// "min_cost":"1",
|
|
268
|
+
// "max_cost":"9999999999999999",
|
|
269
|
+
// "cost_precision":8,
|
|
270
|
+
// "taker_fee_rate":"0.2",
|
|
271
|
+
// "maker_fee_rate":"0.2",
|
|
272
|
+
// "show_in_ui":true,
|
|
273
|
+
// "closed":false
|
|
274
|
+
// },
|
|
275
|
+
// ]
|
|
276
|
+
// }
|
|
277
|
+
//
|
|
278
|
+
const markets = this.safeValue(response, 'data', []);
|
|
279
|
+
return this.parseMarkets(markets);
|
|
280
|
+
}
|
|
281
|
+
parseMarket(market) {
|
|
282
|
+
const id = this.safeString(market, 'id');
|
|
283
|
+
const baseId = this.safeString(market, 'base_currency_id');
|
|
284
|
+
const quoteId = this.safeString(market, 'quote_currency_id');
|
|
285
|
+
const base = this.safeCurrencyCode(baseId);
|
|
286
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
287
|
+
const closed = this.safeValue(market, 'closed', false);
|
|
288
|
+
const takerFeeRate = this.safeString(market, 'taker_fee_rate');
|
|
289
|
+
const taker = Precise["default"].stringDiv(takerFeeRate, '100');
|
|
290
|
+
const makerFeeRate = this.safeString(market, 'maker_fee_rate');
|
|
291
|
+
const maker = Precise["default"].stringDiv(makerFeeRate, '100');
|
|
292
|
+
return {
|
|
293
|
+
'id': id,
|
|
294
|
+
'symbol': base + '/' + quote,
|
|
295
|
+
'base': base,
|
|
296
|
+
'quote': quote,
|
|
297
|
+
'settle': undefined,
|
|
298
|
+
'baseId': baseId,
|
|
299
|
+
'quoteId': quoteId,
|
|
300
|
+
'settleId': undefined,
|
|
301
|
+
'type': 'spot',
|
|
302
|
+
'spot': true,
|
|
303
|
+
'margin': false,
|
|
304
|
+
'swap': false,
|
|
305
|
+
'future': false,
|
|
306
|
+
'option': false,
|
|
307
|
+
'active': !closed,
|
|
308
|
+
'contract': false,
|
|
309
|
+
'linear': undefined,
|
|
310
|
+
'inverse': undefined,
|
|
311
|
+
'taker': this.parseNumber(taker),
|
|
312
|
+
'maker': this.parseNumber(maker),
|
|
313
|
+
'contractSize': undefined,
|
|
314
|
+
'expiry': undefined,
|
|
315
|
+
'expiryDatetime': undefined,
|
|
316
|
+
'strike': undefined,
|
|
317
|
+
'optionType': undefined,
|
|
318
|
+
'precision': {
|
|
319
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantity_precision'))),
|
|
320
|
+
'price': this.safeNumber(market, 'price_increment'),
|
|
321
|
+
'cost': this.parseNumber(this.parsePrecision(this.safeString(market, 'cost_precision'))),
|
|
322
|
+
},
|
|
323
|
+
'limits': {
|
|
324
|
+
'leverage': {
|
|
325
|
+
'min': undefined,
|
|
326
|
+
'max': undefined,
|
|
327
|
+
},
|
|
328
|
+
'amount': {
|
|
329
|
+
'min': this.safeNumber(market, 'min_quantity'),
|
|
330
|
+
'max': this.safeNumber(market, 'max_quantity'),
|
|
331
|
+
},
|
|
332
|
+
'price': {
|
|
333
|
+
'min': this.safeNumber(market, 'min_price'),
|
|
334
|
+
'max': this.safeNumber(market, 'max_price'),
|
|
335
|
+
},
|
|
336
|
+
'cost': {
|
|
337
|
+
'min': this.safeNumber(market, 'min_cost'),
|
|
338
|
+
'max': this.safeNumber(market, 'max_cost'),
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
'created': undefined,
|
|
342
|
+
'info': market,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
async fetchCurrencies(params = {}) {
|
|
346
|
+
/**
|
|
347
|
+
* @method
|
|
348
|
+
* @name probit#fetchCurrencies
|
|
349
|
+
* @see https://docs-en.probit.com/reference/currency
|
|
350
|
+
* @description fetches all available currencies on an exchange
|
|
351
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
352
|
+
* @returns {object} an associative dictionary of currencies
|
|
353
|
+
*/
|
|
354
|
+
const response = await this.publicGetCurrencyWithPlatform(params);
|
|
355
|
+
//
|
|
356
|
+
// {
|
|
357
|
+
// "data":[
|
|
358
|
+
// {
|
|
359
|
+
// "id":"USDT",
|
|
360
|
+
// "display_name":{"ko-kr":"테더","en-us":"Tether"},
|
|
361
|
+
// "show_in_ui":true,
|
|
362
|
+
// "platform":[
|
|
363
|
+
// {
|
|
364
|
+
// "id":"ETH",
|
|
365
|
+
// "priority":1,
|
|
366
|
+
// "deposit":true,
|
|
367
|
+
// "withdrawal":true,
|
|
368
|
+
// "currency_id":"USDT",
|
|
369
|
+
// "precision":6,
|
|
370
|
+
// "min_confirmation_count":15,
|
|
371
|
+
// "require_destination_tag":false,
|
|
372
|
+
// "display_name":{"name":{"ko-kr":"ERC-20","en-us":"ERC-20"}},
|
|
373
|
+
// "min_deposit_amount":"0",
|
|
374
|
+
// "min_withdrawal_amount":"1",
|
|
375
|
+
// "withdrawal_fee":[
|
|
376
|
+
// {"amount":"0.01","priority":2,"currency_id":"ETH"},
|
|
377
|
+
// {"amount":"1.5","priority":1,"currency_id":"USDT"},
|
|
378
|
+
// ],
|
|
379
|
+
// "deposit_fee":{},
|
|
380
|
+
// "suspended_reason":"",
|
|
381
|
+
// "deposit_suspended":false,
|
|
382
|
+
// "withdrawal_suspended":false
|
|
383
|
+
// },
|
|
384
|
+
// {
|
|
385
|
+
// "id":"OMNI",
|
|
386
|
+
// "priority":2,
|
|
387
|
+
// "deposit":true,
|
|
388
|
+
// "withdrawal":true,
|
|
389
|
+
// "currency_id":"USDT",
|
|
390
|
+
// "precision":6,
|
|
391
|
+
// "min_confirmation_count":3,
|
|
392
|
+
// "require_destination_tag":false,
|
|
393
|
+
// "display_name":{"name":{"ko-kr":"OMNI","en-us":"OMNI"}},
|
|
394
|
+
// "min_deposit_amount":"0",
|
|
395
|
+
// "min_withdrawal_amount":"5",
|
|
396
|
+
// "withdrawal_fee":[{"amount":"5","priority":1,"currency_id":"USDT"}],
|
|
397
|
+
// "deposit_fee":{},
|
|
398
|
+
// "suspended_reason":"wallet_maintenance",
|
|
399
|
+
// "deposit_suspended":false,
|
|
400
|
+
// "withdrawal_suspended":false
|
|
401
|
+
// }
|
|
402
|
+
// ],
|
|
403
|
+
// "stakeable":false,
|
|
404
|
+
// "unstakeable":false,
|
|
405
|
+
// "auto_stake":false,
|
|
406
|
+
// "auto_stake_amount":"0"
|
|
407
|
+
// }
|
|
408
|
+
// ]
|
|
409
|
+
// }
|
|
410
|
+
//
|
|
411
|
+
const currencies = this.safeValue(response, 'data', []);
|
|
412
|
+
const result = {};
|
|
413
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
414
|
+
const currency = currencies[i];
|
|
415
|
+
const id = this.safeString(currency, 'id');
|
|
416
|
+
const code = this.safeCurrencyCode(id);
|
|
417
|
+
const displayName = this.safeValue(currency, 'display_name');
|
|
418
|
+
const name = this.safeString(displayName, 'en-us');
|
|
419
|
+
const platforms = this.safeValue(currency, 'platform', []);
|
|
420
|
+
const platformsByPriority = this.sortBy(platforms, 'priority');
|
|
421
|
+
let platform = undefined;
|
|
422
|
+
const networkList = {};
|
|
423
|
+
for (let j = 0; j < platformsByPriority.length; j++) {
|
|
424
|
+
const network = platformsByPriority[j];
|
|
425
|
+
const networkId = this.safeString(network, 'id');
|
|
426
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
427
|
+
const currentDepositSuspended = this.safeValue(network, 'deposit_suspended');
|
|
428
|
+
const currentWithdrawalSuspended = this.safeValue(network, 'withdrawal_suspended');
|
|
429
|
+
const currentDeposit = !currentDepositSuspended;
|
|
430
|
+
const currentWithdraw = !currentWithdrawalSuspended;
|
|
431
|
+
const currentActive = currentDeposit && currentWithdraw;
|
|
432
|
+
if (currentActive) {
|
|
433
|
+
platform = network;
|
|
434
|
+
}
|
|
435
|
+
const precision = this.parsePrecision(this.safeString(network, 'precision'));
|
|
436
|
+
const withdrawFee = this.safeValue(network, 'withdrawal_fee', []);
|
|
437
|
+
let networkFee = this.safeValue(withdrawFee, 0, {});
|
|
438
|
+
for (let k = 0; k < withdrawFee.length; k++) {
|
|
439
|
+
const withdrawPlatform = withdrawFee[k];
|
|
440
|
+
const feeCurrencyId = this.safeString(withdrawPlatform, 'currency_id');
|
|
441
|
+
if (feeCurrencyId === id) {
|
|
442
|
+
networkFee = withdrawPlatform;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
networkList[networkCode] = {
|
|
447
|
+
'id': networkId,
|
|
448
|
+
'network': networkCode,
|
|
449
|
+
'active': currentActive,
|
|
450
|
+
'deposit': currentDeposit,
|
|
451
|
+
'withdraw': currentWithdraw,
|
|
452
|
+
'fee': this.safeNumber(networkFee, 'amount'),
|
|
453
|
+
'precision': this.parseNumber(precision),
|
|
454
|
+
'limits': {
|
|
455
|
+
'withdraw': {
|
|
456
|
+
'min': this.safeNumber(network, 'min_withdrawal_amount'),
|
|
457
|
+
'max': undefined,
|
|
458
|
+
},
|
|
459
|
+
'deposit': {
|
|
460
|
+
'min': this.safeNumber(network, 'min_deposit_amount'),
|
|
461
|
+
'max': undefined,
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
'info': network,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
if (platform === undefined) {
|
|
468
|
+
platform = this.safeValue(platformsByPriority, 0, {});
|
|
469
|
+
}
|
|
470
|
+
const depositSuspended = this.safeValue(platform, 'deposit_suspended');
|
|
471
|
+
const withdrawalSuspended = this.safeValue(platform, 'withdrawal_suspended');
|
|
472
|
+
const deposit = !depositSuspended;
|
|
473
|
+
const withdraw = !withdrawalSuspended;
|
|
474
|
+
const active = deposit && withdraw;
|
|
475
|
+
const withdrawalFees = this.safeValue(platform, 'withdrawal_fee', {});
|
|
476
|
+
const fees = [];
|
|
477
|
+
// sometimes the withdrawal fee is an empty object
|
|
478
|
+
// [ { 'amount': '0.015', 'priority': 1, 'currency_id': 'ETH' }, {} ]
|
|
479
|
+
for (let j = 0; j < withdrawalFees.length; j++) {
|
|
480
|
+
const withdrawalFeeInner = withdrawalFees[j];
|
|
481
|
+
const amount = this.safeNumber(withdrawalFeeInner, 'amount');
|
|
482
|
+
const priority = this.safeInteger(withdrawalFeeInner, 'priority');
|
|
483
|
+
if ((amount !== undefined) && (priority !== undefined)) {
|
|
484
|
+
fees.push(withdrawalFeeInner);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
const withdrawalFeesByPriority = this.sortBy(fees, 'priority');
|
|
488
|
+
const withdrawalFee = this.safeValue(withdrawalFeesByPriority, 0, {});
|
|
489
|
+
const fee = this.safeNumber(withdrawalFee, 'amount');
|
|
490
|
+
result[code] = {
|
|
491
|
+
'id': id,
|
|
492
|
+
'code': code,
|
|
493
|
+
'info': currency,
|
|
494
|
+
'name': name,
|
|
495
|
+
'active': active,
|
|
496
|
+
'deposit': deposit,
|
|
497
|
+
'withdraw': withdraw,
|
|
498
|
+
'fee': fee,
|
|
499
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(platform, 'precision'))),
|
|
500
|
+
'limits': {
|
|
501
|
+
'amount': {
|
|
502
|
+
'min': undefined,
|
|
503
|
+
'max': undefined,
|
|
504
|
+
},
|
|
505
|
+
'deposit': {
|
|
506
|
+
'min': this.safeNumber(platform, 'min_deposit_amount'),
|
|
507
|
+
'max': undefined,
|
|
508
|
+
},
|
|
509
|
+
'withdraw': {
|
|
510
|
+
'min': this.safeNumber(platform, 'min_withdrawal_amount'),
|
|
511
|
+
'max': undefined,
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
'networks': networkList,
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
parseBalance(response) {
|
|
520
|
+
const result = {
|
|
521
|
+
'info': response,
|
|
522
|
+
'timestamp': undefined,
|
|
523
|
+
'datetime': undefined,
|
|
524
|
+
};
|
|
525
|
+
const data = this.safeValue(response, 'data', []);
|
|
526
|
+
for (let i = 0; i < data.length; i++) {
|
|
527
|
+
const balance = data[i];
|
|
528
|
+
const currencyId = this.safeString(balance, 'currency_id');
|
|
529
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
530
|
+
const account = this.account();
|
|
531
|
+
account['total'] = this.safeString(balance, 'total');
|
|
532
|
+
account['free'] = this.safeString(balance, 'available');
|
|
533
|
+
result[code] = account;
|
|
534
|
+
}
|
|
535
|
+
return this.safeBalance(result);
|
|
536
|
+
}
|
|
537
|
+
async fetchBalance(params = {}) {
|
|
538
|
+
/**
|
|
539
|
+
* @method
|
|
540
|
+
* @name probit#fetchBalance
|
|
541
|
+
* @see https://docs-en.probit.com/reference/balance
|
|
542
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
543
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
544
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
545
|
+
*/
|
|
546
|
+
await this.loadMarkets();
|
|
547
|
+
const response = await this.privateGetBalance(params);
|
|
548
|
+
//
|
|
549
|
+
// {
|
|
550
|
+
// "data": [
|
|
551
|
+
// {
|
|
552
|
+
// "currency_id":"XRP",
|
|
553
|
+
// "total":"100",
|
|
554
|
+
// "available":"0",
|
|
555
|
+
// }
|
|
556
|
+
// ]
|
|
557
|
+
// }
|
|
558
|
+
//
|
|
559
|
+
return this.parseBalance(response);
|
|
560
|
+
}
|
|
561
|
+
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
562
|
+
/**
|
|
563
|
+
* @method
|
|
564
|
+
* @name probit#fetchOrderBook
|
|
565
|
+
* @see https://docs-en.probit.com/reference/order_book
|
|
566
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
567
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
568
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
569
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
570
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
571
|
+
*/
|
|
572
|
+
await this.loadMarkets();
|
|
573
|
+
const market = this.market(symbol);
|
|
574
|
+
const request = {
|
|
575
|
+
'market_id': market['id'],
|
|
576
|
+
};
|
|
577
|
+
const response = await this.publicGetOrderBook(this.extend(request, params));
|
|
578
|
+
//
|
|
579
|
+
// {
|
|
580
|
+
// data: [
|
|
581
|
+
// { side: 'buy', price: '0.000031', quantity: '10' },
|
|
582
|
+
// { side: 'buy', price: '0.00356007', quantity: '4.92156877' },
|
|
583
|
+
// { side: 'sell', price: '0.1857', quantity: '0.17' },
|
|
584
|
+
// ]
|
|
585
|
+
// }
|
|
586
|
+
//
|
|
587
|
+
const data = this.safeValue(response, 'data', []);
|
|
588
|
+
const dataBySide = this.groupBy(data, 'side');
|
|
589
|
+
return this.parseOrderBook(dataBySide, market['symbol'], undefined, 'buy', 'sell', 'price', 'quantity');
|
|
590
|
+
}
|
|
591
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
592
|
+
/**
|
|
593
|
+
* @method
|
|
594
|
+
* @name probit#fetchTickers
|
|
595
|
+
* @see https://docs-en.probit.com/reference/ticker
|
|
596
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
597
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
598
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
599
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
600
|
+
*/
|
|
601
|
+
await this.loadMarkets();
|
|
602
|
+
const request = {};
|
|
603
|
+
if (symbols !== undefined) {
|
|
604
|
+
const marketIds = this.marketIds(symbols);
|
|
605
|
+
request['market_ids'] = marketIds.join(',');
|
|
606
|
+
}
|
|
607
|
+
const response = await this.publicGetTicker(this.extend(request, params));
|
|
608
|
+
//
|
|
609
|
+
// {
|
|
610
|
+
// "data":[
|
|
611
|
+
// {
|
|
612
|
+
// "last":"0.022902",
|
|
613
|
+
// "low":"0.021693",
|
|
614
|
+
// "high":"0.024093",
|
|
615
|
+
// "change":"-0.000047",
|
|
616
|
+
// "base_volume":"15681.986",
|
|
617
|
+
// "quote_volume":"360.514403624",
|
|
618
|
+
// "market_id":"ETH-BTC",
|
|
619
|
+
// "time":"2020-04-12T18:43:38.000Z"
|
|
620
|
+
// }
|
|
621
|
+
// ]
|
|
622
|
+
// }
|
|
623
|
+
//
|
|
624
|
+
const data = this.safeValue(response, 'data', []);
|
|
625
|
+
return this.parseTickers(data, symbols);
|
|
626
|
+
}
|
|
627
|
+
async fetchTicker(symbol, params = {}) {
|
|
628
|
+
/**
|
|
629
|
+
* @method
|
|
630
|
+
* @name probit#fetchTicker
|
|
631
|
+
* @see https://docs-en.probit.com/reference/ticker
|
|
632
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
633
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
634
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
635
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
636
|
+
*/
|
|
637
|
+
await this.loadMarkets();
|
|
638
|
+
const market = this.market(symbol);
|
|
639
|
+
const request = {
|
|
640
|
+
'market_ids': market['id'],
|
|
641
|
+
};
|
|
642
|
+
const response = await this.publicGetTicker(this.extend(request, params));
|
|
643
|
+
//
|
|
644
|
+
// {
|
|
645
|
+
// "data":[
|
|
646
|
+
// {
|
|
647
|
+
// "last":"0.022902",
|
|
648
|
+
// "low":"0.021693",
|
|
649
|
+
// "high":"0.024093",
|
|
650
|
+
// "change":"-0.000047",
|
|
651
|
+
// "base_volume":"15681.986",
|
|
652
|
+
// "quote_volume":"360.514403624",
|
|
653
|
+
// "market_id":"ETH-BTC",
|
|
654
|
+
// "time":"2020-04-12T18:43:38.000Z"
|
|
655
|
+
// }
|
|
656
|
+
// ]
|
|
657
|
+
// }
|
|
658
|
+
//
|
|
659
|
+
const data = this.safeValue(response, 'data', []);
|
|
660
|
+
const ticker = this.safeValue(data, 0);
|
|
661
|
+
if (ticker === undefined) {
|
|
662
|
+
throw new errors.BadResponse(this.id + ' fetchTicker() returned an empty response');
|
|
663
|
+
}
|
|
664
|
+
return this.parseTicker(ticker, market);
|
|
665
|
+
}
|
|
666
|
+
parseTicker(ticker, market = undefined) {
|
|
667
|
+
//
|
|
668
|
+
// {
|
|
669
|
+
// "last":"0.022902",
|
|
670
|
+
// "low":"0.021693",
|
|
671
|
+
// "high":"0.024093",
|
|
672
|
+
// "change":"-0.000047",
|
|
673
|
+
// "base_volume":"15681.986",
|
|
674
|
+
// "quote_volume":"360.514403624",
|
|
675
|
+
// "market_id":"ETH-BTC",
|
|
676
|
+
// "time":"2020-04-12T18:43:38.000Z"
|
|
677
|
+
// }
|
|
678
|
+
//
|
|
679
|
+
const timestamp = this.parse8601(this.safeString(ticker, 'time'));
|
|
680
|
+
const marketId = this.safeString(ticker, 'market_id');
|
|
681
|
+
const symbol = this.safeSymbol(marketId, market, '-');
|
|
682
|
+
const close = this.safeString(ticker, 'last');
|
|
683
|
+
const change = this.safeString(ticker, 'change');
|
|
684
|
+
const baseVolume = this.safeString(ticker, 'base_volume');
|
|
685
|
+
const quoteVolume = this.safeString(ticker, 'quote_volume');
|
|
686
|
+
return this.safeTicker({
|
|
687
|
+
'symbol': symbol,
|
|
688
|
+
'timestamp': timestamp,
|
|
689
|
+
'datetime': this.iso8601(timestamp),
|
|
690
|
+
'high': this.safeString(ticker, 'high'),
|
|
691
|
+
'low': this.safeString(ticker, 'low'),
|
|
692
|
+
'bid': undefined,
|
|
693
|
+
'bidVolume': undefined,
|
|
694
|
+
'ask': undefined,
|
|
695
|
+
'askVolume': undefined,
|
|
696
|
+
'vwap': undefined,
|
|
697
|
+
'open': undefined,
|
|
698
|
+
'close': close,
|
|
699
|
+
'last': close,
|
|
700
|
+
'previousClose': undefined,
|
|
701
|
+
'change': change,
|
|
702
|
+
'percentage': undefined,
|
|
703
|
+
'average': undefined,
|
|
704
|
+
'baseVolume': baseVolume,
|
|
705
|
+
'quoteVolume': quoteVolume,
|
|
706
|
+
'info': ticker,
|
|
707
|
+
}, market);
|
|
708
|
+
}
|
|
709
|
+
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
710
|
+
/**
|
|
711
|
+
* @method
|
|
712
|
+
* @name probit#fetchMyTrades
|
|
713
|
+
* @see https://docs-en.probit.com/reference/trade
|
|
714
|
+
* @description fetch all trades made by the user
|
|
715
|
+
* @param {string} symbol unified market symbol
|
|
716
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
717
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
718
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
719
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
720
|
+
*/
|
|
721
|
+
await this.loadMarkets();
|
|
722
|
+
let market = undefined;
|
|
723
|
+
const now = this.milliseconds();
|
|
724
|
+
const request = {
|
|
725
|
+
'limit': 100,
|
|
726
|
+
'start_time': this.iso8601(now - 31536000000),
|
|
727
|
+
'end_time': this.iso8601(now),
|
|
728
|
+
};
|
|
729
|
+
if (symbol !== undefined) {
|
|
730
|
+
market = this.market(symbol);
|
|
731
|
+
request['market_id'] = market['id'];
|
|
732
|
+
}
|
|
733
|
+
if (since !== undefined) {
|
|
734
|
+
request['start_time'] = this.iso8601(since);
|
|
735
|
+
request['end_time'] = this.iso8601(Math.min(now, since + 31536000000));
|
|
736
|
+
}
|
|
737
|
+
if (limit !== undefined) {
|
|
738
|
+
request['limit'] = limit;
|
|
739
|
+
}
|
|
740
|
+
const response = await this.privateGetTradeHistory(this.extend(request, params));
|
|
741
|
+
//
|
|
742
|
+
// {
|
|
743
|
+
// "data": [
|
|
744
|
+
// {
|
|
745
|
+
// "id":"BTC-USDT:183566",
|
|
746
|
+
// "order_id":"17209376",
|
|
747
|
+
// "side":"sell",
|
|
748
|
+
// "fee_amount":"0.657396569175",
|
|
749
|
+
// "fee_currency_id":"USDT",
|
|
750
|
+
// "status":"settled",
|
|
751
|
+
// "price":"6573.96569175",
|
|
752
|
+
// "quantity":"0.1",
|
|
753
|
+
// "cost":"657.396569175",
|
|
754
|
+
// "time":"2018-08-10T06:06:46.000Z",
|
|
755
|
+
// "market_id":"BTC-USDT"
|
|
756
|
+
// }
|
|
757
|
+
// ]
|
|
758
|
+
// }
|
|
759
|
+
//
|
|
760
|
+
const data = this.safeValue(response, 'data', []);
|
|
761
|
+
return this.parseTrades(data, market, since, limit);
|
|
762
|
+
}
|
|
763
|
+
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
764
|
+
/**
|
|
765
|
+
* @method
|
|
766
|
+
* @name probit#fetchTrades
|
|
767
|
+
* @see https://docs-en.probit.com/reference/trade-1
|
|
768
|
+
* @description get the list of most recent trades for a particular symbol
|
|
769
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
770
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
771
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
772
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
773
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
774
|
+
*/
|
|
775
|
+
await this.loadMarkets();
|
|
776
|
+
const market = this.market(symbol);
|
|
777
|
+
const request = {
|
|
778
|
+
'market_id': market['id'],
|
|
779
|
+
'start_time': '1970-01-01T00:00:00.000Z',
|
|
780
|
+
'end_time': this.iso8601(this.milliseconds()),
|
|
781
|
+
};
|
|
782
|
+
if (since !== undefined) {
|
|
783
|
+
request['start_time'] = this.iso8601(since);
|
|
784
|
+
}
|
|
785
|
+
if (limit !== undefined) {
|
|
786
|
+
request['limit'] = Math.min(limit, 1000);
|
|
787
|
+
}
|
|
788
|
+
else {
|
|
789
|
+
request['limit'] = 1000; // required to set any value
|
|
790
|
+
}
|
|
791
|
+
const response = await this.publicGetTrade(this.extend(request, params));
|
|
792
|
+
//
|
|
793
|
+
// {
|
|
794
|
+
// "data":[
|
|
795
|
+
// {
|
|
796
|
+
// "id":"ETH-BTC:3331886",
|
|
797
|
+
// "price":"0.022981",
|
|
798
|
+
// "quantity":"12.337",
|
|
799
|
+
// "time":"2020-04-12T20:55:42.371Z",
|
|
800
|
+
// "side":"sell",
|
|
801
|
+
// "tick_direction":"down"
|
|
802
|
+
// },
|
|
803
|
+
// {
|
|
804
|
+
// "id":"ETH-BTC:3331885",
|
|
805
|
+
// "price":"0.022982",
|
|
806
|
+
// "quantity":"6.472",
|
|
807
|
+
// "time":"2020-04-12T20:55:39.652Z",
|
|
808
|
+
// "side":"sell",
|
|
809
|
+
// "tick_direction":"down"
|
|
810
|
+
// }
|
|
811
|
+
// ]
|
|
812
|
+
// }
|
|
813
|
+
//
|
|
814
|
+
const data = this.safeValue(response, 'data', []);
|
|
815
|
+
return this.parseTrades(data, market, since, limit);
|
|
816
|
+
}
|
|
817
|
+
parseTrade(trade, market = undefined) {
|
|
818
|
+
//
|
|
819
|
+
// fetchTrades (public)
|
|
820
|
+
//
|
|
821
|
+
// {
|
|
822
|
+
// "id":"ETH-BTC:3331886",
|
|
823
|
+
// "price":"0.022981",
|
|
824
|
+
// "quantity":"12.337",
|
|
825
|
+
// "time":"2020-04-12T20:55:42.371Z",
|
|
826
|
+
// "side":"sell",
|
|
827
|
+
// "tick_direction":"down"
|
|
828
|
+
// }
|
|
829
|
+
//
|
|
830
|
+
// fetchMyTrades (private)
|
|
831
|
+
//
|
|
832
|
+
// {
|
|
833
|
+
// "id":"BTC-USDT:183566",
|
|
834
|
+
// "order_id":"17209376",
|
|
835
|
+
// "side":"sell",
|
|
836
|
+
// "fee_amount":"0.657396569175",
|
|
837
|
+
// "fee_currency_id":"USDT",
|
|
838
|
+
// "status":"settled",
|
|
839
|
+
// "price":"6573.96569175",
|
|
840
|
+
// "quantity":"0.1",
|
|
841
|
+
// "cost":"657.396569175",
|
|
842
|
+
// "time":"2018-08-10T06:06:46.000Z",
|
|
843
|
+
// "market_id":"BTC-USDT"
|
|
844
|
+
// }
|
|
845
|
+
//
|
|
846
|
+
const timestamp = this.parse8601(this.safeString(trade, 'time'));
|
|
847
|
+
const id = this.safeString(trade, 'id');
|
|
848
|
+
let marketId = undefined;
|
|
849
|
+
if (id !== undefined) {
|
|
850
|
+
const parts = id.split(':');
|
|
851
|
+
marketId = this.safeString(parts, 0);
|
|
852
|
+
}
|
|
853
|
+
marketId = this.safeString(trade, 'market_id', marketId);
|
|
854
|
+
const symbol = this.safeSymbol(marketId, market, '-');
|
|
855
|
+
const side = this.safeString(trade, 'side');
|
|
856
|
+
const priceString = this.safeString(trade, 'price');
|
|
857
|
+
const amountString = this.safeString(trade, 'quantity');
|
|
858
|
+
const orderId = this.safeString(trade, 'order_id');
|
|
859
|
+
const feeCostString = this.safeString(trade, 'fee_amount');
|
|
860
|
+
let fee = undefined;
|
|
861
|
+
if (feeCostString !== undefined) {
|
|
862
|
+
const feeCurrencyId = this.safeString(trade, 'fee_currency_id');
|
|
863
|
+
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
864
|
+
fee = {
|
|
865
|
+
'cost': feeCostString,
|
|
866
|
+
'currency': feeCurrencyCode,
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
return this.safeTrade({
|
|
870
|
+
'id': id,
|
|
871
|
+
'info': trade,
|
|
872
|
+
'timestamp': timestamp,
|
|
873
|
+
'datetime': this.iso8601(timestamp),
|
|
874
|
+
'symbol': symbol,
|
|
875
|
+
'order': orderId,
|
|
876
|
+
'type': undefined,
|
|
877
|
+
'side': side,
|
|
878
|
+
'takerOrMaker': undefined,
|
|
879
|
+
'price': priceString,
|
|
880
|
+
'amount': amountString,
|
|
881
|
+
'cost': undefined,
|
|
882
|
+
'fee': fee,
|
|
883
|
+
}, market);
|
|
884
|
+
}
|
|
885
|
+
async fetchTime(params = {}) {
|
|
886
|
+
/**
|
|
887
|
+
* @method
|
|
888
|
+
* @name probit#fetchTime
|
|
889
|
+
* @see https://docs-en.probit.com/reference/time
|
|
890
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
891
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
892
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
893
|
+
*/
|
|
894
|
+
const response = await this.publicGetTime(params);
|
|
895
|
+
//
|
|
896
|
+
// { "data":"2020-04-12T18:54:25.390Z" }
|
|
897
|
+
//
|
|
898
|
+
const timestamp = this.parse8601(this.safeString(response, 'data'));
|
|
899
|
+
return timestamp;
|
|
900
|
+
}
|
|
901
|
+
normalizeOHLCVTimestamp(timestamp, timeframe, after = false) {
|
|
902
|
+
const duration = this.parseTimeframe(timeframe);
|
|
903
|
+
if (timeframe === '1M') {
|
|
904
|
+
const iso8601 = this.iso8601(timestamp);
|
|
905
|
+
const parts = iso8601.split('-');
|
|
906
|
+
const year = this.safeString(parts, 0);
|
|
907
|
+
const month = this.safeInteger(parts, 1);
|
|
908
|
+
let monthString = undefined;
|
|
909
|
+
if (after) {
|
|
910
|
+
monthString = this.sum(month, 1).toString();
|
|
911
|
+
}
|
|
912
|
+
if (month < 10) {
|
|
913
|
+
monthString = '0' + month.toString();
|
|
914
|
+
}
|
|
915
|
+
return year + '-' + monthString + '-01T00:00:00.000Z';
|
|
916
|
+
}
|
|
917
|
+
else if (timeframe === '1w') {
|
|
918
|
+
timestamp = this.parseToInt(timestamp / 1000);
|
|
919
|
+
const firstSunday = 259200; // 1970-01-04T00:00:00.000Z
|
|
920
|
+
const difference = timestamp - firstSunday;
|
|
921
|
+
const numWeeks = Math.floor(difference / duration);
|
|
922
|
+
let previousSunday = this.sum(firstSunday, numWeeks * duration);
|
|
923
|
+
if (after) {
|
|
924
|
+
previousSunday = this.sum(previousSunday, duration);
|
|
925
|
+
}
|
|
926
|
+
return this.iso8601(previousSunday * 1000);
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
timestamp = this.parseToInt(timestamp / 1000);
|
|
930
|
+
timestamp = duration * this.parseToInt(timestamp / duration);
|
|
931
|
+
if (after) {
|
|
932
|
+
timestamp = this.sum(timestamp, duration);
|
|
933
|
+
}
|
|
934
|
+
return this.iso8601(timestamp * 1000);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
938
|
+
/**
|
|
939
|
+
* @method
|
|
940
|
+
* @name probit#fetchOHLCV
|
|
941
|
+
* @see https://docs-en.probit.com/reference/candle
|
|
942
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
943
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
944
|
+
* @param {string} timeframe the length of time each candle represents
|
|
945
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
946
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
947
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
948
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
949
|
+
*/
|
|
950
|
+
await this.loadMarkets();
|
|
951
|
+
const market = this.market(symbol);
|
|
952
|
+
const interval = this.safeString(this.timeframes, timeframe, timeframe);
|
|
953
|
+
limit = (limit === undefined) ? 100 : limit;
|
|
954
|
+
let requestLimit = this.sum(limit, 1);
|
|
955
|
+
requestLimit = Math.min(1000, requestLimit); // max 1000
|
|
956
|
+
const request = {
|
|
957
|
+
'market_ids': market['id'],
|
|
958
|
+
'interval': interval,
|
|
959
|
+
'sort': 'asc',
|
|
960
|
+
'limit': requestLimit, // max 1000
|
|
961
|
+
};
|
|
962
|
+
const now = this.milliseconds();
|
|
963
|
+
const duration = this.parseTimeframe(timeframe);
|
|
964
|
+
let startTime = since;
|
|
965
|
+
let endTime = now;
|
|
966
|
+
if (since === undefined) {
|
|
967
|
+
if (limit === undefined) {
|
|
968
|
+
limit = requestLimit;
|
|
969
|
+
}
|
|
970
|
+
startTime = now - limit * duration * 1000;
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
if (limit === undefined) {
|
|
974
|
+
endTime = now;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
endTime = this.sum(since, this.sum(limit, 1) * duration * 1000);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
const startTimeNormalized = this.normalizeOHLCVTimestamp(startTime, timeframe);
|
|
981
|
+
const endTimeNormalized = this.normalizeOHLCVTimestamp(endTime, timeframe, true);
|
|
982
|
+
request['start_time'] = startTimeNormalized;
|
|
983
|
+
request['end_time'] = endTimeNormalized;
|
|
984
|
+
const response = await this.publicGetCandle(this.extend(request, params));
|
|
985
|
+
//
|
|
986
|
+
// {
|
|
987
|
+
// "data":[
|
|
988
|
+
// {
|
|
989
|
+
// "market_id":"ETH-BTC",
|
|
990
|
+
// "open":"0.02811",
|
|
991
|
+
// "close":"0.02811",
|
|
992
|
+
// "low":"0.02811",
|
|
993
|
+
// "high":"0.02811",
|
|
994
|
+
// "base_volume":"0.0005",
|
|
995
|
+
// "quote_volume":"0.000014055",
|
|
996
|
+
// "start_time":"2018-11-30T18:19:00.000Z",
|
|
997
|
+
// "end_time":"2018-11-30T18:20:00.000Z"
|
|
998
|
+
// },
|
|
999
|
+
// ]
|
|
1000
|
+
// }
|
|
1001
|
+
//
|
|
1002
|
+
const data = this.safeValue(response, 'data', []);
|
|
1003
|
+
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
1004
|
+
}
|
|
1005
|
+
parseOHLCV(ohlcv, market = undefined) {
|
|
1006
|
+
//
|
|
1007
|
+
// {
|
|
1008
|
+
// "market_id":"ETH-BTC",
|
|
1009
|
+
// "open":"0.02811",
|
|
1010
|
+
// "close":"0.02811",
|
|
1011
|
+
// "low":"0.02811",
|
|
1012
|
+
// "high":"0.02811",
|
|
1013
|
+
// "base_volume":"0.0005",
|
|
1014
|
+
// "quote_volume":"0.000014055",
|
|
1015
|
+
// "start_time":"2018-11-30T18:19:00.000Z",
|
|
1016
|
+
// "end_time":"2018-11-30T18:20:00.000Z"
|
|
1017
|
+
// }
|
|
1018
|
+
//
|
|
1019
|
+
return [
|
|
1020
|
+
this.parse8601(this.safeString(ohlcv, 'start_time')),
|
|
1021
|
+
this.safeNumber(ohlcv, 'open'),
|
|
1022
|
+
this.safeNumber(ohlcv, 'high'),
|
|
1023
|
+
this.safeNumber(ohlcv, 'low'),
|
|
1024
|
+
this.safeNumber(ohlcv, 'close'),
|
|
1025
|
+
this.safeNumber(ohlcv, 'base_volume'),
|
|
1026
|
+
];
|
|
1027
|
+
}
|
|
1028
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1029
|
+
/**
|
|
1030
|
+
* @method
|
|
1031
|
+
* @name probit#fetchOpenOrders
|
|
1032
|
+
* @see https://docs-en.probit.com/reference/open_order-1
|
|
1033
|
+
* @description fetch all unfilled currently open orders
|
|
1034
|
+
* @param {string} symbol unified market symbol
|
|
1035
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1036
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
1037
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1038
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1039
|
+
*/
|
|
1040
|
+
await this.loadMarkets();
|
|
1041
|
+
since = this.parse8601(since);
|
|
1042
|
+
const request = {};
|
|
1043
|
+
let market = undefined;
|
|
1044
|
+
if (symbol !== undefined) {
|
|
1045
|
+
market = this.market(symbol);
|
|
1046
|
+
request['market_id'] = market['id'];
|
|
1047
|
+
}
|
|
1048
|
+
const response = await this.privateGetOpenOrder(this.extend(request, params));
|
|
1049
|
+
const data = this.safeValue(response, 'data');
|
|
1050
|
+
return this.parseOrders(data, market, since, limit);
|
|
1051
|
+
}
|
|
1052
|
+
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1053
|
+
/**
|
|
1054
|
+
* @method
|
|
1055
|
+
* @name probit#fetchClosedOrders
|
|
1056
|
+
* @see https://docs-en.probit.com/reference/order
|
|
1057
|
+
* @description fetches information on multiple closed orders made by the user
|
|
1058
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1059
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1060
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
1061
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1062
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1063
|
+
*/
|
|
1064
|
+
await this.loadMarkets();
|
|
1065
|
+
const request = {
|
|
1066
|
+
'start_time': this.iso8601(0),
|
|
1067
|
+
'end_time': this.iso8601(this.milliseconds()),
|
|
1068
|
+
'limit': 100,
|
|
1069
|
+
};
|
|
1070
|
+
let market = undefined;
|
|
1071
|
+
if (symbol !== undefined) {
|
|
1072
|
+
market = this.market(symbol);
|
|
1073
|
+
request['market_id'] = market['id'];
|
|
1074
|
+
}
|
|
1075
|
+
if (since) {
|
|
1076
|
+
request['start_time'] = this.iso8601(since);
|
|
1077
|
+
}
|
|
1078
|
+
if (limit) {
|
|
1079
|
+
request['limit'] = limit;
|
|
1080
|
+
}
|
|
1081
|
+
const response = await this.privateGetOrderHistory(this.extend(request, params));
|
|
1082
|
+
const data = this.safeValue(response, 'data');
|
|
1083
|
+
return this.parseOrders(data, market, since, limit);
|
|
1084
|
+
}
|
|
1085
|
+
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
1086
|
+
/**
|
|
1087
|
+
* @method
|
|
1088
|
+
* @name probit#fetchOrder
|
|
1089
|
+
* @see https://docs-en.probit.com/reference/order-3
|
|
1090
|
+
* @description fetches information on an order made by the user
|
|
1091
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
1092
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1093
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1094
|
+
*/
|
|
1095
|
+
if (symbol === undefined) {
|
|
1096
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
1097
|
+
}
|
|
1098
|
+
await this.loadMarkets();
|
|
1099
|
+
const market = this.market(symbol);
|
|
1100
|
+
const request = {
|
|
1101
|
+
'market_id': market['id'],
|
|
1102
|
+
};
|
|
1103
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
|
|
1104
|
+
if (clientOrderId !== undefined) {
|
|
1105
|
+
request['client_order_id'] = clientOrderId;
|
|
1106
|
+
}
|
|
1107
|
+
else {
|
|
1108
|
+
request['order_id'] = id;
|
|
1109
|
+
}
|
|
1110
|
+
const query = this.omit(params, ['clientOrderId', 'client_order_id']);
|
|
1111
|
+
const response = await this.privateGetOrder(this.extend(request, query));
|
|
1112
|
+
const data = this.safeValue(response, 'data', []);
|
|
1113
|
+
const order = this.safeValue(data, 0);
|
|
1114
|
+
return this.parseOrder(order, market);
|
|
1115
|
+
}
|
|
1116
|
+
parseOrderStatus(status) {
|
|
1117
|
+
const statuses = {
|
|
1118
|
+
'open': 'open',
|
|
1119
|
+
'cancelled': 'canceled',
|
|
1120
|
+
'filled': 'closed',
|
|
1121
|
+
};
|
|
1122
|
+
return this.safeString(statuses, status, status);
|
|
1123
|
+
}
|
|
1124
|
+
parseOrder(order, market = undefined) {
|
|
1125
|
+
//
|
|
1126
|
+
// {
|
|
1127
|
+
// id,
|
|
1128
|
+
// user_id,
|
|
1129
|
+
// market_id,
|
|
1130
|
+
// "type": "orderType",
|
|
1131
|
+
// "side": "side",
|
|
1132
|
+
// quantity,
|
|
1133
|
+
// limit_price,
|
|
1134
|
+
// "time_in_force": "timeInForce",
|
|
1135
|
+
// filled_cost,
|
|
1136
|
+
// filled_quantity,
|
|
1137
|
+
// open_quantity,
|
|
1138
|
+
// cancelled_quantity,
|
|
1139
|
+
// "status": "orderStatus",
|
|
1140
|
+
// "time": "date",
|
|
1141
|
+
// client_order_id,
|
|
1142
|
+
// }
|
|
1143
|
+
//
|
|
1144
|
+
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
1145
|
+
const id = this.safeString(order, 'id');
|
|
1146
|
+
const type = this.safeString(order, 'type');
|
|
1147
|
+
const side = this.safeString(order, 'side');
|
|
1148
|
+
const marketId = this.safeString(order, 'market_id');
|
|
1149
|
+
const symbol = this.safeSymbol(marketId, market, '-');
|
|
1150
|
+
const timestamp = this.parse8601(this.safeString(order, 'time'));
|
|
1151
|
+
let price = this.safeString(order, 'limit_price');
|
|
1152
|
+
const filled = this.safeString(order, 'filled_quantity');
|
|
1153
|
+
let remaining = this.safeString(order, 'open_quantity');
|
|
1154
|
+
const canceledAmount = this.safeString(order, 'cancelled_quantity');
|
|
1155
|
+
if (canceledAmount !== undefined) {
|
|
1156
|
+
remaining = Precise["default"].stringAdd(remaining, canceledAmount);
|
|
1157
|
+
}
|
|
1158
|
+
const amount = this.safeString(order, 'quantity', Precise["default"].stringAdd(filled, remaining));
|
|
1159
|
+
const cost = this.safeString2(order, 'filled_cost', 'cost');
|
|
1160
|
+
if (type === 'market') {
|
|
1161
|
+
price = undefined;
|
|
1162
|
+
}
|
|
1163
|
+
const clientOrderId = this.safeString(order, 'client_order_id');
|
|
1164
|
+
const timeInForce = this.safeStringUpper(order, 'time_in_force');
|
|
1165
|
+
return this.safeOrder({
|
|
1166
|
+
'id': id,
|
|
1167
|
+
'info': order,
|
|
1168
|
+
'clientOrderId': clientOrderId,
|
|
1169
|
+
'timestamp': timestamp,
|
|
1170
|
+
'datetime': this.iso8601(timestamp),
|
|
1171
|
+
'lastTradeTimestamp': undefined,
|
|
1172
|
+
'symbol': symbol,
|
|
1173
|
+
'type': type,
|
|
1174
|
+
'timeInForce': timeInForce,
|
|
1175
|
+
'side': side,
|
|
1176
|
+
'status': status,
|
|
1177
|
+
'price': price,
|
|
1178
|
+
'stopPrice': undefined,
|
|
1179
|
+
'triggerPrice': undefined,
|
|
1180
|
+
'amount': amount,
|
|
1181
|
+
'filled': filled,
|
|
1182
|
+
'remaining': remaining,
|
|
1183
|
+
'average': undefined,
|
|
1184
|
+
'cost': cost,
|
|
1185
|
+
'fee': undefined,
|
|
1186
|
+
'trades': undefined,
|
|
1187
|
+
}, market);
|
|
1188
|
+
}
|
|
1189
|
+
costToPrecision(symbol, cost) {
|
|
1190
|
+
return this.decimalToPrecision(cost, number.TRUNCATE, this.markets[symbol]['precision']['cost'], this.precisionMode);
|
|
1191
|
+
}
|
|
1192
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1193
|
+
/**
|
|
1194
|
+
* @method
|
|
1195
|
+
* @name probit#createOrder
|
|
1196
|
+
* @description create a trade order
|
|
1197
|
+
* @see https://docs-en.probit.com/reference/order-1
|
|
1198
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1199
|
+
* @param {string} type 'market' or 'limit'
|
|
1200
|
+
* @param {string} side 'buy' or 'sell'
|
|
1201
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
1202
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1203
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1204
|
+
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount for market buy orders
|
|
1205
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1206
|
+
*/
|
|
1207
|
+
await this.loadMarkets();
|
|
1208
|
+
const market = this.market(symbol);
|
|
1209
|
+
const options = this.safeValue(this.options, 'timeInForce');
|
|
1210
|
+
const defaultTimeInForce = this.safeValue(options, type);
|
|
1211
|
+
const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force', defaultTimeInForce);
|
|
1212
|
+
const request = {
|
|
1213
|
+
'market_id': market['id'],
|
|
1214
|
+
'type': type,
|
|
1215
|
+
'side': side,
|
|
1216
|
+
'time_in_force': timeInForce,
|
|
1217
|
+
};
|
|
1218
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
|
|
1219
|
+
if (clientOrderId !== undefined) {
|
|
1220
|
+
request['client_order_id'] = clientOrderId;
|
|
1221
|
+
}
|
|
1222
|
+
let quoteAmount = undefined;
|
|
1223
|
+
if (type === 'limit') {
|
|
1224
|
+
request['limit_price'] = this.priceToPrecision(symbol, price);
|
|
1225
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
1226
|
+
}
|
|
1227
|
+
else if (type === 'market') {
|
|
1228
|
+
// for market buy it requires the amount of quote currency to spend
|
|
1229
|
+
if (side === 'buy') {
|
|
1230
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1231
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
1232
|
+
const cost = this.safeString(params, 'cost');
|
|
1233
|
+
params = this.omit(params, 'cost');
|
|
1234
|
+
if (cost !== undefined) {
|
|
1235
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
1236
|
+
}
|
|
1237
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
1238
|
+
if (price === undefined) {
|
|
1239
|
+
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');
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
const amountString = this.numberToString(amount);
|
|
1243
|
+
const priceString = this.numberToString(price);
|
|
1244
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
1245
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
1250
|
+
}
|
|
1251
|
+
request['cost'] = quoteAmount;
|
|
1252
|
+
}
|
|
1253
|
+
else {
|
|
1254
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
const query = this.omit(params, ['timeInForce', 'time_in_force', 'clientOrderId', 'client_order_id']);
|
|
1258
|
+
const response = await this.privatePostNewOrder(this.extend(request, query));
|
|
1259
|
+
//
|
|
1260
|
+
// {
|
|
1261
|
+
// "data": {
|
|
1262
|
+
// id,
|
|
1263
|
+
// user_id,
|
|
1264
|
+
// market_id,
|
|
1265
|
+
// "type": "orderType",
|
|
1266
|
+
// "side": "side",
|
|
1267
|
+
// quantity,
|
|
1268
|
+
// limit_price,
|
|
1269
|
+
// "time_in_force": "timeInForce",
|
|
1270
|
+
// filled_cost,
|
|
1271
|
+
// filled_quantity,
|
|
1272
|
+
// open_quantity,
|
|
1273
|
+
// cancelled_quantity,
|
|
1274
|
+
// "status": "orderStatus",
|
|
1275
|
+
// "time": "date",
|
|
1276
|
+
// client_order_id,
|
|
1277
|
+
// }
|
|
1278
|
+
// }
|
|
1279
|
+
//
|
|
1280
|
+
const data = this.safeValue(response, 'data');
|
|
1281
|
+
const order = this.parseOrder(data, market);
|
|
1282
|
+
// a workaround for incorrect huge amounts
|
|
1283
|
+
// returned by the exchange on market buys
|
|
1284
|
+
if ((type === 'market') && (side === 'buy')) {
|
|
1285
|
+
order['amount'] = undefined;
|
|
1286
|
+
order['cost'] = this.parseNumber(quoteAmount);
|
|
1287
|
+
order['remaining'] = undefined;
|
|
1288
|
+
}
|
|
1289
|
+
return order;
|
|
1290
|
+
}
|
|
1291
|
+
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1292
|
+
/**
|
|
1293
|
+
* @method
|
|
1294
|
+
* @name probit#cancelOrder
|
|
1295
|
+
* @see https://docs-en.probit.com/reference/order-2
|
|
1296
|
+
* @description cancels an open order
|
|
1297
|
+
* @param {string} id order id
|
|
1298
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
1299
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1300
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1301
|
+
*/
|
|
1302
|
+
if (symbol === undefined) {
|
|
1303
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
1304
|
+
}
|
|
1305
|
+
await this.loadMarkets();
|
|
1306
|
+
const market = this.market(symbol);
|
|
1307
|
+
const request = {
|
|
1308
|
+
'market_id': market['id'],
|
|
1309
|
+
'order_id': id,
|
|
1310
|
+
};
|
|
1311
|
+
const response = await this.privatePostCancelOrder(this.extend(request, params));
|
|
1312
|
+
const data = this.safeValue(response, 'data');
|
|
1313
|
+
return this.parseOrder(data);
|
|
1314
|
+
}
|
|
1315
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
1316
|
+
const address = this.safeString(depositAddress, 'address');
|
|
1317
|
+
const tag = this.safeString(depositAddress, 'destination_tag');
|
|
1318
|
+
const currencyId = this.safeString(depositAddress, 'currency_id');
|
|
1319
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
1320
|
+
const code = currency['code'];
|
|
1321
|
+
const network = this.safeString(depositAddress, 'platform_id');
|
|
1322
|
+
this.checkAddress(address);
|
|
1323
|
+
return {
|
|
1324
|
+
'currency': code,
|
|
1325
|
+
'address': address,
|
|
1326
|
+
'tag': tag,
|
|
1327
|
+
'network': network,
|
|
1328
|
+
'info': depositAddress,
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
async fetchDepositAddress(code, params = {}) {
|
|
1332
|
+
/**
|
|
1333
|
+
* @method
|
|
1334
|
+
* @name probit#fetchDepositAddress
|
|
1335
|
+
* @see https://docs-en.probit.com/reference/deposit_address
|
|
1336
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
1337
|
+
* @param {string} code unified currency code
|
|
1338
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1339
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1340
|
+
*/
|
|
1341
|
+
await this.loadMarkets();
|
|
1342
|
+
const currency = this.currency(code);
|
|
1343
|
+
const request = {
|
|
1344
|
+
'currency_id': currency['id'],
|
|
1345
|
+
// 'platform_id': 'TRON', (undocumented)
|
|
1346
|
+
};
|
|
1347
|
+
const networks = this.safeValue(this.options, 'networks', {});
|
|
1348
|
+
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
1349
|
+
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
1350
|
+
if (network !== undefined) {
|
|
1351
|
+
request['platform_id'] = network;
|
|
1352
|
+
params = this.omit(params, 'platform_id');
|
|
1353
|
+
}
|
|
1354
|
+
const response = await this.privateGetDepositAddress(this.extend(request, params));
|
|
1355
|
+
//
|
|
1356
|
+
// without 'platform_id'
|
|
1357
|
+
// {
|
|
1358
|
+
// "data":[
|
|
1359
|
+
// {
|
|
1360
|
+
// "currency_id":"ETH",
|
|
1361
|
+
// "address":"0x12e2caf3c4051ba1146e612f532901a423a9898a",
|
|
1362
|
+
// "destination_tag":null
|
|
1363
|
+
// }
|
|
1364
|
+
// ]
|
|
1365
|
+
// }
|
|
1366
|
+
//
|
|
1367
|
+
// with 'platform_id'
|
|
1368
|
+
// {
|
|
1369
|
+
// "data":[
|
|
1370
|
+
// {
|
|
1371
|
+
// "platform_id":"TRON",
|
|
1372
|
+
// "address":"TDQLMxBTa6MzuoZ6deSGZkqET3Ek8v7uC6",
|
|
1373
|
+
// "destination_tag":null
|
|
1374
|
+
// }
|
|
1375
|
+
// ]
|
|
1376
|
+
// }
|
|
1377
|
+
//
|
|
1378
|
+
const data = this.safeValue(response, 'data', []);
|
|
1379
|
+
const firstAddress = this.safeValue(data, 0);
|
|
1380
|
+
if (firstAddress === undefined) {
|
|
1381
|
+
throw new errors.InvalidAddress(this.id + ' fetchDepositAddress() returned an empty response');
|
|
1382
|
+
}
|
|
1383
|
+
return this.parseDepositAddress(firstAddress, currency);
|
|
1384
|
+
}
|
|
1385
|
+
async fetchDepositAddresses(codes = undefined, params = {}) {
|
|
1386
|
+
/**
|
|
1387
|
+
* @method
|
|
1388
|
+
* @name probit#fetchDepositAddresses
|
|
1389
|
+
* @see https://docs-en.probit.com/reference/deposit_address
|
|
1390
|
+
* @description fetch deposit addresses for multiple currencies and chain types
|
|
1391
|
+
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
1392
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1393
|
+
* @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1394
|
+
*/
|
|
1395
|
+
await this.loadMarkets();
|
|
1396
|
+
const request = {};
|
|
1397
|
+
if (codes) {
|
|
1398
|
+
const currencyIds = [];
|
|
1399
|
+
for (let i = 0; i < codes.length; i++) {
|
|
1400
|
+
const currency = this.currency(codes[i]);
|
|
1401
|
+
currencyIds.push(currency['id']);
|
|
1402
|
+
}
|
|
1403
|
+
request['currency_id'] = codes.join(',');
|
|
1404
|
+
}
|
|
1405
|
+
const response = await this.privateGetDepositAddress(this.extend(request, params));
|
|
1406
|
+
const data = this.safeValue(response, 'data', []);
|
|
1407
|
+
return this.parseDepositAddresses(data, codes);
|
|
1408
|
+
}
|
|
1409
|
+
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
1410
|
+
/**
|
|
1411
|
+
* @method
|
|
1412
|
+
* @name probit#withdraw
|
|
1413
|
+
* @see https://docs-en.probit.com/reference/withdrawal
|
|
1414
|
+
* @description make a withdrawal
|
|
1415
|
+
* @param {string} code unified currency code
|
|
1416
|
+
* @param {float} amount the amount to withdraw
|
|
1417
|
+
* @param {string} address the address to withdraw to
|
|
1418
|
+
* @param {string} tag
|
|
1419
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1420
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1421
|
+
*/
|
|
1422
|
+
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
1423
|
+
// In order to use this method
|
|
1424
|
+
// you need to allow API withdrawal from the API Settings Page, and
|
|
1425
|
+
// and register the list of withdrawal addresses and destination tags on the API Settings page
|
|
1426
|
+
// you can only withdraw to the registered addresses using the API
|
|
1427
|
+
this.checkAddress(address);
|
|
1428
|
+
await this.loadMarkets();
|
|
1429
|
+
const currency = this.currency(code);
|
|
1430
|
+
if (tag === undefined) {
|
|
1431
|
+
tag = '';
|
|
1432
|
+
}
|
|
1433
|
+
const request = {
|
|
1434
|
+
'currency_id': currency['id'],
|
|
1435
|
+
// 'platform_id': 'ETH', // if omitted it will use the default platform for the currency
|
|
1436
|
+
'address': address,
|
|
1437
|
+
'destination_tag': tag,
|
|
1438
|
+
'amount': this.numberToString(amount),
|
|
1439
|
+
// which currency to pay the withdrawal fees
|
|
1440
|
+
// only applicable for currencies that accepts multiple withdrawal fee options
|
|
1441
|
+
// 'fee_currency_id': 'ETH', // if omitted it will use the default fee policy for each currency
|
|
1442
|
+
// whether the amount field includes fees
|
|
1443
|
+
// 'include_fee': false, // makes sense only when fee_currency_id is equal to currency_id
|
|
1444
|
+
};
|
|
1445
|
+
const networks = this.safeValue(this.options, 'networks', {});
|
|
1446
|
+
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
1447
|
+
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
1448
|
+
if (network !== undefined) {
|
|
1449
|
+
request['platform_id'] = network;
|
|
1450
|
+
params = this.omit(params, 'network');
|
|
1451
|
+
}
|
|
1452
|
+
const response = await this.privatePostWithdrawal(this.extend(request, params));
|
|
1453
|
+
const data = this.safeValue(response, 'data');
|
|
1454
|
+
return this.parseTransaction(data, currency);
|
|
1455
|
+
}
|
|
1456
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1457
|
+
/**
|
|
1458
|
+
* @method
|
|
1459
|
+
* @name probit#fetchDeposits
|
|
1460
|
+
* @description fetch all deposits made to an account
|
|
1461
|
+
* @param {string} code unified currency code
|
|
1462
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
1463
|
+
* @param {int} [limit] the maximum number of transaction structures to retrieve
|
|
1464
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1465
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1466
|
+
*/
|
|
1467
|
+
const request = {
|
|
1468
|
+
'type': 'deposit',
|
|
1469
|
+
};
|
|
1470
|
+
const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
|
|
1471
|
+
return result;
|
|
1472
|
+
}
|
|
1473
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1474
|
+
/**
|
|
1475
|
+
* @method
|
|
1476
|
+
* @name probit#fetchWithdrawals
|
|
1477
|
+
* @description fetch all withdrawals made to an account
|
|
1478
|
+
* @param {string} code unified currency code
|
|
1479
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
1480
|
+
* @param {int} [limit] the maximum number of transaction structures to retrieve
|
|
1481
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1482
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1483
|
+
*/
|
|
1484
|
+
const request = {
|
|
1485
|
+
'type': 'withdrawal',
|
|
1486
|
+
};
|
|
1487
|
+
const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
|
|
1488
|
+
return result;
|
|
1489
|
+
}
|
|
1490
|
+
async fetchTransactions(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1491
|
+
/**
|
|
1492
|
+
* @method
|
|
1493
|
+
* @name probit#fetchTransactions
|
|
1494
|
+
* @deprecated
|
|
1495
|
+
* @description use fetchDepositsWithdrawals instead
|
|
1496
|
+
* @see https://docs-en.probit.com/reference/transferpayment
|
|
1497
|
+
* @param {string} code unified currency code
|
|
1498
|
+
* @param {int} [since] the earliest time in ms to fetch transactions for
|
|
1499
|
+
* @param {int} [limit] the maximum number of transaction structures to retrieve
|
|
1500
|
+
* @param {int} [params.until] the latest time in ms to fetch transactions for
|
|
1501
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1502
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1503
|
+
*/
|
|
1504
|
+
await this.loadMarkets();
|
|
1505
|
+
let currency = undefined;
|
|
1506
|
+
const request = {};
|
|
1507
|
+
if (code !== undefined) {
|
|
1508
|
+
currency = this.currency(code);
|
|
1509
|
+
request['currency_id'] = currency['id'];
|
|
1510
|
+
}
|
|
1511
|
+
if (since !== undefined) {
|
|
1512
|
+
request['start_time'] = this.iso8601(since);
|
|
1513
|
+
}
|
|
1514
|
+
else {
|
|
1515
|
+
request['start_time'] = this.iso8601(1);
|
|
1516
|
+
}
|
|
1517
|
+
const until = this.safeInteger2(params, 'till', 'until');
|
|
1518
|
+
if (until !== undefined) {
|
|
1519
|
+
request['end_time'] = this.iso8601(until);
|
|
1520
|
+
params = this.omit(params, ['until', 'till']);
|
|
1521
|
+
}
|
|
1522
|
+
else {
|
|
1523
|
+
request['end_time'] = this.iso8601(this.milliseconds());
|
|
1524
|
+
}
|
|
1525
|
+
if (limit !== undefined) {
|
|
1526
|
+
request['limit'] = limit;
|
|
1527
|
+
}
|
|
1528
|
+
else {
|
|
1529
|
+
request['limit'] = 100;
|
|
1530
|
+
}
|
|
1531
|
+
const response = await this.privateGetTransferPayment(this.extend(request, params));
|
|
1532
|
+
//
|
|
1533
|
+
// {
|
|
1534
|
+
// "data": [
|
|
1535
|
+
// {
|
|
1536
|
+
// "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
|
|
1537
|
+
// "type": "deposit",
|
|
1538
|
+
// "status": "done",
|
|
1539
|
+
// "amount": "0.01",
|
|
1540
|
+
// "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
|
|
1541
|
+
// "time": "2023-06-14T12:03:11.000Z",
|
|
1542
|
+
// "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
|
|
1543
|
+
// "currency_id": "ETH",
|
|
1544
|
+
// "confirmations":0,
|
|
1545
|
+
// "fee": "0",
|
|
1546
|
+
// "destination_tag": null,
|
|
1547
|
+
// "platform_id": "ETH",
|
|
1548
|
+
// "fee_currency_id": "ETH",
|
|
1549
|
+
// "payment_service_name":null,
|
|
1550
|
+
// "payment_service_display_name":null,
|
|
1551
|
+
// "crypto":null
|
|
1552
|
+
// }
|
|
1553
|
+
// ]
|
|
1554
|
+
// }
|
|
1555
|
+
//
|
|
1556
|
+
const data = this.safeValue(response, 'data', {});
|
|
1557
|
+
return this.parseTransactions(data, currency, since, limit);
|
|
1558
|
+
}
|
|
1559
|
+
parseTransaction(transaction, currency = undefined) {
|
|
1560
|
+
//
|
|
1561
|
+
// {
|
|
1562
|
+
// "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
|
|
1563
|
+
// "type": "deposit",
|
|
1564
|
+
// "status": "done",
|
|
1565
|
+
// "amount": "0.01",
|
|
1566
|
+
// "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
|
|
1567
|
+
// "time": "2023-06-14T12:03:11.000Z",
|
|
1568
|
+
// "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
|
|
1569
|
+
// "currency_id": "ETH",
|
|
1570
|
+
// "confirmations":0,
|
|
1571
|
+
// "fee": "0",
|
|
1572
|
+
// "destination_tag": null,
|
|
1573
|
+
// "platform_id": "ETH",
|
|
1574
|
+
// "fee_currency_id": "ETH",
|
|
1575
|
+
// "payment_service_name":null,
|
|
1576
|
+
// "payment_service_display_name":null,
|
|
1577
|
+
// "crypto":null
|
|
1578
|
+
// }
|
|
1579
|
+
//
|
|
1580
|
+
const id = this.safeString(transaction, 'id');
|
|
1581
|
+
const networkId = this.safeString(transaction, 'platform_id');
|
|
1582
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
1583
|
+
const amount = this.safeNumber(transaction, 'amount');
|
|
1584
|
+
const address = this.safeString(transaction, 'address');
|
|
1585
|
+
const tag = this.safeString(transaction, 'destination_tag');
|
|
1586
|
+
const txid = this.safeString(transaction, 'hash');
|
|
1587
|
+
const timestamp = this.parse8601(this.safeString(transaction, 'time'));
|
|
1588
|
+
const type = this.safeString(transaction, 'type');
|
|
1589
|
+
const currencyId = this.safeString(transaction, 'currency_id');
|
|
1590
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
1591
|
+
const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
1592
|
+
const feeCost = this.safeNumber(transaction, 'fee');
|
|
1593
|
+
let fee = undefined;
|
|
1594
|
+
if (feeCost !== undefined && feeCost !== 0) {
|
|
1595
|
+
fee = {
|
|
1596
|
+
'currency': code,
|
|
1597
|
+
'cost': feeCost,
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
return {
|
|
1601
|
+
'id': id,
|
|
1602
|
+
'currency': code,
|
|
1603
|
+
'amount': amount,
|
|
1604
|
+
'network': networkCode,
|
|
1605
|
+
'addressFrom': undefined,
|
|
1606
|
+
'address': address,
|
|
1607
|
+
'addressTo': address,
|
|
1608
|
+
'tagFrom': undefined,
|
|
1609
|
+
'tag': tag,
|
|
1610
|
+
'tagTo': tag,
|
|
1611
|
+
'status': status,
|
|
1612
|
+
'type': type,
|
|
1613
|
+
'txid': txid,
|
|
1614
|
+
'timestamp': timestamp,
|
|
1615
|
+
'datetime': this.iso8601(timestamp),
|
|
1616
|
+
'updated': undefined,
|
|
1617
|
+
'internal': undefined,
|
|
1618
|
+
'comment': undefined,
|
|
1619
|
+
'fee': fee,
|
|
1620
|
+
'info': transaction,
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
parseTransactionStatus(status) {
|
|
1624
|
+
const statuses = {
|
|
1625
|
+
'requested': 'pending',
|
|
1626
|
+
'pending': 'pending',
|
|
1627
|
+
'confirming': 'pending',
|
|
1628
|
+
'confirmed': 'pending',
|
|
1629
|
+
'applying': 'pending',
|
|
1630
|
+
'done': 'ok',
|
|
1631
|
+
'cancelled': 'canceled',
|
|
1632
|
+
'cancelling': 'canceled',
|
|
1633
|
+
};
|
|
1634
|
+
return this.safeString(statuses, status, status);
|
|
1635
|
+
}
|
|
1636
|
+
async fetchDepositWithdrawFees(codes = undefined, params = {}) {
|
|
1637
|
+
/**
|
|
1638
|
+
* @method
|
|
1639
|
+
* @name probit#fetchDepositWithdrawFees
|
|
1640
|
+
* @see https://docs-en.probit.com/reference/currency
|
|
1641
|
+
* @description fetch deposit and withdraw fees
|
|
1642
|
+
* @param {string[]|undefined} codes list of unified currency codes
|
|
1643
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1644
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1645
|
+
*/
|
|
1646
|
+
await this.loadMarkets();
|
|
1647
|
+
const response = await this.publicGetCurrencyWithPlatform(params);
|
|
1648
|
+
//
|
|
1649
|
+
// {
|
|
1650
|
+
// "data": [
|
|
1651
|
+
// {
|
|
1652
|
+
// "id": "AFX",
|
|
1653
|
+
// "display_name": {
|
|
1654
|
+
// "ko-kr": "아프릭스",
|
|
1655
|
+
// "en-us": "Afrix"
|
|
1656
|
+
// },
|
|
1657
|
+
// "show_in_ui": true,
|
|
1658
|
+
// "platform": [
|
|
1659
|
+
// {
|
|
1660
|
+
// "id": "ZYN",
|
|
1661
|
+
// "priority": 1,
|
|
1662
|
+
// "deposit": true,
|
|
1663
|
+
// "withdrawal": true,
|
|
1664
|
+
// "currency_id": "AFX",
|
|
1665
|
+
// "precision": 18,
|
|
1666
|
+
// "min_confirmation_count": 60,
|
|
1667
|
+
// "require_destination_tag": false,
|
|
1668
|
+
// "allow_withdrawal_destination_tag": false,
|
|
1669
|
+
// "display_name": {
|
|
1670
|
+
// "name": {
|
|
1671
|
+
// "ko-kr": "지네코인",
|
|
1672
|
+
// "en-us": "Wethio"
|
|
1673
|
+
// }
|
|
1674
|
+
// },
|
|
1675
|
+
// "min_deposit_amount": "0",
|
|
1676
|
+
// "min_withdrawal_amount": "0",
|
|
1677
|
+
// "withdrawal_fee": [
|
|
1678
|
+
// {
|
|
1679
|
+
// "currency_id": "ZYN",
|
|
1680
|
+
// "amount": "0.5",
|
|
1681
|
+
// "priority": 1
|
|
1682
|
+
// }
|
|
1683
|
+
// ],
|
|
1684
|
+
// "deposit_fee": {},
|
|
1685
|
+
// "suspended_reason": "",
|
|
1686
|
+
// "deposit_suspended": false,
|
|
1687
|
+
// "withdrawal_suspended": false,
|
|
1688
|
+
// "platform_currency_display_name": {}
|
|
1689
|
+
// }
|
|
1690
|
+
// ],
|
|
1691
|
+
// "internal_transfer": {
|
|
1692
|
+
// "suspended_reason": null,
|
|
1693
|
+
// "suspended": false
|
|
1694
|
+
// },
|
|
1695
|
+
// "stakeable": false,
|
|
1696
|
+
// "unstakeable": false,
|
|
1697
|
+
// "auto_stake": false,
|
|
1698
|
+
// "auto_stake_amount": "0"
|
|
1699
|
+
// },
|
|
1700
|
+
// ]
|
|
1701
|
+
// }
|
|
1702
|
+
//
|
|
1703
|
+
const data = this.safeValue(response, 'data');
|
|
1704
|
+
return this.parseDepositWithdrawFees(data, codes, 'id');
|
|
1705
|
+
}
|
|
1706
|
+
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
1707
|
+
//
|
|
1708
|
+
// {
|
|
1709
|
+
// "id": "USDT",
|
|
1710
|
+
// "display_name": { "ko-kr": '테더', "en-us": "Tether" },
|
|
1711
|
+
// "show_in_ui": true,
|
|
1712
|
+
// "platform": [
|
|
1713
|
+
// {
|
|
1714
|
+
// "id": "ETH",
|
|
1715
|
+
// "priority": "1",
|
|
1716
|
+
// "deposit": true,
|
|
1717
|
+
// "withdrawal": true,
|
|
1718
|
+
// "currency_id": "USDT",
|
|
1719
|
+
// "precision": "6",
|
|
1720
|
+
// "min_confirmation_count": "15",
|
|
1721
|
+
// "require_destination_tag": false,
|
|
1722
|
+
// "allow_withdrawal_destination_tag": false,
|
|
1723
|
+
// "display_name": [Object],
|
|
1724
|
+
// "min_deposit_amount": "0",
|
|
1725
|
+
// "min_withdrawal_amount": "1",
|
|
1726
|
+
// "withdrawal_fee": [Array],
|
|
1727
|
+
// "deposit_fee": {},
|
|
1728
|
+
// "suspended_reason": '',
|
|
1729
|
+
// "deposit_suspended": false,
|
|
1730
|
+
// "withdrawal_suspended": false,
|
|
1731
|
+
// "platform_currency_display_name": [Object]
|
|
1732
|
+
// },
|
|
1733
|
+
// ],
|
|
1734
|
+
// "internal_transfer": { suspended_reason: null, suspended: false },
|
|
1735
|
+
// "stakeable": false,
|
|
1736
|
+
// "unstakeable": false,
|
|
1737
|
+
// "auto_stake": false,
|
|
1738
|
+
// "auto_stake_amount": "0"
|
|
1739
|
+
// }
|
|
1740
|
+
//
|
|
1741
|
+
const depositWithdrawFee = this.depositWithdrawFee({});
|
|
1742
|
+
const platforms = this.safeValue(fee, 'platform', []);
|
|
1743
|
+
const depositResult = {
|
|
1744
|
+
'fee': undefined,
|
|
1745
|
+
'percentage': undefined,
|
|
1746
|
+
};
|
|
1747
|
+
for (let i = 0; i < platforms.length; i++) {
|
|
1748
|
+
const network = platforms[i];
|
|
1749
|
+
const networkId = this.safeString(network, 'id');
|
|
1750
|
+
const networkCode = this.networkIdToCode(networkId, currency['code']);
|
|
1751
|
+
const withdrawalFees = this.safeValue(network, 'withdrawal_fee', {});
|
|
1752
|
+
const withdrawFee = this.safeNumber(withdrawalFees[0], 'amount');
|
|
1753
|
+
if (withdrawalFees.length) {
|
|
1754
|
+
const withdrawResult = {
|
|
1755
|
+
'fee': withdrawFee,
|
|
1756
|
+
'percentage': (withdrawFee !== undefined) ? false : undefined,
|
|
1757
|
+
};
|
|
1758
|
+
if (i === 0) {
|
|
1759
|
+
depositWithdrawFee['withdraw'] = withdrawResult;
|
|
1760
|
+
}
|
|
1761
|
+
depositWithdrawFee['networks'][networkCode] = {
|
|
1762
|
+
'withdraw': withdrawResult,
|
|
1763
|
+
'deposit': depositResult,
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
depositWithdrawFee['info'] = fee;
|
|
1768
|
+
return depositWithdrawFee;
|
|
1769
|
+
}
|
|
1770
|
+
nonce() {
|
|
1771
|
+
return this.milliseconds();
|
|
1772
|
+
}
|
|
1773
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
1774
|
+
let url = this.urls['api'][api] + '/';
|
|
1775
|
+
const query = this.omit(params, this.extractParams(path));
|
|
1776
|
+
if (api === 'accounts') {
|
|
1777
|
+
this.checkRequiredCredentials();
|
|
1778
|
+
url += this.implodeParams(path, params);
|
|
1779
|
+
const auth = this.apiKey + ':' + this.secret;
|
|
1780
|
+
const auth64 = this.stringToBase64(auth);
|
|
1781
|
+
headers = {
|
|
1782
|
+
'Authorization': 'Basic ' + auth64,
|
|
1783
|
+
'Content-Type': 'application/json',
|
|
1784
|
+
};
|
|
1785
|
+
if (Object.keys(query).length) {
|
|
1786
|
+
body = this.json(query);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
url += this.version + '/';
|
|
1791
|
+
if (api === 'public') {
|
|
1792
|
+
url += this.implodeParams(path, params);
|
|
1793
|
+
if (Object.keys(query).length) {
|
|
1794
|
+
url += '?' + this.urlencode(query);
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
else if (api === 'private') {
|
|
1798
|
+
const now = this.milliseconds();
|
|
1799
|
+
this.checkRequiredCredentials();
|
|
1800
|
+
const expires = this.safeInteger(this.options, 'expires');
|
|
1801
|
+
if ((expires === undefined) || (expires < now)) {
|
|
1802
|
+
throw new errors.AuthenticationError(this.id + ' access token expired, call signIn() method');
|
|
1803
|
+
}
|
|
1804
|
+
const accessToken = this.safeString(this.options, 'accessToken');
|
|
1805
|
+
headers = {
|
|
1806
|
+
'Authorization': 'Bearer ' + accessToken,
|
|
1807
|
+
};
|
|
1808
|
+
url += this.implodeParams(path, params);
|
|
1809
|
+
if (method === 'GET') {
|
|
1810
|
+
if (Object.keys(query).length) {
|
|
1811
|
+
url += '?' + this.urlencode(query);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
else if (Object.keys(query).length) {
|
|
1815
|
+
body = this.json(query);
|
|
1816
|
+
headers['Content-Type'] = 'application/json';
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
1821
|
+
}
|
|
1822
|
+
async signIn(params = {}) {
|
|
1823
|
+
/**
|
|
1824
|
+
* @method
|
|
1825
|
+
* @name probit#signIn
|
|
1826
|
+
* @see https://docs-en.probit.com/reference/token
|
|
1827
|
+
* @description sign in, must be called prior to using other authenticated methods
|
|
1828
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1829
|
+
* @returns response from exchange
|
|
1830
|
+
*/
|
|
1831
|
+
this.checkRequiredCredentials();
|
|
1832
|
+
const request = {
|
|
1833
|
+
'grant_type': 'client_credentials', // the only supported value
|
|
1834
|
+
};
|
|
1835
|
+
const response = await this.accountsPostToken(this.extend(request, params));
|
|
1836
|
+
//
|
|
1837
|
+
// {
|
|
1838
|
+
// "access_token": "0ttDv/2hTTn3bLi8GP1gKaneiEQ6+0hOBenPrxNQt2s=",
|
|
1839
|
+
// "token_type": "bearer",
|
|
1840
|
+
// "expires_in": 900
|
|
1841
|
+
// }
|
|
1842
|
+
//
|
|
1843
|
+
const expiresIn = this.safeInteger(response, 'expires_in');
|
|
1844
|
+
const accessToken = this.safeString(response, 'access_token');
|
|
1845
|
+
this.options['accessToken'] = accessToken;
|
|
1846
|
+
this.options['expires'] = this.sum(this.milliseconds(), expiresIn * 1000);
|
|
1847
|
+
return response;
|
|
1848
|
+
}
|
|
1849
|
+
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
1850
|
+
if (response === undefined) {
|
|
1851
|
+
return undefined; // fallback to default error handler
|
|
1852
|
+
}
|
|
1853
|
+
if ('errorCode' in response) {
|
|
1854
|
+
const errorCode = this.safeString(response, 'errorCode');
|
|
1855
|
+
const message = this.safeString(response, 'message');
|
|
1856
|
+
if (errorCode !== undefined) {
|
|
1857
|
+
const feedback = this.id + ' ' + body;
|
|
1858
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
|
|
1859
|
+
this.throwBroadlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
1860
|
+
throw new errors.ExchangeError(feedback);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
return undefined;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
module.exports = probit;
|