Skip to main content

Terminal Usage

Command Structure

Commands consist of three parts: category, module, and action.

mexc  spot  marketv2  ticker --symbol BTC_USDT
# category module action

Discover Capabilities

mexc explore opens an interactive interface where you can browse all 307 capabilities with descriptions using the arrow keys. Press y to copy a command template and q to exit. Run this command first if you are new to the CLI.

mexc explore                       # Interactive browse
mexc spot marketv2 ticker --help # Parameters for a single command
mexc schema spot.trade.place # Parameters, request body fields, and read/write attributes

Common Commands

Public contract market data does not require a key. All 37 capabilities under contract market can be called directly:

mexc contract market ticker --symbol BTC_USDT                # Ticker
mexc contract market depth --symbol BTC_USDT # Order book depth
mexc contract market kline --symbol BTC_USDT # Kline, no API key required
mexc contract market funding-rate --contractName BTC_USDT # Funding rate

Real-time streams also do not require a key. Without --limit or --listen-duration, they keep receiving until you press Ctrl+C:

mexc spot marketv2 ws-trades --symbol BTCUSDT --limit 1               # Exit after receiving one message
mexc futures market ws-ticker --symbol BTC_USDT --listen-duration 10s # Listen for ten seconds

Most spot market endpoints do not require a key. Under spot marketv2, only symbols, tickers, symbol-trade, and user-eftd-info require a key; their results are account-related (hidden trading pairs are filtered by region, IP, and account). The other 18 queries and 3 real-time streams are public.

mexc spot marketv2 ticker --symbol BTC_USDT   # Live price, no API key required
mexc spot marketv2 coin-new-list # Newly listed coins, no API key required
mexc spot marketv2 depth --symbolId <id> # Order book depth, no API key required
mexc spot marketv2 tickers # All tickers, API key required
mexc spot marketv2 symbols # Symbol list and IDs, API key required

Accounts and assets:

mexc spot asset overview                      # Overview across accounts
mexc spot asset assets-spot # Spot balances
mexc contract account assets # Contract balances
mexc spot asset assets-financial # Financial assets
mexc spot asset deposit-history # Deposit history
mexc spot asset transfer-internal-history # Transfer history
mexc spot asset pnl-overview # PnL

Spot trading:

mexc spot trade current-orders                # Open orders
mexc spot trade history-orders # Order history
mexc spot trade deals # Trade details
mexc spot trade place --data ... # Place a limit order
mexc spot trade place-market --data ... # Place a market order
mexc spot trade cancel --data ... # Cancel an order

Financial products and activities:

mexc financial-openapi common member-positions    # Financial positions
mexc financial-openapi common member-assets-v2 # Financial assets
mexc activity online list --data '{"limit":10}' # Online activities
mexc activity reward summary # My rewards

Parameter names are not fully uniform. Most capabilities use --symbol; contract funding rate uses --contractName; spot kline endpoints that do not require a key and order book depth use --symbolId, the internal ID returned by mexc spot marketv2 symbols. Trading pairs have two formats: BTC_USDT for ordinary queries and BTCUSDT for real-time streams. Use the output of --help as the source of truth.

Global Flags

mexc <command> --read-only    # Reject any state-changing operation
mexc <command> --dry-run # Print the request that would be sent without sending it
mexc <command> --yes # Mark the operation as confirmed and skip the confirmation prompt

Run with --dry-run before placing an order to catch parameter errors before a request is sent. For --read-only and --yes, which affect fund safety, see the explanations in Security.