The unofficial MEXC API SDK, by Tribulnation. Compatible with Trading SDK.
Project description
MEXC API SDK
An unofficial, fully-typed async Python SDK for the MEXC cryptocurrency exchange, with Trading SDK compatibility.
Installation
pip install mexc-trading-sdk
Features
- Fully async (with
httpx) - Type-annotated (with
TypedDict,Literal, etc.) and validated (withpydantic) - Trading SDK compatibility layer
- Easy context-managed usage (with
async with) - Comprehensive spot trading, market data, and wallet endpoints
Usage
from mexc import MEXC # Main async client
API_KEY = "your_api_key" # aka "access key"
API_SECRET = "your_api_secret" # aka "secret key"
async with MEXC(API_KEY, API_SECRET) as client:
r = await client.place_order('BTCUSDT', {
'price': '100000',
'quantity': '0.001',
'type': 'LIMIT',
'side': 'BUY',
})
Get your API keys from the MEXC dashboard.
Or, you can use public methods:
from mexc.api.spot import MarketData
async with MarketData() as client:
candles = await client.candles('BTCUSDT', interval='15m')
Trading SDK Compatibility
This SDK includes a compatibility layer with the Trading SDK.
Note: For Trading SDK compatibility, use
from mexc.sdk import MEXC, notfrom mexc import MEXC.
import trading_sdk as tdk
from mexc.sdk import MEXC
async def micro_strategy(client: tdk.Trading):
while True:
await client.place_order('BTCUSDT', {
'quantity': '1',
'type': 'MARKET',
'side': 'BUY',
})
await asyncio.sleep(3600*24)
async with MEXC(API_KEY, API_SECRET) as client:
await micro_strategy(client)
Supported APIs
The SDK covers the following MEXC endpoints:
Spot
Trading
User Data
Market Data
time(server time)depth(order book)candles(klines)trades(recent trades)agg_trades
Wallet
currency_info(withdrawal methods)deposit_addresses(deposit methods)withdrawcancel_withdraw
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mexc_trading_sdk-0.1.0.tar.gz.
File metadata
- Download URL: mexc_trading_sdk-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59a2f93e12b7b65543d0a79bc88b1c7103e303efcff4088afadddcda1d8b2153
|
|
| MD5 |
1b99817df5fc0bb0eaebefcac91b62ba
|
|
| BLAKE2b-256 |
cd80752064a57f5188d4fac1dc7751a95f9593a1078a25eefbe4f119df73950d
|
File details
Details for the file mexc_trading_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mexc_trading_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5feab8fc79618f4d29aab07b42887fd6701e91859a1fbb7c397981b9d5de3153
|
|
| MD5 |
28b55c753f1eb17f1ed0a4a32f87907d
|
|
| BLAKE2b-256 |
79ee2614142d90a9d160c2c1a8fc1729da7de60b297b7d5e21f9b1ad86ccdbd8
|