Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
AscendEx
Backpack
BigONE
Binance
Bitfinex
bitFlyer
Bitget
Bithumb
Bitstamp
Bybit
Coincheck
Coinone
CoinW
Crypto.com
DeepCoin
Deribit
DigiFinex
Gate
Gemini
HashKey
HitBTC
HTX
Korbit
Kraken
KuCoin
LBank
MEXC
OKX
Poloniex
Upbit
WEEX
WOO X
Zaif
Decentralized Exchanges (DEX)
Prediction Markets
Securities and Futures
On-chain & Custom

MEXC (Spot): MEXC spot trading through the MEXC spot V3 API (api.mexc.com); everything is REST polling, with no market data or order push. Private endpoints need an API key (Access Key and Secret Key). Spot only, with no simulated trading; use Futures_MEXC for perpetual contracts.

Futures_MEXC (Futures): MEXC perpetual contracts: USDT- and USDC-margined and coin-margined contracts, through the MEXC futures API (contract.mexc.com); everything is REST polling, with no market data or order push. Private endpoints need an API key (Access Key and Secret Key). Perpetual contracts only, with no simulated trading.

Names and Configuration
exchange.GetName()TypeAliases
MEXCSpot—
Futures_MEXCFuturesMEXC Futures

✓ marks the exchange objects that have the field.

FieldMEXCFutures_MEXCRequiredDefaultDescription
Access Key✓✓Yes——
Secret Key✓✓Yes——
V3 Protocol✓NoCheckedKept for compatibility with old configurations; the connector always uses the V3 API, so the setting has no effect.

Trading Pairs and Contract Codes
MEXC (Spot)

Pair examples: BTC_USDT, ETH_USDC

Trading pairs are written BASE_QUOTE, case-insensitive; for example BTC_USDT maps to the MEXC native code BTCUSDT. Symbols with a contract suffix (such as .swap) or containing - are rejected.

Futures_MEXC (Futures)

Pair examples: BTC_USDT, BTC_USDC, BTC_USD

Trading pair BTC_USDT or BTC_USDC means USDT- or USDC-margined contracts; BTC_USD means coin-margined contracts.

Contract codeDescription
swapPerpetual contract (the only contract code).

MEXC futures have perpetual contracts only; other contract codes are rejected. The native contract code has the same form as the trading pair (BTC_USDT). Order amounts are in contracts (for both limit and market orders); the coin amount per contract is CtVal in exchange.GetMarkets().

Exchange-specific IO Commands
MEXC (Spot)

No exchange-specific commands; for the common commands see exchange.IO.

Futures_MEXC (Futures)
CommandArgumentsDescriptionReturns
crossboolCross (true, the default) / isolated (false) margin. Stored on the exchange object and used when placing orders; no request is sent to the exchange.The value set.

For the common commands api, base and currency see exchange.IO.

Function Support
MEXC (Spot)

Not supported (the call fails with an error and returns null): exchange.ModifyOrder, exchange.CreateConditionOrder, exchange.ModifyConditionOrder, exchange.CancelConditionOrder, exchange.GetConditionOrder, exchange.GetConditionOrders, exchange.GetHistoryConditionOrders.

Served through a fallback:

  • exchange.GetRecords: Native periods are 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M; other periods are synthesized by the docker.
Futures_MEXC (Futures)

Not supported (the call fails with an error and returns null): exchange.ModifyConditionOrder.

Served through a fallback:

  • exchange.GetRecords: Native periods are 1m, 5m, 15m, 30m, 1h, 4h, 8h, 1d, 1w, 1M; other periods are synthesized by the docker.

Margin, Account and Simulation
Futures_MEXC (Futures)

Margin mode: Choose cross/isolated margin with exchange.IO("cross", bool); it is sent with each order. exchange.GetPositions returns only positions in the currently selected margin mode.

Account: In cross mode exchange.SetMarginLevel() changes the contract's leverage for both the long and short side on the exchange; in isolated mode it only records the leverage locally and sends it with each order. An isolated order without a leverage set first queries the contract's current isolated leverage from the exchange. Leverage is rounded to the nearest integer before it is sent, and a value that rounds below 1 is rejected; leverage in an order's extra parameters sets the leverage of that order.

Notes
MEXC (Spot)
  • MEXC spot's open-order endpoint requires a trading pair: exchange.GetOrders() without arguments queries the current trading pair only, not all pairs.
  • The amount of a market buy order is the quote-currency sum to spend (sent as MEXC's quoteOrderQty); a market sell order's amount is in the base currency.
  • A limit order with post-only (postOnly) is placed as MEXC's LIMIT_MAKER type.
  • exchange.GetHistoryOrders() can only query orders from the last 7 days (an exchange API limit); a since earlier than 7 days ago starts from 7 days ago.
Futures_MEXC (Futures)
  • exchange.GetFundings cannot query in batch; pass a specific symbol such as BTC_USDT.swap.
  • Conditional orders support take-profit and stop-loss only, not OCO; modifying a conditional order is not supported, and conditional orders cannot carry a custom order id (clientId). They trigger on the last traded price and are valid for 24 hours, expiring automatically afterwards.
  • Order amendment (exchange.ModifyOrder()) works on limit orders only; the exchange cancels the original order and places a new one; the return value is the new order's Id, use it for later queries and cancellation.
  • Limit orders support IOC, FOK and post-only (postOnly); market orders cannot use FOK or post-only, and conditional orders support GTC only.