UNPKG

ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

863 lines (860 loc) 570 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var sha2_js = require('@noble/hashes/sha2.js'); 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'); // ---------------------------------------------------------------------------- // --------------------------------------------------------------------------- /** * @class kucoin * @augments Exchange */ class kucoin extends kucoin$1["default"] { describe() { return this.deepExtend(super.describe(), { 'id': 'kucoin', 'name': 'KuCoin', 'countries': ['SC'], 'rateLimit': 7.5, // 4000 requests per 30 seconds (VIP0 for spot) 'version': 'v2', 'certified': true, 'pro': true, 'comment': 'Platform 2.0', 'quoteJsonNumbers': false, 'has': { 'CORS': undefined, 'spot': true, 'margin': true, 'swap': true, 'future': true, 'option': false, 'addMargin': true, 'borrowCrossMargin': true, 'borrowIsolatedMargin': true, 'cancelAllOrders': true, 'cancelOrder': true, 'cancelOrders': true, 'closeAllPositions': false, 'closePosition': true, 'createDepositAddress': true, 'createMarketBuyOrderWithCost': true, 'createMarketOrderWithCost': true, 'createMarketSellOrderWithCost': true, 'createOrder': true, 'createOrders': true, 'createOrderWithTakeProfitAndStopLoss': true, 'createPostOnlyOrder': true, 'createStopLimitOrder': true, 'createStopLossOrder': true, 'createStopMarketOrder': true, 'createStopOrder': true, 'createTakeProfitOrder': true, 'createTriggerOrder': true, 'editOrder': true, 'fetchAccounts': true, 'fetchBalance': true, 'fetchBorrowInterest': true, 'fetchBorrowRateHistories': true, 'fetchBorrowRateHistory': true, 'fetchClosedOrders': true, 'fetchCrossBorrowRate': true, 'fetchCrossBorrowRates': false, 'fetchCurrencies': true, 'fetchDepositAddress': true, 'fetchDepositAddresses': false, 'fetchDepositAddressesByNetwork': true, 'fetchDeposits': true, 'fetchDepositWithdrawFee': true, 'fetchDepositWithdrawFees': true, 'fetchFundingHistory': true, 'fetchFundingInterval': true, 'fetchFundingRate': true, 'fetchFundingRateHistory': true, 'fetchFundingRates': false, 'fetchIndexOHLCV': true, // uta only 'fetchIsolatedBorrowRate': false, 'fetchIsolatedBorrowRates': false, 'fetchL3OrderBook': true, 'fetchLedger': true, 'fetchLeverage': true, 'fetchLeverageTiers': false, 'fetchMarginAdjustmentHistory': false, 'fetchMarginMode': true, 'fetchMarketLeverageTiers': true, 'fetchMarkets': true, 'fetchMarkOHLCV': true, // uta only 'fetchMarkPrice': true, 'fetchMarkPrices': true, 'fetchMyTrades': true, 'fetchOHLCV': true, 'fetchOpenInterest': true, 'fetchOpenInterestHistory': true, 'fetchOpenInterests': true, 'fetchOpenOrders': true, 'fetchOrder': true, 'fetchOrderBook': true, 'fetchOrderBooks': false, 'fetchOrdersByStatus': true, 'fetchOrderTrades': true, 'fetchPosition': true, 'fetchPositionADLRank': true, 'fetchPositionHistory': true, 'fetchPositionMode': true, 'fetchPositions': true, 'fetchPositionsADLRank': true, 'fetchPositionsHistory': true, 'fetchPremiumIndexOHLCV': true, // uta only 'fetchStatus': true, 'fetchTicker': true, 'fetchTickers': true, 'fetchTime': true, 'fetchTrades': true, 'fetchTradingFee': true, 'fetchTradingFees': false, 'fetchTransactionFee': true, 'fetchTransfers': true, 'fetchWithdrawals': true, 'reduceMargin': true, 'repayCrossMargin': true, 'repayIsolatedMargin': true, 'setLeverage': true, 'setMarginMode': true, 'setPositionMode': true, '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', 'uta': 'https://api.kucoin.com', 'utaPrivate': '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 => 4000/30s // Weight = x // Pro, Futures, Management, Management, Earn, CopyTrading => 2000/30s // Weight = x*2 'public': { 'get': { // spot trading 'currencies': 3, 'currencies/{currency}': 3, 'symbols': 4, 'market/orderbook/level1': 2, 'market/allTickers': 15, 'market/stats': 15, 'markets': 3, 'market/orderbook/level{level}_{limit}': 4, 'market/orderbook/level2_20': 2, 'market/orderbook/level2_100': 4, 'market/histories': 3, 'market/candles': 3, 'prices': 3, 'timestamp': 3, 'status': 3, // margin trading 'mark-price/{symbol}/current': 2, 'mark-price/all-symbols': 10, 'margin/config': 25, 'announcements': 20, 'margin/collateralRatio': 10, // convert 'convert/symbol': 5, 'convert/currencies': 5, }, 'post': { // ws 'bullet-public': 10, }, }, 'private': { 'get': { // account 'user-info': 20, 'user/api-key': 20, 'accounts': 5, 'accounts/{accountId}': 5, 'accounts/ledgers': 2, 'hf/accounts/ledgers': 2, 'hf/margin/account/ledgers': 2, 'transaction-history': 2, 'sub/user': 20, 'sub-accounts/{subUserId}': 15, 'sub-accounts': 20, 'sub/api-key': 20, // funding 'margin/account': 40, 'margin/accounts': 15, 'isolated/accounts': 15, 'deposit-addresses': 5, 'deposits': 5, 'hist-deposits': 5, 'withdrawals': 20, 'hist-withdrawals': 20, 'withdrawals/quotas': 20, 'accounts/transferable': 20, 'transfer-list': 20, '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}': 2, '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, 'hf/margin/stop-orders': 8, 'hf/margin/stop-order/orderId': 3, 'hf/margin/stop-order/clientOid': 3, 'hf/margin/oco-order/orderId': 2, 'hf/margin/oco-order/clientOid': 2, 'hf/margin/oco-order/detail/orderId': 2, 'hf/margin/oco-orders': 2, 'etf/info': 25, 'margin/currencies': 20, 'risk/limit/strategy': 20, // Deprecate 'isolated/symbols': 3, 'margin/symbols': 3, 'isolated/account/{symbol}': 50, 'margin/borrow': 15, 'margin/repay': 15, 'margin/interest': 20, 'project/list': 10, 'project/marketInterestRate': 5, 'redeem/orders': 10, 'purchase/orders': 10, // broker 'broker/api/rebase/download': 3, 'broker/queryMyCommission': 3, 'broker/queryUser': 3, 'broker/queryDetailByUid': 3, 'migrate/user/account/status': 3, // convert 'convert/quote': 20, 'convert/order/detail': 5, 'convert/order/history': 5, 'convert/limit/quote': 20, 'convert/limit/order/detail': 5, 'convert/limit/orders': 5, // affiliate 'affiliate/inviter/statistics': 30, }, 'post': { // account 'sub/user/created': 15, 'sub/api-key': 20, 'sub/api-key/update': 30, // funding 'deposit-addresses': 20, 'withdrawals': 5, 'accounts/universal-transfer': 4, 'accounts/sub-transfer': 30, 'accounts/inner-transfer': 15, 'transfer-out': 20, 'transfer-in': 20, // 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': 1, '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': 2, 'hf/margin/order/test': 2, 'hf/margin/stop-order': 3, 'margin/order': 5, 'margin/order/test': 5, 'hf/margin/oco-order': 2, 'margin/borrow': 15, 'margin/repay': 10, 'purchase': 15, 'redeem': 15, 'lend/purchase/update': 10, // convert 'convert/order': 20, 'convert/limit/order': 20, // ws 'bullet-private': 10, 'position/update-user-leverage': 5, 'deposit-address/create': 20, }, 'delete': { // account 'sub/api-key': 30, // funding 'withdrawals/{withdrawalId}': 20, // 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}': 1, '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}': 2, 'hf/margin/orders/client-order/{clientOid}': 2, 'hf/margin/orders': 5, 'hf/margin/stop-order/cancel-by-id': 3, 'hf/margin/stop-order/cancel-by-clientOid': 5, 'hf/margin/stop-order/cancel': 3, 'hf/margin/oco-order/cancel-by-id': 3, 'hf/margin/oco-order/cancel-by-clientOid': 3, 'hf/margin/oco-order/cancel': 3, // convert 'convert/limit/order/cancel': 5, }, }, 'futuresPublic': { 'get': { 'contracts/active': 6, 'contracts/{symbol}': 6, // 3PW 'ticker': 4, // 2PW 'allTickers': 10, // 5PW 'level2/snapshot': 6, // 3PW 'level2/depth20': 10, // 5PW 'level2/depth100': 20, // 10PW 'trade/history': 10, // 5PW 'kline/query': 6, // 3PW 'interest/query': 10, // 5PW 'index/query': 4, // 2PW 'mark-price/{symbol}/current': 6, // 3PW 'premium/query': 6, // 3PW 'trade-statistics': 6, // 3PW 'funding-rate/{symbol}/current': 4, // 2PW 'contract/funding-rates': 10, // 5PW 'timestamp': 4, // 2PW 'status': 8, // 4PW // ? 'level2/message/query': 1.3953, 'contracts/risk-limit/{symbol}': 3, 'level3/message/query': 3, // deprecated,level3/snapshot is suggested 'level3/snapshot': 3, // v2 }, 'post': { // ws 'bullet-public': 20, // 10PW }, }, 'futuresPrivate': { 'get': { // account 'transaction-history': 4, // 2MW // funding 'account-overview': 10, // 5FW 'account-overview-all': 12, // 6FW 'transfer-list': 20, // futures 'orders': 4, // 2FW 'stopOrders': 12, // 6FW 'recentDoneOrders': 10, // 5FW 'orders/{orderId}': 10, // 5FW 'orders/byClientOid': 10, // 5FW 'fills': 10, // 5FW 'recentFills': 6, // 3FW 'trade-fees': 6, 'openOrderStatistics': 20, // 10FW 'position': 4, // 2FW 'positions': 4, // 2FW 'margin/maxWithdrawMargin': 20, // 10FW 'contracts/risk-limit/{symbol}': 10, // 5FW 'funding-history': 10, // 5FW 'copy-trade/futures/get-max-open-size': 8, // 4FW 'copy-trade/futures/position/margin/max-withdraw-margin': 20, // 10FW 'history-positions': 4, 'position/getMarginMode': 4, 'position/getPositionMode': 4, 'deposit-address': 4, 'deposit-list': 4, 'withdrawals/quotas': 4, 'withdrawal-list': 4, 'sub/api-key': 4, 'trade-statistics': 4, 'getMaxOpenSize': 4, 'getCrossUserLeverage': 4, }, 'post': { // funding 'transfer-out': 20, 'transfer-in': 20, // futures 'orders': 4, // 2FW 'st-orders': 4, 'orders/test': 4, // 2FW 'orders/multi': 6, // 3FW 'position/margin/auto-deposit-status': 8, // 4FW 'margin/withdrawMargin': 10, // 10FW 'position/margin/deposit-margin': 8, // 4FW 'position/risk-limit-level/change': 8, // 4FW 'copy-trade/futures/orders': 4, // 2FW 'copy-trade/futures/orders/test': 4, // 2FW 'copy-trade/futures/st-orders': 4, // 2FW 'copy-trade/futures/position/margin/deposit-margin': 8, // 4FW 'copy-trade/futures/position/margin/withdraw-margin': 20, // 10FW 'copy-trade/futures/position/risk-limit-level/change': 4, // 2FW 'copy-trade/futures/position/margin/auto-deposit-status': 8, // 4FW 'copy-trade/futures/position/changeMarginMode': 4, // 2FW 'copy-trade/futures/position/changeCrossUserLeverage': 4, // 2FW 'copy-trade/getCrossModeMarginRequirement': 6, // 3FW 'copy-trade/position/switchPositionMode': 4, // 2FW 'changeCrossUserLeverage': 4, 'withdrawals': 4, 'sub/api-key': 4, 'sub/api-key/update': 4, 'position/changeMarginMode': 4, 'position/switchPositionMode': 4, // ws 'bullet-private': 20, // 10FW }, 'delete': { 'orders/{orderId}': 2, // 1FW 'orders/client-order/{clientOid}': 2, // 1FW 'orders': 20, // 10FW 'stopOrders': 30, // 15FW 'copy-trade/futures/orders': 1.5, // 1FW 'copy-trade/futures/orders/client-order': 1.5, // 1FW 'orders/multi-cancel': 40, // 20FW 'withdrawals/{withdrawalId}': 10, 'cancel/transfer-out': 10, 'sub/api-key': 10, }, }, 'webExchange': { 'get': { 'currency/currency/chain-info': 1, // this is temporary from webApi 'contract/{symbol}/funding-rates': 2, }, }, 'broker': { 'get': { 'broker/nd/info': 4, 'broker/nd/account': 4, 'broker/nd/account/apikey': 4, 'broker/nd/rebase/download': 4, 'asset/ndbroker/deposit/list': 2, 'broker/nd/transfer/detail': 2, 'broker/nd/deposit/detail': 2, 'broker/nd/withdraw/detail': 2, }, 'post': { 'broker/nd/transfer': 2, 'broker/nd/account': 6, 'broker/nd/account/apikey': 6, 'broker/nd/account/update-apikey': 6, }, 'delete': { 'broker/nd/account/apikey': 6, }, }, 'earn': { 'get': { 'otc-loan/discount-rate-configs': 20, 'otc-loan/loan': 2, 'otc-loan/accounts': 2, 'earn/redeem-preview': 10, // 5EW 'earn/saving/products': 10, // 5EW 'earn/hold-assets': 10, // 5EW 'earn/promotion/products': 10, // 5EW 'earn/kcs-staking/products': 10, // 5EW 'earn/staking/products': 10, // 5EW 'earn/eth-staking/products': 10, // 5EW 'struct-earn/dual/products': 6, 'struct-earn/orders': 10, }, 'post': { 'earn/orders': 10, // 5EW 'struct-earn/orders': 10, }, 'delete': { 'earn/orders': 10, // 5EW }, }, 'uta': { 'get': { 'market/announcement': 40, 'market/currency': 6, 'asset/currencies': 6, 'market/instrument': 8, 'market/ticker': 30, 'market/trade': 6, 'market/kline': 6, 'market/funding-rate': 4, 'market/funding-rate-history': 10, 'market/cross-config': 50, 'market/collateral-discount-ratio': 20, 'market/index-price': 20, 'market/position-tiers': 40, 'market/open-interest': 20, 'server/status': 6, 'market/borrowable-currency': 30, 'user/my-ip': 20, 'market/fiat-price': 6, }, }, 'utaPrivate': { 'get': { 'market/orderbook': 6, 'account/balance': 10, 'account/transfer-quota': 40, 'account/mode': 60, 'account/ledger': 4, 'account/interest-history': 30, 'asset/deposit/address': 10, 'account/deposit/address': 5, '{accountMode}/account/balance': 10, '{accountMode}/account/overview': 10, '{accountMode}/order/detail': 8, '{accountMode}/order/open-list': 8, '{accountMode}/order/history': 8, '{accountMode}/order/execution': 8, '{accountMode}/position/open-list': 6, '{accountMode}/position/history': 4, 'position/history': 4, '{accountMode}/position/tiers': 40, 'sub-account/balance': 10, 'user/fee-rate': 6, 'dcp/query': 4, 'unified/account/leverage': 20, // returns {"code":"404","msg":"Not Found","retry":false,"success":false} 'position/funding-history': 30, 'account/interest-limits': 20, }, 'post': { 'account/transfer': 8, 'account/mode': 60, '{accountMode}/account/modify-leverage': 40, '{accountMode}/order/place': 2, '{accountMode}/order/place-batch': 8, '{accountMode}/order/cancel': 2, '{accountMode}/order/cancel-batch': 8, '{accountMode}/order/cancel-all': 40, 'sub-account/canTransferOut': 10, 'dcp/set': 4, '{accountMode}/account/modify-leverage-margin-cross': 40, }, }, }, 'timeframes': { '1m': '1min', // spot and uta '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': { 'Order not exist or not allow to be cancelled': errors.OrderNotFound, 'The order does not exist.': errors.OrderNotFound, 'order not exist': errors.OrderNotFound, 'order not exist.': errors.OrderNotFound, // duplicated error temporarily 'order_not_exist': errors.OrderNotFound, // {"code":"order_not_exist","msg":"order_not_exist"} ¯\_(ツ)_/¯ 'order_not_exist_or_not_allow_to_cancel': errors.OrderNotFound, // {"code":"400100","msg":"order_not_exist_or_not_allow_to_cancel"}, same condition as the spaced variant above, see https://github.com/ccxt/ccxt/issues/24154 'Order size below the minimum requirement.': errors.InvalidOrder, // {"code":"400100","msg":"Order size below the minimum requirement."} 'Order size increment invalid.': errors.InvalidOrder, // {"msg":"Order size increment invalid.","code":"600100"} 'The withdrawal amount is below the minimum requirement.': errors.ExchangeError, // {"code":"400100","msg":"The withdrawal amount is below the minimum requirement."} 'Unsuccessful! Exceeded the max. funds out-transfer limit': errors.InsufficientFunds, // {"code":"200000","msg":"Unsuccessful! Exceeded the max. funds out-transfer limit"} 'The amount increment is invalid.': errors.BadRequest, 'The quantity is below the minimum requirement.': errors.InvalidOrder, // {"msg":"The quantity is below the minimum requirement.","code":"400100"} 'not in the given range!': errors.BadRequest, // {"msg":"price not in the given range!","code":"400100"} 'recAccountType not in the given range': errors.BadRequest, // {"msg":"recAccountType not in the given range","code":"400100"} 'Unsupported trading pair.': errors.BadSymbol, // {"msg":"Unsupported trading pair.","code":"400100"} '400': errors.BadRequest, '401': errors.AuthenticationError, '403': errors.NotSupported, '404': errors.NotSupported, '405': errors.NotSupported, '415': errors.NotSupported, '429': errors.RateLimitExceeded, '500': errors.ExchangeNotAvailable, // Internal Server Error -- We had a problem with our server. Try again later. '503': errors.ExchangeNotAvailable, '101030': errors.PermissionDenied, // {"code":"101030","msg":"You haven't yet enabled the margin trading"} '103000': errors.InvalidOrder, // {"code":"103000","msg":"Exceed the borrowing limit, the remaining borrowable amount is: 0USDT"} '112010': errors.PermissionDenied, // {"msg":"Invalid Unified Account user.","code":"112010"} '130101': errors.BadRequest, // Parameter error '130102': errors.ExchangeError, // Maximum subscription amount has been exceeded. '130103': errors.OrderNotFound, // Subscription order does not exist. '130104': errors.ExchangeError, // Maximum number of subscription orders has been exceeded. '130105': errors.InsufficientFunds, // Insufficient balance. '130106': errors.NotSupported, // The currency does not support redemption. '130107': errors.ExchangeError, // Redemption amount exceeds subscription amount. '130108': errors.OrderNotFound, // Redemption order does not exist. '130201': errors.PermissionDenied, // Your account has restricted access to certain features. Please contact customer service for further assistance '130202': errors.ExchangeError, // The system is renewing the loan automatically. Please try again later '130203': errors.InsufficientFunds, // Insufficient account balance '130204': errors.BadRequest, // As the total lending amount for platform leverage reaches the platform's maximum position limit, the system suspends the borrowing function of leverage '130301': errors.InsufficientFunds, // Insufficient account balance '130302': errors.PermissionDenied, // Your relevant permission rights have been restricted, you can contact customer service for processing '130303': errors.NotSupported, // The current trading pair does not support isolated positions '130304': errors.NotSupported, // The trading function of the current trading pair is not enabled '130305': errors.NotSupported, // The current trading pair does not support cross position '130306': errors.NotSupported, // The account has not opened leveraged trading '130307': errors.NotSupported, // Please reopen the leverage agreement '130308': errors.InvalidOrder, // Position renewal freeze '130309': errors.InvalidOrder, // Position forced liquidation freeze '130310': errors.ExchangeError, // Abnormal leverage account status '130311': errors.InvalidOrder, // Failed to place an order, triggering buy limit '130312': errors.InvalidOrder, // Trigger global position limit, suspend buying '130313': errors.InvalidOrder, // Trigger global position limit, suspend selling '130314': errors.InvalidOrder, // Trigger the global position limit and prompt the remaining quantity available for purchase '130315': errors.NotSupported, // This feature has been suspended due to country restrictions '126000': errors.ExchangeError, // Abnormal margin trading '126001': errors.NotSupported, // Users currently do not support high frequency '126002': errors.ExchangeError, // There is a risk problem in your account and transactions are temporarily not allowed! '126003': errors.InvalidOrder, // The commission amount is less than the minimum transaction amount for a single commission '126004': errors.ExchangeError, // Trading pair does not exist or is prohibited '126005': errors.PermissionDenied, // This trading pair requires advanced KYC certification before trading '126006': errors.ExchangeError, // Trading pair is not available '126007': errors.ExchangeError, // Trading pair suspended '126009': errors.ExchangeError, // Trading pair is suspended from creating orders '126010': errors.ExchangeError, // Trading pair suspended order cancellation '126011': errors.ExchangeError, // There are too many orders in the order '126013': errors.InsufficientFunds, // Insufficient account balance '126015': errors.ExchangeError, // It is prohibited to place orders on this trading pair '126021': errors.NotSupported, // This digital asset does not support user participation in your region, thank you for your understanding! '126022': errors.InvalidOrder, // The final transaction price of your order will trigger the price protection strategy. To protect the price from deviating too much, please place an order again. '126027': errors.InvalidOrder, // Only limit orders are supported '126028': errors.InvalidOrder, // Only limit orders are supported before the specified time '126029': errors.InvalidOrder, // The maximum order price is: xxx '126030': errors.InvalidOrder, // The minimum order price is: xxx '126033': errors.InvalidOrder, // Duplicate order '126034': errors.InvalidOrder, // Failed to create take profit and stop loss order '126036': errors.InvalidOrder, // Failed to create margin order '126037': errors.ExchangeError, // Due to country and region restrictions, this function has been suspended! '126038': errors.ExchangeError, // Third-party service call failed (internal exception) '126039': errors.ExchangeError, // Third-party service call failed, reason: xxx '126041': errors.ExchangeError, // clientTimestamp parameter error '126042': errors.ExchangeError, // Exceeded maximum position limit '126043': errors.OrderNotFound, // Order does not exist '126044': errors.InvalidOrder, // clientOid duplicate '126045': errors.NotSupported, // This digital asset does not support user participation in your region, thank you for your understanding! '126046': errors.NotSupported, // This digital asset does not support your IP region, thank you for your understanding! '126047': errors.PermissionDenied, // Please complete identity verification '126048': errors.PermissionDenied, // Please complete authentication for the master account '135005': errors.ExchangeError, // Margin order query business abnormality '135018': errors.ExchangeError, // Margin order query service abnormality '200004': errors.InsufficientFunds, '210014': errors.InvalidOrder, // {"code":"210014","msg":"Exceeds the max. borrowing amount, the remaining amount you can borrow: 0USDT"} '210021': errors.InsufficientFunds, // {"code":"210021","msg":"Balance not enough"} '230003': errors.InsufficientFunds, // {"code":"230003","msg":"Balance insufficient!"} '260000': errors.InvalidAddress, // {"code":"260000","msg":"Deposit address already exists."} '260100': errors.InsufficientFunds, // {"code":"260100","msg":"account.noBalance"} '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.BadRequest, // {"msg":"account.available.amount","code":"400100"} or {"msg":"Withdrawal amount is below the minimum requirement.","code":"400100"} or {"msg":"pageSize should not greater than 500","code":"400100"} '400200': errors.InvalidOrder, // {"code":"400200","msg":"Forbidden to place an order"} '400330': errors.InvalidOrder, // {"msg":"Order price can't deviate from NAV by 50%","code":"400330"} '400350': errors.InvalidOrder, // {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."} '400370': errors.InvalidOrder, // {"code":"400370","msg":"Max. price: 0.02500000000000000000"} '400400': errors.BadRequest, // Parameter error '400401': errors.AuthenticationError, // User is not logged in '400500': errors.RestrictedLocation, // {"code":"400500","msg":"Your located country/region is currently not supported for the trading of this token"} '400600': errors.BadSymbol, // {"code":"400600","msg":"validation.createOrder.symbolNotAvailable"} '400760': errors.InvalidOrder, // {"code":"400760","msg":"order price should be more than XX"} '401000': errors.BadRequest, // {"code":"401000","msg":"The interface has been deprecated"} '408000': errors.BadRequest, // Network timeout, please try again later '411100': errors.AccountSuspended, '415000': errors.BadRequest, // {"code":"415000","msg":"Unsupported Media Type"} '400303': errors.PermissionDenied, // {"msg":"To enjoy the full range of our products and services, we kindly request you complete the identity verification process.","code":"400303"} '500000': errors.ExchangeNotAvailable, // {"code":"500000","msg":"Internal Server Error"} '260220': errors.InvalidAddress, // { "code": "260220", "msg": "deposit.address.not.exists" } '600100': errors.InsufficientFunds, // {"msg":"Funds below the minimum requirement.","code":"600100"} '600101': errors.InvalidOrder, // {"msg":"The order funds should more then 0.1 USDT.","code":"600101"} '900014': errors.BadRequest, // {"code":"900014","msg":"Invalid chainId"} // futures errors '330012': errors.InvalidOrder, // {"msg":"Your order is in One-Way Mode, while your account is set to Hedge Mode. Update your settings so they match and try again.","code":"330012"} '330005': errors.InvalidOrder, // {"msg":"The order's margin mode does not match the selected one. Please switch and try again.","code":"330005"} '100001': errors.OrderNotFound, // {"msg":"error.getOrder.orderNotExist","code":"100001"} '100004': errors.BadRequest, // {"code":"100004","msg":"Order is in not cancelable state"} '300003': errors.InsufficientFunds, '300012': errors.InvalidOrder, '404000': errors.NotSupported, // URL Not Found -- The requested resource could not be found '300009': errors.InvalidOrder, // {"msg":"No open positions to close.","code":"300009"} '330008': errors.InsufficientFunds, // {"msg":"Your current margin and leverage have reached the maximum open limit. Please increase your margin or raise your leverage to open larger positions.","code":"330008"} }, 'broad': { 'pageSize should not greater than 500': errors.BadRequest, 'Exceeded the access frequency': errors.RateLimitExceeded, 'require more permission': errors.PermissionDenied, // futures errors 'Position does not exist': errors.OrderNotFound, // { "code":"200000", "msg":"Position does not exist" } }, }, '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')], ], }, }, 'spot': { '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')], ], }, }, 'contract': { 'tierBased': true, 'percentage': true, 'taker': this.parseNumber('0.0006'), 'maker': this.parseNumber('0.0002'), 'tiers': { 'taker': [ [this.parseNumber('0'), this.parseNumber('0.0006')], [this.parseNumber('50'), this.parseNumber('0.0006')], [this.parseNumber('200'), this.parseNumber('0.0006')], [this.parseNumber('500'), this.parseNumber('0.0005')], [this.parseNumber('1000'), this.parseNumber('0.0004')], [this.parseNumber('2000'), this.parseNumber('0.0004')], [this.parseNumber('4000'), this.parseNumber('0.00038')], [this.parseNumber('8000'), this.parseNumber('0.00035')], [this.parseNumber('15000'), this.parseNumber('0.00032')], [this.parseNumber('25000'), this.parseNumber('0.0003')], [this.parseNumber('40000'), this.parseNumber('0.0003')], [this.parseNumber('60000'), this.parseNumber('0.0003')], [this.parseNumber('80000'), this.parseNumber('0.0003')], ], '