UNPKG

ccxt

Version:

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges

1,137 lines (1,135 loc) • 237 kB
'use strict'; var kucoin$1 = require('./abstract/kucoin.js'); var errors = require('./base/errors.js'); var Precise = require('./base/Precise.js'); var number = require('./base/functions/number.js'); var sha256 = require('./static_dependencies/noble-hashes/sha256.js'); // ---------------------------------------------------------------------------- // --------------------------------------------------------------------------- /** * @class kucoin * @augments Exchange */ class kucoin extends kucoin$1 { describe() { return this.deepExtend(super.describe(), { 'id': 'kucoin', 'name': 'KuCoin', 'countries': ['SC'], 'rateLimit': 10, 'version': 'v2', 'certified': true, 'pro': true, 'comment': 'Platform 2.0', 'quoteJsonNumbers': false, 'has': { 'CORS': undefined, 'spot': true, 'margin': true, 'swap': false, 'future': false, 'option': false, 'borrowCrossMargin': true, 'borrowIsolatedMargin': true, 'cancelAllOrders': true, 'cancelOrder': true, 'closeAllPositions': false, 'closePosition': false, 'createDepositAddress': true, 'createMarketBuyOrderWithCost': true, 'createMarketOrderWithCost': true, 'createMarketSellOrderWithCost': true, 'createOrder': true, 'createOrders': true, 'createPostOnlyOrder': true, 'createStopLimitOrder': true, 'createStopMarketOrder': true, 'createStopOrder': true, 'createTriggerOrder': true, 'editOrder': true, 'fetchAccounts': true, 'fetchBalance': true, 'fetchBorrowInterest': true, 'fetchBorrowRateHistories': true, 'fetchBorrowRateHistory': true, 'fetchClosedOrders': true, 'fetchCrossBorrowRate': false, 'fetchCrossBorrowRates': false, 'fetchCurrencies': true, 'fetchDepositAddress': true, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': true, 'fetchDeposits': true, 'fetchDepositWithdrawFee': true, 'fetchDepositWithdrawFees': true, 'fetchFundingHistory': false, 'fetchFundingRate': false, 'fetchFundingRateHistory': false, 'fetchFundingRates': false, 'fetchIndexOHLCV': false, 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': false, 'fetchL3OrderBook': true, 'fetchLedger': true, 'fetchLeverageTiers': false, 'fetchMarginAdjustmentHistory': false, 'fetchMarginMode': false, 'fetchMarketLeverageTiers': false, 'fetchMarkets': true, 'fetchMarkOHLCV': false, 'fetchMarkPrice': true, 'fetchMarkPrices': true, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': false, 'fetchOpenInterestHistory': false, 'fetchOpenOrders': true, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrderBooks': false, 'fetchOrdersByStatus': true, 'fetchOrderTrades': true, 'fetchPositionHistory': false, 'fetchPositionMode': false, 'fetchPositionsHistory': false, 'fetchPremiumIndexOHLCV': false, 'fetchStatus': true, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, 'fetchTradingFees': false, 'fetchTransactionFee': true, 'fetchTransfers': false, 'fetchWithdrawals': true, 'repayCrossMargin': true, 'repayIsolatedMargin': true, 'setLeverage': true, 'setMarginMode': false, 'setPositionMode': false, 'signIn': false, 'transfer': true, 'withdraw': true, }, 'urls': { 'logo': 'https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg', 'referral': 'https://www.kucoin.com/ucenter/signup?rcode=E5wkqe', 'api': { 'public': 'https://api.kucoin.com', 'private': 'https://api.kucoin.com', 'futuresPrivate': 'https://api-futures.kucoin.com', 'futuresPublic': 'https://api-futures.kucoin.com', 'webExchange': 'https://kucoin.com/_api', 'broker': 'https://api-broker.kucoin.com', 'earn': 'https://api.kucoin.com', }, 'www': 'https://www.kucoin.com', 'doc': [ 'https://docs.kucoin.com', ], }, 'requiredCredentials': { 'apiKey': true, 'secret': true, 'password': true, }, 'api': { // level VIP0 // Spot => 3000/30s => 100/s // Weight = x => 100/(100/x) = x // Futures Management Public => 2000/30s => 200/3/s // Weight = x => 100/(200/3/x) = x*1.5 'public': { 'get': { // spot trading 'currencies': 4.5, 'currencies/{currency}': 4.5, 'symbols': 6, 'market/orderbook/level1': 3, 'market/allTickers': 22.5, 'market/stats': 22.5, 'markets': 4.5, 'market/orderbook/level{level}_{limit}': 6, 'market/orderbook/level2_20': 3, 'market/orderbook/level2_100': 6, 'market/histories': 4.5, 'market/candles': 4.5, 'prices': 4.5, 'timestamp': 4.5, 'status': 4.5, // margin trading 'mark-price/{symbol}/current': 3, 'mark-price/all-symbols': 3, 'margin/config': 25, 'announcements': 20, // 20W }, 'post': { // ws 'bullet-public': 15, // 10PW }, }, 'private': { 'get': { // account 'user-info': 30, 'accounts': 7.5, 'accounts/{accountId}': 7.5, 'accounts/ledgers': 3, 'hf/accounts/ledgers': 2, 'hf/margin/account/ledgers': 2, 'transaction-history': 3, 'sub/user': 30, 'sub-accounts/{subUserId}': 22.5, 'sub-accounts': 30, 'sub/api-key': 30, // funding 'margin/account': 40, 'margin/accounts': 15, 'isolated/accounts': 15, 'deposit-addresses': 7.5, 'deposits': 7.5, 'hist-deposits': 7.5, 'withdrawals': 30, 'hist-withdrawals': 30, 'withdrawals/quotas': 30, 'accounts/transferable': 30, 'transfer-list': 30, 'base-fee': 3, 'trade-fees': 3, // spot trading 'market/orderbook/level{level}': 3, 'market/orderbook/level2': 3, 'market/orderbook/level3': 3, 'hf/accounts/opened': 2, 'hf/orders/active': 2, 'hf/orders/active/symbols': 2, 'hf/margin/order/active/symbols': 2, 'hf/orders/done': 2, 'hf/orders/{orderId}': 2, 'hf/orders/client-order/{clientOid}': 2, 'hf/orders/dead-cancel-all/query': 2, 'hf/fills': 2, 'orders': 2, 'limit/orders': 3, 'orders/{orderId}': 2, 'order/client-order/{clientOid}': 3, 'fills': 10, 'limit/fills': 20, 'stop-order': 8, 'stop-order/{orderId}': 3, 'stop-order/queryOrderByClientOid': 3, 'oco/order/{orderId}': 2, 'oco/order/details/{orderId}': 2, 'oco/client-order/{clientOid}': 2, 'oco/orders': 2, // margin trading 'hf/margin/orders/active': 4, 'hf/margin/orders/done': 10, 'hf/margin/orders/{orderId}': 4, 'hf/margin/orders/client-order/{clientOid}': 5, 'hf/margin/fills': 5, 'etf/info': 25, 'margin/currencies': 20, 'risk/limit/strategy': 20, 'isolated/symbols': 20, 'margin/symbols': 5, 'isolated/account/{symbol}': 50, 'margin/borrow': 15, 'margin/repay': 15, 'margin/interest': 20, 'project/list': 10, 'project/marketInterestRate': 7.5, 'redeem/orders': 10, 'purchase/orders': 10, // broker 'broker/api/rebase/download': 3, 'migrate/user/account/status': 3, // affiliate 'affiliate/inviter/statistics': 30, }, 'post': { // account 'sub/user/created': 22.5, 'sub/api-key': 30, 'sub/api-key/update': 45, // funding 'deposit-addresses': 30, 'withdrawals': 7.5, 'accounts/universal-transfer': 6, 'accounts/sub-transfer': 45, 'accounts/inner-transfer': 15, 'transfer-out': 30, 'transfer-in': 30, // spot trading 'hf/orders': 1, 'hf/orders/test': 1, 'hf/orders/sync': 1, 'hf/orders/multi': 1, 'hf/orders/multi/sync': 1, 'hf/orders/alter': 3, 'hf/orders/dead-cancel-all': 2, 'orders': 2, 'orders/test': 2, 'orders/multi': 3, 'stop-order': 2, 'oco/order': 2, // margin trading 'hf/margin/order': 5, 'hf/margin/order/test': 5, 'margin/order': 5, 'margin/order/test': 5, 'margin/borrow': 15, 'margin/repay': 10, 'purchase': 15, 'redeem': 15, 'lend/purchase/update': 10, // ws 'bullet-private': 10, 'position/update-user-leverage': 5, 'deposit-address/create': 20, }, 'delete': { // account 'sub/api-key': 45, // funding 'withdrawals/{withdrawalId}': 30, // spot trading 'hf/orders/{orderId}': 1, 'hf/orders/sync/{orderId}': 1, 'hf/orders/client-order/{clientOid}': 1, 'hf/orders/sync/client-order/{clientOid}': 1, 'hf/orders/cancel/{orderId}': 2, 'hf/orders': 2, 'hf/orders/cancelAll': 30, 'orders/{orderId}': 3, 'order/client-order/{clientOid}': 5, 'orders': 20, 'stop-order/{orderId}': 3, 'stop-order/cancelOrderByClientOid': 5, 'stop-order/cancel': 3, 'oco/order/{orderId}': 3, 'oco/client-order/{clientOid}': 3, 'oco/orders': 3, // margin trading 'hf/margin/orders/{orderId}': 5, 'hf/margin/orders/client-order/{clientOid}': 5, 'hf/margin/orders': 10, // 10SW }, }, 'futuresPublic': { 'get': { 'contracts/active': 4.5, 'contracts/{symbol}': 4.5, 'ticker': 3, 'level2/snapshot': 4.5, 'level2/depth20': 7.5, 'level2/depth100': 15, 'trade/history': 7.5, 'kline/query': 4.5, 'interest/query': 7.5, 'index/query': 3, 'mark-price/{symbol}/current': 4.5, 'premium/query': 4.5, 'trade-statistics': 4.5, 'funding-rate/{symbol}/current': 3, 'contract/funding-rates': 7.5, 'timestamp': 3, 'status': 6, // ? 'level2/message/query': 1.3953, }, 'post': { // ws 'bullet-public': 15, // 10PW }, }, 'futuresPrivate': { 'get': { // account 'transaction-history': 3, // funding 'account-overview': 7.5, 'account-overview-all': 9, 'transfer-list': 30, // futures 'orders': 3, 'stopOrders': 9, 'recentDoneOrders': 7.5, 'orders/{orderId}': 7.5, 'orders/byClientOid': 7.5, 'fills': 7.5, 'recentFills': 4.5, 'openOrderStatistics': 15, 'position': 3, 'positions': 3, 'margin/maxWithdrawMargin': 15, 'contracts/risk-limit/{symbol}': 7.5, 'funding-history': 7.5, // 5FW }, 'post': { // funding 'transfer-out': 30, 'transfer-in': 30, // futures 'orders': 3, 'orders/test': 3, 'orders/multi': 4.5, 'position/margin/auto-deposit-status': 6, 'margin/withdrawMargin': 15, 'position/margin/deposit-margin': 6, 'position/risk-limit-level/change': 6, // ws 'bullet-private': 15, // 10FW }, 'delete': { 'orders/{orderId}': 1.5, 'orders/client-order/{clientOid}': 1.5, 'orders': 45, 'stopOrders': 22.5, // 15FW }, }, 'webExchange': { 'get': { 'currency/currency/chain-info': 1, // this is temporary from webApi }, }, 'broker': { 'get': { 'broker/nd/info': 2, 'broker/nd/account': 2, 'broker/nd/account/apikey': 2, 'broker/nd/rebase/download': 3, 'asset/ndbroker/deposit/list': 1, 'broker/nd/transfer/detail': 1, 'broker/nd/deposit/detail': 1, 'broker/nd/withdraw/detail': 1, }, 'post': { 'broker/nd/transfer': 1, 'broker/nd/account': 3, 'broker/nd/account/apikey': 3, 'broker/nd/account/update-apikey': 3, }, 'delete': { 'broker/nd/account/apikey': 3, }, }, 'earn': { 'get': { 'otc-loan/loan': 1, 'otc-loan/accounts': 1, 'earn/redeem-preview': 7.5, 'earn/saving/products': 7.5, 'earn/hold-assets': 7.5, 'earn/promotion/products': 7.5, 'earn/kcs-staking/products': 7.5, 'earn/staking/products': 7.5, 'earn/eth-staking/products': 7.5, // 5EW }, 'post': { 'earn/orders': 7.5, // 5EW }, 'delete': { 'earn/orders': 7.5, // 5EW }, }, }, 'timeframes': { '1m': '1min', '3m': '3min', '5m': '5min', '15m': '15min', '30m': '30min', '1h': '1hour', '2h': '2hour', '4h': '4hour', '6h': '6hour', '8h': '8hour', '12h': '12hour', '1d': '1day', '1w': '1week', '1M': '1month', }, 'precisionMode': number.TICK_SIZE, 'exceptions': { 'exact': { 'The order does not exist.': errors.OrderNotFound, 'order not exist': errors.OrderNotFound, 'order not exist.': errors.OrderNotFound, 'order_not_exist': errors.OrderNotFound, 'order_not_exist_or_not_allow_to_cancel': errors.InvalidOrder, 'Order size below the minimum requirement.': errors.InvalidOrder, 'The withdrawal amount is below the minimum requirement.': errors.ExchangeError, 'Unsuccessful! Exceeded the max. funds out-transfer limit': errors.InsufficientFunds, 'The amount increment is invalid.': errors.BadRequest, 'The quantity is below the minimum requirement.': errors.InvalidOrder, '400': errors.BadRequest, '401': errors.AuthenticationError, '403': errors.NotSupported, '404': errors.NotSupported, '405': errors.NotSupported, '415': errors.NotSupported, '429': errors.RateLimitExceeded, '500': errors.ExchangeNotAvailable, '503': errors.ExchangeNotAvailable, '101030': errors.PermissionDenied, '103000': errors.InvalidOrder, '130101': errors.BadRequest, '130102': errors.ExchangeError, '130103': errors.OrderNotFound, '130104': errors.ExchangeError, '130105': errors.InsufficientFunds, '130106': errors.NotSupported, '130107': errors.ExchangeError, '130108': errors.OrderNotFound, '130201': errors.PermissionDenied, '130202': errors.ExchangeError, '130203': errors.InsufficientFunds, '130204': errors.BadRequest, '130301': errors.InsufficientFunds, '130302': errors.PermissionDenied, '130303': errors.NotSupported, '130304': errors.NotSupported, '130305': errors.NotSupported, '130306': errors.NotSupported, '130307': errors.NotSupported, '130308': errors.InvalidOrder, '130309': errors.InvalidOrder, '130310': errors.ExchangeError, '130311': errors.InvalidOrder, '130312': errors.InvalidOrder, '130313': errors.InvalidOrder, '130314': errors.InvalidOrder, '130315': errors.NotSupported, '126000': errors.ExchangeError, '126001': errors.NotSupported, '126002': errors.ExchangeError, '126003': errors.InvalidOrder, '126004': errors.ExchangeError, '126005': errors.PermissionDenied, '126006': errors.ExchangeError, '126007': errors.ExchangeError, '126009': errors.ExchangeError, '126010': errors.ExchangeError, '126011': errors.ExchangeError, '126013': errors.InsufficientFunds, '126015': errors.ExchangeError, '126021': errors.NotSupported, '126022': errors.InvalidOrder, '126027': errors.InvalidOrder, '126028': errors.InvalidOrder, '126029': errors.InvalidOrder, '126030': errors.InvalidOrder, '126033': errors.InvalidOrder, '126034': errors.InvalidOrder, '126036': errors.InvalidOrder, '126037': errors.ExchangeError, '126038': errors.ExchangeError, '126039': errors.ExchangeError, '126041': errors.ExchangeError, '126042': errors.ExchangeError, '126043': errors.OrderNotFound, '126044': errors.InvalidOrder, '126045': errors.NotSupported, '126046': errors.NotSupported, '126047': errors.PermissionDenied, '126048': errors.PermissionDenied, '135005': errors.ExchangeError, '135018': errors.ExchangeError, '200004': errors.InsufficientFunds, '210014': errors.InvalidOrder, '210021': errors.InsufficientFunds, '230003': errors.InsufficientFunds, '260000': errors.InvalidAddress, '260100': errors.InsufficientFunds, '300000': errors.InvalidOrder, '400000': errors.BadSymbol, '400001': errors.AuthenticationError, '400002': errors.InvalidNonce, '400003': errors.AuthenticationError, '400004': errors.AuthenticationError, '400005': errors.AuthenticationError, '400006': errors.AuthenticationError, '400007': errors.AuthenticationError, '400008': errors.NotSupported, '400100': errors.InsufficientFunds, '400200': errors.InvalidOrder, '400330': errors.InvalidOrder, '400350': errors.InvalidOrder, '400370': errors.InvalidOrder, '400400': errors.BadRequest, '400401': errors.AuthenticationError, '400500': errors.InvalidOrder, '400600': errors.BadSymbol, '400760': errors.InvalidOrder, '401000': errors.BadRequest, '408000': errors.BadRequest, '411100': errors.AccountSuspended, '415000': errors.BadRequest, '400303': errors.PermissionDenied, '500000': errors.ExchangeNotAvailable, '260220': errors.InvalidAddress, '600100': errors.InsufficientFunds, '600101': errors.InvalidOrder, '900014': errors.BadRequest, // {"code":"900014","msg":"Invalid chainId"} }, 'broad': { 'Exceeded the access frequency': errors.RateLimitExceeded, 'require more permission': errors.PermissionDenied, }, }, 'fees': { 'trading': { 'tierBased': true, 'percentage': true, 'taker': this.parseNumber('0.001'), 'maker': this.parseNumber('0.001'), 'tiers': { 'taker': [ [this.parseNumber('0'), this.parseNumber('0.001')], [this.parseNumber('50'), this.parseNumber('0.001')], [this.parseNumber('200'), this.parseNumber('0.0009')], [this.parseNumber('500'), this.parseNumber('0.0008')], [this.parseNumber('1000'), this.parseNumber('0.0007')], [this.parseNumber('2000'), this.parseNumber('0.0007')], [this.parseNumber('4000'), this.parseNumber('0.0006')], [this.parseNumber('8000'), this.parseNumber('0.0005')], [this.parseNumber('15000'), this.parseNumber('0.00045')], [this.parseNumber('25000'), this.parseNumber('0.0004')], [this.parseNumber('40000'), this.parseNumber('0.00035')], [this.parseNumber('60000'), this.parseNumber('0.0003')], [this.parseNumber('80000'), this.parseNumber('0.00025')], ], 'maker': [ [this.parseNumber('0'), this.parseNumber('0.001')], [this.parseNumber('50'), this.parseNumber('0.0009')], [this.parseNumber('200'), this.parseNumber('0.0007')], [this.parseNumber('500'), this.parseNumber('0.0005')], [this.parseNumber('1000'), this.parseNumber('0.0003')], [this.parseNumber('2000'), this.parseNumber('0')], [this.parseNumber('4000'), this.parseNumber('0')], [this.parseNumber('8000'), this.parseNumber('0')], [this.parseNumber('15000'), this.parseNumber('-0.00005')], [this.parseNumber('25000'), this.parseNumber('-0.00005')], [this.parseNumber('40000'), this.parseNumber('-0.00005')], [this.parseNumber('60000'), this.parseNumber('-0.00005')], [this.parseNumber('80000'), this.parseNumber('-0.00005')], ], }, }, 'funding': { 'tierBased': false, 'percentage': false, 'withdraw': {}, 'deposit': {}, }, }, 'commonCurrencies': { 'BIFI': 'BIFIF', 'VAI': 'VAIOT', 'WAX': 'WAXP', 'ALT': 'APTOSLAUNCHTOKEN', 'KALT': 'ALT', 'FUD': 'FTX Users\' Debt', }, 'options': { 'hf': undefined, 'version': 'v1', 'symbolSeparator': '-', 'fetchMyTradesMethod': 'private_get_fills', 'timeDifference': 0, 'adjustForTimeDifference': false, 'fetchCurrencies': { 'webApiEnable': true, 'webApiRetries': 1, 'webApiMuteFailure': true, }, 'fetchMarkets': { 'fetchTickersFees': true, }, 'withdraw': { 'includeFee': false, }, // endpoint versions 'versions': { 'public': { 'GET': { // spot trading 'currencies': 'v3', 'currencies/{currency}': 'v3', 'symbols': 'v2', 'mark-price/all-symbols': 'v3', 'announcements': 'v3', }, }, 'private': { 'GET': { // account 'user-info': 'v2', 'hf/margin/account/ledgers': 'v3', 'sub/user': 'v2', 'sub-accounts': 'v2', // funding 'margin/accounts': 'v3', 'isolated/accounts': 'v3', // 'deposit-addresses': 'v2', 'deposit-addresses': 'v1', // spot trading 'market/orderbook/level2': 'v3', 'market/orderbook/level3': 'v3', 'market/orderbook/level{level}': 'v3', 'oco/order/{orderId}': 'v3', 'oco/order/details/{orderId}': 'v3', 'oco/client-order/{clientOid}': 'v3', 'oco/orders': 'v3', // margin trading 'hf/margin/orders/active': 'v3', 'hf/margin/order/active/symbols': 'v3', 'hf/margin/orders/done': 'v3', 'hf/margin/orders/{orderId}': 'v3', 'hf/margin/orders/client-order/{clientOid}': 'v3', 'hf/margin/fills': 'v3', 'etf/info': 'v3', 'margin/currencies': 'v3', 'margin/borrow': 'v3', 'margin/repay': 'v3', 'margin/interest': 'v3', 'project/list': 'v3', 'project/marketInterestRate': 'v3', 'redeem/orders': 'v3', 'purchase/orders': 'v3', 'migrate/user/account/status': 'v3', 'margin/symbols': 'v3', 'affiliate/inviter/statistics': 'v2', 'asset/ndbroker/deposit/list': 'v1', }, 'POST': { // account 'sub/user/created': 'v2', // funding 'accounts/universal-transfer': 'v3', 'accounts/sub-transfer': 'v2', 'accounts/inner-transfer': 'v2', 'transfer-out': 'v3', 'deposit-address/create': 'v3', // spot trading 'oco/order': 'v3', // margin trading 'hf/margin/order': 'v3', 'hf/margin/order/test': 'v3', 'margin/borrow': 'v3', 'margin/repay': 'v3', 'purchase': 'v3', 'redeem': 'v3', 'lend/purchase/update': 'v3', 'position/update-user-leverage': 'v3', 'withdrawals': 'v3', }, 'DELETE': { // account // funding // spot trading 'hf/margin/orders/{orderId}': 'v3', 'hf/margin/orders/client-order/{clientOid}': 'v3', 'hf/margin/orders': 'v3', 'oco/order/{orderId}': 'v3', 'oco/client-order/{clientOid}': 'v3', 'oco/orders': 'v3', // margin trading }, }, 'futuresPrivate': { 'POST': { 'transfer-out': 'v3', }, }, }, 'partner': { // the support for spot and future exchanges as separate settings 'spot': { 'id': 'ccxt', 'key': '9e58cc35-5b5e-4133-92ec-166e3f077cb8', }, 'future': { 'id': 'ccxtfutures', 'key': '1b327198-f30c-4f14-a0ac-918871282f15', }, // exchange-wide settings are also supported // 'id': 'ccxt' // 'key': '9e58cc35-5b5e-4133-92ec-166e3f077cb8', }, 'accountsByType': { 'spot': 'trade', 'margin': 'margin', 'cross': 'margin', 'isolated': 'isolated', 'main': 'main', 'funding': 'main', 'future': 'contract', 'swap': 'contract', 'mining': 'pool', 'hf': 'trade_hf', }, 'networks': { 'BRC20': 'btc', 'BTCNATIVESEGWIT': 'bech32', 'ERC20': 'eth', 'TRC20': 'trx', 'HRC20': 'heco', 'MATIC': 'matic', 'KCC': 'kcc', 'SOL': 'sol', 'ALGO': 'algo', 'EOS': 'eos', 'BEP20': 'bsc', 'BEP2': 'bnb', 'ARBONE': 'arbitrum', 'AVAXX': 'avax', 'AVAXC': 'avaxc', 'TLOS': 'tlos', 'CFX': 'cfx', 'ACA': 'aca', 'OP': 'optimism', 'ONT': 'ont', 'GLMR': 'glmr', 'CSPR': 'cspr', 'KLAY': 'klay', 'XRD': 'xrd', 'RVN': 'rvn', 'NEAR': 'near', 'APT': 'aptos', 'ETHW': 'ethw', 'TON': 'ton', 'BCH': 'bch', 'BSV': 'bchsv', 'BCHA': 'bchabc', 'OSMO': 'osmo', 'NANO': 'nano', 'XLM': 'xlm', 'VET': 'vet', 'IOST': 'iost', 'ZIL': 'zil', 'XRP': 'xrp', 'TOMO': 'tomo', 'XMR': 'xmr', 'COTI': 'coti', 'XTZ': 'xtz', 'ADA': 'ada', 'WAX': 'waxp', 'THETA': 'theta', 'ONE': 'one', 'IOTEX': 'iotx', 'NULS': 'nuls', 'KSM': 'ksm', 'LTC': 'ltc', 'WAVES': 'waves', 'DOT': 'dot', 'STEEM': 'steem', 'QTUM': 'qtum', 'DOGE': 'doge', 'FIL': 'fil', 'XYM': 'xym', 'FLUX': 'flux', 'ATOM': 'atom', 'XDC': 'xdc', 'KDA': 'kda', 'ICP': 'icp', 'CELO': 'celo', 'LSK': 'lsk', 'VSYS': 'vsys', 'KAR': 'kar', 'XCH': 'xch', 'FLOW': 'flow', 'BAND': 'band', 'EGLD': 'egld', 'HBAR': 'hbar', 'XPR': 'xpr', 'AR': 'ar', 'FTM': 'ftm', 'KAVA': 'kava', 'KMA': 'kma', 'XEC': 'xec', 'IOTA': 'iota', 'HNT': 'hnt', 'ASTR': 'astr', 'PDEX': 'pdex', 'METIS': 'metis', 'ZEC': 'zec', 'POKT': 'pokt', 'OASYS': 'oas', 'OASIS': 'oasis', 'ETC': 'etc', 'AKT': 'akt', 'FSN': 'fsn', 'SCRT': 'scrt', 'CFG': 'cfg', 'ICX': 'icx', 'KMD': 'kmd', 'NEM': 'NEM', 'STX': 'stx', 'DGB': 'dgb', 'DCR': 'dcr', 'CKB': 'ckb', 'ELA': 'ela', 'HYDRA': 'hydra', 'BTM': 'btm', 'KARDIA': 'kai', 'SXP': 'sxp', 'NEBL': 'nebl', 'ZEN': 'zen', 'SDN': 'sdn', 'LTO': 'lto', 'WEMIX': 'wemix', // 'BOBA': 'boba', // tbd 'EVER': 'ever', 'BNC': 'bnc', 'BNCDOT': 'bncdot', // 'CMP': 'cmp', // todo: after consensus 'AION': 'aion', 'GRIN': 'grin', 'LOKI': 'loki', 'QKC': 'qkc', 'TT': 'TT', 'PIVX': 'pivx', 'SERO': 'sero', 'METER': 'meter', 'STATEMINE': 'statemine', 'DVPN': 'dvpn', 'XPRT': 'xprt', 'MOVR': 'movr', 'ERGO': 'ergo', 'ABBC': 'abbc', 'DIVI': 'divi', 'PURA': 'pura', 'DFI': 'dfi', // 'NEO': 'neo', // tbd neo legacy 'NEON3': 'neon3', 'DOCK': 'dock', 'TRUE': 'true', 'CS': 'cs', 'ORAI': 'orai', 'BASE': 'base', // below will be uncommented after consensus // 'BITCOINDIAMON': 'bcd', // 'BITCOINGOLD': 'btg', // 'HTR': 'htr', // 'DEROHE': 'derohe', // 'NDAU': 'ndau', // 'HPB': 'hpb', // 'AXE': 'axe', // 'BITCOINPRIVATE': 'btcp', // 'EDGEWARE': 'edg', // 'JUPITER': 'jup', // 'VELAS': 'vlx', // vlxevm is different // // 'terra' luna lunc TBD // 'DIGITALBITS': 'xdb', // // fra is fra-emv on kucoin // 'PASTEL': 'psl', // // sysevm // 'CONCORDIUM': 'ccd', // 'AURORA': 'aurora', // 'PHA': 'pha', // a.k.a. khala // 'PAL': 'pal', // 'RSK': 'rbtc', // 'NIX': 'nix', // 'NIM': 'nim', // 'NRG': 'nrg', // 'RFOX': 'rfox', // 'PIONEER': 'neer', // 'PIXIE': 'pix', // 'ALEPHZERO': 'azero', // 'ACHAIN': 'act', // actevm is different // 'BOSCOIN': 'bos', // 'ELECTRONEUM': 'etn', // 'GOCHAIN': 'go', // 'SOPHIATX': 'sphtx', // 'WANCHAIN': 'wan', // 'ZEEPIN': 'zpt', // 'MATRIXAI': 'man', // 'METADIUM': 'meta', // 'METAHASH': 'mhc', // // eosc --"eosforce" tbd // 'IOTCHAIN': 'itc', // 'CONTENTOS': 'cos', // 'CPCHAIN': 'cpc', // 'INTCHAIN': 'int', // // 'DASH': 'dash', tbd digita-cash // 'WALTONCHAIN': 'wtc', // 'CONSTELLATION': 'dag', // 'ONELEDGER': 'olt', // 'AIRDAO': 'amb', // a.k.a. AMBROSUS // 'ENERGYWEB': 'ewt', // 'WAVESENTERPRISE': 'west', // 'HYPERCASH': 'hc', // 'ENECUUM': 'enq', // 'HAVEN': 'xhv', // 'CHAINX': 'pcx', // // 'FLUXOLD': 'zel', // zel seems old chain (with uppercase FLUX in kucoin UI and with id 'zel') // 'BUMO': 'bu', // 'DEEPONION': 'onion', // 'ULORD': 'ut', // 'ASCH': 'xas', // 'SOLARIS': 'xlr', // 'APOLLO': 'apl', // 'PIRATECHAIN': 'arrr', // 'ULTRA': 'uos', // 'EMONEY': 'ngm', // 'AURORACHAIN': 'aoa', // 'KLEVER': 'klv', // undetermined: xns(insolar), rhoc, luk (luniverse), kts (klimatas), bchn (bitcoin cash node), god (shallow entry), lit (litmus), }, 'marginModes': { 'cross': 'MARGIN_TRADE', 'isolated': 'MARGIN_ISOLATED_TRADE', 'spot': 'TRADE', }, }, 'features': { 'spot': { 'sandbox': false, 'createOrder': { 'marginMode': true, 'triggerPrice': true, 'triggerPriceType': undefined, 'triggerDirection': false, 'stopLossPrice': true, 'takeProfitPrice': true, 'attachedStopLossTakeProfit': undefined, 'timeInForce': { 'IOC': true, 'FOK': true, 'PO': true, 'GTD': true, }, 'hedged': false, 'trailing': false, 'leverage': false, 'marketBuyByCost': true, 'marketBuyRequiresPrice': false, 'selfTradePrevention': true, 'iceberg': true, // todo implement }, 'createOrders': { 'max': 5, }, 'fetchMyTrades': { 'marginMode': true, 'limit': undefined, 'daysBack': undefined, 'untilDays': 7, 'symbolRequired': true, }, 'fetchOrder': { 'marginMode': false, 'trigger': true, 'trailing': false, 'symbolRequired': true, }, 'fetchOpenOrders': { 'marginMode': true, 'limit': 500, 'trigger': true, 'trailing': false, 'symbolRequired': true, }, 'fetchOrders': undefined, 'fetchClosedOrders': { 'marginMode': true, 'limit': 500, 'daysBack': undefined, 'daysBackCanceled': undefined, 'untilDays': 7, 'trigger': true, 'trailing': false, 'symbolRequired': true, }, 'fetchOHLCV': { 'limit': 1500, }, }, 'swap': { 'linear': undefined, 'inverse': undefined, }, 'future': { 'linear': undefined, 'inverse': undefined, }, }, }); } nonce() { return this.milliseconds() - this.options['timeDifference']; } /** * @method * @name kucoin#fetchTime * @description fetches the current integer timestamp in milliseconds from the exchange server * @see https://docs.kucoin.com/#server-time * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int} the current integer timestamp in milliseconds from the exchange server */ async fetchTime(params = {}) { const response = await this.publicGetTimestamp(params); // // { // "code":"200000", // "msg":"success", // "data":1546837113087 // } // return this.safeInteger(response, 'data'); } /** * @method * @name kucoin#fetchStatus * @description the latest known information on the availability of the exchange API * @see https://docs.kucoin.com/#service-status * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure} */ async fetchStatus(params = {}) { const response = await this.publicGetStatus(params); // // { // "code":"200000", // "data":{ // "status":"open", //open, close, cancelonly // "msg":"upgrade match engine" //remark for operation // } // } // const data = this.safeDict(response, 'data', {}); const status = this.safeString(data, 'status'); return { 'status': (status === 'open') ? 'ok' : 'maintenance', 'updated': undefined, 'eta': undefined, 'url': undefined, 'info': response, }; } /** * @method * @name kucoin#fetchMarkets * @description retrieves data on all markets for kucoin * @see https://docs.kucoin.com/#get-symbols-list-deprecated * @see https://docs.kucoin.com/#get-all-tickers * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} an array of objects representing market data */ async fetchMarkets(params = {}) { let fetchTickersFees = undefined; [fetchTickersFees, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'fetchTickersFees', true); const promises = []; promises.push(this.publicGetSymbols(params)); // // { // "code": "200000", // "data": [ // { // "symbol": "XLM-USDT", // "name": "XLM-USDT", // "baseCurrency": "XLM", //