Skip to main content

Mexc api

Python wrapper for the Mexc api

Documentation Status

mexc docs

Usage

Requirements

  • Python 3.11 or newer
  • requests
  • websocket-client

installation

pip install mexc-api

api key

generate an api key here: https://www.mexc.com/user/openapi

Example

import time
from mexc_api.spot import Spot
from mexc_api.websocket import SpotWebsocketStreamClient
from mexc_api.common.enums import Side, OrderType, StreamInterval, Action
from mexc_api.common.exceptions import MexcAPIError

KEY = "<KEY>"
SECRET = "<KEY>"

spot = Spot(KEY, SECRET)

server_time = spot.market.server_time()
print(server_time)

order_book = spot.market.order_book("MXUSDT")
print(order_book)

order = spot.account.test_new_order(
    "MXUSDT",
    Side.BUY,
    OrderType.LIMIT,
    '1',
    price='1'
)
print(order)

ws = SpotWebsocketStreamClient(
    KEY,
    SECRET,
    on_message=print
)
time.sleep(1)
ws.klines("MXUSDT", StreamInterval.ONE_MIN)
ws.account_orders()

time.sleep(5)
ws.account_orders(Action.UNSUBSCRIBE)
ws.klines("MXUSDT", StreamInterval.ONE_MIN, Action.UNSUBSCRIBE)
ws.stop()

Metadata

Release files for mexc-api 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mexc-api 0.0.2
File Size Uploaded Provenance Actions
mexc-api-0.0.2.tar.gz 10.1 kB Without provenance Details for mexc-api-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mexc-api 0.0.2
File Interpreter ABI Platform Actions
mexc_api-0.0.2-py3-none-any.whl Python 3 none any Details for mexc_api-0.0.2-py3-none-any.whl

Total release size: 23.9 kB

Release files / mexc-api-0.0.2.tar.gz

Download URL mexc-api-0.0.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ad2f284663a57f73ff2743544f4b6cdef93fcf7784b7a24d6e14aee39cc12e3f
BLAKE2b-256 checksum
How to use checksums
b3cfee43ad19b73fc86a2f7219658441262e382d9975f0ae3e6b358b67ca2660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / mexc_api-0.0.2-py3-none-any.whl

Download URL mexc_api-0.0.2-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8db9457b21070747cf5bb3ee1b55afdd75bcad378ab6a760d7e736933caad563
BLAKE2b-256 checksum
How to use checksums
51bb2ca7d94e82eadaffada15657148d32092bf0eee2a3d587dee3d3f02feca3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for mexc-api 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page