# Typed MEXC

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

```python
from typed_mexc import MEXC

async with MEXC.new(public=True) 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.get('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

```bash
pip install typed-mexc
```

## How To

- [API Keys Setup](/typed/mexc/api-keys)
- [Fetch Market Data](/typed/mexc/how-to/fetch-market-data)
- [Place & Manage Orders](/typed/mexc/how-to/place-and-manage-orders)
- [Fetch Balances, Positions & History](/typed/mexc/how-to/fetch-balances-positions-and-history)
- [Manage Deposits & Withdrawals](/typed/mexc/how-to/manage-deposits-and-withdrawals)
- [Listen To Streams](/typed/mexc/how-to/listen-to-streams)

## Reference

- [Async Usage](/typed/mexc/reference/async-usage)
- [Error Handling](/typed/mexc/reference/error-handling)
- [Environment Variables](/typed/mexc/reference/env-vars)
- [Timestamps](/typed/mexc/reference/timestamps)

## Design Philosophy

Typed MEXC follows the principles outlined in [this blog post](https://tribulnation.com/blog/clients).

*Details matter. Developer experience matters.*
