Skip to content

Typed MEXC

A fully typed, validated async client for the MEXC spot and futures APIs.

from mexc import MEXC

async with MEXC.public() as client:
  candles = await client.spot.market.candles(symbol='BTCUSDT', interval='1m', limit=5)
  stream = await client.futures.streams.market.ticker('BTC_USDT')
  print(candles[-1][4])

  async for ticker in stream:
    print(ticker['lastPrice'])
    break

Why Typed MEXC?

  • 🎯 Precise Types: Typed endpoint inputs and responses.
  • ✅ Runtime Validation: Validated responses by default.
  • âš¡ Async First: HTTP and WebSocket subscriptions.
  • 📚 Full API Surface: client.spot, client.futures, and stream groups for both spot and futures.

Installation

pip install typed-mexc

How To

Reference