Skip to main content

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 (with pydantic)
  • 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, not from 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

Wallet

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mexc_trading_sdk-0.1.2.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mexc_trading_sdk-0.1.2-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file mexc_trading_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: mexc_trading_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for mexc_trading_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 53f93511f2957778f9b1e5bdcf3bf552893ddad974a060d8a1eb1a2657631d8c
MD5 f87081abffac0057500874c108f06333
BLAKE2b-256 dda98b5db2ead93aecbd39efb39a55fbd07c2b0e1f42e750263e7493d23e5ee2

See more details on using hashes here.

File details

Details for the file mexc_trading_sdk-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mexc_trading_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20c63d13e9e5a4509c80897a1ca12e630485f6eacc3896b27b5023e75f88f3a3
MD5 a3c7b0589682c00c9ba9fe0203945275
BLAKE2b-256 5d6c4ae3bbb6558008bf3102a39a63f2e8483b9d8aec97b791a88166644b6a86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page