ccxt 4.2.17 → 4.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/ccxt.browser.js +48992 -47725
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +12 -1
- package/dist/cjs/src/alpaca.js +18 -18
- package/dist/cjs/src/ascendex.js +13 -6
- package/dist/cjs/src/base/Exchange.js +266 -27
- package/dist/cjs/src/bigone.js +434 -168
- package/dist/cjs/src/binance.js +163 -34
- package/dist/cjs/src/binanceus.js +8 -0
- package/dist/cjs/src/bingx.js +183 -41
- package/dist/cjs/src/bitfinex.js +2 -3
- package/dist/cjs/src/bitget.js +59 -16
- package/dist/cjs/src/bitmart.js +5 -5
- package/dist/cjs/src/bitmex.js +4 -6
- package/dist/cjs/src/bitpanda.js +5 -1991
- package/dist/cjs/src/bitstamp.js +8 -0
- package/dist/cjs/src/bybit.js +27 -47
- package/dist/cjs/src/coinbase.js +176 -26
- package/dist/cjs/src/coincheck.js +1 -0
- package/dist/cjs/src/coinex.js +3 -0
- package/dist/cjs/src/coinlist.js +13 -6
- package/dist/cjs/src/coinone.js +2 -2
- package/dist/cjs/src/coinsph.js +4 -5
- package/dist/cjs/src/delta.js +7 -1
- package/dist/cjs/src/deribit.js +17 -4
- package/dist/cjs/src/gate.js +151 -169
- package/dist/cjs/src/gemini.js +1 -1
- package/dist/cjs/src/hitbtc.js +2 -3
- package/dist/cjs/src/htx.js +157 -7
- package/dist/cjs/src/huobijp.js +2 -3
- package/dist/cjs/src/independentreserve.js +7 -5
- package/dist/cjs/src/kraken.js +86 -54
- package/dist/cjs/src/kucoin.js +5 -0
- package/dist/cjs/src/kucoinfutures.js +131 -77
- package/dist/cjs/src/lbank.js +60 -33
- package/dist/cjs/src/luno.js +84 -2
- package/dist/cjs/src/mexc.js +3 -3
- package/dist/cjs/src/oceanex.js +1 -1
- package/dist/cjs/src/okx.js +23 -11
- package/dist/cjs/{js/src/bitpanda.js → src/onetrading.js} +39 -39
- package/dist/cjs/src/phemex.js +37 -27
- package/dist/cjs/src/poloniexfutures.js +1 -0
- package/dist/cjs/src/pro/binance.js +66 -25
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitpanda.js +5 -1330
- package/dist/cjs/src/pro/coinbase.js +4 -1
- package/dist/cjs/src/pro/coincheck.js +208 -0
- package/dist/cjs/src/pro/hitbtc.js +5 -4
- package/dist/cjs/src/pro/htx.js +6 -1
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/krakenfutures.js +7 -1
- package/dist/cjs/src/pro/kucoin.js +46 -36
- package/dist/cjs/src/pro/kucoinfutures.js +45 -37
- package/dist/cjs/src/pro/lbank.js +881 -0
- package/dist/cjs/src/pro/okx.js +52 -2
- package/dist/cjs/{js/src/pro/bitpanda.js → src/pro/onetrading.js} +4 -7
- package/dist/cjs/src/pro/poloniex.js +2 -2
- package/dist/cjs/src/pro/poloniexfutures.js +43 -35
- package/dist/cjs/src/pro/woo.js +126 -0
- package/dist/cjs/src/probit.js +4 -2
- package/dist/cjs/src/upbit.js +12 -12
- package/dist/cjs/src/wavesexchange.js +1 -1
- package/dist/cjs/src/whitebit.js +1 -0
- package/dist/cjs/src/woo.js +56 -0
- package/js/ccxt.d.ts +14 -2
- package/js/ccxt.js +10 -2
- package/js/src/abstract/bitpanda.d.ts +4 -4
- package/js/src/abstract/bitstamp.d.ts +8 -0
- package/js/src/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/abstract/htx.d.ts +3 -0
- package/js/src/abstract/huobi.d.ts +3 -0
- package/js/src/abstract/luno.d.ts +1 -0
- package/js/src/abstract/onetrading.d.ts +38 -0
- package/js/src/ascendex.js +2 -0
- package/js/src/base/Exchange.d.ts +2 -3
- package/js/src/base/Exchange.js +5 -2
- package/js/src/binance.js +7 -1
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +26 -0
- package/js/src/bitget.js +22 -3
- package/js/src/bitpanda.d.ts +2 -72
- package/js/src/bitpanda.js +5 -1991
- package/js/src/bitstamp.js +8 -0
- package/js/src/bybit.js +21 -47
- package/js/src/coincheck.js +1 -0
- package/js/src/deribit.js +16 -4
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +50 -110
- package/js/src/htx.js +3 -0
- package/js/src/kraken.d.ts +1 -0
- package/js/src/kraken.js +40 -39
- package/js/src/lbank.js +1 -0
- package/js/src/luno.d.ts +3 -1
- package/js/src/luno.js +84 -2
- package/js/src/mexc.js +1 -2
- package/js/src/onetrading.d.ts +74 -0
- package/js/src/onetrading.js +2003 -0
- package/js/src/poloniexfutures.js +1 -0
- package/js/src/pro/binance.js +7 -2
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitpanda.d.ts +2 -34
- package/js/src/pro/bitpanda.js +5 -1330
- package/js/src/pro/coincheck.d.ts +12 -0
- package/js/src/pro/coincheck.js +209 -0
- package/js/src/pro/kucoin.js +43 -35
- package/js/src/pro/kucoinfutures.js +45 -37
- package/js/src/pro/lbank.d.ts +29 -0
- package/js/src/pro/lbank.js +882 -0
- package/js/src/pro/onetrading.d.ts +36 -0
- package/js/src/pro/onetrading.js +1339 -0
- package/js/src/pro/poloniexfutures.js +43 -35
- package/js/src/whitebit.js +1 -0
- package/package.json +2 -2
- package/rollup.config.js +2 -0
- package/skip-tests.json +14 -2
- package/test-commonjs.cjs +25 -1
- package/dist/cjs/js/ccxt.js +0 -476
- package/dist/cjs/js/src/abstract/alpaca.js +0 -9
- package/dist/cjs/js/src/abstract/ascendex.js +0 -9
- package/dist/cjs/js/src/abstract/bigone.js +0 -9
- package/dist/cjs/js/src/abstract/binance.js +0 -9
- package/dist/cjs/js/src/abstract/bingx.js +0 -9
- package/dist/cjs/js/src/abstract/bit2c.js +0 -9
- package/dist/cjs/js/src/abstract/bitbank.js +0 -9
- package/dist/cjs/js/src/abstract/bitbns.js +0 -9
- package/dist/cjs/js/src/abstract/bitfinex.js +0 -9
- package/dist/cjs/js/src/abstract/bitfinex2.js +0 -9
- package/dist/cjs/js/src/abstract/bitflyer.js +0 -9
- package/dist/cjs/js/src/abstract/bitforex.js +0 -9
- package/dist/cjs/js/src/abstract/bitget.js +0 -9
- package/dist/cjs/js/src/abstract/bithumb.js +0 -9
- package/dist/cjs/js/src/abstract/bitmart.js +0 -9
- package/dist/cjs/js/src/abstract/bitmex.js +0 -9
- package/dist/cjs/js/src/abstract/bitopro.js +0 -9
- package/dist/cjs/js/src/abstract/bitpanda.js +0 -9
- package/dist/cjs/js/src/abstract/bitrue.js +0 -9
- package/dist/cjs/js/src/abstract/bitso.js +0 -9
- package/dist/cjs/js/src/abstract/bitstamp.js +0 -9
- package/dist/cjs/js/src/abstract/bitteam.js +0 -9
- package/dist/cjs/js/src/abstract/bitvavo.js +0 -9
- package/dist/cjs/js/src/abstract/bl3p.js +0 -9
- package/dist/cjs/js/src/abstract/blockchaincom.js +0 -9
- package/dist/cjs/js/src/abstract/btcalpha.js +0 -9
- package/dist/cjs/js/src/abstract/btcbox.js +0 -9
- package/dist/cjs/js/src/abstract/btcmarkets.js +0 -9
- package/dist/cjs/js/src/abstract/btcturk.js +0 -9
- package/dist/cjs/js/src/abstract/bybit.js +0 -9
- package/dist/cjs/js/src/abstract/cex.js +0 -9
- package/dist/cjs/js/src/abstract/coinbase.js +0 -9
- package/dist/cjs/js/src/abstract/coinbasepro.js +0 -9
- package/dist/cjs/js/src/abstract/coincheck.js +0 -9
- package/dist/cjs/js/src/abstract/coinex.js +0 -9
- package/dist/cjs/js/src/abstract/coinlist.js +0 -9
- package/dist/cjs/js/src/abstract/coinmate.js +0 -9
- package/dist/cjs/js/src/abstract/coinone.js +0 -9
- package/dist/cjs/js/src/abstract/coinsph.js +0 -9
- package/dist/cjs/js/src/abstract/coinspot.js +0 -9
- package/dist/cjs/js/src/abstract/cryptocom.js +0 -9
- package/dist/cjs/js/src/abstract/currencycom.js +0 -9
- package/dist/cjs/js/src/abstract/delta.js +0 -9
- package/dist/cjs/js/src/abstract/deribit.js +0 -9
- package/dist/cjs/js/src/abstract/digifinex.js +0 -9
- package/dist/cjs/js/src/abstract/exmo.js +0 -9
- package/dist/cjs/js/src/abstract/gate.js +0 -9
- package/dist/cjs/js/src/abstract/gemini.js +0 -9
- package/dist/cjs/js/src/abstract/hitbtc.js +0 -9
- package/dist/cjs/js/src/abstract/hollaex.js +0 -9
- package/dist/cjs/js/src/abstract/htx.js +0 -9
- package/dist/cjs/js/src/abstract/huobijp.js +0 -9
- package/dist/cjs/js/src/abstract/idex.js +0 -9
- package/dist/cjs/js/src/abstract/independentreserve.js +0 -9
- package/dist/cjs/js/src/abstract/indodax.js +0 -9
- package/dist/cjs/js/src/abstract/kraken.js +0 -9
- package/dist/cjs/js/src/abstract/krakenfutures.js +0 -9
- package/dist/cjs/js/src/abstract/kucoin.js +0 -9
- package/dist/cjs/js/src/abstract/kucoinfutures.js +0 -9
- package/dist/cjs/js/src/abstract/kuna.js +0 -9
- package/dist/cjs/js/src/abstract/latoken.js +0 -9
- package/dist/cjs/js/src/abstract/lbank.js +0 -9
- package/dist/cjs/js/src/abstract/luno.js +0 -9
- package/dist/cjs/js/src/abstract/lykke.js +0 -9
- package/dist/cjs/js/src/abstract/mercado.js +0 -9
- package/dist/cjs/js/src/abstract/mexc.js +0 -9
- package/dist/cjs/js/src/abstract/ndax.js +0 -9
- package/dist/cjs/js/src/abstract/novadax.js +0 -9
- package/dist/cjs/js/src/abstract/oceanex.js +0 -9
- package/dist/cjs/js/src/abstract/okcoin.js +0 -9
- package/dist/cjs/js/src/abstract/okx.js +0 -9
- package/dist/cjs/js/src/abstract/p2b.js +0 -9
- package/dist/cjs/js/src/abstract/paymium.js +0 -9
- package/dist/cjs/js/src/abstract/phemex.js +0 -9
- package/dist/cjs/js/src/abstract/poloniex.js +0 -9
- package/dist/cjs/js/src/abstract/poloniexfutures.js +0 -9
- package/dist/cjs/js/src/abstract/probit.js +0 -9
- package/dist/cjs/js/src/abstract/timex.js +0 -9
- package/dist/cjs/js/src/abstract/tokocrypto.js +0 -9
- package/dist/cjs/js/src/abstract/upbit.js +0 -9
- package/dist/cjs/js/src/abstract/wavesexchange.js +0 -9
- package/dist/cjs/js/src/abstract/wazirx.js +0 -9
- package/dist/cjs/js/src/abstract/whitebit.js +0 -9
- package/dist/cjs/js/src/abstract/woo.js +0 -9
- package/dist/cjs/js/src/abstract/yobit.js +0 -9
- package/dist/cjs/js/src/abstract/zaif.js +0 -9
- package/dist/cjs/js/src/abstract/zonda.js +0 -9
- package/dist/cjs/js/src/ace.js +0 -1058
- package/dist/cjs/js/src/alpaca.js +0 -1125
- package/dist/cjs/js/src/ascendex.js +0 -3365
- package/dist/cjs/js/src/base/Exchange.js +0 -5257
- package/dist/cjs/js/src/base/Precise.js +0 -263
- package/dist/cjs/js/src/base/errors.js +0 -299
- package/dist/cjs/js/src/base/functions/crypto.js +0 -78
- package/dist/cjs/js/src/base/functions/encode.js +0 -44
- package/dist/cjs/js/src/base/functions/generic.js +0 -193
- package/dist/cjs/js/src/base/functions/misc.js +0 -96
- package/dist/cjs/js/src/base/functions/number.js +0 -297
- package/dist/cjs/js/src/base/functions/platform.js +0 -28
- package/dist/cjs/js/src/base/functions/rsa.js +0 -34
- package/dist/cjs/js/src/base/functions/string.js +0 -48
- package/dist/cjs/js/src/base/functions/throttle.js +0 -66
- package/dist/cjs/js/src/base/functions/time.js +0 -187
- package/dist/cjs/js/src/base/functions/totp.js +0 -24
- package/dist/cjs/js/src/base/functions/type.js +0 -162
- package/dist/cjs/js/src/base/functions.js +0 -157
- package/dist/cjs/js/src/base/ws/Cache.js +0 -254
- package/dist/cjs/js/src/base/ws/Client.js +0 -299
- package/dist/cjs/js/src/base/ws/Future.js +0 -34
- package/dist/cjs/js/src/base/ws/OrderBook.js +0 -107
- package/dist/cjs/js/src/base/ws/OrderBookSide.js +0 -281
- package/dist/cjs/js/src/base/ws/WsClient.js +0 -69
- package/dist/cjs/js/src/bequant.js +0 -33
- package/dist/cjs/js/src/bigone.js +0 -2213
- package/dist/cjs/js/src/binance.js +0 -9845
- package/dist/cjs/js/src/binancecoinm.js +0 -45
- package/dist/cjs/js/src/binanceus.js +0 -92
- package/dist/cjs/js/src/binanceusdm.js +0 -58
- package/dist/cjs/js/src/bingx.js +0 -3846
- package/dist/cjs/js/src/bit2c.js +0 -916
- package/dist/cjs/js/src/bitbank.js +0 -1000
- package/dist/cjs/js/src/bitbay.js +0 -17
- package/dist/cjs/js/src/bitbns.js +0 -1220
- package/dist/cjs/js/src/bitcoincom.js +0 -17
- package/dist/cjs/js/src/bitfinex.js +0 -1670
- package/dist/cjs/js/src/bitfinex2.js +0 -2990
- package/dist/cjs/js/src/bitflyer.js +0 -1045
- package/dist/cjs/js/src/bitforex.js +0 -852
- package/dist/cjs/js/src/bitget.js +0 -8295
- package/dist/cjs/js/src/bithumb.js +0 -1090
- package/dist/cjs/js/src/bitmart.js +0 -4454
- package/dist/cjs/js/src/bitmex.js +0 -2881
- package/dist/cjs/js/src/bitopro.js +0 -1724
- package/dist/cjs/js/src/bitrue.js +0 -3253
- package/dist/cjs/js/src/bitso.js +0 -1753
- package/dist/cjs/js/src/bitstamp.js +0 -2188
- package/dist/cjs/js/src/bitteam.js +0 -2309
- package/dist/cjs/js/src/bitvavo.js +0 -1968
- package/dist/cjs/js/src/bl3p.js +0 -447
- package/dist/cjs/js/src/blockchaincom.js +0 -1160
- package/dist/cjs/js/src/btcalpha.js +0 -929
- package/dist/cjs/js/src/btcbox.js +0 -565
- package/dist/cjs/js/src/btcmarkets.js +0 -1237
- package/dist/cjs/js/src/btcturk.js +0 -929
- package/dist/cjs/js/src/bybit.js +0 -7650
- package/dist/cjs/js/src/cex.js +0 -1693
- package/dist/cjs/js/src/coinbase.js +0 -3424
- package/dist/cjs/js/src/coinbasepro.js +0 -1866
- package/dist/cjs/js/src/coincheck.js +0 -843
- package/dist/cjs/js/src/coinex.js +0 -5417
- package/dist/cjs/js/src/coinlist.js +0 -2337
- package/dist/cjs/js/src/coinmate.js +0 -989
- package/dist/cjs/js/src/coinone.js +0 -1185
- package/dist/cjs/js/src/coinsph.js +0 -1933
- package/dist/cjs/js/src/coinspot.js +0 -548
- package/dist/cjs/js/src/cryptocom.js +0 -3007
- package/dist/cjs/js/src/currencycom.js +0 -2015
- package/dist/cjs/js/src/delta.js +0 -3262
- package/dist/cjs/js/src/deribit.js +0 -3306
- package/dist/cjs/js/src/digifinex.js +0 -4307
- package/dist/cjs/js/src/exmo.js +0 -2645
- package/dist/cjs/js/src/fmfwio.js +0 -34
- package/dist/cjs/js/src/gate.js +0 -7077
- package/dist/cjs/js/src/gateio.js +0 -16
- package/dist/cjs/js/src/gemini.js +0 -1801
- package/dist/cjs/js/src/hitbtc.js +0 -3660
- package/dist/cjs/js/src/hitbtc3.js +0 -19
- package/dist/cjs/js/src/hollaex.js +0 -1882
- package/dist/cjs/js/src/htx.js +0 -9174
- package/dist/cjs/js/src/huobi.js +0 -16
- package/dist/cjs/js/src/huobijp.js +0 -1918
- package/dist/cjs/js/src/idex.js +0 -1770
- package/dist/cjs/js/src/independentreserve.js +0 -761
- package/dist/cjs/js/src/indodax.js +0 -1069
- package/dist/cjs/js/src/kraken.js +0 -2891
- package/dist/cjs/js/src/krakenfutures.js +0 -2407
- package/dist/cjs/js/src/kucoin.js +0 -4494
- package/dist/cjs/js/src/kucoinfutures.js +0 -2529
- package/dist/cjs/js/src/kuna.js +0 -1949
- package/dist/cjs/js/src/latoken.js +0 -1729
- package/dist/cjs/js/src/lbank.js +0 -2851
- package/dist/cjs/js/src/luno.js +0 -1044
- package/dist/cjs/js/src/lykke.js +0 -1303
- package/dist/cjs/js/src/mercado.js +0 -897
- package/dist/cjs/js/src/mexc.js +0 -5407
- package/dist/cjs/js/src/ndax.js +0 -2450
- package/dist/cjs/js/src/novadax.js +0 -1556
- package/dist/cjs/js/src/oceanex.js +0 -964
- package/dist/cjs/js/src/okcoin.js +0 -3115
- package/dist/cjs/js/src/okx.js +0 -7331
- package/dist/cjs/js/src/p2b.js +0 -1243
- package/dist/cjs/js/src/paymium.js +0 -597
- package/dist/cjs/js/src/phemex.js +0 -4725
- package/dist/cjs/js/src/poloniex.js +0 -2356
- package/dist/cjs/js/src/poloniexfutures.js +0 -1794
- package/dist/cjs/js/src/pro/alpaca.js +0 -714
- package/dist/cjs/js/src/pro/ascendex.js +0 -957
- package/dist/cjs/js/src/pro/bequant.js +0 -33
- package/dist/cjs/js/src/pro/binance.js +0 -2796
- package/dist/cjs/js/src/pro/binancecoinm.js +0 -23
- package/dist/cjs/js/src/pro/binanceus.js +0 -51
- package/dist/cjs/js/src/pro/binanceusdm.js +0 -32
- package/dist/cjs/js/src/pro/bingx.js +0 -944
- package/dist/cjs/js/src/pro/bitcoincom.js +0 -29
- package/dist/cjs/js/src/pro/bitfinex.js +0 -672
- package/dist/cjs/js/src/pro/bitfinex2.js +0 -1159
- package/dist/cjs/js/src/pro/bitget.js +0 -1733
- package/dist/cjs/js/src/pro/bitmart.js +0 -1486
- package/dist/cjs/js/src/pro/bitmex.js +0 -1576
- package/dist/cjs/js/src/pro/bitopro.js +0 -327
- package/dist/cjs/js/src/pro/bitrue.js +0 -462
- package/dist/cjs/js/src/pro/bitstamp.js +0 -547
- package/dist/cjs/js/src/pro/bitvavo.js +0 -704
- package/dist/cjs/js/src/pro/blockchaincom.js +0 -794
- package/dist/cjs/js/src/pro/bybit.js +0 -1843
- package/dist/cjs/js/src/pro/cex.js +0 -1510
- package/dist/cjs/js/src/pro/coinbase.js +0 -561
- package/dist/cjs/js/src/pro/coinbasepro.js +0 -968
- package/dist/cjs/js/src/pro/coinex.js +0 -1095
- package/dist/cjs/js/src/pro/cryptocom.js +0 -1020
- package/dist/cjs/js/src/pro/currencycom.js +0 -563
- package/dist/cjs/js/src/pro/deribit.js +0 -825
- package/dist/cjs/js/src/pro/exmo.js +0 -658
- package/dist/cjs/js/src/pro/gate.js +0 -1316
- package/dist/cjs/js/src/pro/gateio.js +0 -16
- package/dist/cjs/js/src/pro/gemini.js +0 -649
- package/dist/cjs/js/src/pro/hitbtc.js +0 -1294
- package/dist/cjs/js/src/pro/hollaex.js +0 -597
- package/dist/cjs/js/src/pro/htx.js +0 -2388
- package/dist/cjs/js/src/pro/huobi.js +0 -16
- package/dist/cjs/js/src/pro/huobijp.js +0 -606
- package/dist/cjs/js/src/pro/idex.js +0 -714
- package/dist/cjs/js/src/pro/independentreserve.js +0 -280
- package/dist/cjs/js/src/pro/kraken.js +0 -1364
- package/dist/cjs/js/src/pro/krakenfutures.js +0 -1506
- package/dist/cjs/js/src/pro/kucoin.js +0 -1054
- package/dist/cjs/js/src/pro/kucoinfutures.js +0 -981
- package/dist/cjs/js/src/pro/luno.js +0 -322
- package/dist/cjs/js/src/pro/mexc.js +0 -1170
- package/dist/cjs/js/src/pro/ndax.js +0 -545
- package/dist/cjs/js/src/pro/okcoin.js +0 -760
- package/dist/cjs/js/src/pro/okx.js +0 -1608
- package/dist/cjs/js/src/pro/phemex.js +0 -1511
- package/dist/cjs/js/src/pro/poloniex.js +0 -1253
- package/dist/cjs/js/src/pro/poloniexfutures.js +0 -1014
- package/dist/cjs/js/src/pro/probit.js +0 -586
- package/dist/cjs/js/src/pro/upbit.js +0 -234
- package/dist/cjs/js/src/pro/wazirx.js +0 -776
- package/dist/cjs/js/src/pro/whitebit.js +0 -927
- package/dist/cjs/js/src/pro/woo.js +0 -895
- package/dist/cjs/js/src/probit.js +0 -1867
- package/dist/cjs/js/src/static_dependencies/fflake/browser.js +0 -401
- package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -195
- package/dist/cjs/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -308
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -554
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -94
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -70
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -91
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -16
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -1760
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -52
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -81
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -376
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -70
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -1580
- package/dist/cjs/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -74
- package/dist/cjs/js/src/static_dependencies/noble-curves/_shortw_utils.js +0 -24
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/curve.js +0 -158
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/edwards.js +0 -429
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -176
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/modular.js +0 -324
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/montgomery.js +0 -163
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/utils.js +0 -245
- package/dist/cjs/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +0 -1018
- package/dist/cjs/js/src/static_dependencies/noble-curves/ed25519.js +0 -383
- package/dist/cjs/js/src/static_dependencies/noble-curves/secp256k1.js +0 -258
- package/dist/cjs/js/src/static_dependencies/noble-hashes/_assert.js +0 -53
- package/dist/cjs/js/src/static_dependencies/noble-hashes/_sha2.js +0 -120
- package/dist/cjs/js/src/static_dependencies/noble-hashes/_u64.js +0 -69
- package/dist/cjs/js/src/static_dependencies/noble-hashes/crypto.js +0 -7
- package/dist/cjs/js/src/static_dependencies/noble-hashes/hmac.js +0 -83
- package/dist/cjs/js/src/static_dependencies/noble-hashes/md5.js +0 -240
- package/dist/cjs/js/src/static_dependencies/noble-hashes/sha1.js +0 -91
- package/dist/cjs/js/src/static_dependencies/noble-hashes/sha256.js +0 -130
- package/dist/cjs/js/src/static_dependencies/noble-hashes/sha3.js +0 -214
- package/dist/cjs/js/src/static_dependencies/noble-hashes/sha512.js +0 -239
- package/dist/cjs/js/src/static_dependencies/noble-hashes/utils.js +0 -93
- package/dist/cjs/js/src/static_dependencies/node-fetch/body.js +0 -354
- package/dist/cjs/js/src/static_dependencies/node-fetch/errors/abort-error.js +0 -16
- package/dist/cjs/js/src/static_dependencies/node-fetch/errors/base.js +0 -20
- package/dist/cjs/js/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -30
- package/dist/cjs/js/src/static_dependencies/node-fetch/headers.js +0 -239
- package/dist/cjs/js/src/static_dependencies/node-fetch/index.js +0 -372
- package/dist/cjs/js/src/static_dependencies/node-fetch/request.js +0 -273
- package/dist/cjs/js/src/static_dependencies/node-fetch/response.js +0 -139
- package/dist/cjs/js/src/static_dependencies/node-fetch/utils/get-search.js +0 -14
- package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -16
- package/dist/cjs/js/src/static_dependencies/node-fetch/utils/is.js +0 -81
- package/dist/cjs/js/src/static_dependencies/node-fetch/utils/referrer.js +0 -292
- package/dist/cjs/js/src/static_dependencies/proxies/agent-base/index.js +0 -103
- package/dist/cjs/js/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -140
- package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -175
- package/dist/cjs/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -95
- package/dist/cjs/js/src/static_dependencies/qs/index.cjs.js +0 -7
- package/dist/cjs/js/src/static_dependencies/scure-base/index.js +0 -383
- package/dist/cjs/js/src/timex.js +0 -1562
- package/dist/cjs/js/src/tokocrypto.js +0 -2542
- package/dist/cjs/js/src/upbit.js +0 -1844
- package/dist/cjs/js/src/wavesexchange.js +0 -2607
- package/dist/cjs/js/src/wazirx.js +0 -953
- package/dist/cjs/js/src/whitebit.js +0 -2309
- package/dist/cjs/js/src/woo.js +0 -2769
- package/dist/cjs/js/src/yobit.js +0 -1314
- package/dist/cjs/js/src/zaif.js +0 -736
- package/dist/cjs/js/src/zonda.js +0 -1883
- package/dist/cjs/src/abstract/bitpanda.js +0 -9
- package/test.ts +0 -0
- /package/dist/cjs/{js/src/abstract/ace.js → src/abstract/onetrading.js} +0 -0
- /package/dist/cjs/{js/src → src}/pro/coinone.js +0 -0
- /package/js/src/abstract/{bitpanda.js → onetrading.js} +0 -0
|
@@ -1,1000 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var bitbank$1 = require('./abstract/bitbank.js');
|
|
4
|
-
var errors = require('./base/errors.js');
|
|
5
|
-
var number = require('./base/functions/number.js');
|
|
6
|
-
var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
|
|
7
|
-
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
/**
|
|
11
|
-
* @class bitbank
|
|
12
|
-
* @augments Exchange
|
|
13
|
-
*/
|
|
14
|
-
class bitbank extends bitbank$1 {
|
|
15
|
-
describe() {
|
|
16
|
-
return this.deepExtend(super.describe(), {
|
|
17
|
-
'id': 'bitbank',
|
|
18
|
-
'name': 'bitbank',
|
|
19
|
-
'countries': ['JP'],
|
|
20
|
-
'version': 'v1',
|
|
21
|
-
'has': {
|
|
22
|
-
'CORS': undefined,
|
|
23
|
-
'spot': true,
|
|
24
|
-
'margin': false,
|
|
25
|
-
'swap': false,
|
|
26
|
-
'future': false,
|
|
27
|
-
'option': false,
|
|
28
|
-
'addMargin': false,
|
|
29
|
-
'cancelOrder': true,
|
|
30
|
-
'closeAllPositions': false,
|
|
31
|
-
'closePosition': false,
|
|
32
|
-
'createOrder': true,
|
|
33
|
-
'createReduceOnlyOrder': false,
|
|
34
|
-
'fetchBalance': true,
|
|
35
|
-
'fetchBorrowRateHistories': false,
|
|
36
|
-
'fetchBorrowRateHistory': false,
|
|
37
|
-
'fetchCrossBorrowRate': false,
|
|
38
|
-
'fetchCrossBorrowRates': false,
|
|
39
|
-
'fetchDepositAddress': true,
|
|
40
|
-
'fetchFundingHistory': false,
|
|
41
|
-
'fetchFundingRate': false,
|
|
42
|
-
'fetchFundingRateHistory': false,
|
|
43
|
-
'fetchFundingRates': false,
|
|
44
|
-
'fetchIndexOHLCV': false,
|
|
45
|
-
'fetchIsolatedBorrowRate': false,
|
|
46
|
-
'fetchIsolatedBorrowRates': false,
|
|
47
|
-
'fetchLeverage': false,
|
|
48
|
-
'fetchLeverageTiers': false,
|
|
49
|
-
'fetchMarginMode': false,
|
|
50
|
-
'fetchMarkOHLCV': false,
|
|
51
|
-
'fetchMyTrades': true,
|
|
52
|
-
'fetchOHLCV': true,
|
|
53
|
-
'fetchOpenInterestHistory': false,
|
|
54
|
-
'fetchOpenOrders': true,
|
|
55
|
-
'fetchOrder': true,
|
|
56
|
-
'fetchOrderBook': true,
|
|
57
|
-
'fetchPosition': false,
|
|
58
|
-
'fetchPositionMode': false,
|
|
59
|
-
'fetchPositions': false,
|
|
60
|
-
'fetchPositionsRisk': false,
|
|
61
|
-
'fetchPremiumIndexOHLCV': false,
|
|
62
|
-
'fetchTicker': true,
|
|
63
|
-
'fetchTrades': true,
|
|
64
|
-
'fetchTradingFee': false,
|
|
65
|
-
'fetchTradingFees': true,
|
|
66
|
-
'fetchTransfer': false,
|
|
67
|
-
'fetchTransfers': false,
|
|
68
|
-
'reduceMargin': false,
|
|
69
|
-
'setLeverage': false,
|
|
70
|
-
'setMarginMode': false,
|
|
71
|
-
'setPositionMode': false,
|
|
72
|
-
'transfer': false,
|
|
73
|
-
'withdraw': true,
|
|
74
|
-
},
|
|
75
|
-
'timeframes': {
|
|
76
|
-
'1m': '1min',
|
|
77
|
-
'5m': '5min',
|
|
78
|
-
'15m': '15min',
|
|
79
|
-
'30m': '30min',
|
|
80
|
-
'1h': '1hour',
|
|
81
|
-
'4h': '4hour',
|
|
82
|
-
'8h': '8hour',
|
|
83
|
-
'12h': '12hour',
|
|
84
|
-
'1d': '1day',
|
|
85
|
-
'1w': '1week',
|
|
86
|
-
},
|
|
87
|
-
'hostname': 'bitbank.cc',
|
|
88
|
-
'urls': {
|
|
89
|
-
'logo': 'https://user-images.githubusercontent.com/1294454/37808081-b87f2d9c-2e59-11e8-894d-c1900b7584fe.jpg',
|
|
90
|
-
'api': {
|
|
91
|
-
'public': 'https://public.{hostname}',
|
|
92
|
-
'private': 'https://api.{hostname}',
|
|
93
|
-
'markets': 'https://api.{hostname}',
|
|
94
|
-
},
|
|
95
|
-
'www': 'https://bitbank.cc/',
|
|
96
|
-
'doc': 'https://docs.bitbank.cc/',
|
|
97
|
-
'fees': 'https://bitbank.cc/docs/fees/',
|
|
98
|
-
},
|
|
99
|
-
'api': {
|
|
100
|
-
'public': {
|
|
101
|
-
'get': [
|
|
102
|
-
'{pair}/ticker',
|
|
103
|
-
'tickers',
|
|
104
|
-
'tickers_jpy',
|
|
105
|
-
'{pair}/depth',
|
|
106
|
-
'{pair}/transactions',
|
|
107
|
-
'{pair}/transactions/{yyyymmdd}',
|
|
108
|
-
'{pair}/candlestick/{candletype}/{yyyymmdd}',
|
|
109
|
-
'{pair}/circuit_break_info',
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
'private': {
|
|
113
|
-
'get': [
|
|
114
|
-
'user/assets',
|
|
115
|
-
'user/spot/order',
|
|
116
|
-
'user/spot/active_orders',
|
|
117
|
-
'user/spot/trade_history',
|
|
118
|
-
'user/deposit_history',
|
|
119
|
-
'user/withdrawal_account',
|
|
120
|
-
'user/withdrawal_history',
|
|
121
|
-
'spot/status',
|
|
122
|
-
'spot/pairs',
|
|
123
|
-
],
|
|
124
|
-
'post': [
|
|
125
|
-
'user/spot/order',
|
|
126
|
-
'user/spot/cancel_order',
|
|
127
|
-
'user/spot/cancel_orders',
|
|
128
|
-
'user/spot/orders_info',
|
|
129
|
-
'user/request_withdrawal',
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
'markets': {
|
|
133
|
-
'get': [
|
|
134
|
-
'spot/pairs',
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
'precisionMode': number.TICK_SIZE,
|
|
139
|
-
'exceptions': {
|
|
140
|
-
'20001': errors.AuthenticationError,
|
|
141
|
-
'20002': errors.AuthenticationError,
|
|
142
|
-
'20003': errors.AuthenticationError,
|
|
143
|
-
'20005': errors.AuthenticationError,
|
|
144
|
-
'20004': errors.InvalidNonce,
|
|
145
|
-
'40020': errors.InvalidOrder,
|
|
146
|
-
'40021': errors.InvalidOrder,
|
|
147
|
-
'40025': errors.ExchangeError,
|
|
148
|
-
'40013': errors.OrderNotFound,
|
|
149
|
-
'40014': errors.OrderNotFound,
|
|
150
|
-
'50008': errors.PermissionDenied,
|
|
151
|
-
'50009': errors.OrderNotFound,
|
|
152
|
-
'50010': errors.OrderNotFound,
|
|
153
|
-
'60001': errors.InsufficientFunds,
|
|
154
|
-
'60005': errors.InvalidOrder,
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
async fetchMarkets(params = {}) {
|
|
159
|
-
/**
|
|
160
|
-
* @method
|
|
161
|
-
* @name bitbank#fetchMarkets
|
|
162
|
-
* @description retrieves data on all markets for bitbank
|
|
163
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-all-pairs-info
|
|
164
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
165
|
-
* @returns {object[]} an array of objects representing market data
|
|
166
|
-
*/
|
|
167
|
-
const response = await this.marketsGetSpotPairs(params);
|
|
168
|
-
//
|
|
169
|
-
// {
|
|
170
|
-
// "success": 1,
|
|
171
|
-
// "data": {
|
|
172
|
-
// "pairs": [
|
|
173
|
-
// {
|
|
174
|
-
// "name": "btc_jpy",
|
|
175
|
-
// "base_asset": "btc",
|
|
176
|
-
// "quote_asset": "jpy",
|
|
177
|
-
// "maker_fee_rate_base": "0",
|
|
178
|
-
// "taker_fee_rate_base": "0",
|
|
179
|
-
// "maker_fee_rate_quote": "-0.0002",
|
|
180
|
-
// "taker_fee_rate_quote": "0.0012",
|
|
181
|
-
// "unit_amount": "0.0001",
|
|
182
|
-
// "limit_max_amount": "1000",
|
|
183
|
-
// "market_max_amount": "10",
|
|
184
|
-
// "market_allowance_rate": "0.2",
|
|
185
|
-
// "price_digits": 0,
|
|
186
|
-
// "amount_digits": 4,
|
|
187
|
-
// "is_enabled": true,
|
|
188
|
-
// "stop_order": false,
|
|
189
|
-
// "stop_order_and_cancel": false
|
|
190
|
-
// }
|
|
191
|
-
// ]
|
|
192
|
-
// }
|
|
193
|
-
// }
|
|
194
|
-
//
|
|
195
|
-
const data = this.safeValue(response, 'data');
|
|
196
|
-
const pairs = this.safeValue(data, 'pairs', []);
|
|
197
|
-
return this.parseMarkets(pairs);
|
|
198
|
-
}
|
|
199
|
-
parseMarket(entry) {
|
|
200
|
-
const id = this.safeString(entry, 'name');
|
|
201
|
-
const baseId = this.safeString(entry, 'base_asset');
|
|
202
|
-
const quoteId = this.safeString(entry, 'quote_asset');
|
|
203
|
-
const base = this.safeCurrencyCode(baseId);
|
|
204
|
-
const quote = this.safeCurrencyCode(quoteId);
|
|
205
|
-
return {
|
|
206
|
-
'id': id,
|
|
207
|
-
'symbol': base + '/' + quote,
|
|
208
|
-
'base': base,
|
|
209
|
-
'quote': quote,
|
|
210
|
-
'settle': undefined,
|
|
211
|
-
'baseId': baseId,
|
|
212
|
-
'quoteId': quoteId,
|
|
213
|
-
'settleId': undefined,
|
|
214
|
-
'type': 'spot',
|
|
215
|
-
'spot': true,
|
|
216
|
-
'margin': false,
|
|
217
|
-
'swap': false,
|
|
218
|
-
'future': false,
|
|
219
|
-
'option': false,
|
|
220
|
-
'active': this.safeValue(entry, 'is_enabled'),
|
|
221
|
-
'contract': false,
|
|
222
|
-
'linear': undefined,
|
|
223
|
-
'inverse': undefined,
|
|
224
|
-
'taker': this.safeNumber(entry, 'taker_fee_rate_quote'),
|
|
225
|
-
'maker': this.safeNumber(entry, 'maker_fee_rate_quote'),
|
|
226
|
-
'contractSize': undefined,
|
|
227
|
-
'expiry': undefined,
|
|
228
|
-
'expiryDatetime': undefined,
|
|
229
|
-
'strike': undefined,
|
|
230
|
-
'optionType': undefined,
|
|
231
|
-
'precision': {
|
|
232
|
-
'amount': this.parseNumber(this.parsePrecision(this.safeString(entry, 'amount_digits'))),
|
|
233
|
-
'price': this.parseNumber(this.parsePrecision(this.safeString(entry, 'price_digits'))),
|
|
234
|
-
},
|
|
235
|
-
'limits': {
|
|
236
|
-
'leverage': {
|
|
237
|
-
'min': undefined,
|
|
238
|
-
'max': undefined,
|
|
239
|
-
},
|
|
240
|
-
'amount': {
|
|
241
|
-
'min': this.safeNumber(entry, 'unit_amount'),
|
|
242
|
-
'max': this.safeNumber(entry, 'limit_max_amount'),
|
|
243
|
-
},
|
|
244
|
-
'price': {
|
|
245
|
-
'min': undefined,
|
|
246
|
-
'max': undefined,
|
|
247
|
-
},
|
|
248
|
-
'cost': {
|
|
249
|
-
'min': undefined,
|
|
250
|
-
'max': undefined,
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
'created': undefined,
|
|
254
|
-
'info': entry,
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
parseTicker(ticker, market = undefined) {
|
|
258
|
-
const symbol = this.safeSymbol(undefined, market);
|
|
259
|
-
const timestamp = this.safeInteger(ticker, 'timestamp');
|
|
260
|
-
const last = this.safeString(ticker, 'last');
|
|
261
|
-
return this.safeTicker({
|
|
262
|
-
'symbol': symbol,
|
|
263
|
-
'timestamp': timestamp,
|
|
264
|
-
'datetime': this.iso8601(timestamp),
|
|
265
|
-
'high': this.safeString(ticker, 'high'),
|
|
266
|
-
'low': this.safeString(ticker, 'low'),
|
|
267
|
-
'bid': this.safeString(ticker, 'buy'),
|
|
268
|
-
'bidVolume': undefined,
|
|
269
|
-
'ask': this.safeString(ticker, 'sell'),
|
|
270
|
-
'askVolume': undefined,
|
|
271
|
-
'vwap': undefined,
|
|
272
|
-
'open': undefined,
|
|
273
|
-
'close': last,
|
|
274
|
-
'last': last,
|
|
275
|
-
'previousClose': undefined,
|
|
276
|
-
'change': undefined,
|
|
277
|
-
'percentage': undefined,
|
|
278
|
-
'average': undefined,
|
|
279
|
-
'baseVolume': this.safeString(ticker, 'vol'),
|
|
280
|
-
'quoteVolume': undefined,
|
|
281
|
-
'info': ticker,
|
|
282
|
-
}, market);
|
|
283
|
-
}
|
|
284
|
-
async fetchTicker(symbol, params = {}) {
|
|
285
|
-
/**
|
|
286
|
-
* @method
|
|
287
|
-
* @name bitbank#fetchTicker
|
|
288
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
289
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#ticker
|
|
290
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
291
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
292
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
293
|
-
*/
|
|
294
|
-
await this.loadMarkets();
|
|
295
|
-
const market = this.market(symbol);
|
|
296
|
-
const request = {
|
|
297
|
-
'pair': market['id'],
|
|
298
|
-
};
|
|
299
|
-
const response = await this.publicGetPairTicker(this.extend(request, params));
|
|
300
|
-
const data = this.safeValue(response, 'data', {});
|
|
301
|
-
return this.parseTicker(data, market);
|
|
302
|
-
}
|
|
303
|
-
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
304
|
-
/**
|
|
305
|
-
* @method
|
|
306
|
-
* @name bitbank#fetchOrderBook
|
|
307
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
308
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#depth
|
|
309
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
310
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
311
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
312
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
313
|
-
*/
|
|
314
|
-
await this.loadMarkets();
|
|
315
|
-
const market = this.market(symbol);
|
|
316
|
-
const request = {
|
|
317
|
-
'pair': market['id'],
|
|
318
|
-
};
|
|
319
|
-
const response = await this.publicGetPairDepth(this.extend(request, params));
|
|
320
|
-
const orderbook = this.safeValue(response, 'data', {});
|
|
321
|
-
const timestamp = this.safeInteger(orderbook, 'timestamp');
|
|
322
|
-
return this.parseOrderBook(orderbook, market['symbol'], timestamp);
|
|
323
|
-
}
|
|
324
|
-
parseTrade(trade, market = undefined) {
|
|
325
|
-
//
|
|
326
|
-
// fetchTrades
|
|
327
|
-
//
|
|
328
|
-
// {
|
|
329
|
-
// "transaction_id": "1143247037",
|
|
330
|
-
// "side": "buy",
|
|
331
|
-
// "price": "3836025",
|
|
332
|
-
// "amount": "0.0005",
|
|
333
|
-
// "executed_at": "1694249441593"
|
|
334
|
-
// }
|
|
335
|
-
//
|
|
336
|
-
const timestamp = this.safeInteger(trade, 'executed_at');
|
|
337
|
-
market = this.safeMarket(undefined, market);
|
|
338
|
-
const priceString = this.safeString(trade, 'price');
|
|
339
|
-
const amountString = this.safeString(trade, 'amount');
|
|
340
|
-
const id = this.safeString2(trade, 'transaction_id', 'trade_id');
|
|
341
|
-
const takerOrMaker = this.safeString(trade, 'maker_taker');
|
|
342
|
-
let fee = undefined;
|
|
343
|
-
const feeCostString = this.safeString(trade, 'fee_amount_quote');
|
|
344
|
-
if (feeCostString !== undefined) {
|
|
345
|
-
fee = {
|
|
346
|
-
'currency': market['quote'],
|
|
347
|
-
'cost': feeCostString,
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
const orderId = this.safeString(trade, 'order_id');
|
|
351
|
-
const type = this.safeString(trade, 'type');
|
|
352
|
-
const side = this.safeString(trade, 'side');
|
|
353
|
-
return this.safeTrade({
|
|
354
|
-
'timestamp': timestamp,
|
|
355
|
-
'datetime': this.iso8601(timestamp),
|
|
356
|
-
'symbol': market['symbol'],
|
|
357
|
-
'id': id,
|
|
358
|
-
'order': orderId,
|
|
359
|
-
'type': type,
|
|
360
|
-
'side': side,
|
|
361
|
-
'takerOrMaker': takerOrMaker,
|
|
362
|
-
'price': priceString,
|
|
363
|
-
'amount': amountString,
|
|
364
|
-
'cost': undefined,
|
|
365
|
-
'fee': fee,
|
|
366
|
-
'info': trade,
|
|
367
|
-
}, market);
|
|
368
|
-
}
|
|
369
|
-
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
370
|
-
/**
|
|
371
|
-
* @method
|
|
372
|
-
* @name bitbank#fetchTrades
|
|
373
|
-
* @description get the list of most recent trades for a particular symbol
|
|
374
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#transactions
|
|
375
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
376
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
377
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
378
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
379
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
380
|
-
*/
|
|
381
|
-
await this.loadMarkets();
|
|
382
|
-
const market = this.market(symbol);
|
|
383
|
-
const request = {
|
|
384
|
-
'pair': market['id'],
|
|
385
|
-
};
|
|
386
|
-
const response = await this.publicGetPairTransactions(this.extend(request, params));
|
|
387
|
-
const data = this.safeValue(response, 'data', {});
|
|
388
|
-
const trades = this.safeValue(data, 'transactions', []);
|
|
389
|
-
return this.parseTrades(trades, market, since, limit);
|
|
390
|
-
}
|
|
391
|
-
async fetchTradingFees(params = {}) {
|
|
392
|
-
/**
|
|
393
|
-
* @method
|
|
394
|
-
* @name bitbank#fetchTradingFees
|
|
395
|
-
* @description fetch the trading fees for multiple markets
|
|
396
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-all-pairs-info
|
|
397
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
398
|
-
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
399
|
-
*/
|
|
400
|
-
await this.loadMarkets();
|
|
401
|
-
const response = await this.marketsGetSpotPairs(params);
|
|
402
|
-
//
|
|
403
|
-
// {
|
|
404
|
-
// "success": "1",
|
|
405
|
-
// "data": {
|
|
406
|
-
// "pairs": [
|
|
407
|
-
// {
|
|
408
|
-
// "name": "btc_jpy",
|
|
409
|
-
// "base_asset": "btc",
|
|
410
|
-
// "quote_asset": "jpy",
|
|
411
|
-
// "maker_fee_rate_base": "0",
|
|
412
|
-
// "taker_fee_rate_base": "0",
|
|
413
|
-
// "maker_fee_rate_quote": "-0.0002",
|
|
414
|
-
// "taker_fee_rate_quote": "0.0012",
|
|
415
|
-
// "unit_amount": "0.0001",
|
|
416
|
-
// "limit_max_amount": "1000",
|
|
417
|
-
// "market_max_amount": "10",
|
|
418
|
-
// "market_allowance_rate": "0.2",
|
|
419
|
-
// "price_digits": "0",
|
|
420
|
-
// "amount_digits": "4",
|
|
421
|
-
// "is_enabled": true,
|
|
422
|
-
// "stop_order": false,
|
|
423
|
-
// "stop_order_and_cancel": false
|
|
424
|
-
// },
|
|
425
|
-
// ...
|
|
426
|
-
// ]
|
|
427
|
-
// }
|
|
428
|
-
// }
|
|
429
|
-
//
|
|
430
|
-
const data = this.safeValue(response, 'data', {});
|
|
431
|
-
const pairs = this.safeValue(data, 'pairs', []);
|
|
432
|
-
const result = {};
|
|
433
|
-
for (let i = 0; i < pairs.length; i++) {
|
|
434
|
-
const pair = pairs[i];
|
|
435
|
-
const marketId = this.safeString(pair, 'name');
|
|
436
|
-
const market = this.safeMarket(marketId);
|
|
437
|
-
const symbol = market['symbol'];
|
|
438
|
-
result[symbol] = {
|
|
439
|
-
'info': pair,
|
|
440
|
-
'symbol': symbol,
|
|
441
|
-
'maker': this.safeNumber(pair, 'maker_fee_rate_quote'),
|
|
442
|
-
'taker': this.safeNumber(pair, 'taker_fee_rate_quote'),
|
|
443
|
-
'percentage': true,
|
|
444
|
-
'tierBased': false,
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
return result;
|
|
448
|
-
}
|
|
449
|
-
parseOHLCV(ohlcv, market = undefined) {
|
|
450
|
-
//
|
|
451
|
-
// [
|
|
452
|
-
// "0.02501786",
|
|
453
|
-
// "0.02501786",
|
|
454
|
-
// "0.02501786",
|
|
455
|
-
// "0.02501786",
|
|
456
|
-
// "0.0000",
|
|
457
|
-
// 1591488000000
|
|
458
|
-
// ]
|
|
459
|
-
//
|
|
460
|
-
return [
|
|
461
|
-
this.safeInteger(ohlcv, 5),
|
|
462
|
-
this.safeNumber(ohlcv, 0),
|
|
463
|
-
this.safeNumber(ohlcv, 1),
|
|
464
|
-
this.safeNumber(ohlcv, 2),
|
|
465
|
-
this.safeNumber(ohlcv, 3),
|
|
466
|
-
this.safeNumber(ohlcv, 4),
|
|
467
|
-
];
|
|
468
|
-
}
|
|
469
|
-
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
470
|
-
/**
|
|
471
|
-
* @method
|
|
472
|
-
* @name bitbank#fetchOHLCV
|
|
473
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
474
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#candlestick
|
|
475
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
476
|
-
* @param {string} timeframe the length of time each candle represents
|
|
477
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
478
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
479
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
480
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
481
|
-
*/
|
|
482
|
-
if (since === undefined) {
|
|
483
|
-
if (limit === undefined) {
|
|
484
|
-
limit = 1000; // it doesn't have any defaults, might return 200, might 2000 (i.e. https://public.bitbank.cc/btc_jpy/candlestick/4hour/2020)
|
|
485
|
-
}
|
|
486
|
-
const duration = this.parseTimeframe(timeframe);
|
|
487
|
-
since = this.milliseconds() - duration * 1000 * limit;
|
|
488
|
-
}
|
|
489
|
-
await this.loadMarkets();
|
|
490
|
-
const market = this.market(symbol);
|
|
491
|
-
const request = {
|
|
492
|
-
'pair': market['id'],
|
|
493
|
-
'candletype': this.safeString(this.timeframes, timeframe, timeframe),
|
|
494
|
-
'yyyymmdd': this.yyyymmdd(since, ''),
|
|
495
|
-
};
|
|
496
|
-
const response = await this.publicGetPairCandlestickCandletypeYyyymmdd(this.extend(request, params));
|
|
497
|
-
//
|
|
498
|
-
// {
|
|
499
|
-
// "success":1,
|
|
500
|
-
// "data":{
|
|
501
|
-
// "candlestick":[
|
|
502
|
-
// {
|
|
503
|
-
// "type":"5min",
|
|
504
|
-
// "ohlcv":[
|
|
505
|
-
// ["0.02501786","0.02501786","0.02501786","0.02501786","0.0000",1591488000000],
|
|
506
|
-
// ["0.02501747","0.02501953","0.02501747","0.02501953","0.3017",1591488300000],
|
|
507
|
-
// ["0.02501762","0.02501762","0.02500392","0.02500392","0.1500",1591488600000],
|
|
508
|
-
// ]
|
|
509
|
-
// }
|
|
510
|
-
// ],
|
|
511
|
-
// "timestamp":1591508668190
|
|
512
|
-
// }
|
|
513
|
-
// }
|
|
514
|
-
//
|
|
515
|
-
const data = this.safeValue(response, 'data', {});
|
|
516
|
-
const candlestick = this.safeValue(data, 'candlestick', []);
|
|
517
|
-
const first = this.safeValue(candlestick, 0, {});
|
|
518
|
-
const ohlcv = this.safeValue(first, 'ohlcv', []);
|
|
519
|
-
return this.parseOHLCVs(ohlcv, market, timeframe, since, limit);
|
|
520
|
-
}
|
|
521
|
-
parseBalance(response) {
|
|
522
|
-
const result = {
|
|
523
|
-
'info': response,
|
|
524
|
-
'timestamp': undefined,
|
|
525
|
-
'datetime': undefined,
|
|
526
|
-
};
|
|
527
|
-
const data = this.safeValue(response, 'data', {});
|
|
528
|
-
const assets = this.safeValue(data, 'assets', []);
|
|
529
|
-
for (let i = 0; i < assets.length; i++) {
|
|
530
|
-
const balance = assets[i];
|
|
531
|
-
const currencyId = this.safeString(balance, 'asset');
|
|
532
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
533
|
-
const account = this.account();
|
|
534
|
-
account['free'] = this.safeString(balance, 'free_amount');
|
|
535
|
-
account['used'] = this.safeString(balance, 'locked_amount');
|
|
536
|
-
account['total'] = this.safeString(balance, 'onhand_amount');
|
|
537
|
-
result[code] = account;
|
|
538
|
-
}
|
|
539
|
-
return this.safeBalance(result);
|
|
540
|
-
}
|
|
541
|
-
async fetchBalance(params = {}) {
|
|
542
|
-
/**
|
|
543
|
-
* @method
|
|
544
|
-
* @name bitbank#fetchBalance
|
|
545
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
546
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#assets
|
|
547
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
548
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
549
|
-
*/
|
|
550
|
-
await this.loadMarkets();
|
|
551
|
-
const response = await this.privateGetUserAssets(params);
|
|
552
|
-
//
|
|
553
|
-
// {
|
|
554
|
-
// "success": "1",
|
|
555
|
-
// "data": {
|
|
556
|
-
// "assets": [
|
|
557
|
-
// {
|
|
558
|
-
// "asset": "jpy",
|
|
559
|
-
// "amount_precision": "4",
|
|
560
|
-
// "onhand_amount": "0.0000",
|
|
561
|
-
// "locked_amount": "0.0000",
|
|
562
|
-
// "free_amount": "0.0000",
|
|
563
|
-
// "stop_deposit": false,
|
|
564
|
-
// "stop_withdrawal": false,
|
|
565
|
-
// "withdrawal_fee": {
|
|
566
|
-
// "threshold": "30000.0000",
|
|
567
|
-
// "under": "550.0000",
|
|
568
|
-
// "over": "770.0000"
|
|
569
|
-
// }
|
|
570
|
-
// },
|
|
571
|
-
// {
|
|
572
|
-
// "asset": "btc",
|
|
573
|
-
// "amount_precision": "8",
|
|
574
|
-
// "onhand_amount": "0.00000000",
|
|
575
|
-
// "locked_amount": "0.00000000",
|
|
576
|
-
// "free_amount": "0.00000000",
|
|
577
|
-
// "stop_deposit": false,
|
|
578
|
-
// "stop_withdrawal": false,
|
|
579
|
-
// "withdrawal_fee": "0.00060000"
|
|
580
|
-
// },
|
|
581
|
-
// ]
|
|
582
|
-
// }
|
|
583
|
-
// }
|
|
584
|
-
//
|
|
585
|
-
return this.parseBalance(response);
|
|
586
|
-
}
|
|
587
|
-
parseOrderStatus(status) {
|
|
588
|
-
const statuses = {
|
|
589
|
-
'UNFILLED': 'open',
|
|
590
|
-
'PARTIALLY_FILLED': 'open',
|
|
591
|
-
'FULLY_FILLED': 'closed',
|
|
592
|
-
'CANCELED_UNFILLED': 'canceled',
|
|
593
|
-
'CANCELED_PARTIALLY_FILLED': 'canceled',
|
|
594
|
-
};
|
|
595
|
-
return this.safeString(statuses, status, status);
|
|
596
|
-
}
|
|
597
|
-
parseOrder(order, market = undefined) {
|
|
598
|
-
const id = this.safeString(order, 'order_id');
|
|
599
|
-
const marketId = this.safeString(order, 'pair');
|
|
600
|
-
market = this.safeMarket(marketId, market);
|
|
601
|
-
const timestamp = this.safeInteger(order, 'ordered_at');
|
|
602
|
-
const price = this.safeString(order, 'price');
|
|
603
|
-
const amount = this.safeString(order, 'start_amount');
|
|
604
|
-
const filled = this.safeString(order, 'executed_amount');
|
|
605
|
-
const remaining = this.safeString(order, 'remaining_amount');
|
|
606
|
-
const average = this.safeString(order, 'average_price');
|
|
607
|
-
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
608
|
-
const type = this.safeStringLower(order, 'type');
|
|
609
|
-
const side = this.safeStringLower(order, 'side');
|
|
610
|
-
return this.safeOrder({
|
|
611
|
-
'id': id,
|
|
612
|
-
'clientOrderId': undefined,
|
|
613
|
-
'datetime': this.iso8601(timestamp),
|
|
614
|
-
'timestamp': timestamp,
|
|
615
|
-
'lastTradeTimestamp': undefined,
|
|
616
|
-
'status': status,
|
|
617
|
-
'symbol': market['symbol'],
|
|
618
|
-
'type': type,
|
|
619
|
-
'timeInForce': undefined,
|
|
620
|
-
'postOnly': undefined,
|
|
621
|
-
'side': side,
|
|
622
|
-
'price': price,
|
|
623
|
-
'stopPrice': undefined,
|
|
624
|
-
'triggerPrice': undefined,
|
|
625
|
-
'cost': undefined,
|
|
626
|
-
'average': average,
|
|
627
|
-
'amount': amount,
|
|
628
|
-
'filled': filled,
|
|
629
|
-
'remaining': remaining,
|
|
630
|
-
'trades': undefined,
|
|
631
|
-
'fee': undefined,
|
|
632
|
-
'info': order,
|
|
633
|
-
}, market);
|
|
634
|
-
}
|
|
635
|
-
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
636
|
-
/**
|
|
637
|
-
* @method
|
|
638
|
-
* @name bitbank#createOrder
|
|
639
|
-
* @description create a trade order
|
|
640
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#create-new-order
|
|
641
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
642
|
-
* @param {string} type 'market' or 'limit'
|
|
643
|
-
* @param {string} side 'buy' or 'sell'
|
|
644
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
645
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
646
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
647
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
648
|
-
*/
|
|
649
|
-
await this.loadMarkets();
|
|
650
|
-
const market = this.market(symbol);
|
|
651
|
-
const request = {
|
|
652
|
-
'pair': market['id'],
|
|
653
|
-
'amount': this.amountToPrecision(symbol, amount),
|
|
654
|
-
'side': side,
|
|
655
|
-
'type': type,
|
|
656
|
-
};
|
|
657
|
-
if (type === 'limit') {
|
|
658
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
659
|
-
}
|
|
660
|
-
const response = await this.privatePostUserSpotOrder(this.extend(request, params));
|
|
661
|
-
const data = this.safeValue(response, 'data');
|
|
662
|
-
return this.parseOrder(data, market);
|
|
663
|
-
}
|
|
664
|
-
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
665
|
-
/**
|
|
666
|
-
* @method
|
|
667
|
-
* @name bitbank#cancelOrder
|
|
668
|
-
* @description cancels an open order
|
|
669
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#cancel-order
|
|
670
|
-
* @param {string} id order id
|
|
671
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
672
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
673
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
674
|
-
*/
|
|
675
|
-
await this.loadMarkets();
|
|
676
|
-
const market = this.market(symbol);
|
|
677
|
-
const request = {
|
|
678
|
-
'order_id': id,
|
|
679
|
-
'pair': market['id'],
|
|
680
|
-
};
|
|
681
|
-
const response = await this.privatePostUserSpotCancelOrder(this.extend(request, params));
|
|
682
|
-
const data = this.safeValue(response, 'data');
|
|
683
|
-
return data;
|
|
684
|
-
}
|
|
685
|
-
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
686
|
-
/**
|
|
687
|
-
* @method
|
|
688
|
-
* @name bitbank#fetchOrder
|
|
689
|
-
* @description fetches information on an order made by the user
|
|
690
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#fetch-order-information
|
|
691
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
692
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
693
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
694
|
-
*/
|
|
695
|
-
await this.loadMarkets();
|
|
696
|
-
const market = this.market(symbol);
|
|
697
|
-
const request = {
|
|
698
|
-
'order_id': id,
|
|
699
|
-
'pair': market['id'],
|
|
700
|
-
};
|
|
701
|
-
const response = await this.privateGetUserSpotOrder(this.extend(request, params));
|
|
702
|
-
const data = this.safeValue(response, 'data');
|
|
703
|
-
return this.parseOrder(data, market);
|
|
704
|
-
}
|
|
705
|
-
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
706
|
-
/**
|
|
707
|
-
* @method
|
|
708
|
-
* @name bitbank#fetchOpenOrders
|
|
709
|
-
* @description fetch all unfilled currently open orders
|
|
710
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#fetch-active-orders
|
|
711
|
-
* @param {string} symbol unified market symbol
|
|
712
|
-
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
713
|
-
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
714
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
715
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
716
|
-
*/
|
|
717
|
-
await this.loadMarkets();
|
|
718
|
-
const market = this.market(symbol);
|
|
719
|
-
const request = {
|
|
720
|
-
'pair': market['id'],
|
|
721
|
-
};
|
|
722
|
-
if (limit !== undefined) {
|
|
723
|
-
request['count'] = limit;
|
|
724
|
-
}
|
|
725
|
-
if (since !== undefined) {
|
|
726
|
-
request['since'] = this.parseToInt(since / 1000);
|
|
727
|
-
}
|
|
728
|
-
const response = await this.privateGetUserSpotActiveOrders(this.extend(request, params));
|
|
729
|
-
const data = this.safeValue(response, 'data', {});
|
|
730
|
-
const orders = this.safeValue(data, 'orders', []);
|
|
731
|
-
return this.parseOrders(orders, market, since, limit);
|
|
732
|
-
}
|
|
733
|
-
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
734
|
-
/**
|
|
735
|
-
* @method
|
|
736
|
-
* @name bitbank#fetchMyTrades
|
|
737
|
-
* @description fetch all trades made by the user
|
|
738
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#fetch-trade-history
|
|
739
|
-
* @param {string} symbol unified market symbol
|
|
740
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
741
|
-
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
742
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
743
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
744
|
-
*/
|
|
745
|
-
await this.loadMarkets();
|
|
746
|
-
const request = {};
|
|
747
|
-
let market = undefined;
|
|
748
|
-
if (symbol !== undefined) {
|
|
749
|
-
market = this.market(symbol);
|
|
750
|
-
request['pair'] = market['id'];
|
|
751
|
-
}
|
|
752
|
-
if (limit !== undefined) {
|
|
753
|
-
request['count'] = limit;
|
|
754
|
-
}
|
|
755
|
-
if (since !== undefined) {
|
|
756
|
-
request['since'] = this.parseToInt(since / 1000);
|
|
757
|
-
}
|
|
758
|
-
const response = await this.privateGetUserSpotTradeHistory(this.extend(request, params));
|
|
759
|
-
const data = this.safeValue(response, 'data', {});
|
|
760
|
-
const trades = this.safeValue(data, 'trades', []);
|
|
761
|
-
return this.parseTrades(trades, market, since, limit);
|
|
762
|
-
}
|
|
763
|
-
async fetchDepositAddress(code, params = {}) {
|
|
764
|
-
/**
|
|
765
|
-
* @method
|
|
766
|
-
* @name bitbank#fetchDepositAddress
|
|
767
|
-
* @description fetch the deposit address for a currency associated with this account
|
|
768
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-withdrawal-accounts
|
|
769
|
-
* @param {string} code unified currency code
|
|
770
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
771
|
-
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
772
|
-
*/
|
|
773
|
-
await this.loadMarkets();
|
|
774
|
-
const currency = this.currency(code);
|
|
775
|
-
const request = {
|
|
776
|
-
'asset': currency['id'],
|
|
777
|
-
};
|
|
778
|
-
const response = await this.privateGetUserWithdrawalAccount(this.extend(request, params));
|
|
779
|
-
const data = this.safeValue(response, 'data', {});
|
|
780
|
-
// Not sure about this if there could be more than one account...
|
|
781
|
-
const accounts = this.safeValue(data, 'accounts', []);
|
|
782
|
-
const firstAccount = this.safeValue(accounts, 0, {});
|
|
783
|
-
const address = this.safeString(firstAccount, 'address');
|
|
784
|
-
return {
|
|
785
|
-
'currency': currency,
|
|
786
|
-
'address': address,
|
|
787
|
-
'tag': undefined,
|
|
788
|
-
'network': undefined,
|
|
789
|
-
'info': response,
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
793
|
-
/**
|
|
794
|
-
* @method
|
|
795
|
-
* @name bitbank#withdraw
|
|
796
|
-
* @description make a withdrawal
|
|
797
|
-
* @see https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#new-withdrawal-request
|
|
798
|
-
* @param {string} code unified currency code
|
|
799
|
-
* @param {float} amount the amount to withdraw
|
|
800
|
-
* @param {string} address the address to withdraw to
|
|
801
|
-
* @param {string} tag
|
|
802
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
803
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
804
|
-
*/
|
|
805
|
-
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
806
|
-
if (!('uuid' in params)) {
|
|
807
|
-
throw new errors.ExchangeError(this.id + ' uuid is required for withdrawal');
|
|
808
|
-
}
|
|
809
|
-
await this.loadMarkets();
|
|
810
|
-
const currency = this.currency(code);
|
|
811
|
-
const request = {
|
|
812
|
-
'asset': currency['id'],
|
|
813
|
-
'amount': amount,
|
|
814
|
-
};
|
|
815
|
-
const response = await this.privatePostUserRequestWithdrawal(this.extend(request, params));
|
|
816
|
-
//
|
|
817
|
-
// {
|
|
818
|
-
// "success": 1,
|
|
819
|
-
// "data": {
|
|
820
|
-
// "uuid": "string",
|
|
821
|
-
// "asset": "btc",
|
|
822
|
-
// "amount": 0,
|
|
823
|
-
// "account_uuid": "string",
|
|
824
|
-
// "fee": 0,
|
|
825
|
-
// "status": "DONE",
|
|
826
|
-
// "label": "string",
|
|
827
|
-
// "txid": "string",
|
|
828
|
-
// "address": "string",
|
|
829
|
-
// "requested_at": 0
|
|
830
|
-
// }
|
|
831
|
-
// }
|
|
832
|
-
//
|
|
833
|
-
const data = this.safeValue(response, 'data', {});
|
|
834
|
-
return this.parseTransaction(data, currency);
|
|
835
|
-
}
|
|
836
|
-
parseTransaction(transaction, currency = undefined) {
|
|
837
|
-
//
|
|
838
|
-
// withdraw
|
|
839
|
-
//
|
|
840
|
-
// {
|
|
841
|
-
// "uuid": "string",
|
|
842
|
-
// "asset": "btc",
|
|
843
|
-
// "amount": 0,
|
|
844
|
-
// "account_uuid": "string",
|
|
845
|
-
// "fee": 0,
|
|
846
|
-
// "status": "DONE",
|
|
847
|
-
// "label": "string",
|
|
848
|
-
// "txid": "string",
|
|
849
|
-
// "address": "string",
|
|
850
|
-
// "requested_at": 0
|
|
851
|
-
// }
|
|
852
|
-
//
|
|
853
|
-
const txid = this.safeString(transaction, 'txid');
|
|
854
|
-
currency = this.safeCurrency(undefined, currency);
|
|
855
|
-
return {
|
|
856
|
-
'id': txid,
|
|
857
|
-
'txid': txid,
|
|
858
|
-
'timestamp': undefined,
|
|
859
|
-
'datetime': undefined,
|
|
860
|
-
'network': undefined,
|
|
861
|
-
'addressFrom': undefined,
|
|
862
|
-
'address': undefined,
|
|
863
|
-
'addressTo': undefined,
|
|
864
|
-
'amount': undefined,
|
|
865
|
-
'type': undefined,
|
|
866
|
-
'currency': currency['code'],
|
|
867
|
-
'status': undefined,
|
|
868
|
-
'updated': undefined,
|
|
869
|
-
'tagFrom': undefined,
|
|
870
|
-
'tag': undefined,
|
|
871
|
-
'tagTo': undefined,
|
|
872
|
-
'comment': undefined,
|
|
873
|
-
'internal': undefined,
|
|
874
|
-
'fee': undefined,
|
|
875
|
-
'info': transaction,
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
nonce() {
|
|
879
|
-
return this.milliseconds();
|
|
880
|
-
}
|
|
881
|
-
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
882
|
-
let query = this.omit(params, this.extractParams(path));
|
|
883
|
-
let url = this.implodeHostname(this.urls['api'][api]) + '/';
|
|
884
|
-
if ((api === 'public') || (api === 'markets')) {
|
|
885
|
-
url += this.implodeParams(path, params);
|
|
886
|
-
if (Object.keys(query).length) {
|
|
887
|
-
url += '?' + this.urlencode(query);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
else {
|
|
891
|
-
this.checkRequiredCredentials();
|
|
892
|
-
const nonce = this.nonce().toString();
|
|
893
|
-
let auth = nonce;
|
|
894
|
-
url += this.version + '/' + this.implodeParams(path, params);
|
|
895
|
-
if (method === 'POST') {
|
|
896
|
-
body = this.json(query);
|
|
897
|
-
auth += body;
|
|
898
|
-
}
|
|
899
|
-
else {
|
|
900
|
-
auth += '/' + this.version + '/' + path;
|
|
901
|
-
if (Object.keys(query).length) {
|
|
902
|
-
query = this.urlencode(query);
|
|
903
|
-
url += '?' + query;
|
|
904
|
-
auth += '?' + query;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
headers = {
|
|
908
|
-
'Content-Type': 'application/json',
|
|
909
|
-
'ACCESS-KEY': this.apiKey,
|
|
910
|
-
'ACCESS-NONCE': nonce,
|
|
911
|
-
'ACCESS-SIGNATURE': this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256),
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
915
|
-
}
|
|
916
|
-
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
917
|
-
if (response === undefined) {
|
|
918
|
-
return undefined;
|
|
919
|
-
}
|
|
920
|
-
const success = this.safeInteger(response, 'success');
|
|
921
|
-
const data = this.safeValue(response, 'data');
|
|
922
|
-
if (!success || !data) {
|
|
923
|
-
const errorMessages = {
|
|
924
|
-
'10000': 'URL does not exist',
|
|
925
|
-
'10001': 'A system error occurred. Please contact support',
|
|
926
|
-
'10002': 'Invalid JSON format. Please check the contents of transmission',
|
|
927
|
-
'10003': 'A system error occurred. Please contact support',
|
|
928
|
-
'10005': 'A timeout error occurred. Please wait for a while and try again',
|
|
929
|
-
'20001': 'API authentication failed',
|
|
930
|
-
'20002': 'Illegal API key',
|
|
931
|
-
'20003': 'API key does not exist',
|
|
932
|
-
'20004': 'API Nonce does not exist',
|
|
933
|
-
'20005': 'API signature does not exist',
|
|
934
|
-
'20011': 'Two-step verification failed',
|
|
935
|
-
'20014': 'SMS authentication failed',
|
|
936
|
-
'30001': 'Please specify the order quantity',
|
|
937
|
-
'30006': 'Please specify the order ID',
|
|
938
|
-
'30007': 'Please specify the order ID array',
|
|
939
|
-
'30009': 'Please specify the stock',
|
|
940
|
-
'30012': 'Please specify the order price',
|
|
941
|
-
'30013': 'Trade Please specify either',
|
|
942
|
-
'30015': 'Please specify the order type',
|
|
943
|
-
'30016': 'Please specify asset name',
|
|
944
|
-
'30019': 'Please specify uuid',
|
|
945
|
-
'30039': 'Please specify the amount to be withdrawn',
|
|
946
|
-
'40001': 'The order quantity is invalid',
|
|
947
|
-
'40006': 'Count value is invalid',
|
|
948
|
-
'40007': 'End time is invalid',
|
|
949
|
-
'40008': 'end_id Value is invalid',
|
|
950
|
-
'40009': 'The from_id value is invalid',
|
|
951
|
-
'40013': 'The order ID is invalid',
|
|
952
|
-
'40014': 'The order ID array is invalid',
|
|
953
|
-
'40015': 'Too many specified orders',
|
|
954
|
-
'40017': 'Incorrect issue name',
|
|
955
|
-
'40020': 'The order price is invalid',
|
|
956
|
-
'40021': 'The trading classification is invalid',
|
|
957
|
-
'40022': 'Start date is invalid',
|
|
958
|
-
'40024': 'The order type is invalid',
|
|
959
|
-
'40025': 'Incorrect asset name',
|
|
960
|
-
'40028': 'uuid is invalid',
|
|
961
|
-
'40048': 'The amount of withdrawal is illegal',
|
|
962
|
-
'50003': 'Currently, this account is in a state where you can not perform the operation you specified. Please contact support',
|
|
963
|
-
'50004': 'Currently, this account is temporarily registered. Please try again after registering your account',
|
|
964
|
-
'50005': 'Currently, this account is locked. Please contact support',
|
|
965
|
-
'50006': 'Currently, this account is locked. Please contact support',
|
|
966
|
-
'50008': 'User identification has not been completed',
|
|
967
|
-
'50009': 'Your order does not exist',
|
|
968
|
-
'50010': 'Can not cancel specified order',
|
|
969
|
-
'50011': 'API not found',
|
|
970
|
-
'60001': 'The number of possessions is insufficient',
|
|
971
|
-
'60002': 'It exceeds the quantity upper limit of the tender buying order',
|
|
972
|
-
'60003': 'The specified quantity exceeds the limit',
|
|
973
|
-
'60004': 'The specified quantity is below the threshold',
|
|
974
|
-
'60005': 'The specified price is above the limit',
|
|
975
|
-
'60006': 'The specified price is below the lower limit',
|
|
976
|
-
'70001': 'A system error occurred. Please contact support',
|
|
977
|
-
'70002': 'A system error occurred. Please contact support',
|
|
978
|
-
'70003': 'A system error occurred. Please contact support',
|
|
979
|
-
'70004': 'We are unable to accept orders as the transaction is currently suspended',
|
|
980
|
-
'70005': 'Order can not be accepted because purchase order is currently suspended',
|
|
981
|
-
'70006': 'We can not accept orders because we are currently unsubscribed ',
|
|
982
|
-
'70009': 'We are currently temporarily restricting orders to be carried out. Please use the limit order.',
|
|
983
|
-
'70010': 'We are temporarily raising the minimum order quantity as the system load is now rising.',
|
|
984
|
-
};
|
|
985
|
-
const errorClasses = this.exceptions;
|
|
986
|
-
const code = this.safeString(data, 'code');
|
|
987
|
-
const message = this.safeString(errorMessages, code, 'Error');
|
|
988
|
-
const ErrorClass = this.safeValue(errorClasses, code);
|
|
989
|
-
if (ErrorClass !== undefined) {
|
|
990
|
-
throw new errorClasses[code](message);
|
|
991
|
-
}
|
|
992
|
-
else {
|
|
993
|
-
throw new errors.ExchangeError(this.id + ' ' + this.json(response));
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
return undefined;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
module.exports = bitbank;
|