Skip to main content

Unofficial python library for interacting with the MEXC crypto exchange :REVISION:AmadoRamos

Project description

PyPI version License image Github last commit date

pymexc

pymexc is an unofficial Python library for interacting with the MEXC crypto exchange. It provides a simple and intuitive API for making requests to the MEXC API endpoints.

Most of the code was generated with ChatGPT, if you see an error, write to issues.

Installation

You can install pymexc using pip:

pip install pymexc

Getting Started

To start working with pymexc, you must import spot or futures from the library. Each of them contains 2 classes: HTTP and WebSocket. To work with simple requests, you need to initialize the HTTP class. To work with web sockets you need to initialize the WebSocket class

Example:

from pymexc import spot, futures

api_key = "YOUR API KEY"
api_secret = "YOUR API SECRET KEY"

def handle_message(message): 
    # handle websocket message
    print(message)


# SPOT V3

# initialize HTTP client
spot_client = spot.HTTP(api_key = api_key, api_secret = api_secret)
# initialize WebSocket client
ws_spot_client = spot.WebSocket(api_key = api_key, api_secret = api_secret)

# make http request to api
print(spot_client.exchange_info())

# create websocket connection to public channel (spot@public.deals.v3.api@BTCUSDT)
# all messages will be handled by function `handle_message`
ws_spot_client.deals_stream(handle_message, "BTCUSDT")


# FUTURES V1

# initialize HTTP client
futures_client = futures.HTTP(api_key = api_key, api_secret = api_secret)
# initialize WebSocket client
ws_futures_client = futures.WebSocket(api_key = api_key, api_secret = api_secret)

# make http request to api
print(futures_client.index_price("MX_USDT"))

# create websocket connection to public channel (sub.tickers)
# all messages will be handled by function `handle_message`
ws_futures_client.tickers_stream(handle_message)

# loop forever for save websocket connection 
while True: 
    ...

Documentation

You can find the official documentation for the MEXC API here.

License

This library is licensed under the MIT License.

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

monedadigitalm-1.0.10.post1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

monedadigitalm-1.0.10.post1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file monedadigitalm-1.0.10.post1.tar.gz.

File metadata

  • Download URL: monedadigitalm-1.0.10.post1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for monedadigitalm-1.0.10.post1.tar.gz
Algorithm Hash digest
SHA256 3d7a3add5648b0842bb0306a8e715d3a18a7d0535706d783e7321d1f41f899b8
MD5 47a11db409aab272db459af74d6e4ad5
BLAKE2b-256 2f01322e171df60bc90e548bd71633a58ff7e72cc79b3779204e70c76ee18859

See more details on using hashes here.

File details

Details for the file monedadigitalm-1.0.10.post1-py3-none-any.whl.

File metadata

  • Download URL: monedadigitalm-1.0.10.post1-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for monedadigitalm-1.0.10.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 2244c542d41f9781f8834e95d1ba89956a3395d0fd8cff5471a6e499e293372a
MD5 8af7b2898760a695c89cbcf0b36f522e
BLAKE2b-256 4e1abf7bd44be24e91643d53ffcd61f7202485f09dc272f3f5c0469c32504614

See more details on using hashes here.

Supported by

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