ccxt
Version:
1,020 lines (1,017 loc) • 290 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var sha2_js = require('@noble/hashes/sha2.js');
var mexc$1 = require('./abstract/mexc.js');
var errors = require('./base/errors.js');
var number = require('./base/functions/number.js');
var Precise = require('./base/Precise.js');
// ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/**
* @class mexc
* @augments Exchange
*/
class mexc extends mexc$1["default"] {
describe() {
return this.deepExtend(super.describe(), {
'id': 'mexc',
'name': 'MEXC Global',
'countries': ['SC'], // Seychelles
'rateLimit': 50, // default rate limit is 20 times per second
'version': 'v3',
'certified': true,
'pro': true,
'has': {
'CORS': undefined,
'spot': true,
'margin': true,
'swap': true,
'future': false,
'option': false,
'addMargin': true,
'borrowCrossMargin': false,
'borrowIsolatedMargin': false,
'borrowMargin': false,
'cancelAllOrders': true,
'cancelOrder': true,
'cancelOrders': undefined,
'closeAllPositions': true,
'closePosition': false,
'createDepositAddress': true,
'createMarketBuyOrderWithCost': true,
'createMarketOrderWithCost': true,
'createMarketSellOrderWithCost': true,
'createOrder': true,
'createOrders': true,
'createPostOnlyOrder': true,
'createReduceOnlyOrder': true,
'createStopLimitOrder': true,
'createStopMarketOrder': true,
'createStopOrder': true,
'createTriggerOrder': true,
'deposit': undefined,
'editOrder': undefined,
'fetchAccounts': true,
'fetchBalance': true,
'fetchBidsAsks': true,
'fetchBorrowInterest': false,
'fetchBorrowRate': false,
'fetchBorrowRateHistories': false,
'fetchBorrowRateHistory': false,
'fetchBorrowRates': false,
'fetchBorrowRatesPerSymbol': false,
'fetchCanceledOrders': true,
'fetchClosedOrder': undefined,
'fetchClosedOrders': true,
'fetchCrossBorrowRate': false,
'fetchCrossBorrowRates': false,
'fetchCurrencies': true,
'fetchDeposit': undefined,
'fetchDepositAddress': true,
'fetchDepositAddresses': undefined,
'fetchDepositAddressesByNetwork': true,
'fetchDeposits': true,
'fetchDepositWithdrawFee': 'emulated',
'fetchDepositWithdrawFees': true,
'fetchFundingHistory': true,
'fetchFundingInterval': true,
'fetchFundingIntervals': false,
'fetchFundingRate': true,
'fetchFundingRateHistory': true,
'fetchFundingRates': false,
'fetchIndexOHLCV': true,
'fetchIsolatedBorrowRate': false,
'fetchIsolatedBorrowRates': false,
'fetchIsolatedPositions': false,
'fetchL2OrderBook': true,
'fetchLedger': undefined,
'fetchLedgerEntry': undefined,
'fetchLeverage': true,
'fetchLeverages': false,
'fetchLeverageTiers': true,
'fetchMarginAdjustmentHistory': false,
'fetchMarginMode': false,
'fetchMarketLeverageTiers': 'emulated',
'fetchMarkets': true,
'fetchMarkOHLCV': true,
'fetchMyTrades': true,
'fetchOHLCV': true,
'fetchOpenInterest': false,
'fetchOpenInterestHistory': false,
'fetchOpenOrder': undefined,
'fetchOpenOrders': true,
'fetchOrder': true,
'fetchOrderBook': true,
'fetchOrderBooks': undefined,
'fetchOrders': true,
'fetchOrderTrades': true,
'fetchPosition': 'emulated',
'fetchPositionHistory': 'emulated',
'fetchPositionMode': true,
'fetchPositions': true,
'fetchPositionsHistory': true,
'fetchPositionsRisk': undefined,
'fetchPremiumIndexOHLCV': false,
'fetchStatus': true,
'fetchTicker': true,
'fetchTickers': true,
'fetchTime': true,
'fetchTrades': true,
'fetchTradingFee': true,
'fetchTradingFees': false,
'fetchTradingLimits': undefined,
'fetchTransactionFee': 'emulated',
'fetchTransactionFees': true,
'fetchTransactions': undefined,
'fetchTransfer': true,
'fetchTransfers': true,
'fetchWithdrawal': undefined,
'fetchWithdrawals': true,
'reduceMargin': true,
'repayCrossMargin': false,
'repayIsolatedMargin': false,
'setLeverage': true,
'setMarginMode': true,
'setPositionMode': true,
'signIn': undefined,
'transfer': undefined,
'withdraw': true,
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg',
'api': {
'spot': {
'public': 'https://api.mexc.com',
'private': 'https://api.mexc.com',
},
'spot2': {
'public': 'https://www.mexc.com/open/api/v2',
'private': 'https://www.mexc.com/open/api/v2',
},
'contract': {
'public': 'https://api.mexc.com/api/v1/contract',
'private': 'https://api.mexc.com/api/v1/private',
},
'broker': {
'private': 'https://api.mexc.com/api/v3/broker',
},
},
'www': 'https://www.mexc.com/',
'doc': [
'https://www.mexc.com/api-docs/spot-v3/introduction',
'https://www.mexc.com/api-docs/futures/integration-guide',
],
'fees': [
'https://www.mexc.com/fee',
],
'referral': 'https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1',
},
'api': {
'spot': {
'public': {
'get': {
'ping': 1,
'time': 1,
'defaultSymbols': 1,
'symbol/offline': 10,
'exchangeInfo': 25,
'depth': 3,
'trades': 5,
'historicalTrades': 1,
'aggTrades': 1,
'klines': 1,
'avgPrice': 1,
'ticker/24hr': 25,
'ticker/price': 10,
'ticker/bookTicker': 10,
'etf/info': 1,
},
},
'private': {
'get': {
'kyc/status': 1,
'uid': 1,
'order': 2,
'openOrders': 3,
'allOrders': 10,
'account': 10,
'myTrades': 10,
'strategy/group': 20,
'strategy/group/uid': 20,
'tradeFee': 20,
'sub-account/list': 1,
'sub-account/apiKey': 1,
'sub-account/asset': 1,
'capital/config/getall': 10,
'capital/deposit/hisrec': 10,
'capital/withdraw/history': 1,
'capital/withdraw/address': 10,
'capital/deposit/address': 10,
'capital/transfer': 1,
'capital/transfer/tranId': 1,
'capital/transfer/internal': 1,
'capital/sub-account/universalTransfer': 1,
'capital/convert': 1,
'capital/convert/list': 1,
'margin/loan': 1,
'margin/allOrders': 1,
'margin/myTrades': 1,
'margin/openOrders': 1,
'margin/maxTransferable': 1,
'margin/priceIndex': 1,
'margin/order': 1,
'margin/isolated/account': 1,
'margin/maxBorrowable': 1,
'margin/repay': 1,
'margin/isolated/pair': 1,
'margin/forceLiquidationRec': 1,
'margin/isolatedMarginData': 1,
'margin/isolatedMarginTier': 1,
'rebate/taxQuery': 1,
'rebate/detail': 1,
'rebate/detail/kickback': 1,
'rebate/referCode': 1,
'rebate/affiliate/commission': 1,
'rebate/affiliate/withdraw': 1,
'rebate/affiliate/commission/detail': 1,
'rebate/affiliate/campaign': 1,
'rebate/affiliate/referral': 1,
'rebate/affiliate/subaffiliates': 1,
'rebate/affiliate/list': 1,
'mxDeduct/enable': 1,
'userDataStream': 1,
'selfSymbols': 1,
'asset/internal/transfer/record': 10,
},
'post': {
'order': 1,
'order/test': 1,
'apiKeyInfo': 1,
'sub-account/virtualSubAccount': 1,
'sub-account/apiKey': 1,
'sub-account/futures': 1,
'sub-account/margin': 1,
'batchOrders': 10,
'strategy/group': 20,
'capital/withdraw/apply': 1,
'capital/withdraw': 1,
'capital/transfer': 50,
'capital/transfer/internal': 1,
'capital/deposit/address': 1,
'capital/sub-account/universalTransfer': 1,
'capital/convert': 10,
'mxDeduct/enable': 1,
'userDataStream': 1,
},
'put': {
'userDataStream': 1,
},
'delete': {
'order': 1,
'openOrders': 1,
'order/all': 1,
'sub-account/apiKey': 1,
'strategy/group': 1,
'strategy/group/uid': 1,
'margin/order': 1,
'margin/openOrders': 1, // deprecated
'userDataStream': 1,
'capital/withdraw': 1,
},
},
},
'contract': {
'public': {
'get': {
'ping': 2,
'detail': 100,
'support_currencies': 2,
'depth/{symbol}': 2,
'depth_commits/{symbol}/{limit}': 2,
'index_price/{symbol}': 2,
'fair_price/{symbol}': 2,
'funding_rate/{symbol}': 2,
'kline/{symbol}': 2,
'kline/index_price/{symbol}': 2,
'kline/fair_price/{symbol}': 2,
'deals/{symbol}': 2,
'ticker': 2,
'risk_reverse': 2,
'risk_reverse/history': 2,
'funding_rate/history': 2,
},
},
'private': {
'get': {
'account/assets': 2,
'account/asset/{currency}': 2,
'account/transfer_record': 2,
'account/profit_rate/{type}': 2,
'account/asset/analysis/{type}': 2,
'account/feeDeductConfigs': 2,
'account/asset/analysis/yesterday_pnl': 2,
'account/asset/analysis/today_pnl': 2,
'account/config/contractFeeDiscountConfig': 2,
'order/fee_details': 2,
'account/discountType': 2,
'account/asset/analysis/export': 2,
'account/asset_book/order_deal_fee/total': 2,
'account/contract/fee_rate': 2,
'account/contract/zero_fee_rate': 2, // documentation removed 2026-05-22
'position/list/history_positions': 2,
'position/open_positions': 2,
'position/funding_records': 2,
'position/position_mode': 2,
'order/list/open_orders/{symbol}': 2,
'order/list/open_orders': 2,
'order/list/history_orders': 2,
'order/list/order_deals/v3': 2,
'order/external/{symbol}/{external_oid}': 2,
'order/get/{order_id}': 2,
'order/batch_query': 8,
'order/deal_details/{order_id}': 2,
'order/list/order_deals': 2,
'order/list/close_orders': 2,
'planorder/list/orders': 2,
'stoporder/list/orders': 2,
'stoporder/open_orders': 2,
'stoporder/order_details/{stop_order_id}': 2,
'account/risk_limit': 2, // TO_DO: gets max/min position size, allowed sides, leverage, maintenance margin, initial margin, etc...
'account/tiered_fee_rate': 2, // TO_DO: taker/maker fees for account
'position/leverage': 2,
'account/tiered_fee_rate/v2': 2,
'trackorder/list/orders': 2,
'market_maker/self_trade/blacklist': 2,
'market_maker/self_trade/blacklist/search': 2,
},
'post': {
'account/asset/analysis/v3': 2,
'account/asset/analysis/calendar/daily/v3': 2,
'account/asset/analysis/calendar/monthly/v3': 2,
'account/asset/analysis/recent/v3': 2,
'position/change_margin': 2,
'position/change_auto_add_im': 2,
'position/change_leverage': 2,
'position/change_position_mode': 2,
'position/reverse': 2,
'position/close_all': 10,
'order/create': 2,
'order/submit': 2,
'order/submit_batch': 40,
'order/chase_limit_order': 40,
'order/change_limit_order': 40,
'order/cancel': 2,
'order/batch_cancel_with_external': 2,
'order/cancel_with_external': 2,
'order/cancel_all': 2,
'order/open_order_total_count': 2,
'order/batch_query_with_external': 2,
'account/change_risk_level': 2,
'planorder/place': 2,
'planorder/place/v2': 2,
'planorder/cancel': 2,
'planorder/cancel_all': 2,
'planorder/change_stop_order': 2,
'stoporder/place': 2,
'stoporder/cancel': 2,
'stoporder/cancel_all': 2,
'stoporder/change_price': 2,
'stoporder/change_plan_price': 2,
'trackorder/place': 2,
'trackorder/cancel': 2,
'trackorder/change_order': 2,
'market_maker/self_trade/blacklist/create': 2,
'market_maker/self_trade/blacklist/update': 2,
'market_maker/self_trade/blacklist/delete': 2,
},
},
},
'spot2': {
'public': {
'get': {
'market/symbols': 1,
'market/coin/list': 2,
'common/timestamp': 1,
'common/ping': 2,
'market/ticker': 1,
'market/depth': 1,
'market/deals': 1,
'market/kline': 1,
'market/api_default_symbols': 2,
},
},
'private': {
'get': {
'account/info': 1,
'order/open_orders': 1,
'order/list': 1,
'order/query': 1,
'order/deals': 1,
'order/deal_detail': 1,
'asset/deposit/address/list': 2,
'asset/deposit/list': 2,
'asset/address/list': 2,
'asset/withdraw/list': 2,
'asset/internal/transfer/record': 10,
'account/balance': 10,
'asset/internal/transfer/info': 10,
'market/api_symbols': 2,
},
'post': {
'order/place': 1,
'order/place_batch': 1,
'order/advanced/place_batch': 1,
'asset/withdraw': 2,
'asset/internal/transfer': 10,
},
'delete': {
'order/cancel': 1,
'order/cancel_by_symbol': 1,
'asset/withdraw': 2,
},
},
},
'broker': {
'private': {
'get': {
'sub-account/universalTransfer': 1,
'sub-account/list': 1,
'sub-account/status': 1,
'sub-account/apiKey': 1,
'capital/deposit/subAddress': 1,
'capital/deposit/subHisrec': 1,
'capital/deposit/subHisrec/getall': 1,
'rebate/taxQuery': 1,
},
'post': {
'sub-account/virtualSubAccount': 1,
'sub-account/apiKey': 1,
'capital/deposit/subAddress': 1,
'capital/withdraw/apply': 1,
'sub-account/universalTransfer': 1,
'sub-account/futures': 1,
},
'delete': {
'sub-account/apiKey': 1,
},
},
},
},
'precisionMode': number.TICK_SIZE,
'timeframes': {
'1m': '1m', // spot, swap
'5m': '5m', // spot, swap
'15m': '15m', // spot, swap
'30m': '30m', // spot, swap
'1h': '1h', // spot, swap
'4h': '4h', // spot, swap
'8h': '8h', // swap
'1d': '1d', // spot, swap
'1w': '1w', // swap
'1M': '1M', // spot, swap
},
'fees': {
'trading': {
'tierBased': false,
'percentage': true,
'maker': this.parseNumber('0.002'), // maker / taker
'taker': this.parseNumber('0.002'),
},
},
'options': {
'adjustForTimeDifference': false,
'timeDifference': 0,
'fetchMarkets': {
'types': {
'spot': true,
'swap': {
'linear': true,
'inverse': false,
},
},
},
'useCcxtTradeId': true,
'timeframes': {
'spot': {
'1m': '1m',
'5m': '5m',
'15m': '15m',
'30m': '30m',
'1h': '60m',
'4h': '4h',
'1d': '1d',
'1w': '1W',
'1M': '1M',
},
'swap': {
'1m': 'Min1',
'5m': 'Min5',
'15m': 'Min15',
'30m': 'Min30',
'1h': 'Min60',
'4h': 'Hour4',
'8h': 'Hour8',
'1d': 'Day1',
'1w': 'Week1',
'1M': 'Month1',
},
},
'defaultType': 'spot', // spot, swap
'defaultNetwork': 'ETH',
'defaultNetworks': {
'ETH': 'ETH',
'USDT': 'ERC20',
'USDC': 'ERC20',
'BTC': 'BTC',
'LTC': 'LTC',
},
'networks': {
'ZKSYNC': 'ZKSYNCERA',
'TRC20': 'TRX',
'TON': 'TONCOIN',
'ARBITRUM': 'ARB',
'STX': 'STACKS',
'LUNC': 'LUNA',
'STARK': 'STARKNET',
'APT': 'APTOS',
'PEAQ': 'PEAQEVM',
'AVAXC': 'AVAX_CCHAIN',
'ERC20': 'ETH',
'ACA': 'ACALA',
'BEP20': 'BSC',
'OPTIMISM': 'OP',
// 'ADA': 'Cardano(ADA)',
// 'AE': 'AE',
// 'ALGO': 'Algorand(ALGO)',
// 'ALPH': 'Alephium(ALPH)',
// 'ARB': 'Arbitrum One(ARB)',
// 'ARBONE': 'ArbitrumOne(ARB)',
'ASTR': 'ASTAR', // ASTAREVM is different
// 'ATOM': 'Cosmos(ATOM)',
// 'AVAXC': 'Avalanche C Chain(AVAX CCHAIN)',
// 'AVAXX': 'Avalanche X Chain(AVAX XCHAIN)',
// 'AZERO': 'Aleph Zero(AZERO)',
// 'BCH': 'Bitcoin Cash(BCH)',
// 'BNCDOT': 'BNCPOLKA',
// 'BSV': 'Bitcoin SV(BSV)',
// 'BTC': 'Bitcoin(BTC)',
'BTM': 'BTM2',
// 'CHZ': 'Chiliz Legacy Chain(CHZ)',
// 'CHZ2': 'Chiliz Chain(CHZ2)',
// 'CLORE': 'Clore.ai(CLORE)',
'CRC20': 'CRONOS',
// 'DC': 'Dogechain(DC)',
// 'DNX': 'Dynex(DNX)',
// 'DOGE': 'Dogecoin(DOGE)',
// 'DOT': 'Polkadot(DOT)',
'DOT': 'DOTASSETHUB',
// 'DYM': 'Dymension(DYM)',
'ETHF': 'ETF',
'HRC20': 'HECO',
// 'KLAY': 'Klaytn(KLAY)',
'OASIS': 'ROSE',
'OKC': 'OKT',
'RSK': 'RBTC',
// 'RVN': 'Ravencoin(RVN)',
// 'SATOX': 'Satoxcoin(SATOX)',
// 'SC': 'SC',
// 'SCRT': 'SCRT',
// 'SDN': 'SDN',
// 'SGB': 'SGB',
// 'SOL': 'Solana(SOL)',
// 'STAR': 'STAR',
// 'STARK': 'Starknet(STARK)',
// 'STEEM': 'STEEM',
// 'SYS': 'SYS',
// 'TAO': 'Bittensor(TAO)',
// 'TIA': 'Celestia(TIA)',
// 'TOMO': 'TOMO',
// 'TON': 'Toncoin(TON)',
// 'TRC10': 'TRC10',
// 'TRC20': 'Tron(TRC20)',
// 'UGAS': 'UGAS(Ultrain)',
// 'VET': 'VeChain(VET)',
// 'VEX': 'Vexanium(VEX)',
// 'VSYS': 'VSYS',
// 'WAVES': 'WAVES',
// 'WAX': 'WAX',
// 'WEMIX': 'WEMIX',
// 'XCH': 'Chia(XCH)',
// 'XDC': 'XDC',
// 'XEC': 'XEC',
// 'XLM': 'Stellar(XLM)',
// 'XMR': 'Monero(XMR)',
// 'XNA': 'Neurai(XNA)',
// 'XPR': 'XPR Network',
// 'XRD': 'XRD',
// 'XRP': 'Ripple(XRP)',
// 'XTZ': 'XTZ',
// 'XVG': 'XVG',
// 'XYM': 'XYM',
// 'ZEC': 'ZEC',
// 'ZEN': 'ZEN',
// 'ZIL': 'Zilliqa(ZIL)',
// 'ZTG': 'ZTG',
// todo: uncomment below after consensus
// 'ALAYA': 'ATP',
// 'ANDUSCHAIN': 'DEB',
// 'ASSETMANTLE': 'MNTL',
// 'AXE': 'AXE',
// 'BITCOINHD': 'BHD',
// 'BITCOINVAULT': 'BTCV',
// 'BITKUB': 'KUB',
// 'BITSHARES_OLD': 'BTS',
// 'BITSHARES': 'NBS',
// 'BYTZ': 'BYTZ',
// 'CANTO': 'CANTO', // CANTOEVM
// 'CENNZ': 'CENNZ',
// 'CHAINX': 'PCX',
// 'CONCODRIUM': 'CCD',
// 'CONTENTVALUENETWORK': 'CVNT',
// 'CORTEX': 'CTXC',
// 'CYPHERIUM': 'CPH',
// 'DANGNN': 'DGC',
// 'DARWINIASMARTCHAIN': 'Darwinia Smart Chain',
// 'DHEALTH': 'DHP',
// 'DOGECOIN': [ 'DOGE', 'DOGECHAIN' ], // todo after unification
// 'DRAC': 'DRAC',
// 'DRAKEN': 'DRK',
// 'ECOCHAIN': 'ECOC',
// 'ELECTRAPROTOCOL': 'XEP',
// 'EMERALD': 'EMERALD', // sits on top of OASIS
// 'EVMOS': 'EVMOS', // EVMOSETH is different
// 'EXOSAMA': 'SAMA',
// 'FIBOS': 'FO',
// 'FILECASH': 'FIC',
// 'FIRMACHAIN': 'FCT',
// 'FIRO': 'XZC',
// 'FNCY': 'FNCY',
// 'FRUITS': 'FRTS',
// 'GLEEC': 'GLEEC',
// 'GXCHAIN': 'GXC',
// 'HANDSHAKE': 'HNS',
// 'HPB': 'HPB',
// 'HSHARE': 'HC',
// 'HUAHUA': 'HUAHUA',
// 'HUPAYX': 'HPX',
// 'INDEXCHAIN': 'IDX',
// 'INTCHAIN': 'INT',
// 'INTEGRITEE': 'TEER',
// 'INTERLAY': 'INTR',
// 'IOEX': 'IOEX',
// 'JUNO': 'JUNO',
// 'KASPA': 'KASPA',
// 'KEKCHAIN': 'KEKCHAIN',
// 'KINTSUGI': 'KINT',
// 'KOINOS': 'KOINOS',
// 'KONSTELLATION': 'DARC',
// 'KUJIRA': 'KUJI',
// 'KULUPU': 'KLP',
// 'LBRY': 'LBC',
// 'LEDGIS': 'LED',
// 'LIGHTNINGBITCOIN': 'LBTC',
// 'LINE': 'LINE',
// 'MDNA': 'DNA',
// 'MDUKEY': 'MDU',
// 'METAMUI': 'MMUI',
// 'METAVERSE_ETP': 'ETP',
// 'METER': 'MTRG',
// 'MEVERSE': 'MEVerse',
// 'NEWTON': 'NEW',
// 'NODLE': 'NODLE',
// 'ORIGYN': 'OGY',
// 'PAC': 'PAC',
// 'PASTEL': 'PSL',
// 'PHALA': 'Khala',
// 'PLEX': 'PLEX',
// 'PMG': 'PMG',
// 'POINT': 'POINT', // POINTEVM is different
// 'PROOFOFMEMES': 'POM',
// 'PROXIMAX': 'XPX',
// 'RCHAIN': 'REV',
// 'REBUS': 'REBUS', // REBUSEVM is different
// 'RIZON': 'ATOLO',
// 'SENTINEL': 'DVPN',
// 'SERO': 'SERO',
// 'TECHPAY': 'TPC',
// 'TELOSCOIN': 'TLOS', // todo
// 'TERRA': 'LUNA2',
// 'TERRACLASSIC': 'LUNC',
// 'TLOS': 'TELOS', // todo
// 'TOMAINFO': 'TON',
// 'TONGTONG': 'TTC',
// 'TURTLECOIN': 'TRTL',
// 'ULORD': 'UT',
// 'ULTRAIN': 'UGAS',
// 'UMEE': 'UMEE',
// 'VDIMENSION': 'VOLLAR',
// 'VEXANIUM': 'VEX',
// 'VNT': 'VNT',
// 'WAYKICHAIN': 'WICC',
// 'WHITECOIN': 'XWC',
// 'WITNET': 'WIT',
// 'XDAI': 'XDAI',
// 'XX': 'XX',
// 'YAS': 'YAS',
// 'ZENITH': 'ZENITH',
// 'ZKSYNC': 'ZKSYNC',
// // 'BAJUN': '',
// OKB <> OKT (for usdt it's exception) for OKC, PMEER, FLARE, STRD, ZEL, FUND, "NONE", CRING, FREETON, QTZ (probably unique network is meant), HT, BSC(RACAV1), BSC(RACAV2), AMBROSUS, BAJUN, NOM. their individual info is at https://www.mexc.com/api/platform/asset/spot/{COINNAME}
},
'networksById': {
'BNB Smart Chain(BEP20-RACAV1)': 'BSC',
'BNB Smart Chain(BEP20-RACAV2)': 'BSC',
'BNB Smart Chain(BEP20)': 'BSC',
'Ethereum(ERC20)': 'ERC20',
// TODO: uncomment below after deciding unified name
// 'PEPE COIN BSC':
// 'SMART BLOCKCHAIN':
// 'f(x)Core':
// 'Syscoin Rollux':
// 'Syscoin UTXO':
// 'zkSync Era':
// 'zkSync Lite':
// 'Darwinia Smart Chain':
// 'Arbitrum One(ARB-Bridged)':
// 'Optimism(OP-Bridged)':
// 'Polygon(MATIC-Bridged)':
},
'recvWindow': 5 * 1000, // 5 sec, default
'maxTimeTillEnd': 90 * 86400 * 1000 - 1, // 90 days
'broker': 'CCXT',
},
'features': {
'default': {
'sandbox': false,
'createOrder': {
'marginMode': true,
'triggerPrice': false,
'triggerDirection': false,
'triggerPriceType': {
'last': false,
'mark': false,
'index': false,
},
'stopLossPrice': false, // todo
'takeProfitPrice': false,
'attachedStopLossTakeProfit': undefined,
'timeInForce': {
'IOC': true,
'FOK': true,
'PO': true,
'GTD': false,
},
'hedged': true, // todo implement
'trailing': false,
'leverage': true, // todo implement
'marketBuyByCost': true,
'marketBuyRequiresPrice': false,
'selfTradePrevention': false,
'iceberg': false,
},
'createOrders': {
'max': 20,
},
'fetchMyTrades': {
'marginMode': false,
'limit': 100,
'daysBack': 30,
'untilDays': undefined,
'symbolRequired': true,
},
'fetchOrder': {
'marginMode': false,
'trigger': false,
'trailing': false,
'symbolRequired': true,
},
'fetchOpenOrders': {
'marginMode': true,
'limit': undefined,
'trigger': false,
'trailing': false,
'symbolRequired': true,
},
'fetchOrders': {
'marginMode': true,
'limit': 1000,
'daysBack': 7,
'untilDays': 7,
'trigger': false,
'trailing': false,
'symbolRequired': true,
},
'fetchClosedOrders': {
'marginMode': true,
'limit': 1000,
'daysBack': 7,
'daysBackCanceled': 7,
'untilDays': 7,
'trigger': false,
'trailing': false,
'symbolRequired': true,
},
'fetchOHLCV': {
'limit': 1000,
},
},
'spot': {
'extends': 'default',
'fetchCurrencies': {
'private': true,
},
},
'forDerivs': {
'extends': 'default',
'createOrder': {
'triggerPrice': true,
'triggerPriceType': {
'last': true,
'mark': true,
'index': true,
},
'triggerDirection': true, // todo
'stopLossPrice': false, // todo
'takeProfitPrice': false, // todo
'hedged': true,
'leverage': true, // todo
'marketBuyByCost': false,
},
'createOrders': undefined, // todo: needs implementation https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance:~:text=Order%20the%20contract%20in%20batch
'fetchMyTrades': {
'marginMode': false,
'limit': 100,
'daysBack': 90,
'untilDays': 90,
},
'fetchOrder': {
'marginMode': false,
},
'fetchOpenOrders': {
'marginMode': false,
'limit': 100,
'trigger': true,
'trailing': false,
},
'fetchOrders': {
'marginMode': false,
'limit': 100,
'daysBack': 90,
'untilDays': 90,
'trigger': true,
'trailing': false,
},
'fetchClosedOrders': {
'marginMode': false,
'limit': 100,
'daysBack': 90,
'daysBackCanceled': undefined,
'untilDays': 90,
'trigger': true,
'trailing': false,
},
'fetchOHLCV': {
'limit': 2000,
},
},
'swap': {
'linear': {
'extends': 'forDerivs',
},
'inverse': {
'extends': 'forDerivs',
},
},
'future': {
'linear': undefined,
'inverse': undefined,
},
},
'commonCurrencies': {
'BEYONDPROTOCOL': 'BEYOND',
'BIFI': 'BIFIF',
'BYN': 'BEYONDFI',
'COFI': 'COFIX', // conflict with CoinFi
'DFI': 'DFISTARTER',
'DFT': 'DFUTURE',
'DRK': 'DRK',
'EGC': 'EGORASCREDIT',
'FLUX1': 'FLUX', // switched places
'FLUX': 'FLUX1', // switched places
'FREE': 'FREEROSSDAO', // conflict with FREE Coin
'GAS': 'GASDAO',
'GASNEO': 'GAS',
'GMT': 'GMTTOKEN', // Conflict with GMT (STEPN)
'STEPN': 'GMT', // Conflict with GMT Token
'HERO': 'STEPHERO', // conflict with Metahero
'MIMO': 'MIMOSA',
'PROS': 'PROSFINANCE', // conflict with Prosper
'SIN': 'SINCITYTOKEN',
'SOUL': 'SOULSWAP',
'XBT': 'XBT', // restore original mapping
},
'exceptions': {
'exact': {
// until mexc migrates fully to v3, it might be worth to note the version & market aside errors, not easily remove obsolete version's exceptions in future
'-1128': errors.BadRequest,
'-2011': errors.BadRequest,
'-1121': errors.BadSymbol,
'401': errors.AuthenticationError, // No authority / Not logged in or login has expired
'402': errors.AuthenticationError, // API Key expired, please apply again
'403': errors.PermissionDenied, // Access Denied
'406': errors.PermissionDenied, // Accessing IP is not in the whitelist
'429': errors.RateLimitExceeded, // Too Many Requests
'500': errors.ExchangeError, // Internal error
'501': errors.ExchangeNotAvailable, // System busy, try again later
'503': errors.ExchangeNotAvailable, // service not available, please try again
'504': errors.RequestTimeout, // Gateway Time-out
'510': errors.RateLimitExceeded, // Requests are too frequent, please try again later
'511': errors.PermissionDenied, // You do not have access to the interface
'513': errors.BadRequest, // Invalid request, please try again later
'601': errors.BadRequest, // Data parsing error
'603': errors.BadRequest, // Repeated request
'604': errors.OnMaintenance, // Sorry, this feature is under maintenance
'701': errors.PermissionDenied, // Please enable API Key read access
'702': errors.PermissionDenied, // Please enable API Key write access
'703': errors.PermissionDenied, // Trading information read access is required
'704': errors.PermissionDenied, // Please enable API Key trading information write access
'801': errors.OnMaintenance, // System under maintenance
'1000': errors.AuthenticationError, // Account does not exist
'1001': errors.BadSymbol, // Contract does not exist
'10101': errors.InsufficientFunds, // {"msg":"资金不足","code":10101}
'2009': errors.InvalidOrder, // {"success":false,"code":2009,"message":"Position is not exists or closed."}
'2011': errors.BadRequest,
'30004': errors.InsufficientFunds,
'33333': errors.BadRequest, // {"msg":"Not support transfer","code":33333}
'44444': errors.BadRequest,
'1002': errors.InvalidOrder,
'30019': errors.BadRequest,
'30005': errors.InvalidOrder,
'2003': errors.InvalidOrder,
'2005': errors.InsufficientFunds,
'400': errors.BadRequest, // {"msg":"The start time cannot be earlier than 90 days","code":400}
// '500': OnMaintenance, // {"code": 500,"message": "Under maintenance, please try again later","announcement": "https://www.mexc.com/support/articles/17827791510263"}
'600': errors.BadRequest,
'70011': errors.PermissionDenied, // {"code":70011,"msg":"Pair user ban trade apikey."}
'88004': errors.InsufficientFunds, // {"msg":"超出最大可借,最大可借币为:18.09833211","code":88004}
'88009': errors.ExchangeError, // v3 {"msg":"Loan record does not exist","code":88009}
'88013': errors.InvalidOrder, // {"msg":"最小交易额不能小于:5USDT","code":88013}
'88015': errors.InsufficientFunds, // {"msg":"持仓不足","code":88015}
'700003': errors.InvalidNonce, // {"code":700003,"msg":"Timestamp for this request is outside of the recvWindow."}
'26': errors.ExchangeError, // operation not allowed
'602': errors.AuthenticationError, // Signature verification failed
'10001': errors.AuthenticationError, // user does not exist
'10007': errors.BadSymbol, // {"code":10007,"msg":"bad symbol"}
'10015': errors.BadRequest, // user id cannot be null
'10072': errors.BadRequest, // invalid access key
'10073': errors.BadRequest, // invalid Request-Time
'10095': errors.InvalidOrder, // amount cannot be null
'10096': errors.InvalidOrder, // amount decimal places is too long
'10097': errors.InvalidOrder, // amount is error
'10098': errors.InvalidOrder, // risk control system detected abnormal
'10099': errors.BadRequest, // user sub account does not open
'10100': errors.BadRequest, // this currency transfer is not supported
'10102': errors.InvalidOrder, // amount cannot be zero or negative
'10103': errors.ExchangeError, // this account transfer is not supported
'10200': errors.BadRequest, // transfer operation processing
'10201': errors.BadRequest, // transfer in failed
'10202': errors.BadRequest, // transfer out failed
'10206': errors.BadRequest, // transfer is disabled
'10211': errors.BadRequest, // transfer is forbidden
'10212': errors.BadRequest, // This withdrawal address is not on the commonly used address list or has been invalidated
'10216': errors.ExchangeError, // no address available. Please try again later
'10219': errors.ExchangeError, // asset flow writing failed please try again
'10222': errors.BadRequest, // currency cannot be null
'10232': errors.BadRequest, // currency does not exist
'10259': errors.ExchangeError, // Intermediate account does not configured in redisredis
'10265': errors.ExchangeError, // Due to risk control, withdrawal is unavailable, please try again later
'10268': errors.BadRequest, // remark length is too long
'11444': errors.OnMaintenance, // This feature is temporarily unavailable. For details, please refer to our official announcement. Thank you for your understanding and cooperation
'20001': errors.ExchangeError, // subsystem is not supported
'20002': errors.ExchangeError, // Internal system error please contact support
'22222': errors.BadRequest, // record does not exist
'30000': errors.ExchangeError, // suspended transaction for the symbol
'30001': errors.InvalidOrder, // The current transaction direction is not allowed to place an order
'30002': errors.InvalidOrder, // The minimum transaction volume cannot be less than :
'30003': errors.InvalidOrder, // The maximum transaction volume cannot be greater than :
'30010': errors.InvalidOrder, // no valid trade price
'30014': errors.InvalidOrder, // invalid symbol
'30016': errors.InvalidOrder, // trading disabled
'30018': errors.AccountSuspended, // {"msg":"账号暂时不能下单,请联系客服","code":30018}
'30020': errors.AuthenticationError, // no permission for the symbol
'30021': errors.BadRequest, // invalid symbol
'30025': errors.InvalidOrder, // no exist opponent order
'30026': errors.BadRequest, // invalid order ids
'30027': errors.InvalidOrder, // The currency has reached the maximum position limit, the buying is suspended
'30028': errors.InvalidOrder, // The currency triggered the platform risk control, the selling is suspended
'30029': errors.InvalidOrder, // Cannot exceed the maximum order limit
'30032': errors.InvalidOrder, // Cannot exceed the maximum position
'30041': errors.InvalidOrder, // current order type can not place order
'30087': errors.InvalidOrder, // {"msg":"Order price exceeds allowed range","code":30087}
'60005': errors.ExchangeError, // your account is abnormal
'700001': errors.AuthenticationError, // {"code":700002,"msg":"Signature for this request is not valid."} // same message for expired API keys
'700002': errors.AuthenticationError, // Signature for this request is not valid // or the API secret is incorrect
'700004': errors.BadRequest, // Param 'origClientOrderId' or 'orderId' must be sent, but both were empty/null
'700005': errors.InvalidNonce, // recvWindow must less than 60000
'700006': errors.BadRequest, // IP non white list
'700007': errors.Authenti