UNPKG

ccxt

Version:

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

871 lines (868 loc) 568 kB
// ---------------------------------------------------------------------------- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code // EDIT THE CORRESPONDENT .ts FILE INSTEAD // --------------------------------------------------------------------------- import { sha256 } from '@noble/hashes/sha2.js'; import Exchange from './abstract/kucoin.js'; import { AccountSuspended, ArgumentsRequired, AuthenticationError, BadRequest, BadSymbol, ExchangeError, ExchangeNotAvailable, InsufficientFunds, InvalidAddress, InvalidNonce, InvalidOrder, NotSupported, OrderNotFound, PermissionDenied, RateLimitExceeded, RestrictedLocation } from './base/errors.js'; import { Precise } from './base/Precise.js'; import { TICK_SIZE, TRUNCATE } from './base/functions/number.js'; // --------------------------------------------------------------------------- /** * @class kucoin * @augments Exchange */ export default class kucoin extends Exchange { 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': TICK_SIZE, 'exceptions': { 'exact': { 'Order not exist or not allow to be cancelled': OrderNotFound, 'The order does not exist.': OrderNotFound, 'order not exist': OrderNotFound, 'order not exist.': OrderNotFound, // duplicated error temporarily 'order_not_exist': OrderNotFound, // {"code":"order_not_exist","msg":"order_not_exist"} ¯\_(ツ)_/¯ 'order_not_exist_or_not_allow_to_cancel': 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.': InvalidOrder, // {"code":"400100","msg":"Order size below the minimum requirement."} 'Order size increment invalid.': InvalidOrder, // {"msg":"Order size increment invalid.","code":"600100"} 'The withdrawal amount is below the minimum requirement.': ExchangeError, // {"code":"400100","msg":"The withdrawal amount is below the minimum requirement."} 'Unsuccessful! Exceeded the max. funds out-transfer limit': InsufficientFunds, // {"code":"200000","msg":"Unsuccessful! Exceeded the max. funds out-transfer limit"} 'The amount increment is invalid.': BadRequest, 'The quantity is below the minimum requirement.': InvalidOrder, // {"msg":"The quantity is below the minimum requirement.","code":"400100"} 'not in the given range!': BadRequest, // {"msg":"price not in the given range!","code":"400100"} 'recAccountType not in the given range': BadRequest, // {"msg":"recAccountType not in the given range","code":"400100"} 'Unsupported trading pair.': BadSymbol, // {"msg":"Unsupported trading pair.","code":"400100"} '400': BadRequest, '401': AuthenticationError, '403': NotSupported, '404': NotSupported, '405': NotSupported, '415': NotSupported, '429': RateLimitExceeded, '500': ExchangeNotAvailable, // Internal Server Error -- We had a problem with our server. Try again later. '503': ExchangeNotAvailable, '101030': PermissionDenied, // {"code":"101030","msg":"You haven't yet enabled the margin trading"} '103000': InvalidOrder, // {"code":"103000","msg":"Exceed the borrowing limit, the remaining borrowable amount is: 0USDT"} '112010': PermissionDenied, // {"msg":"Invalid Unified Account user.","code":"112010"} '130101': BadRequest, // Parameter error '130102': ExchangeError, // Maximum subscription amount has been exceeded. '130103': OrderNotFound, // Subscription order does not exist. '130104': ExchangeError, // Maximum number of subscription orders has been exceeded. '130105': InsufficientFunds, // Insufficient balance. '130106': NotSupported, // The currency does not support redemption. '130107': ExchangeError, // Redemption amount exceeds subscription amount. '130108': OrderNotFound, // Redemption order does not exist. '130201': PermissionDenied, // Your account has restricted access to certain features. Please contact customer service for further assistance '130202': ExchangeError, // The system is renewing the loan automatically. Please try again later '130203': InsufficientFunds, // Insufficient account balance '130204': 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': InsufficientFunds, // Insufficient account balance '130302': PermissionDenied, // Your relevant permission rights have been restricted, you can contact customer service for processing '130303': NotSupported, // The current trading pair does not support isolated positions '130304': NotSupported, // The trading function of the current trading pair is not enabled '130305': NotSupported, // The current trading pair does not support cross position '130306': NotSupported, // The account has not opened leveraged trading '130307': NotSupported, // Please reopen the leverage agreement '130308': InvalidOrder, // Position renewal freeze '130309': InvalidOrder, // Position forced liquidation freeze '130310': ExchangeError, // Abnormal leverage account status '130311': InvalidOrder, // Failed to place an order, triggering buy limit '130312': InvalidOrder, // Trigger global position limit, suspend buying '130313': InvalidOrder, // Trigger global position limit, suspend selling '130314': InvalidOrder, // Trigger the global position limit and prompt the remaining quantity available for purchase '130315': NotSupported, // This feature has been suspended due to country restrictions '126000': ExchangeError, // Abnormal margin trading '126001': NotSupported, // Users currently do not support high frequency '126002': ExchangeError, // There is a risk problem in your account and transactions are temporarily not allowed! '126003': InvalidOrder, // The commission amount is less than the minimum transaction amount for a single commission '126004': ExchangeError, // Trading pair does not exist or is prohibited '126005': PermissionDenied, // This trading pair requires advanced KYC certification before trading '126006': ExchangeError, // Trading pair is not available '126007': ExchangeError, // Trading pair suspended '126009': ExchangeError, // Trading pair is suspended from creating orders '126010': ExchangeError, // Trading pair suspended order cancellation '126011': ExchangeError, // There are too many orders in the order '126013': InsufficientFunds, // Insufficient account balance '126015': ExchangeError, // It is prohibited to place orders on this trading pair '126021': NotSupported, // This digital asset does not support user participation in your region, thank you for your understanding! '126022': 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': InvalidOrder, // Only limit orders are supported '126028': InvalidOrder, // Only limit orders are supported before the specified time '126029': InvalidOrder, // The maximum order price is: xxx '126030': InvalidOrder, // The minimum order price is: xxx '126033': InvalidOrder, // Duplicate order '126034': InvalidOrder, // Failed to create take profit and stop loss order '126036': InvalidOrder, // Failed to create margin order '126037': ExchangeError, // Due to country and region restrictions, this function has been suspended! '126038': ExchangeError, // Third-party service call failed (internal exception) '126039': ExchangeError, // Third-party service call failed, reason: xxx '126041': ExchangeError, // clientTimestamp parameter error '126042': ExchangeError, // Exceeded maximum position limit '126043': OrderNotFound, // Order does not exist '126044': InvalidOrder, // clientOid duplicate '126045': NotSupported, // This digital asset does not support user participation in your region, thank you for your understanding! '126046': NotSupported, // This digital asset does not support your IP region, thank you for your understanding! '126047': PermissionDenied, // Please complete identity verification '126048': PermissionDenied, // Please complete authentication for the master account '135005': ExchangeError, // Margin order query business abnormality '135018': ExchangeError, // Margin order query service abnormality '200004': InsufficientFunds, '210014': InvalidOrder, // {"code":"210014","msg":"Exceeds the max. borrowing amount, the remaining amount you can borrow: 0USDT"} '210021': InsufficientFunds, // {"code":"210021","msg":"Balance not enough"} '230003': InsufficientFunds, // {"code":"230003","msg":"Balance insufficient!"} '260000': InvalidAddress, // {"code":"260000","msg":"Deposit address already exists."} '260100': InsufficientFunds, // {"code":"260100","msg":"account.noBalance"} '300000': InvalidOrder, '400000': BadSymbol, '400001': AuthenticationError, '400002': InvalidNonce, '400003': AuthenticationError, '400004': AuthenticationError, '400005': AuthenticationError, '400006': AuthenticationError, '400007': AuthenticationError, '400008': NotSupported, '400100': 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': InvalidOrder, // {"code":"400200","msg":"Forbidden to place an order"} '400330': InvalidOrder, // {"msg":"Order price can't deviate from NAV by 50%","code":"400330"} '400350': InvalidOrder, // {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."} '400370': InvalidOrder, // {"code":"400370","msg":"Max. price: 0.02500000000000000000"} '400400': BadRequest, // Parameter error '400401': AuthenticationError, // User is not logged in '400500': RestrictedLocation, // {"code":"400500","msg":"Your located country/region is currently not supported for the trading of this token"} '400600': BadSymbol, // {"code":"400600","msg":"validation.createOrder.symbolNotAvailable"} '400760': InvalidOrder, // {"code":"400760","msg":"order price should be more than XX"} '401000': BadRequest, // {"code":"401000","msg":"The interface has been deprecated"} '408000': BadRequest, // Network timeout, please try again later '411100': AccountSuspended, '415000': BadRequest, // {"code":"415000","msg":"Unsupported Media Type"} '400303': PermissionDenied, // {"msg":"To enjoy the full range of our products and services, we kindly request you complete the identity verification process.","code":"400303"} '500000': ExchangeNotAvailable, // {"code":"500000","msg":"Internal Server Error"} '260220': InvalidAddress, // { "code": "260220", "msg": "deposit.address.not.exists" } '600100': InsufficientFunds, // {"msg":"Funds below the minimum requirement.","code":"600100"} '600101': InvalidOrder, // {"msg":"The order funds should more then 0.1 USDT.","code":"600101"} '900014': BadRequest, // {"code":"900014","msg":"Invalid chainId"} // futures errors '330012': 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': InvalidOrder, // {"msg":"The order's margin mode does not match the selected one. Please switch and try again.","code":"330005"} '100001': OrderNotFound, // {"msg":"error.getOrder.orderNotExist","code":"100001"} '100004': BadRequest, // {"code":"100004","msg":"Order is in not cancelable state"} '300003': InsufficientFunds, '300012': InvalidOrder, '404000': NotSupported, // URL Not Found -- The requested resource could not be found '300009': InvalidOrder, // {"msg":"No open positions to close.","code":"300009"} '330008': 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': BadRequest, 'Exceeded the access frequency': RateLimitExceeded, 'require more permission': PermissionDenied, // futures errors 'Position does not exist': 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')], ], 'maker': [ [this.parseNumber('0'), this.parseNumber('0.02')], [this.parseNumber('50'), this.parseNumber('0.015')], [this.parseNumber('200'), this.parseNumber('0.01')], [this.parseNumber('500'), this.parseNumber('0.01')], [this.parseNumber('1000'), this.parseNumber('0.01')], [this.parseNumber('2000'), this.parseNumber('0')],