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,1729 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var latoken$1 = require('./abstract/latoken.js');
|
|
4
|
-
var errors = require('./base/errors.js');
|
|
5
|
-
var number = require('./base/functions/number.js');
|
|
6
|
-
var sha512 = require('./static_dependencies/noble-hashes/sha512.js');
|
|
7
|
-
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
/**
|
|
11
|
-
* @class latoken
|
|
12
|
-
* @augments Exchange
|
|
13
|
-
*/
|
|
14
|
-
class latoken extends latoken$1 {
|
|
15
|
-
describe() {
|
|
16
|
-
return this.deepExtend(super.describe(), {
|
|
17
|
-
'id': 'latoken',
|
|
18
|
-
'name': 'Latoken',
|
|
19
|
-
'countries': ['KY'],
|
|
20
|
-
'version': 'v2',
|
|
21
|
-
'rateLimit': 1000,
|
|
22
|
-
'has': {
|
|
23
|
-
'CORS': undefined,
|
|
24
|
-
'spot': true,
|
|
25
|
-
'margin': false,
|
|
26
|
-
'swap': false,
|
|
27
|
-
'future': false,
|
|
28
|
-
'option': false,
|
|
29
|
-
'cancelAllOrders': true,
|
|
30
|
-
'cancelOrder': true,
|
|
31
|
-
'closeAllPositions': false,
|
|
32
|
-
'closePosition': false,
|
|
33
|
-
'createOrder': true,
|
|
34
|
-
'createPostOnlyOrder': false,
|
|
35
|
-
'createStopLimitOrder': true,
|
|
36
|
-
'createStopMarketOrder': false,
|
|
37
|
-
'createStopOrder': true,
|
|
38
|
-
'fetchBalance': true,
|
|
39
|
-
'fetchBorrowRateHistories': false,
|
|
40
|
-
'fetchBorrowRateHistory': false,
|
|
41
|
-
'fetchCrossBorrowRate': false,
|
|
42
|
-
'fetchCrossBorrowRates': false,
|
|
43
|
-
'fetchCurrencies': true,
|
|
44
|
-
'fetchDepositsWithdrawals': true,
|
|
45
|
-
'fetchDepositWithdrawFees': false,
|
|
46
|
-
'fetchIsolatedBorrowRate': false,
|
|
47
|
-
'fetchIsolatedBorrowRates': false,
|
|
48
|
-
'fetchMarginMode': false,
|
|
49
|
-
'fetchMarkets': true,
|
|
50
|
-
'fetchMyTrades': true,
|
|
51
|
-
'fetchOpenOrders': true,
|
|
52
|
-
'fetchOrder': true,
|
|
53
|
-
'fetchOrderBook': true,
|
|
54
|
-
'fetchOrders': true,
|
|
55
|
-
'fetchPositionMode': false,
|
|
56
|
-
'fetchTicker': true,
|
|
57
|
-
'fetchTickers': true,
|
|
58
|
-
'fetchTime': true,
|
|
59
|
-
'fetchTrades': true,
|
|
60
|
-
'fetchTradingFee': true,
|
|
61
|
-
'fetchTradingFees': false,
|
|
62
|
-
'fetchTransactions': 'emulated',
|
|
63
|
-
'fetchTransfer': false,
|
|
64
|
-
'fetchTransfers': true,
|
|
65
|
-
'transfer': true,
|
|
66
|
-
},
|
|
67
|
-
'urls': {
|
|
68
|
-
'logo': 'https://user-images.githubusercontent.com/1294454/61511972-24c39f00-aa01-11e9-9f7c-471f1d6e5214.jpg',
|
|
69
|
-
'api': {
|
|
70
|
-
'rest': 'https://api.latoken.com',
|
|
71
|
-
},
|
|
72
|
-
'www': 'https://latoken.com',
|
|
73
|
-
'doc': [
|
|
74
|
-
'https://api.latoken.com',
|
|
75
|
-
],
|
|
76
|
-
'fees': 'https://latoken.com/fees',
|
|
77
|
-
'referral': 'https://latoken.com/invite?r=mvgp2djk',
|
|
78
|
-
},
|
|
79
|
-
'api': {
|
|
80
|
-
'public': {
|
|
81
|
-
'get': {
|
|
82
|
-
'book/{currency}/{quote}': 1,
|
|
83
|
-
'chart/week': 1,
|
|
84
|
-
'chart/week/{currency}/{quote}': 1,
|
|
85
|
-
'currency': 1,
|
|
86
|
-
'currency/available': 1,
|
|
87
|
-
'currency/quotes': 1,
|
|
88
|
-
'currency/{currency}': 1,
|
|
89
|
-
'pair': 1,
|
|
90
|
-
'pair/available': 1,
|
|
91
|
-
'ticker': 1,
|
|
92
|
-
'ticker/{base}/{quote}': 1,
|
|
93
|
-
'time': 1,
|
|
94
|
-
'trade/history/{currency}/{quote}': 1,
|
|
95
|
-
'trade/fee/{currency}/{quote}': 1,
|
|
96
|
-
'trade/feeLevels': 1,
|
|
97
|
-
'transaction/bindings': 1,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
'private': {
|
|
101
|
-
'get': {
|
|
102
|
-
'auth/account': 1,
|
|
103
|
-
'auth/account/currency/{currency}/{type}': 1,
|
|
104
|
-
'auth/order': 1,
|
|
105
|
-
'auth/order/getOrder/{id}': 1,
|
|
106
|
-
'auth/order/pair/{currency}/{quote}': 1,
|
|
107
|
-
'auth/order/pair/{currency}/{quote}/active': 1,
|
|
108
|
-
'auth/stopOrder': 1,
|
|
109
|
-
'auth/stopOrder/getOrder/{id}': 1,
|
|
110
|
-
'auth/stopOrder/pair/{currency}/{quote}': 1,
|
|
111
|
-
'auth/stopOrder/pair/{currency}/{quote}/active': 1,
|
|
112
|
-
'auth/trade': 1,
|
|
113
|
-
'auth/trade/pair/{currency}/{quote}': 1,
|
|
114
|
-
'auth/trade/fee/{currency}/{quote}': 1,
|
|
115
|
-
'auth/transaction': 1,
|
|
116
|
-
'auth/transaction/bindings': 1,
|
|
117
|
-
'auth/transaction/bindings/{currency}': 1,
|
|
118
|
-
'auth/transaction/{id}': 1,
|
|
119
|
-
'auth/transfer': 1,
|
|
120
|
-
},
|
|
121
|
-
'post': {
|
|
122
|
-
'auth/order/cancel': 1,
|
|
123
|
-
'auth/order/cancelAll': 1,
|
|
124
|
-
'auth/order/cancelAll/{currency}/{quote}': 1,
|
|
125
|
-
'auth/order/place': 1,
|
|
126
|
-
'auth/spot/deposit': 1,
|
|
127
|
-
'auth/spot/withdraw': 1,
|
|
128
|
-
'auth/stopOrder/cancel': 1,
|
|
129
|
-
'auth/stopOrder/cancelAll': 1,
|
|
130
|
-
'auth/stopOrder/cancelAll/{currency}/{quote}': 1,
|
|
131
|
-
'auth/stopOrder/place': 1,
|
|
132
|
-
'auth/transaction/depositAddress': 1,
|
|
133
|
-
'auth/transaction/withdraw': 1,
|
|
134
|
-
'auth/transaction/withdraw/cancel': 1,
|
|
135
|
-
'auth/transaction/withdraw/confirm': 1,
|
|
136
|
-
'auth/transaction/withdraw/resendCode': 1,
|
|
137
|
-
'auth/transfer/email': 1,
|
|
138
|
-
'auth/transfer/id': 1,
|
|
139
|
-
'auth/transfer/phone': 1,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
'precisionMode': number.TICK_SIZE,
|
|
144
|
-
'fees': {
|
|
145
|
-
'trading': {
|
|
146
|
-
'feeSide': 'get',
|
|
147
|
-
'tierBased': false,
|
|
148
|
-
'percentage': true,
|
|
149
|
-
'maker': this.parseNumber('0.0049'),
|
|
150
|
-
'taker': this.parseNumber('0.0049'),
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
'commonCurrencies': {
|
|
154
|
-
'BUX': 'Buxcoin',
|
|
155
|
-
'CBT': 'Community Business Token',
|
|
156
|
-
'CTC': 'CyberTronchain',
|
|
157
|
-
'DMD': 'Diamond Coin',
|
|
158
|
-
'FREN': 'Frenchie',
|
|
159
|
-
'GDX': 'GoldenX',
|
|
160
|
-
'GEC': 'Geco One',
|
|
161
|
-
'GEM': 'NFTmall',
|
|
162
|
-
'GMT': 'GMT Token',
|
|
163
|
-
'IMC': 'IMCoin',
|
|
164
|
-
'MT': 'Monarch',
|
|
165
|
-
'TPAY': 'Tetra Pay',
|
|
166
|
-
'TRADE': 'Smart Trade Coin',
|
|
167
|
-
'TSL': 'Treasure SL',
|
|
168
|
-
'UNO': 'Unobtanium',
|
|
169
|
-
'WAR': 'Warrior Token',
|
|
170
|
-
},
|
|
171
|
-
'exceptions': {
|
|
172
|
-
'exact': {
|
|
173
|
-
'INTERNAL_ERROR': errors.ExchangeError,
|
|
174
|
-
'SERVICE_UNAVAILABLE': errors.ExchangeNotAvailable,
|
|
175
|
-
'NOT_AUTHORIZED': errors.AuthenticationError,
|
|
176
|
-
'FORBIDDEN': errors.PermissionDenied,
|
|
177
|
-
'BAD_REQUEST': errors.BadRequest,
|
|
178
|
-
'NOT_FOUND': errors.ExchangeError,
|
|
179
|
-
'ACCESS_DENIED': errors.PermissionDenied,
|
|
180
|
-
'REQUEST_REJECTED': errors.ExchangeError,
|
|
181
|
-
'HTTP_MEDIA_TYPE_NOT_SUPPORTED': errors.BadRequest,
|
|
182
|
-
'MEDIA_TYPE_NOT_ACCEPTABLE': errors.BadRequest,
|
|
183
|
-
'METHOD_ARGUMENT_NOT_VALID': errors.BadRequest,
|
|
184
|
-
'VALIDATION_ERROR': errors.BadRequest,
|
|
185
|
-
'ACCOUNT_EXPIRED': errors.AccountSuspended,
|
|
186
|
-
'BAD_CREDENTIALS': errors.AuthenticationError,
|
|
187
|
-
'COOKIE_THEFT': errors.AuthenticationError,
|
|
188
|
-
'CREDENTIALS_EXPIRED': errors.AccountSuspended,
|
|
189
|
-
'INSUFFICIENT_AUTHENTICATION': errors.AuthenticationError,
|
|
190
|
-
'UNKNOWN_LOCATION': errors.AuthenticationError,
|
|
191
|
-
'TOO_MANY_REQUESTS': errors.RateLimitExceeded,
|
|
192
|
-
'INSUFFICIENT_FUNDS': errors.InsufficientFunds,
|
|
193
|
-
'ORDER_VALIDATION': errors.InvalidOrder,
|
|
194
|
-
'BAD_TICKS': errors.InvalidOrder, // {"status":"FAILURE","message":"Quantity (1.4) does not match quantity tick (10)","error":"BAD_TICKS","errors":null,"result":false}
|
|
195
|
-
},
|
|
196
|
-
'broad': {
|
|
197
|
-
'invalid API key, signature or digest': errors.AuthenticationError,
|
|
198
|
-
'The API key was revoked': errors.AuthenticationError,
|
|
199
|
-
'request expired or bad': errors.InvalidNonce,
|
|
200
|
-
'For input string': errors.BadRequest,
|
|
201
|
-
'Unable to resolve currency by tag': errors.BadSymbol,
|
|
202
|
-
"Can't find currency with tag": errors.BadSymbol,
|
|
203
|
-
'Unable to place order because pair is in inactive state': errors.BadSymbol,
|
|
204
|
-
'API keys are not available for': errors.AccountSuspended, // {"result":false,"message":"API keys are not available for FROZEN user","error":"BAD_REQUEST","status":"FAILURE"}
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
'options': {
|
|
208
|
-
'defaultType': 'spot',
|
|
209
|
-
'types': {
|
|
210
|
-
'wallet': 'ACCOUNT_TYPE_WALLET',
|
|
211
|
-
'funding': 'ACCOUNT_TYPE_WALLET',
|
|
212
|
-
'spot': 'ACCOUNT_TYPE_SPOT',
|
|
213
|
-
},
|
|
214
|
-
'accounts': {
|
|
215
|
-
'ACCOUNT_TYPE_WALLET': 'wallet',
|
|
216
|
-
'ACCOUNT_TYPE_SPOT': 'spot',
|
|
217
|
-
},
|
|
218
|
-
'fetchTradingFee': {
|
|
219
|
-
'method': 'fetchPrivateTradingFee', // or 'fetchPublicTradingFee'
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
nonce() {
|
|
225
|
-
return this.milliseconds() - this.options['timeDifference'];
|
|
226
|
-
}
|
|
227
|
-
async fetchTime(params = {}) {
|
|
228
|
-
/**
|
|
229
|
-
* @method
|
|
230
|
-
* @name latoken#fetchTime
|
|
231
|
-
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
232
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
233
|
-
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
234
|
-
*/
|
|
235
|
-
const response = await this.publicGetTime(params);
|
|
236
|
-
//
|
|
237
|
-
// {
|
|
238
|
-
// "serverTime": 1570615577321
|
|
239
|
-
// }
|
|
240
|
-
//
|
|
241
|
-
return this.safeInteger(response, 'serverTime');
|
|
242
|
-
}
|
|
243
|
-
async fetchMarkets(params = {}) {
|
|
244
|
-
/**
|
|
245
|
-
* @method
|
|
246
|
-
* @name latoken#fetchMarkets
|
|
247
|
-
* @description retrieves data on all markets for latoken
|
|
248
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
249
|
-
* @returns {object[]} an array of objects representing market data
|
|
250
|
-
*/
|
|
251
|
-
const currencies = await this.fetchCurrenciesFromCache(params);
|
|
252
|
-
//
|
|
253
|
-
// [
|
|
254
|
-
// {
|
|
255
|
-
// "id":"1a075819-9e0b-48fc-8784-4dab1d186d6d",
|
|
256
|
-
// "status":"CURRENCY_STATUS_ACTIVE",
|
|
257
|
-
// "type":"CURRENCY_TYPE_ALTERNATIVE", // CURRENCY_TYPE_CRYPTO, CURRENCY_TYPE_IEO
|
|
258
|
-
// "name":"MyCryptoBank",
|
|
259
|
-
// "tag":"MCB",
|
|
260
|
-
// "description":"",
|
|
261
|
-
// "logo":"",
|
|
262
|
-
// "decimals":18,
|
|
263
|
-
// "created":1572912000000,
|
|
264
|
-
// "tier":1,
|
|
265
|
-
// "assetClass":"ASSET_CLASS_UNKNOWN",
|
|
266
|
-
// "minTransferAmount":0
|
|
267
|
-
// },
|
|
268
|
-
// {
|
|
269
|
-
// "id":"db02758e-2507-46a5-a805-7bc60355b3eb",
|
|
270
|
-
// "status":"CURRENCY_STATUS_ACTIVE",
|
|
271
|
-
// "type":"CURRENCY_TYPE_FUTURES_CONTRACT",
|
|
272
|
-
// "name":"BTC USDT Futures Contract",
|
|
273
|
-
// "tag":"BTCUSDT",
|
|
274
|
-
// "description":"",
|
|
275
|
-
// "logo":"",
|
|
276
|
-
// "decimals":8,
|
|
277
|
-
// "created":1589459984395,
|
|
278
|
-
// "tier":1,
|
|
279
|
-
// "assetClass":"ASSET_CLASS_UNKNOWN",
|
|
280
|
-
// "minTransferAmount":0
|
|
281
|
-
// },
|
|
282
|
-
// ]
|
|
283
|
-
//
|
|
284
|
-
const response = await this.publicGetPair(params);
|
|
285
|
-
//
|
|
286
|
-
// [
|
|
287
|
-
// {
|
|
288
|
-
// "id":"dba4289b-6b46-4d94-bf55-49eec9a163ad",
|
|
289
|
-
// "status":"PAIR_STATUS_ACTIVE", // CURRENCY_STATUS_INACTIVE
|
|
290
|
-
// "baseCurrency":"fb9b53d6-bbf6-472f-b6ba-73cc0d606c9b",
|
|
291
|
-
// "quoteCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
292
|
-
// "priceTick":"0.000000100000000000",
|
|
293
|
-
// "priceDecimals":7,
|
|
294
|
-
// "quantityTick":"0.010000000",
|
|
295
|
-
// "quantityDecimals":2,
|
|
296
|
-
// "costDisplayDecimals":7,
|
|
297
|
-
// "created":1572957210501,
|
|
298
|
-
// "minOrderQuantity":"0",
|
|
299
|
-
// "maxOrderCostUsd":"999999999999999999",
|
|
300
|
-
// "minOrderCostUsd":"0",
|
|
301
|
-
// "externalSymbol":""
|
|
302
|
-
// }
|
|
303
|
-
// ]
|
|
304
|
-
//
|
|
305
|
-
if (this.safeValue(this.options, 'adjustForTimeDifference', true)) {
|
|
306
|
-
await this.loadTimeDifference();
|
|
307
|
-
}
|
|
308
|
-
const currenciesById = this.indexBy(currencies, 'id');
|
|
309
|
-
const result = [];
|
|
310
|
-
for (let i = 0; i < response.length; i++) {
|
|
311
|
-
const market = response[i];
|
|
312
|
-
const id = this.safeString(market, 'id');
|
|
313
|
-
// the exchange shows them inverted
|
|
314
|
-
const baseId = this.safeString(market, 'baseCurrency');
|
|
315
|
-
const quoteId = this.safeString(market, 'quoteCurrency');
|
|
316
|
-
const baseCurrency = this.safeValue(currenciesById, baseId);
|
|
317
|
-
const quoteCurrency = this.safeValue(currenciesById, quoteId);
|
|
318
|
-
if (baseCurrency !== undefined && quoteCurrency !== undefined) {
|
|
319
|
-
const base = this.safeCurrencyCode(this.safeString(baseCurrency, 'tag'));
|
|
320
|
-
const quote = this.safeCurrencyCode(this.safeString(quoteCurrency, 'tag'));
|
|
321
|
-
const lowercaseQuote = quote.toLowerCase();
|
|
322
|
-
const capitalizedQuote = this.capitalize(lowercaseQuote);
|
|
323
|
-
const status = this.safeString(market, 'status');
|
|
324
|
-
result.push({
|
|
325
|
-
'id': id,
|
|
326
|
-
'symbol': base + '/' + quote,
|
|
327
|
-
'base': base,
|
|
328
|
-
'quote': quote,
|
|
329
|
-
'settle': undefined,
|
|
330
|
-
'baseId': baseId,
|
|
331
|
-
'quoteId': quoteId,
|
|
332
|
-
'settleId': undefined,
|
|
333
|
-
'type': 'spot',
|
|
334
|
-
'spot': true,
|
|
335
|
-
'margin': false,
|
|
336
|
-
'swap': false,
|
|
337
|
-
'future': false,
|
|
338
|
-
'option': false,
|
|
339
|
-
'active': (status === 'PAIR_STATUS_ACTIVE'),
|
|
340
|
-
'contract': false,
|
|
341
|
-
'linear': undefined,
|
|
342
|
-
'inverse': undefined,
|
|
343
|
-
'contractSize': undefined,
|
|
344
|
-
'expiry': undefined,
|
|
345
|
-
'expiryDatetime': undefined,
|
|
346
|
-
'strike': undefined,
|
|
347
|
-
'optionType': undefined,
|
|
348
|
-
'precision': {
|
|
349
|
-
'amount': this.safeNumber(market, 'quantityTick'),
|
|
350
|
-
'price': this.safeNumber(market, 'priceTick'),
|
|
351
|
-
},
|
|
352
|
-
'limits': {
|
|
353
|
-
'leverage': {
|
|
354
|
-
'min': undefined,
|
|
355
|
-
'max': undefined,
|
|
356
|
-
},
|
|
357
|
-
'amount': {
|
|
358
|
-
'min': this.safeNumber(market, 'minOrderQuantity'),
|
|
359
|
-
'max': undefined,
|
|
360
|
-
},
|
|
361
|
-
'price': {
|
|
362
|
-
'min': undefined,
|
|
363
|
-
'max': undefined,
|
|
364
|
-
},
|
|
365
|
-
'cost': {
|
|
366
|
-
'min': this.safeNumber(market, 'minOrderCost' + capitalizedQuote),
|
|
367
|
-
'max': this.safeNumber(market, 'maxOrderCost' + capitalizedQuote),
|
|
368
|
-
},
|
|
369
|
-
},
|
|
370
|
-
'created': this.safeInteger(market, 'created'),
|
|
371
|
-
'info': market,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return result;
|
|
376
|
-
}
|
|
377
|
-
async fetchCurrenciesFromCache(params = {}) {
|
|
378
|
-
// this method is now redundant
|
|
379
|
-
// currencies are now fetched before markets
|
|
380
|
-
const options = this.safeValue(this.options, 'fetchCurrencies', {});
|
|
381
|
-
const timestamp = this.safeInteger(options, 'timestamp');
|
|
382
|
-
const expires = this.safeInteger(options, 'expires', 1000);
|
|
383
|
-
const now = this.milliseconds();
|
|
384
|
-
if ((timestamp === undefined) || ((now - timestamp) > expires)) {
|
|
385
|
-
const response = await this.publicGetCurrency(params);
|
|
386
|
-
this.options['fetchCurrencies'] = this.extend(options, {
|
|
387
|
-
'response': response,
|
|
388
|
-
'timestamp': now,
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
return this.safeValue(this.options['fetchCurrencies'], 'response');
|
|
392
|
-
}
|
|
393
|
-
async fetchCurrencies(params = {}) {
|
|
394
|
-
/**
|
|
395
|
-
* @method
|
|
396
|
-
* @name latoken#fetchCurrencies
|
|
397
|
-
* @description fetches all available currencies on an exchange
|
|
398
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
399
|
-
* @returns {object} an associative dictionary of currencies
|
|
400
|
-
*/
|
|
401
|
-
const response = await this.fetchCurrenciesFromCache(params);
|
|
402
|
-
//
|
|
403
|
-
// [
|
|
404
|
-
// {
|
|
405
|
-
// "id":"1a075819-9e0b-48fc-8784-4dab1d186d6d",
|
|
406
|
-
// "status":"CURRENCY_STATUS_ACTIVE",
|
|
407
|
-
// "type":"CURRENCY_TYPE_ALTERNATIVE", // CURRENCY_TYPE_CRYPTO, CURRENCY_TYPE_IEO
|
|
408
|
-
// "name":"MyCryptoBank",
|
|
409
|
-
// "tag":"MCB",
|
|
410
|
-
// "description":"",
|
|
411
|
-
// "logo":"",
|
|
412
|
-
// "decimals":18,
|
|
413
|
-
// "created":1572912000000,
|
|
414
|
-
// "tier":1,
|
|
415
|
-
// "assetClass":"ASSET_CLASS_UNKNOWN",
|
|
416
|
-
// "minTransferAmount":0
|
|
417
|
-
// },
|
|
418
|
-
// {
|
|
419
|
-
// "id":"db02758e-2507-46a5-a805-7bc60355b3eb",
|
|
420
|
-
// "status":"CURRENCY_STATUS_ACTIVE",
|
|
421
|
-
// "type":"CURRENCY_TYPE_FUTURES_CONTRACT",
|
|
422
|
-
// "name":"BTC USDT Futures Contract",
|
|
423
|
-
// "tag":"BTCUSDT",
|
|
424
|
-
// "description":"",
|
|
425
|
-
// "logo":"",
|
|
426
|
-
// "decimals":8,
|
|
427
|
-
// "created":1589459984395,
|
|
428
|
-
// "tier":1,
|
|
429
|
-
// "assetClass":"ASSET_CLASS_UNKNOWN",
|
|
430
|
-
// "minTransferAmount":0
|
|
431
|
-
// },
|
|
432
|
-
// ]
|
|
433
|
-
//
|
|
434
|
-
const result = {};
|
|
435
|
-
for (let i = 0; i < response.length; i++) {
|
|
436
|
-
const currency = response[i];
|
|
437
|
-
const id = this.safeString(currency, 'id');
|
|
438
|
-
const tag = this.safeString(currency, 'tag');
|
|
439
|
-
const code = this.safeCurrencyCode(tag);
|
|
440
|
-
const fee = this.safeNumber(currency, 'fee');
|
|
441
|
-
const currencyType = this.safeString(currency, 'type');
|
|
442
|
-
let type = undefined;
|
|
443
|
-
if (currencyType === 'CURRENCY_TYPE_ALTERNATIVE') {
|
|
444
|
-
type = 'other';
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
// CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos
|
|
448
|
-
type = 'crypto';
|
|
449
|
-
}
|
|
450
|
-
const status = this.safeString(currency, 'status');
|
|
451
|
-
const active = (status === 'CURRENCY_STATUS_ACTIVE');
|
|
452
|
-
const name = this.safeString(currency, 'name');
|
|
453
|
-
result[code] = {
|
|
454
|
-
'id': id,
|
|
455
|
-
'code': code,
|
|
456
|
-
'info': currency,
|
|
457
|
-
'name': name,
|
|
458
|
-
'type': type,
|
|
459
|
-
'active': active,
|
|
460
|
-
'deposit': undefined,
|
|
461
|
-
'withdraw': undefined,
|
|
462
|
-
'fee': fee,
|
|
463
|
-
'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))),
|
|
464
|
-
'limits': {
|
|
465
|
-
'amount': {
|
|
466
|
-
'min': this.safeNumber(currency, 'minTransferAmount'),
|
|
467
|
-
'max': undefined,
|
|
468
|
-
},
|
|
469
|
-
'withdraw': {
|
|
470
|
-
'min': undefined,
|
|
471
|
-
'max': undefined,
|
|
472
|
-
},
|
|
473
|
-
},
|
|
474
|
-
'networks': {},
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
return result;
|
|
478
|
-
}
|
|
479
|
-
async fetchBalance(params = {}) {
|
|
480
|
-
/**
|
|
481
|
-
* @method
|
|
482
|
-
* @name latoken#fetchBalance
|
|
483
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
484
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
485
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
486
|
-
*/
|
|
487
|
-
await this.loadMarkets();
|
|
488
|
-
const response = await this.privateGetAuthAccount(params);
|
|
489
|
-
//
|
|
490
|
-
// [
|
|
491
|
-
// {
|
|
492
|
-
// "id": "e5852e02-8711-431c-9749-a6f5503c6dbe",
|
|
493
|
-
// "status": "ACCOUNT_STATUS_ACTIVE",
|
|
494
|
-
// "type": "ACCOUNT_TYPE_WALLET",
|
|
495
|
-
// "timestamp": "1635920106506",
|
|
496
|
-
// "currency": "0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
497
|
-
// "available": "100.000000",
|
|
498
|
-
// "blocked": "0.000000"
|
|
499
|
-
// },
|
|
500
|
-
// {
|
|
501
|
-
// "id": "369df204-acbc-467e-a25e-b16e3cc09cf6",
|
|
502
|
-
// "status": "ACCOUNT_STATUS_ACTIVE",
|
|
503
|
-
// "type": "ACCOUNT_TYPE_SPOT",
|
|
504
|
-
// "timestamp": "1635920106504",
|
|
505
|
-
// "currency": "0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
506
|
-
// "available": "100.000000",
|
|
507
|
-
// "blocked": "0.000000"
|
|
508
|
-
// }
|
|
509
|
-
// ]
|
|
510
|
-
//
|
|
511
|
-
const result = {
|
|
512
|
-
'info': response,
|
|
513
|
-
'timestamp': undefined,
|
|
514
|
-
'datetime': undefined,
|
|
515
|
-
};
|
|
516
|
-
let maxTimestamp = undefined;
|
|
517
|
-
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
518
|
-
const type = this.safeString(params, 'type', defaultType);
|
|
519
|
-
const types = this.safeValue(this.options, 'types', {});
|
|
520
|
-
const accountType = this.safeString(types, type, type);
|
|
521
|
-
const balancesByType = this.groupBy(response, 'type');
|
|
522
|
-
const balances = this.safeValue(balancesByType, accountType, []);
|
|
523
|
-
for (let i = 0; i < balances.length; i++) {
|
|
524
|
-
const balance = balances[i];
|
|
525
|
-
const currencyId = this.safeString(balance, 'currency');
|
|
526
|
-
const timestamp = this.safeInteger(balance, 'timestamp');
|
|
527
|
-
if (timestamp !== undefined) {
|
|
528
|
-
if (maxTimestamp === undefined) {
|
|
529
|
-
maxTimestamp = timestamp;
|
|
530
|
-
}
|
|
531
|
-
else {
|
|
532
|
-
maxTimestamp = Math.max(maxTimestamp, timestamp);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
536
|
-
const account = this.account();
|
|
537
|
-
account['free'] = this.safeString(balance, 'available');
|
|
538
|
-
account['used'] = this.safeString(balance, 'blocked');
|
|
539
|
-
result[code] = account;
|
|
540
|
-
}
|
|
541
|
-
result['timestamp'] = maxTimestamp;
|
|
542
|
-
result['datetime'] = this.iso8601(maxTimestamp);
|
|
543
|
-
return this.safeBalance(result);
|
|
544
|
-
}
|
|
545
|
-
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
546
|
-
/**
|
|
547
|
-
* @method
|
|
548
|
-
* @name latoken#fetchOrderBook
|
|
549
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
550
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
551
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
552
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
553
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
554
|
-
*/
|
|
555
|
-
await this.loadMarkets();
|
|
556
|
-
const market = this.market(symbol);
|
|
557
|
-
const request = {
|
|
558
|
-
'currency': market['baseId'],
|
|
559
|
-
'quote': market['quoteId'],
|
|
560
|
-
};
|
|
561
|
-
if (limit !== undefined) {
|
|
562
|
-
request['limit'] = limit; // max 1000
|
|
563
|
-
}
|
|
564
|
-
const response = await this.publicGetBookCurrencyQuote(this.extend(request, params));
|
|
565
|
-
//
|
|
566
|
-
// {
|
|
567
|
-
// "ask":[
|
|
568
|
-
// {"price":"4428.76","quantity":"0.08136","cost":"360.3239136","accumulated":"360.3239136"},
|
|
569
|
-
// {"price":"4429.77","quantity":"1.11786","cost":"4951.8626922","accumulated":"5312.1866058"},
|
|
570
|
-
// {"price":"4430.94","quantity":"1.78418","cost":"7905.5945292","accumulated":"13217.781135"},
|
|
571
|
-
// ],
|
|
572
|
-
// "bid":[
|
|
573
|
-
// {"price":"4428.43","quantity":"0.13675","cost":"605.5878025","accumulated":"605.5878025"},
|
|
574
|
-
// {"price":"4428.19","quantity":"0.03619","cost":"160.2561961","accumulated":"765.8439986"},
|
|
575
|
-
// {"price":"4428.15","quantity":"0.02926","cost":"129.567669","accumulated":"895.4116676"},
|
|
576
|
-
// ],
|
|
577
|
-
// "totalAsk":"53.14814",
|
|
578
|
-
// "totalBid":"112216.9029791"
|
|
579
|
-
// }
|
|
580
|
-
//
|
|
581
|
-
return this.parseOrderBook(response, symbol, undefined, 'bid', 'ask', 'price', 'quantity');
|
|
582
|
-
}
|
|
583
|
-
parseTicker(ticker, market = undefined) {
|
|
584
|
-
//
|
|
585
|
-
// {
|
|
586
|
-
// "symbol": "92151d82-df98-4d88-9a4d-284fa9eca49f/0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
587
|
-
// "baseCurrency": "92151d82-df98-4d88-9a4d-284fa9eca49f",
|
|
588
|
-
// "quoteCurrency": "0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
589
|
-
// "volume24h": "165723597.189022176000000000",
|
|
590
|
-
// "volume7d": "934505768.625109571000000000",
|
|
591
|
-
// "change24h": "0.0200",
|
|
592
|
-
// "change7d": "-6.4200",
|
|
593
|
-
// "amount24h": "6438.457663100000000000",
|
|
594
|
-
// "amount7d": "35657.785013800000000000",
|
|
595
|
-
// "lastPrice": "25779.16",
|
|
596
|
-
// "lastQuantity": "0.248403300000000000",
|
|
597
|
-
// "bestBid": "25778.74",
|
|
598
|
-
// "bestBidQuantity": "0.6520232",
|
|
599
|
-
// "bestAsk": "25779.17",
|
|
600
|
-
// "bestAskQuantity": "0.4956043",
|
|
601
|
-
// "updateTimestamp": "1693965231406"
|
|
602
|
-
// }
|
|
603
|
-
//
|
|
604
|
-
const marketId = this.safeString(ticker, 'symbol');
|
|
605
|
-
const last = this.safeString(ticker, 'lastPrice');
|
|
606
|
-
const timestamp = this.safeInteger(ticker, 'updateTimestamp');
|
|
607
|
-
return this.safeTicker({
|
|
608
|
-
'symbol': this.safeSymbol(marketId, market),
|
|
609
|
-
'timestamp': timestamp,
|
|
610
|
-
'datetime': this.iso8601(timestamp),
|
|
611
|
-
'low': undefined,
|
|
612
|
-
'high': undefined,
|
|
613
|
-
'bid': this.safeString(ticker, 'bestBid'),
|
|
614
|
-
'bidVolume': this.safeString(ticker, 'bestBidQuantity'),
|
|
615
|
-
'ask': this.safeString(ticker, 'bestAsk'),
|
|
616
|
-
'askVolume': this.safeString(ticker, 'bestAskQuantity'),
|
|
617
|
-
'vwap': undefined,
|
|
618
|
-
'open': undefined,
|
|
619
|
-
'close': last,
|
|
620
|
-
'last': last,
|
|
621
|
-
'previousClose': undefined,
|
|
622
|
-
'change': undefined,
|
|
623
|
-
'percentage': this.safeString(ticker, 'change24h'),
|
|
624
|
-
'average': undefined,
|
|
625
|
-
'baseVolume': this.safeString(ticker, 'amount24h'),
|
|
626
|
-
'quoteVolume': this.safeString(ticker, 'volume24h'),
|
|
627
|
-
'info': ticker,
|
|
628
|
-
}, market);
|
|
629
|
-
}
|
|
630
|
-
async fetchTicker(symbol, params = {}) {
|
|
631
|
-
/**
|
|
632
|
-
* @method
|
|
633
|
-
* @name latoken#fetchTicker
|
|
634
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
635
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
636
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
637
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
638
|
-
*/
|
|
639
|
-
await this.loadMarkets();
|
|
640
|
-
const market = this.market(symbol);
|
|
641
|
-
const request = {
|
|
642
|
-
'base': market['baseId'],
|
|
643
|
-
'quote': market['quoteId'],
|
|
644
|
-
};
|
|
645
|
-
const response = await this.publicGetTickerBaseQuote(this.extend(request, params));
|
|
646
|
-
//
|
|
647
|
-
// {
|
|
648
|
-
// "symbol": "92151d82-df98-4d88-9a4d-284fa9eca49f/0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
649
|
-
// "baseCurrency": "92151d82-df98-4d88-9a4d-284fa9eca49f",
|
|
650
|
-
// "quoteCurrency": "0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
651
|
-
// "volume24h": "165723597.189022176000000000",
|
|
652
|
-
// "volume7d": "934505768.625109571000000000",
|
|
653
|
-
// "change24h": "0.0200",
|
|
654
|
-
// "change7d": "-6.4200",
|
|
655
|
-
// "amount24h": "6438.457663100000000000",
|
|
656
|
-
// "amount7d": "35657.785013800000000000",
|
|
657
|
-
// "lastPrice": "25779.16",
|
|
658
|
-
// "lastQuantity": "0.248403300000000000",
|
|
659
|
-
// "bestBid": "25778.74",
|
|
660
|
-
// "bestBidQuantity": "0.6520232",
|
|
661
|
-
// "bestAsk": "25779.17",
|
|
662
|
-
// "bestAskQuantity": "0.4956043",
|
|
663
|
-
// "updateTimestamp": "1693965231406"
|
|
664
|
-
// }
|
|
665
|
-
//
|
|
666
|
-
return this.parseTicker(response, market);
|
|
667
|
-
}
|
|
668
|
-
async fetchTickers(symbols = undefined, params = {}) {
|
|
669
|
-
/**
|
|
670
|
-
* @method
|
|
671
|
-
* @name latoken#fetchTickers
|
|
672
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
673
|
-
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
674
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
675
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
676
|
-
*/
|
|
677
|
-
await this.loadMarkets();
|
|
678
|
-
const response = await this.publicGetTicker(params);
|
|
679
|
-
//
|
|
680
|
-
// [
|
|
681
|
-
// {
|
|
682
|
-
// "symbol": "92151d82-df98-4d88-9a4d-284fa9eca49f/0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
683
|
-
// "baseCurrency": "92151d82-df98-4d88-9a4d-284fa9eca49f",
|
|
684
|
-
// "quoteCurrency": "0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
685
|
-
// "volume24h": "165723597.189022176000000000",
|
|
686
|
-
// "volume7d": "934505768.625109571000000000",
|
|
687
|
-
// "change24h": "0.0200",
|
|
688
|
-
// "change7d": "-6.4200",
|
|
689
|
-
// "amount24h": "6438.457663100000000000",
|
|
690
|
-
// "amount7d": "35657.785013800000000000",
|
|
691
|
-
// "lastPrice": "25779.16",
|
|
692
|
-
// "lastQuantity": "0.248403300000000000",
|
|
693
|
-
// "bestBid": "25778.74",
|
|
694
|
-
// "bestBidQuantity": "0.6520232",
|
|
695
|
-
// "bestAsk": "25779.17",
|
|
696
|
-
// "bestAskQuantity": "0.4956043",
|
|
697
|
-
// "updateTimestamp": "1693965231406"
|
|
698
|
-
// }
|
|
699
|
-
// ]
|
|
700
|
-
//
|
|
701
|
-
return this.parseTickers(response, symbols);
|
|
702
|
-
}
|
|
703
|
-
parseTrade(trade, market = undefined) {
|
|
704
|
-
//
|
|
705
|
-
// fetchTrades (public)
|
|
706
|
-
//
|
|
707
|
-
// {
|
|
708
|
-
// "id":"c152f814-8eeb-44f0-8f3f-e5c568f2ffcf",
|
|
709
|
-
// "isMakerBuyer":false,
|
|
710
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
711
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
712
|
-
// "price":"4435.56",
|
|
713
|
-
// "quantity":"0.32534",
|
|
714
|
-
// "cost":"1443.0650904",
|
|
715
|
-
// "timestamp":1635854642725,
|
|
716
|
-
// "makerBuyer":false
|
|
717
|
-
// }
|
|
718
|
-
//
|
|
719
|
-
// fetchMyTrades (private)
|
|
720
|
-
//
|
|
721
|
-
// {
|
|
722
|
-
// "id":"02e02533-b4bf-4ba9-9271-24e2108dfbf7",
|
|
723
|
-
// "isMakerBuyer":false,
|
|
724
|
-
// "direction":"TRADE_DIRECTION_BUY",
|
|
725
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
726
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
727
|
-
// "price":"4564.32",
|
|
728
|
-
// "quantity":"0.01000",
|
|
729
|
-
// "cost":"45.6432",
|
|
730
|
-
// "fee":"0.223651680000000000",
|
|
731
|
-
// "order":"c9cac6a0-484c-4892-88e7-ad51b39f2ce1",
|
|
732
|
-
// "timestamp":1635921580399,
|
|
733
|
-
// "makerBuyer":false
|
|
734
|
-
// }
|
|
735
|
-
//
|
|
736
|
-
const type = undefined;
|
|
737
|
-
const timestamp = this.safeInteger(trade, 'timestamp');
|
|
738
|
-
const priceString = this.safeString(trade, 'price');
|
|
739
|
-
const amountString = this.safeString(trade, 'quantity');
|
|
740
|
-
const costString = this.safeString(trade, 'cost');
|
|
741
|
-
const makerBuyer = this.safeValue(trade, 'makerBuyer');
|
|
742
|
-
let side = this.safeString(trade, 'direction');
|
|
743
|
-
if (side === undefined) {
|
|
744
|
-
side = makerBuyer ? 'sell' : 'buy';
|
|
745
|
-
}
|
|
746
|
-
else {
|
|
747
|
-
if (side === 'TRADE_DIRECTION_BUY') {
|
|
748
|
-
side = 'buy';
|
|
749
|
-
}
|
|
750
|
-
else if (side === 'TRADE_DIRECTION_SELL') {
|
|
751
|
-
side = 'sell';
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
const isBuy = (side === 'buy');
|
|
755
|
-
const takerOrMaker = (makerBuyer && isBuy) ? 'maker' : 'taker';
|
|
756
|
-
const baseId = this.safeString(trade, 'baseCurrency');
|
|
757
|
-
const quoteId = this.safeString(trade, 'quoteCurrency');
|
|
758
|
-
const base = this.safeCurrencyCode(baseId);
|
|
759
|
-
const quote = this.safeCurrencyCode(quoteId);
|
|
760
|
-
const symbol = base + '/' + quote;
|
|
761
|
-
if (symbol in this.markets) {
|
|
762
|
-
market = this.market(symbol);
|
|
763
|
-
}
|
|
764
|
-
const id = this.safeString(trade, 'id');
|
|
765
|
-
const orderId = this.safeString(trade, 'order');
|
|
766
|
-
const feeCost = this.safeString(trade, 'fee');
|
|
767
|
-
let fee = undefined;
|
|
768
|
-
if (feeCost !== undefined) {
|
|
769
|
-
fee = {
|
|
770
|
-
'cost': feeCost,
|
|
771
|
-
'currency': quote,
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
return this.safeTrade({
|
|
775
|
-
'info': trade,
|
|
776
|
-
'timestamp': timestamp,
|
|
777
|
-
'datetime': this.iso8601(timestamp),
|
|
778
|
-
'symbol': symbol,
|
|
779
|
-
'id': id,
|
|
780
|
-
'order': orderId,
|
|
781
|
-
'type': type,
|
|
782
|
-
'takerOrMaker': takerOrMaker,
|
|
783
|
-
'side': side,
|
|
784
|
-
'price': priceString,
|
|
785
|
-
'amount': amountString,
|
|
786
|
-
'cost': costString,
|
|
787
|
-
'fee': fee,
|
|
788
|
-
}, market);
|
|
789
|
-
}
|
|
790
|
-
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
791
|
-
/**
|
|
792
|
-
* @method
|
|
793
|
-
* @name latoken#fetchTrades
|
|
794
|
-
* @description get the list of most recent trades for a particular symbol
|
|
795
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
796
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
797
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
798
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
799
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
800
|
-
*/
|
|
801
|
-
await this.loadMarkets();
|
|
802
|
-
const market = this.market(symbol);
|
|
803
|
-
const request = {
|
|
804
|
-
'currency': market['baseId'],
|
|
805
|
-
'quote': market['quoteId'],
|
|
806
|
-
// 'from': since.toString (), // milliseconds
|
|
807
|
-
// 'limit': limit, // default 100, limit 100
|
|
808
|
-
};
|
|
809
|
-
if (limit !== undefined) {
|
|
810
|
-
request['limit'] = Math.min(limit, 100); // default 100, limit 100
|
|
811
|
-
}
|
|
812
|
-
const response = await this.publicGetTradeHistoryCurrencyQuote(this.extend(request, params));
|
|
813
|
-
//
|
|
814
|
-
// [
|
|
815
|
-
// {"id":"c152f814-8eeb-44f0-8f3f-e5c568f2ffcf","isMakerBuyer":false,"baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f","quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5","price":"4435.56","quantity":"0.32534","cost":"1443.0650904","timestamp":1635854642725,"makerBuyer":false},
|
|
816
|
-
// {"id":"cfecbefb-3d11-43d7-b9d4-fa16211aad8a","isMakerBuyer":false,"baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f","quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5","price":"4435.13","quantity":"0.26540","cost":"1177.083502","timestamp":1635854641114,"makerBuyer":false},
|
|
817
|
-
// {"id":"f43d3ec8-db94-49f3-b534-91dbc2779296","isMakerBuyer":true,"baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f","quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5","price":"4435.00","quantity":"0.41738","cost":"1851.0803","timestamp":1635854640323,"makerBuyer":true},
|
|
818
|
-
// ]
|
|
819
|
-
//
|
|
820
|
-
return this.parseTrades(response, market, since, limit);
|
|
821
|
-
}
|
|
822
|
-
async fetchTradingFee(symbol, params = {}) {
|
|
823
|
-
/**
|
|
824
|
-
* @method
|
|
825
|
-
* @name latoken#fetchTradingFee
|
|
826
|
-
* @description fetch the trading fees for a market
|
|
827
|
-
* @param {string} symbol unified market symbol
|
|
828
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
829
|
-
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
830
|
-
*/
|
|
831
|
-
const options = this.safeValue(this.options, 'fetchTradingFee', {});
|
|
832
|
-
const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTradingFee');
|
|
833
|
-
const method = this.safeString(params, 'method', defaultMethod);
|
|
834
|
-
params = this.omit(params, 'method');
|
|
835
|
-
if (method === 'fetchPrivateTradingFee') {
|
|
836
|
-
return await this.fetchPrivateTradingFee(symbol, params);
|
|
837
|
-
}
|
|
838
|
-
else if (method === 'fetchPublicTradingFee') {
|
|
839
|
-
return await this.fetchPublicTradingFee(symbol, params);
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
throw new errors.NotSupported(this.id + ' not support this method');
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
async fetchPublicTradingFee(symbol, params = {}) {
|
|
846
|
-
await this.loadMarkets();
|
|
847
|
-
const market = this.market(symbol);
|
|
848
|
-
const request = {
|
|
849
|
-
'currency': market['baseId'],
|
|
850
|
-
'quote': market['quoteId'],
|
|
851
|
-
};
|
|
852
|
-
const response = await this.publicGetTradeFeeCurrencyQuote(this.extend(request, params));
|
|
853
|
-
//
|
|
854
|
-
// {
|
|
855
|
-
// "makerFee": "0.004900000000000000",
|
|
856
|
-
// "takerFee": "0.004900000000000000",
|
|
857
|
-
// "type": "FEE_SCHEME_TYPE_PERCENT_QUOTE",
|
|
858
|
-
// "take": "FEE_SCHEME_TAKE_PROPORTION"
|
|
859
|
-
// }
|
|
860
|
-
//
|
|
861
|
-
return {
|
|
862
|
-
'info': response,
|
|
863
|
-
'symbol': market['symbol'],
|
|
864
|
-
'maker': this.safeNumber(response, 'makerFee'),
|
|
865
|
-
'taker': this.safeNumber(response, 'takerFee'),
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
async fetchPrivateTradingFee(symbol, params = {}) {
|
|
869
|
-
await this.loadMarkets();
|
|
870
|
-
const market = this.market(symbol);
|
|
871
|
-
const request = {
|
|
872
|
-
'currency': market['baseId'],
|
|
873
|
-
'quote': market['quoteId'],
|
|
874
|
-
};
|
|
875
|
-
const response = await this.privateGetAuthTradeFeeCurrencyQuote(this.extend(request, params));
|
|
876
|
-
//
|
|
877
|
-
// {
|
|
878
|
-
// "makerFee": "0.004900000000000000",
|
|
879
|
-
// "takerFee": "0.004900000000000000",
|
|
880
|
-
// "type": "FEE_SCHEME_TYPE_PERCENT_QUOTE",
|
|
881
|
-
// "take": "FEE_SCHEME_TAKE_PROPORTION"
|
|
882
|
-
// }
|
|
883
|
-
//
|
|
884
|
-
return {
|
|
885
|
-
'info': response,
|
|
886
|
-
'symbol': market['symbol'],
|
|
887
|
-
'maker': this.safeNumber(response, 'makerFee'),
|
|
888
|
-
'taker': this.safeNumber(response, 'takerFee'),
|
|
889
|
-
};
|
|
890
|
-
}
|
|
891
|
-
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
892
|
-
/**
|
|
893
|
-
* @method
|
|
894
|
-
* @name latoken#fetchMyTrades
|
|
895
|
-
* @description fetch all trades made by the user
|
|
896
|
-
* @param {string} symbol unified market symbol
|
|
897
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
898
|
-
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
899
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
900
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
901
|
-
*/
|
|
902
|
-
await this.loadMarkets();
|
|
903
|
-
const request = {
|
|
904
|
-
// 'currency': market['baseId'],
|
|
905
|
-
// 'quote': market['quoteId'],
|
|
906
|
-
// 'from': this.milliseconds (),
|
|
907
|
-
// 'limit': limit, // default '100'
|
|
908
|
-
};
|
|
909
|
-
let market = undefined;
|
|
910
|
-
if (limit !== undefined) {
|
|
911
|
-
request['limit'] = limit; // default 100
|
|
912
|
-
}
|
|
913
|
-
let response = undefined;
|
|
914
|
-
if (symbol !== undefined) {
|
|
915
|
-
market = this.market(symbol);
|
|
916
|
-
request['currency'] = market['baseId'];
|
|
917
|
-
request['quote'] = market['quoteId'];
|
|
918
|
-
response = await this.privateGetAuthTradePairCurrencyQuote(this.extend(request, params));
|
|
919
|
-
}
|
|
920
|
-
else {
|
|
921
|
-
response = await this.privateGetAuthTrade(this.extend(request, params));
|
|
922
|
-
}
|
|
923
|
-
//
|
|
924
|
-
// [
|
|
925
|
-
// {
|
|
926
|
-
// "id":"02e02533-b4bf-4ba9-9271-24e2108dfbf7",
|
|
927
|
-
// "isMakerBuyer":false,
|
|
928
|
-
// "direction":"TRADE_DIRECTION_BUY",
|
|
929
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
930
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
931
|
-
// "price":"4564.32",
|
|
932
|
-
// "quantity":"0.01000",
|
|
933
|
-
// "cost":"45.6432",
|
|
934
|
-
// "fee":"0.223651680000000000",
|
|
935
|
-
// "order":"c9cac6a0-484c-4892-88e7-ad51b39f2ce1",
|
|
936
|
-
// "timestamp":1635921580399,
|
|
937
|
-
// "makerBuyer":false
|
|
938
|
-
// }
|
|
939
|
-
// ]
|
|
940
|
-
//
|
|
941
|
-
return this.parseTrades(response, market, since, limit);
|
|
942
|
-
}
|
|
943
|
-
parseOrderStatus(status) {
|
|
944
|
-
const statuses = {
|
|
945
|
-
'ORDER_STATUS_PLACED': 'open',
|
|
946
|
-
'ORDER_STATUS_CLOSED': 'closed',
|
|
947
|
-
'ORDER_STATUS_CANCELLED': 'canceled',
|
|
948
|
-
};
|
|
949
|
-
return this.safeString(statuses, status, status);
|
|
950
|
-
}
|
|
951
|
-
parseOrderType(status) {
|
|
952
|
-
const statuses = {
|
|
953
|
-
'ORDER_TYPE_MARKET': 'market',
|
|
954
|
-
'ORDER_TYPE_LIMIT': 'limit',
|
|
955
|
-
};
|
|
956
|
-
return this.safeString(statuses, status, status);
|
|
957
|
-
}
|
|
958
|
-
parseTimeInForce(timeInForce) {
|
|
959
|
-
const timeInForces = {
|
|
960
|
-
'ORDER_CONDITION_GOOD_TILL_CANCELLED': 'GTC',
|
|
961
|
-
'ORDER_CONDITION_IMMEDIATE_OR_CANCEL': 'IOC',
|
|
962
|
-
'ORDER_CONDITION_FILL_OR_KILL': 'FOK',
|
|
963
|
-
};
|
|
964
|
-
return this.safeString(timeInForces, timeInForce, timeInForce);
|
|
965
|
-
}
|
|
966
|
-
parseOrder(order, market = undefined) {
|
|
967
|
-
//
|
|
968
|
-
// createOrder
|
|
969
|
-
//
|
|
970
|
-
// {
|
|
971
|
-
// "baseCurrency": "f7dac554-8139-4ff6-841f-0e586a5984a0",
|
|
972
|
-
// "quoteCurrency": "a5a7a7a9-e2a3-43f9-8754-29a02f6b709b",
|
|
973
|
-
// "side": "BID",
|
|
974
|
-
// "clientOrderId": "my-wonderful-order-number-71566",
|
|
975
|
-
// "price": "10103.19",
|
|
976
|
-
// "stopPrice": "10103.19",
|
|
977
|
-
// "quantity": "3.21",
|
|
978
|
-
// "timestamp": 1568185507
|
|
979
|
-
// }
|
|
980
|
-
//
|
|
981
|
-
// fetchOrder, fetchOpenOrders, fetchOrders
|
|
982
|
-
//
|
|
983
|
-
// {
|
|
984
|
-
// "id":"a76bd262-3560-4bfb-98ac-1cedd394f4fc",
|
|
985
|
-
// "status":"ORDER_STATUS_PLACED",
|
|
986
|
-
// "side":"ORDER_SIDE_BUY",
|
|
987
|
-
// "condition":"ORDER_CONDITION_GOOD_TILL_CANCELLED",
|
|
988
|
-
// "type":"ORDER_TYPE_LIMIT",
|
|
989
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
990
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
991
|
-
// "clientOrderId":"web-macos_chrome_1a6a6659-6f7c-4fac-be0b-d1d7ac06d",
|
|
992
|
-
// "price":"4000.00",
|
|
993
|
-
// "quantity":"0.01",
|
|
994
|
-
// "cost":"40.000000000000000000",
|
|
995
|
-
// "filled":"0",
|
|
996
|
-
// "trader":"7244bb3a-b6b2-446a-ac78-fa4bce5b59a9",
|
|
997
|
-
// "creator":"ORDER_CREATOR_USER",
|
|
998
|
-
// "creatorId":"",
|
|
999
|
-
// "timestamp":1635920767648
|
|
1000
|
-
// }
|
|
1001
|
-
//
|
|
1002
|
-
// cancelOrder
|
|
1003
|
-
//
|
|
1004
|
-
// {
|
|
1005
|
-
// "message":"cancellation request successfully submitted",
|
|
1006
|
-
// "status":"SUCCESS",
|
|
1007
|
-
// "id":"a631426d-3543-45ba-941e-75f7825afb0f"
|
|
1008
|
-
// }
|
|
1009
|
-
//
|
|
1010
|
-
const id = this.safeString(order, 'id');
|
|
1011
|
-
const timestamp = this.safeInteger(order, 'timestamp');
|
|
1012
|
-
const baseId = this.safeString(order, 'baseCurrency');
|
|
1013
|
-
const quoteId = this.safeString(order, 'quoteCurrency');
|
|
1014
|
-
const base = this.safeCurrencyCode(baseId);
|
|
1015
|
-
const quote = this.safeCurrencyCode(quoteId);
|
|
1016
|
-
let symbol = undefined;
|
|
1017
|
-
if ((base !== undefined) && (quote !== undefined)) {
|
|
1018
|
-
symbol = base + '/' + quote;
|
|
1019
|
-
if (symbol in this.markets) {
|
|
1020
|
-
market = this.market(symbol);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
const orderSide = this.safeString(order, 'side');
|
|
1024
|
-
let side = undefined;
|
|
1025
|
-
if (orderSide !== undefined) {
|
|
1026
|
-
const parts = orderSide.split('_');
|
|
1027
|
-
const partsLength = parts.length;
|
|
1028
|
-
side = this.safeStringLower(parts, partsLength - 1);
|
|
1029
|
-
}
|
|
1030
|
-
const type = this.parseOrderType(this.safeString(order, 'type'));
|
|
1031
|
-
const price = this.safeString(order, 'price');
|
|
1032
|
-
const amount = this.safeString(order, 'quantity');
|
|
1033
|
-
const filled = this.safeString(order, 'filled');
|
|
1034
|
-
const cost = this.safeString(order, 'cost');
|
|
1035
|
-
let status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
1036
|
-
const message = this.safeString(order, 'message');
|
|
1037
|
-
if (message !== undefined) {
|
|
1038
|
-
if (message.indexOf('cancel') >= 0) {
|
|
1039
|
-
status = 'canceled';
|
|
1040
|
-
}
|
|
1041
|
-
else if (message.indexOf('accept') >= 0) {
|
|
1042
|
-
status = 'open';
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
1046
|
-
const timeInForce = this.parseTimeInForce(this.safeString(order, 'condition'));
|
|
1047
|
-
const triggerPrice = this.safeString(order, 'stopPrice');
|
|
1048
|
-
return this.safeOrder({
|
|
1049
|
-
'id': id,
|
|
1050
|
-
'clientOrderId': clientOrderId,
|
|
1051
|
-
'info': order,
|
|
1052
|
-
'timestamp': timestamp,
|
|
1053
|
-
'datetime': this.iso8601(timestamp),
|
|
1054
|
-
'lastTradeTimestamp': undefined,
|
|
1055
|
-
'status': status,
|
|
1056
|
-
'symbol': symbol,
|
|
1057
|
-
'type': type,
|
|
1058
|
-
'timeInForce': timeInForce,
|
|
1059
|
-
'postOnly': undefined,
|
|
1060
|
-
'side': side,
|
|
1061
|
-
'price': price,
|
|
1062
|
-
'stopPrice': triggerPrice,
|
|
1063
|
-
'triggerPrice': triggerPrice,
|
|
1064
|
-
'cost': cost,
|
|
1065
|
-
'amount': amount,
|
|
1066
|
-
'filled': filled,
|
|
1067
|
-
'average': undefined,
|
|
1068
|
-
'remaining': undefined,
|
|
1069
|
-
'fee': undefined,
|
|
1070
|
-
'trades': undefined,
|
|
1071
|
-
}, market);
|
|
1072
|
-
}
|
|
1073
|
-
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1074
|
-
/**
|
|
1075
|
-
* @method
|
|
1076
|
-
* @name latoken#fetchOpenOrders
|
|
1077
|
-
* @description fetch all unfilled currently open orders
|
|
1078
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrdersByPair
|
|
1079
|
-
* @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyActiveStopOrdersByPair // stop
|
|
1080
|
-
* @param {string} symbol unified market symbol
|
|
1081
|
-
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1082
|
-
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
1083
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1084
|
-
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
1085
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1086
|
-
*/
|
|
1087
|
-
if (symbol === undefined) {
|
|
1088
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
1089
|
-
}
|
|
1090
|
-
await this.loadMarkets();
|
|
1091
|
-
let response = undefined;
|
|
1092
|
-
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
1093
|
-
params = this.omit(params, 'stop');
|
|
1094
|
-
// privateGetAuthOrderActive doesn't work even though its listed at https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrders
|
|
1095
|
-
const market = this.market(symbol);
|
|
1096
|
-
const request = {
|
|
1097
|
-
'currency': market['baseId'],
|
|
1098
|
-
'quote': market['quoteId'],
|
|
1099
|
-
};
|
|
1100
|
-
if (isTrigger) {
|
|
1101
|
-
response = await this.privateGetAuthStopOrderPairCurrencyQuoteActive(this.extend(request, params));
|
|
1102
|
-
}
|
|
1103
|
-
else {
|
|
1104
|
-
response = await this.privateGetAuthOrderPairCurrencyQuoteActive(this.extend(request, params));
|
|
1105
|
-
}
|
|
1106
|
-
//
|
|
1107
|
-
// [
|
|
1108
|
-
// {
|
|
1109
|
-
// "id":"a76bd262-3560-4bfb-98ac-1cedd394f4fc",
|
|
1110
|
-
// "status":"ORDER_STATUS_PLACED",
|
|
1111
|
-
// "side":"ORDER_SIDE_BUY",
|
|
1112
|
-
// "condition":"ORDER_CONDITION_GOOD_TILL_CANCELLED",
|
|
1113
|
-
// "type":"ORDER_TYPE_LIMIT",
|
|
1114
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
1115
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
1116
|
-
// "clientOrderId":"web-macos_chrome_1a6a6659-6f7c-4fac-be0b-d1d7ac06d",
|
|
1117
|
-
// "price":"4000.00",
|
|
1118
|
-
// "quantity":"0.01000",
|
|
1119
|
-
// "cost":"40.00",
|
|
1120
|
-
// "filled":"0.00000",
|
|
1121
|
-
// "trader":"7244bb3a-b6b2-446a-ac78-fa4bce5b59a9",
|
|
1122
|
-
// "creator":"USER",
|
|
1123
|
-
// "creatorId":"",
|
|
1124
|
-
// "timestamp":1635920767648
|
|
1125
|
-
// }
|
|
1126
|
-
// ]
|
|
1127
|
-
//
|
|
1128
|
-
return this.parseOrders(response, market, since, limit);
|
|
1129
|
-
}
|
|
1130
|
-
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1131
|
-
/**
|
|
1132
|
-
* @method
|
|
1133
|
-
* @name latoken#fetchOrders
|
|
1134
|
-
* @description fetches information on multiple orders made by the user
|
|
1135
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrders
|
|
1136
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrdersByPair
|
|
1137
|
-
* @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrders // stop
|
|
1138
|
-
* @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrdersByPair // stop
|
|
1139
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1140
|
-
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1141
|
-
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
1142
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1143
|
-
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
1144
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1145
|
-
*/
|
|
1146
|
-
await this.loadMarkets();
|
|
1147
|
-
const request = {
|
|
1148
|
-
// 'currency': market['baseId'],
|
|
1149
|
-
// 'quote': market['quoteId'],
|
|
1150
|
-
// 'from': this.milliseconds (),
|
|
1151
|
-
// 'limit': limit, // default '100'
|
|
1152
|
-
};
|
|
1153
|
-
let market = undefined;
|
|
1154
|
-
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
1155
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
1156
|
-
if (limit !== undefined) {
|
|
1157
|
-
request['limit'] = limit; // default 100
|
|
1158
|
-
}
|
|
1159
|
-
let response = undefined;
|
|
1160
|
-
if (symbol !== undefined) {
|
|
1161
|
-
market = this.market(symbol);
|
|
1162
|
-
request['currency'] = market['baseId'];
|
|
1163
|
-
request['quote'] = market['quoteId'];
|
|
1164
|
-
if (isTrigger) {
|
|
1165
|
-
response = await this.privateGetAuthStopOrderPairCurrencyQuote(this.extend(request, params));
|
|
1166
|
-
}
|
|
1167
|
-
else {
|
|
1168
|
-
response = await this.privateGetAuthOrderPairCurrencyQuote(this.extend(request, params));
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
else {
|
|
1172
|
-
if (isTrigger) {
|
|
1173
|
-
response = await this.privateGetAuthStopOrder(this.extend(request, params));
|
|
1174
|
-
}
|
|
1175
|
-
else {
|
|
1176
|
-
response = await this.privateGetAuthOrder(this.extend(request, params));
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
//
|
|
1180
|
-
// [
|
|
1181
|
-
// {
|
|
1182
|
-
// "id":"a76bd262-3560-4bfb-98ac-1cedd394f4fc",
|
|
1183
|
-
// "status":"ORDER_STATUS_PLACED",
|
|
1184
|
-
// "side":"ORDER_SIDE_BUY",
|
|
1185
|
-
// "condition":"ORDER_CONDITION_GOOD_TILL_CANCELLED",
|
|
1186
|
-
// "type":"ORDER_TYPE_LIMIT",
|
|
1187
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
1188
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
1189
|
-
// "clientOrderId":"web-macos_chrome_1a6a6659-6f7c-4fac-be0b-d1d7ac06d",
|
|
1190
|
-
// "price":"4000.00",
|
|
1191
|
-
// "quantity":"0.01000",
|
|
1192
|
-
// "cost":"40.00",
|
|
1193
|
-
// "filled":"0.00000",
|
|
1194
|
-
// "trader":"7244bb3a-b6b2-446a-ac78-fa4bce5b59a9",
|
|
1195
|
-
// "creator":"USER",
|
|
1196
|
-
// "creatorId":"",
|
|
1197
|
-
// "timestamp":1635920767648
|
|
1198
|
-
// }
|
|
1199
|
-
// ]
|
|
1200
|
-
//
|
|
1201
|
-
return this.parseOrders(response, market, since, limit);
|
|
1202
|
-
}
|
|
1203
|
-
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
1204
|
-
/**
|
|
1205
|
-
* @method
|
|
1206
|
-
* @name latoken#fetchOrder
|
|
1207
|
-
* @description fetches information on an order made by the user
|
|
1208
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/getOrderById
|
|
1209
|
-
* @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getStopOrderById
|
|
1210
|
-
* @param {string} [symbol] not used by latoken fetchOrder
|
|
1211
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1212
|
-
* @param {boolean} [params.trigger] true if fetching a trigger order
|
|
1213
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1214
|
-
*/
|
|
1215
|
-
await this.loadMarkets();
|
|
1216
|
-
const request = {
|
|
1217
|
-
'id': id,
|
|
1218
|
-
};
|
|
1219
|
-
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
1220
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
1221
|
-
let response = undefined;
|
|
1222
|
-
if (isTrigger) {
|
|
1223
|
-
response = await this.privateGetAuthStopOrderGetOrderId(this.extend(request, params));
|
|
1224
|
-
}
|
|
1225
|
-
else {
|
|
1226
|
-
response = await this.privateGetAuthOrderGetOrderId(this.extend(request, params));
|
|
1227
|
-
}
|
|
1228
|
-
//
|
|
1229
|
-
// {
|
|
1230
|
-
// "id":"a76bd262-3560-4bfb-98ac-1cedd394f4fc",
|
|
1231
|
-
// "status":"ORDER_STATUS_PLACED",
|
|
1232
|
-
// "side":"ORDER_SIDE_BUY",
|
|
1233
|
-
// "condition":"ORDER_CONDITION_GOOD_TILL_CANCELLED",
|
|
1234
|
-
// "type":"ORDER_TYPE_LIMIT",
|
|
1235
|
-
// "baseCurrency":"620f2019-33c0-423b-8a9d-cde4d7f8ef7f",
|
|
1236
|
-
// "quoteCurrency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
1237
|
-
// "clientOrderId":"web-macos_chrome_1a6a6659-6f7c-4fac-be0b-d1d7ac06d",
|
|
1238
|
-
// "price":"4000.00",
|
|
1239
|
-
// "quantity":"0.01",
|
|
1240
|
-
// "cost":"40.000000000000000000",
|
|
1241
|
-
// "filled":"0",
|
|
1242
|
-
// "trader":"7244bb3a-b6b2-446a-ac78-fa4bce5b59a9",
|
|
1243
|
-
// "creator":"ORDER_CREATOR_USER",
|
|
1244
|
-
// "creatorId":"",
|
|
1245
|
-
// "timestamp":1635920767648
|
|
1246
|
-
// }
|
|
1247
|
-
//
|
|
1248
|
-
return this.parseOrder(response);
|
|
1249
|
-
}
|
|
1250
|
-
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1251
|
-
/**
|
|
1252
|
-
* @method
|
|
1253
|
-
* @name latoken#createOrder
|
|
1254
|
-
* @description create a trade order
|
|
1255
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/placeOrder
|
|
1256
|
-
* @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/placeStopOrder // stop
|
|
1257
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
1258
|
-
* @param {string} type 'market' or 'limit'
|
|
1259
|
-
* @param {string} side 'buy' or 'sell'
|
|
1260
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1261
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1262
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1263
|
-
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1264
|
-
*
|
|
1265
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
1266
|
-
* @param {string} [params.condition] "GTC", "IOC", or "FOK"
|
|
1267
|
-
* @param {string} [params.clientOrderId] [ 0 .. 50 ] characters, client's custom order id (free field for your convenience)
|
|
1268
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1269
|
-
*/
|
|
1270
|
-
await this.loadMarkets();
|
|
1271
|
-
const market = this.market(symbol);
|
|
1272
|
-
const uppercaseType = type.toUpperCase();
|
|
1273
|
-
const request = {
|
|
1274
|
-
'baseCurrency': market['baseId'],
|
|
1275
|
-
'quoteCurrency': market['quoteId'],
|
|
1276
|
-
'side': side.toUpperCase(),
|
|
1277
|
-
'condition': 'GTC',
|
|
1278
|
-
'type': uppercaseType,
|
|
1279
|
-
'clientOrderId': this.uuid(),
|
|
1280
|
-
// 'price': this.priceToPrecision (symbol, price),
|
|
1281
|
-
// 'quantity': this.amountToPrecision (symbol, amount),
|
|
1282
|
-
'quantity': this.amountToPrecision(symbol, amount),
|
|
1283
|
-
'timestamp': this.seconds(),
|
|
1284
|
-
};
|
|
1285
|
-
if (uppercaseType === 'LIMIT') {
|
|
1286
|
-
request['price'] = this.priceToPrecision(symbol, price);
|
|
1287
|
-
}
|
|
1288
|
-
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1289
|
-
params = this.omit(params, ['triggerPrice', 'stopPrice']);
|
|
1290
|
-
let response = undefined;
|
|
1291
|
-
if (triggerPrice !== undefined) {
|
|
1292
|
-
request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1293
|
-
response = await this.privatePostAuthStopOrderPlace(this.extend(request, params));
|
|
1294
|
-
}
|
|
1295
|
-
else {
|
|
1296
|
-
response = await this.privatePostAuthOrderPlace(this.extend(request, params));
|
|
1297
|
-
}
|
|
1298
|
-
//
|
|
1299
|
-
// {
|
|
1300
|
-
// "baseCurrency": "f7dac554-8139-4ff6-841f-0e586a5984a0",
|
|
1301
|
-
// "quoteCurrency": "a5a7a7a9-e2a3-43f9-8754-29a02f6b709b",
|
|
1302
|
-
// "side": "BID",
|
|
1303
|
-
// "clientOrderId": "my-wonderful-order-number-71566",
|
|
1304
|
-
// "price": "10103.19",
|
|
1305
|
-
// "stopPrice": "10103.19",
|
|
1306
|
-
// "quantity": "3.21",
|
|
1307
|
-
// "timestamp": 1568185507
|
|
1308
|
-
// }
|
|
1309
|
-
//
|
|
1310
|
-
return this.parseOrder(response, market);
|
|
1311
|
-
}
|
|
1312
|
-
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1313
|
-
/**
|
|
1314
|
-
* @method
|
|
1315
|
-
* @name latoken#cancelOrder
|
|
1316
|
-
* @description cancels an open order
|
|
1317
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelOrder
|
|
1318
|
-
* @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/cancelStopOrder // stop
|
|
1319
|
-
* @param {string} id order id
|
|
1320
|
-
* @param {string} symbol not used by latoken cancelOrder ()
|
|
1321
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1322
|
-
* @param {boolean} [params.trigger] true if cancelling a trigger order
|
|
1323
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1324
|
-
*/
|
|
1325
|
-
await this.loadMarkets();
|
|
1326
|
-
const request = {
|
|
1327
|
-
'id': id,
|
|
1328
|
-
};
|
|
1329
|
-
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
1330
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
1331
|
-
let response = undefined;
|
|
1332
|
-
if (isTrigger) {
|
|
1333
|
-
response = await this.privatePostAuthStopOrderCancel(this.extend(request, params));
|
|
1334
|
-
}
|
|
1335
|
-
else {
|
|
1336
|
-
response = await this.privatePostAuthOrderCancel(this.extend(request, params));
|
|
1337
|
-
}
|
|
1338
|
-
//
|
|
1339
|
-
// {
|
|
1340
|
-
// "id": "12345678-1234-1244-1244-123456789012",
|
|
1341
|
-
// "message": "cancellation request successfully submitted",
|
|
1342
|
-
// "status": "SUCCESS",
|
|
1343
|
-
// "error": "",
|
|
1344
|
-
// "errors": { }
|
|
1345
|
-
// }
|
|
1346
|
-
//
|
|
1347
|
-
return this.parseOrder(response);
|
|
1348
|
-
}
|
|
1349
|
-
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
1350
|
-
/**
|
|
1351
|
-
* @method
|
|
1352
|
-
* @name latoken#cancelAllOrders
|
|
1353
|
-
* @description cancel all open orders in a market
|
|
1354
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrders
|
|
1355
|
-
* @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrdersByPair
|
|
1356
|
-
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
1357
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1358
|
-
* @param {boolean} [params.trigger] true if cancelling trigger orders
|
|
1359
|
-
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1360
|
-
*/
|
|
1361
|
-
await this.loadMarkets();
|
|
1362
|
-
const request = {
|
|
1363
|
-
// 'currency': market['baseId'],
|
|
1364
|
-
// 'quote': market['quoteId'],
|
|
1365
|
-
};
|
|
1366
|
-
let market = undefined;
|
|
1367
|
-
const isTrigger = this.safeValue2(params, 'trigger', 'stop');
|
|
1368
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
1369
|
-
let response = undefined;
|
|
1370
|
-
if (symbol !== undefined) {
|
|
1371
|
-
market = this.market(symbol);
|
|
1372
|
-
request['currency'] = market['baseId'];
|
|
1373
|
-
request['quote'] = market['quoteId'];
|
|
1374
|
-
if (isTrigger) {
|
|
1375
|
-
response = await this.privatePostAuthStopOrderCancelAllCurrencyQuote(this.extend(request, params));
|
|
1376
|
-
}
|
|
1377
|
-
else {
|
|
1378
|
-
response = await this.privatePostAuthOrderCancelAllCurrencyQuote(this.extend(request, params));
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
else {
|
|
1382
|
-
if (isTrigger) {
|
|
1383
|
-
response = await this.privatePostAuthStopOrderCancelAll(this.extend(request, params));
|
|
1384
|
-
}
|
|
1385
|
-
else {
|
|
1386
|
-
response = await this.privatePostAuthOrderCancelAll(this.extend(request, params));
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
//
|
|
1390
|
-
// {
|
|
1391
|
-
// "message":"cancellation request successfully submitted",
|
|
1392
|
-
// "status":"SUCCESS"
|
|
1393
|
-
// }
|
|
1394
|
-
//
|
|
1395
|
-
return response;
|
|
1396
|
-
}
|
|
1397
|
-
async fetchTransactions(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1398
|
-
/**
|
|
1399
|
-
* @method
|
|
1400
|
-
* @name latoken#fetchTransactions
|
|
1401
|
-
* @deprecated
|
|
1402
|
-
* @description use fetchDepositsWithdrawals instead
|
|
1403
|
-
* @param {string} code unified currency code for the currency of the transactions, default is undefined
|
|
1404
|
-
* @param {int} [since] timestamp in ms of the earliest transaction, default is undefined
|
|
1405
|
-
* @param {int} [limit] max number of transactions to return, default is undefined
|
|
1406
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1407
|
-
* @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1408
|
-
*/
|
|
1409
|
-
await this.loadMarkets();
|
|
1410
|
-
const request = {
|
|
1411
|
-
// 'page': '1',
|
|
1412
|
-
// 'size': 100,
|
|
1413
|
-
};
|
|
1414
|
-
const response = await this.privateGetAuthTransaction(this.extend(request, params));
|
|
1415
|
-
//
|
|
1416
|
-
// {
|
|
1417
|
-
// "hasNext":false,
|
|
1418
|
-
// "content":[
|
|
1419
|
-
// {
|
|
1420
|
-
// "id":"fbf7d0d1-2629-4ad8-9def-7a1dba423362",
|
|
1421
|
-
// "status":"TRANSACTION_STATUS_CONFIRMED",
|
|
1422
|
-
// "type":"TRANSACTION_TYPE_DEPOSIT",
|
|
1423
|
-
// "senderAddress":"",
|
|
1424
|
-
// "recipientAddress":"0x3c46fa2e3f9023bc4897828ed173f8ecb3a554bc",
|
|
1425
|
-
// "amount":"200.000000000000000000",
|
|
1426
|
-
// "transactionFee":"0.000000000000000000",
|
|
1427
|
-
// "timestamp":1635893208404,
|
|
1428
|
-
// "transactionHash":"0x28bad3b74a042df13d64ddfbca855566a51bf7f190b8cd565c236a18d5cd493f#42",
|
|
1429
|
-
// "blockHeight":13540262,
|
|
1430
|
-
// "currency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
1431
|
-
// "memo":null,
|
|
1432
|
-
// "paymentProvider":"a8d6d1cb-f84a-4e9d-aa82-c6a08b356ee1",
|
|
1433
|
-
// "requiresCode":false
|
|
1434
|
-
// }
|
|
1435
|
-
// ],
|
|
1436
|
-
// "first":true,
|
|
1437
|
-
// "hasContent":true,
|
|
1438
|
-
// "pageSize":10
|
|
1439
|
-
// }
|
|
1440
|
-
//
|
|
1441
|
-
let currency = undefined;
|
|
1442
|
-
if (code !== undefined) {
|
|
1443
|
-
currency = this.currency(code);
|
|
1444
|
-
}
|
|
1445
|
-
const content = this.safeValue(response, 'content', []);
|
|
1446
|
-
return this.parseTransactions(content, currency, since, limit);
|
|
1447
|
-
}
|
|
1448
|
-
parseTransaction(transaction, currency = undefined) {
|
|
1449
|
-
//
|
|
1450
|
-
// {
|
|
1451
|
-
// "id":"fbf7d0d1-2629-4ad8-9def-7a1dba423362",
|
|
1452
|
-
// "status":"TRANSACTION_STATUS_CONFIRMED",
|
|
1453
|
-
// "type":"TRANSACTION_TYPE_DEPOSIT",
|
|
1454
|
-
// "senderAddress":"",
|
|
1455
|
-
// "recipientAddress":"0x3c46fa2e3f9023bc4897828ed173f8ecb3a554bc",
|
|
1456
|
-
// "amount":"200.000000000000000000",
|
|
1457
|
-
// "transactionFee":"0.000000000000000000",
|
|
1458
|
-
// "timestamp":1635893208404,
|
|
1459
|
-
// "transactionHash":"0x28bad3b74a042df13d64ddfbca855566a51bf7f190b8cd565c236a18d5cd493f#42",
|
|
1460
|
-
// "blockHeight":13540262,
|
|
1461
|
-
// "currency":"0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
1462
|
-
// "memo":null,
|
|
1463
|
-
// "paymentProvider":"a8d6d1cb-f84a-4e9d-aa82-c6a08b356ee1",
|
|
1464
|
-
// "requiresCode":false
|
|
1465
|
-
// }
|
|
1466
|
-
//
|
|
1467
|
-
const id = this.safeString(transaction, 'id');
|
|
1468
|
-
const timestamp = this.safeInteger(transaction, 'timestamp');
|
|
1469
|
-
const currencyId = this.safeString(transaction, 'currency');
|
|
1470
|
-
const code = this.safeCurrencyCode(currencyId, currency);
|
|
1471
|
-
const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
1472
|
-
const amount = this.safeNumber(transaction, 'amount');
|
|
1473
|
-
const addressFrom = this.safeString(transaction, 'senderAddress');
|
|
1474
|
-
const addressTo = this.safeString(transaction, 'recipientAddress');
|
|
1475
|
-
const txid = this.safeString(transaction, 'transactionHash');
|
|
1476
|
-
const tagTo = this.safeString(transaction, 'memo');
|
|
1477
|
-
const fee = {
|
|
1478
|
-
'currency': undefined,
|
|
1479
|
-
'cost': undefined,
|
|
1480
|
-
'rate': undefined,
|
|
1481
|
-
};
|
|
1482
|
-
const feeCost = this.safeNumber(transaction, 'transactionFee');
|
|
1483
|
-
if (feeCost !== undefined) {
|
|
1484
|
-
fee['cost'] = feeCost;
|
|
1485
|
-
fee['currency'] = code;
|
|
1486
|
-
}
|
|
1487
|
-
const type = this.parseTransactionType(this.safeString(transaction, 'type'));
|
|
1488
|
-
return {
|
|
1489
|
-
'info': transaction,
|
|
1490
|
-
'id': id,
|
|
1491
|
-
'txid': txid,
|
|
1492
|
-
'timestamp': timestamp,
|
|
1493
|
-
'datetime': this.iso8601(timestamp),
|
|
1494
|
-
'network': undefined,
|
|
1495
|
-
'addressFrom': addressFrom,
|
|
1496
|
-
'addressTo': addressTo,
|
|
1497
|
-
'address': addressTo,
|
|
1498
|
-
'tagFrom': undefined,
|
|
1499
|
-
'tagTo': tagTo,
|
|
1500
|
-
'tag': tagTo,
|
|
1501
|
-
'type': type,
|
|
1502
|
-
'amount': amount,
|
|
1503
|
-
'currency': code,
|
|
1504
|
-
'status': status,
|
|
1505
|
-
'updated': undefined,
|
|
1506
|
-
'comment': undefined,
|
|
1507
|
-
'internal': undefined,
|
|
1508
|
-
'fee': fee,
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
parseTransactionStatus(status) {
|
|
1512
|
-
const statuses = {
|
|
1513
|
-
'TRANSACTION_STATUS_CONFIRMED': 'ok',
|
|
1514
|
-
'TRANSACTION_STATUS_EXECUTED': 'ok',
|
|
1515
|
-
'TRANSACTION_STATUS_CANCELLED': 'canceled',
|
|
1516
|
-
};
|
|
1517
|
-
return this.safeString(statuses, status, status);
|
|
1518
|
-
}
|
|
1519
|
-
parseTransactionType(type) {
|
|
1520
|
-
const types = {
|
|
1521
|
-
'TRANSACTION_TYPE_DEPOSIT': 'deposit',
|
|
1522
|
-
'TRANSACTION_TYPE_WITHDRAWAL': 'withdrawal',
|
|
1523
|
-
};
|
|
1524
|
-
return this.safeString(types, type, type);
|
|
1525
|
-
}
|
|
1526
|
-
async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1527
|
-
/**
|
|
1528
|
-
* @method
|
|
1529
|
-
* @name latoken#fetchTransfers
|
|
1530
|
-
* @description fetch a history of internal transfers made on an account
|
|
1531
|
-
* @param {string} code unified currency code of the currency transferred
|
|
1532
|
-
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
1533
|
-
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
1534
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1535
|
-
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
1536
|
-
*/
|
|
1537
|
-
await this.loadMarkets();
|
|
1538
|
-
const currency = this.currency(code);
|
|
1539
|
-
const response = await this.privateGetAuthTransfer(params);
|
|
1540
|
-
//
|
|
1541
|
-
// {
|
|
1542
|
-
// "hasNext": true,
|
|
1543
|
-
// "content": [
|
|
1544
|
-
// {
|
|
1545
|
-
// "id": "ebd6312f-cb4f-45d1-9409-4b0b3027f21e",
|
|
1546
|
-
// "status": "TRANSFER_STATUS_COMPLETED",
|
|
1547
|
-
// "type": "TRANSFER_TYPE_WITHDRAW_SPOT",
|
|
1548
|
-
// "fromAccount": "c429c551-adbb-4078-b74b-276bea308a36",
|
|
1549
|
-
// "toAccount": "631c6203-bd62-4734-a04d-9b2a951f43b9",
|
|
1550
|
-
// "transferringFunds": 1259.0321785,
|
|
1551
|
-
// "usdValue": 1259.032179,
|
|
1552
|
-
// "rejectReason": null,
|
|
1553
|
-
// "timestamp": 1633515579530,
|
|
1554
|
-
// "direction": "INTERNAL",
|
|
1555
|
-
// "method": "TRANSFER_METHOD_UNKNOWN",
|
|
1556
|
-
// "recipient": null,
|
|
1557
|
-
// "sender": null,
|
|
1558
|
-
// "currency": "0c3a106d-bde3-4c13-a26e-3fd2394529e5",
|
|
1559
|
-
// "codeRequired": false,
|
|
1560
|
-
// "fromUser": "ce555f3f-585d-46fb-9ae6-487f66738073",
|
|
1561
|
-
// "toUser": "ce555f3f-585d-46fb-9ae6-487f66738073",
|
|
1562
|
-
// "fee": 0
|
|
1563
|
-
// },
|
|
1564
|
-
// ...
|
|
1565
|
-
// ],
|
|
1566
|
-
// "first": true,
|
|
1567
|
-
// "pageSize": 20,
|
|
1568
|
-
// "hasContent": true
|
|
1569
|
-
// }
|
|
1570
|
-
//
|
|
1571
|
-
const transfers = this.safeValue(response, 'content', []);
|
|
1572
|
-
return this.parseTransfers(transfers, currency, since, limit);
|
|
1573
|
-
}
|
|
1574
|
-
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
1575
|
-
/**
|
|
1576
|
-
* @method
|
|
1577
|
-
* @name latoken#transfer
|
|
1578
|
-
* @description transfer currency internally between wallets on the same account
|
|
1579
|
-
* @param {string} code unified currency code
|
|
1580
|
-
* @param {float} amount amount to transfer
|
|
1581
|
-
* @param {string} fromAccount account to transfer from
|
|
1582
|
-
* @param {string} toAccount account to transfer to
|
|
1583
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1584
|
-
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
1585
|
-
*/
|
|
1586
|
-
await this.loadMarkets();
|
|
1587
|
-
const currency = this.currency(code);
|
|
1588
|
-
const request = {
|
|
1589
|
-
'currency': currency['id'],
|
|
1590
|
-
'recipient': toAccount,
|
|
1591
|
-
'value': this.currencyToPrecision(code, amount),
|
|
1592
|
-
};
|
|
1593
|
-
let response = undefined;
|
|
1594
|
-
if (toAccount.indexOf('@') >= 0) {
|
|
1595
|
-
response = await this.privatePostAuthTransferEmail(this.extend(request, params));
|
|
1596
|
-
}
|
|
1597
|
-
else if (toAccount.length === 36) {
|
|
1598
|
-
response = await this.privatePostAuthTransferId(this.extend(request, params));
|
|
1599
|
-
}
|
|
1600
|
-
else {
|
|
1601
|
-
response = await this.privatePostAuthTransferPhone(this.extend(request, params));
|
|
1602
|
-
}
|
|
1603
|
-
//
|
|
1604
|
-
// {
|
|
1605
|
-
// "id": "e6fc4ace-7750-44e4-b7e9-6af038ac7107",
|
|
1606
|
-
// "status": "TRANSFER_STATUS_COMPLETED",
|
|
1607
|
-
// "type": "TRANSFER_TYPE_DEPOSIT_SPOT",
|
|
1608
|
-
// "fromAccount": "3bf61015-bf32-47a6-b237-c9f70df772ad",
|
|
1609
|
-
// "toAccount": "355eb279-7c7e-4515-814a-575a49dc0325",
|
|
1610
|
-
// "transferringFunds": "500000.000000000000000000",
|
|
1611
|
-
// "usdValue": "0.000000000000000000",
|
|
1612
|
-
// "rejectReason": "",
|
|
1613
|
-
// "timestamp": 1576844438402,
|
|
1614
|
-
// "direction": "INTERNAL",
|
|
1615
|
-
// "method": "TRANSFER_METHOD_UNKNOWN",
|
|
1616
|
-
// "recipient": "",
|
|
1617
|
-
// "sender": "",
|
|
1618
|
-
// "currency": "40af7879-a8cc-4576-a42d-7d2749821b58",
|
|
1619
|
-
// "codeRequired": false,
|
|
1620
|
-
// "fromUser": "cd555555-666d-46fb-9ae6-487f66738073",
|
|
1621
|
-
// "toUser": "cd555555-666d-46fb-9ae6-487f66738073",
|
|
1622
|
-
// "fee": 0
|
|
1623
|
-
// }
|
|
1624
|
-
//
|
|
1625
|
-
return this.parseTransfer(response);
|
|
1626
|
-
}
|
|
1627
|
-
parseTransfer(transfer, currency = undefined) {
|
|
1628
|
-
//
|
|
1629
|
-
// {
|
|
1630
|
-
// "id": "e6fc4ace-7750-44e4-b7e9-6af038ac7107",
|
|
1631
|
-
// "status": "TRANSFER_STATUS_COMPLETED",
|
|
1632
|
-
// "type": "TRANSFER_TYPE_DEPOSIT_SPOT",
|
|
1633
|
-
// "fromAccount": "3bf61015-bf32-47a6-b237-c9f70df772ad",
|
|
1634
|
-
// "toAccount": "355eb279-7c7e-4515-814a-575a49dc0325",
|
|
1635
|
-
// "transferringFunds": "500000.000000000000000000",
|
|
1636
|
-
// "usdValue": "0.000000000000000000",
|
|
1637
|
-
// "rejectReason": "",
|
|
1638
|
-
// "timestamp": 1576844438402,
|
|
1639
|
-
// "direction": "INTERNAL",
|
|
1640
|
-
// "method": "TRANSFER_METHOD_UNKNOWN",
|
|
1641
|
-
// "recipient": "",
|
|
1642
|
-
// "sender": "",
|
|
1643
|
-
// "currency": "40af7879-a8cc-4576-a42d-7d2749821b58",
|
|
1644
|
-
// "codeRequired": false,
|
|
1645
|
-
// "fromUser": "cd555555-666d-46fb-9ae6-487f66738073",
|
|
1646
|
-
// "toUser": "cd555555-666d-46fb-9ae6-487f66738073",
|
|
1647
|
-
// "fee": 0
|
|
1648
|
-
// }
|
|
1649
|
-
//
|
|
1650
|
-
const timestamp = this.safeTimestamp(transfer, 'timestamp');
|
|
1651
|
-
const currencyId = this.safeString(transfer, 'currency');
|
|
1652
|
-
const status = this.safeString(transfer, 'status');
|
|
1653
|
-
return {
|
|
1654
|
-
'info': transfer,
|
|
1655
|
-
'id': this.safeString(transfer, 'id'),
|
|
1656
|
-
'timestamp': this.safeInteger(transfer, 'timestamp'),
|
|
1657
|
-
'datetime': this.iso8601(timestamp),
|
|
1658
|
-
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
1659
|
-
'amount': this.safeNumber(transfer, 'transferringFunds'),
|
|
1660
|
-
'fromAccount': this.safeString(transfer, 'fromAccount'),
|
|
1661
|
-
'toAccount': this.safeString(transfer, 'toAccount'),
|
|
1662
|
-
'status': this.parseTransferStatus(status),
|
|
1663
|
-
};
|
|
1664
|
-
}
|
|
1665
|
-
parseTransferStatus(status) {
|
|
1666
|
-
const statuses = {
|
|
1667
|
-
'TRANSFER_STATUS_COMPLETED': 'ok',
|
|
1668
|
-
'TRANSFER_STATUS_PENDING': 'pending',
|
|
1669
|
-
'TRANSFER_STATUS_REJECTED': 'failed',
|
|
1670
|
-
'TRANSFER_STATUS_UNVERIFIED': 'pending',
|
|
1671
|
-
'TRANSFER_STATUS_CANCELLED': 'canceled',
|
|
1672
|
-
};
|
|
1673
|
-
return this.safeString(statuses, status, status);
|
|
1674
|
-
}
|
|
1675
|
-
sign(path, api = 'public', method = 'GET', params = undefined, headers = undefined, body = undefined) {
|
|
1676
|
-
const request = '/' + this.version + '/' + this.implodeParams(path, params);
|
|
1677
|
-
let requestString = request;
|
|
1678
|
-
const query = this.omit(params, this.extractParams(path));
|
|
1679
|
-
const urlencodedQuery = this.urlencode(query);
|
|
1680
|
-
if (method === 'GET') {
|
|
1681
|
-
if (Object.keys(query).length) {
|
|
1682
|
-
requestString += '?' + urlencodedQuery;
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
if (api === 'private') {
|
|
1686
|
-
this.checkRequiredCredentials();
|
|
1687
|
-
const auth = method + request + urlencodedQuery;
|
|
1688
|
-
const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha512.sha512);
|
|
1689
|
-
headers = {
|
|
1690
|
-
'X-LA-APIKEY': this.apiKey,
|
|
1691
|
-
'X-LA-SIGNATURE': signature,
|
|
1692
|
-
'X-LA-DIGEST': 'HMAC-SHA512', // HMAC-SHA384, HMAC-SHA512, optional
|
|
1693
|
-
};
|
|
1694
|
-
if (method === 'POST') {
|
|
1695
|
-
headers['Content-Type'] = 'application/json';
|
|
1696
|
-
body = this.json(query);
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
const url = this.urls['api']['rest'] + requestString;
|
|
1700
|
-
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
1701
|
-
}
|
|
1702
|
-
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
1703
|
-
if (!response) {
|
|
1704
|
-
return undefined;
|
|
1705
|
-
}
|
|
1706
|
-
//
|
|
1707
|
-
// {"result":false,"message":"invalid API key, signature or digest","error":"BAD_REQUEST","status":"FAILURE"}
|
|
1708
|
-
// {"result":false,"message":"request expired or bad <timeAlive>/<timestamp> format","error":"BAD_REQUEST","status":"FAILURE"}
|
|
1709
|
-
// {"message":"Internal Server Error","error":"INTERNAL_ERROR","status":"FAILURE"}
|
|
1710
|
-
// {"result":false,"message":"Internal error","error":"For input string: \"NaN\"","status":"FAILURE"}
|
|
1711
|
-
//
|
|
1712
|
-
const message = this.safeString(response, 'message');
|
|
1713
|
-
const feedback = this.id + ' ' + body;
|
|
1714
|
-
if (message !== undefined) {
|
|
1715
|
-
this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
|
|
1716
|
-
this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
|
|
1717
|
-
}
|
|
1718
|
-
const error = this.safeValue(response, 'error');
|
|
1719
|
-
const errorMessage = this.safeString(error, 'message');
|
|
1720
|
-
if ((error !== undefined) || (errorMessage !== undefined)) {
|
|
1721
|
-
this.throwExactlyMatchedException(this.exceptions['exact'], error, feedback);
|
|
1722
|
-
this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
|
|
1723
|
-
throw new errors.ExchangeError(feedback); // unknown message
|
|
1724
|
-
}
|
|
1725
|
-
return undefined;
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
module.exports = latoken;
|