Typed MEXC
Fully typed, validated async clients for the MEXC spot and futures APIs.
Use autocomplete instead of documentation.
from mexc import MEXC
async with MEXC.new() as client:
account = await client.spot.account()
print(account['balances'][0]['asset'])
Why Typed MEXC?
- 🎯 Precise Types: Literal types where they help, so your IDE knows what is valid.
- ✅ Automatic Validation: Catch upstream API changes earlier.
- âš¡ Async First: Built for concurrent, network-heavy workflows.
- 🔒 Type Safety: Full type hints throughout.
- 🎨 Better DX: Clear separation between
spot,futures, and theirstreams. - 📦 Practical Extras: Pagination helpers and stream wrappers where they add real value.
Installation
Quick Start
Spot market data
from mexc.spot import Spot
async with Spot.public() as spot:
candles = await spot.candles('BTCUSDT', interval='1m', limit=5)
print(candles[-1].close)
Authenticated multi-surface usage
from mexc import MEXC
async with MEXC.new() as client:
account = await client.spot.account()
positions = await client.futures.positions()
print(len(account['balances']), len(positions))
API Coverage
This package is split the way MEXC itself is split:
MEXC.spotfor spot market data, trading, user data, wallet methods, and spot streamsMEXC.futuresfor futures market data, futures account data, and futures streamsspot.streamsandfutures.streamsfor real-time subscriptions
Current limitation:
- futures trading REST methods are not available in the MEXC API
📋 See API Overview for the current coverage and structure.
Documentation
- Getting Started - Install the package and make your first requests
- API Keys Setup - Configure credentials for spot and futures authenticated usage
- API Overview - Understand the spot / futures split and implemented surface
- How To - Task-focused guides for market data, orders, balances, and streams
- Reference - Async usage, error handling, env vars, and API reference
Design Philosophy
Typed MEXC follows the principles outlined in this blog post.
Details matter. Developer experience matters.