[](https://badge.fury.io/py/pymexc)
[](https://github.com/makarworld/pymexc/blob/main/LICENSE)
[](https://pypi.org/project/pymexc/)
[](https://github.com/makarworld/pymexc/commits)
# pymexc
`pymexc` is an unofficial Python library for interacting with the [MEXC crypto exchange](https://www.mexc.com/). It provides a simple and intuitive API for making requests to the [MEXC API endpoints](https://mexcdevelop.github.io/apidocs/spot_v3_en/#introduction).
Most of the code was generated with ChatGPT, if you see an error, write to issues.
# Installation
You can install pymexc using pip:
```bash
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:
```python
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](https://mexcdevelop.github.io/apidocs/spot_v3_en/#introduction).
# License
This library is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/AmadoRamos/pymexc.git",
"name": "monedadigitalm",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6.0",
"maintainer_email": null,
"keywords": null,
"author": "abuztrade",
"author_email": "abuztrade.work@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6f/0b/0410e98b5bacac5715dae0606a946e4e7dfaaaa1a3f5205fcb269345d08b/monedadigitalm-1.0.10.post2.tar.gz",
"platform": null,
"description": "[](https://badge.fury.io/py/pymexc)\r\n[](https://github.com/makarworld/pymexc/blob/main/LICENSE)\r\n[](https://pypi.org/project/pymexc/)\r\n[](https://github.com/makarworld/pymexc/commits)\r\n\r\n# pymexc\r\n`pymexc` is an unofficial Python library for interacting with the [MEXC crypto exchange](https://www.mexc.com/). It provides a simple and intuitive API for making requests to the [MEXC API endpoints](https://mexcdevelop.github.io/apidocs/spot_v3_en/#introduction).\r\n\r\nMost of the code was generated with ChatGPT, if you see an error, write to issues.\r\n\r\n# Installation\r\nYou can install pymexc using pip:\r\n\r\n```bash\r\npip install pymexc\r\n```\r\n\r\n# Getting Started\r\nTo 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 \r\n\r\n\r\n## Example:\r\n\r\n```python\r\nfrom pymexc import spot, futures\r\n\r\napi_key = \"YOUR API KEY\"\r\napi_secret = \"YOUR API SECRET KEY\"\r\n\r\ndef handle_message(message): \r\n # handle websocket message\r\n print(message)\r\n\r\n\r\n# SPOT V3\r\n\r\n# initialize HTTP client\r\nspot_client = spot.HTTP(api_key = api_key, api_secret = api_secret)\r\n# initialize WebSocket client\r\nws_spot_client = spot.WebSocket(api_key = api_key, api_secret = api_secret)\r\n\r\n# make http request to api\r\nprint(spot_client.exchange_info())\r\n\r\n# create websocket connection to public channel (spot@public.deals.v3.api@BTCUSDT)\r\n# all messages will be handled by function `handle_message`\r\nws_spot_client.deals_stream(handle_message, \"BTCUSDT\")\r\n\r\n\r\n# FUTURES V1\r\n\r\n# initialize HTTP client\r\nfutures_client = futures.HTTP(api_key = api_key, api_secret = api_secret)\r\n# initialize WebSocket client\r\nws_futures_client = futures.WebSocket(api_key = api_key, api_secret = api_secret)\r\n\r\n# make http request to api\r\nprint(futures_client.index_price(\"MX_USDT\"))\r\n\r\n# create websocket connection to public channel (sub.tickers)\r\n# all messages will be handled by function `handle_message`\r\nws_futures_client.tickers_stream(handle_message)\r\n\r\n# loop forever for save websocket connection \r\nwhile True: \r\n ...\r\n```\r\n\r\n\r\n# Documentation\r\nYou can find the official documentation for the MEXC API [here](https://mexcdevelop.github.io/apidocs/spot_v3_en/#introduction).\r\n\r\n# License\r\nThis library is licensed under the MIT License.\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Unofficial python library for interacting with the MEXC crypto exchange :REVISION:AmadoRamos",
"version": "1.0.10.post2",
"project_urls": {
"Download": "https://github.com/AmadoRamos/pymexc/archive/refs/tags/v1.0.10r2.zip",
"Homepage": "https://github.com/AmadoRamos/pymexc.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "62545dcc0fa138b4f63966cdd1d53cb66bf535c0c86773716306e66bd3ec1982",
"md5": "64874f8b05a00566804ecce1f203ad6e",
"sha256": "76c338c7cb0216b905c09639e48f46a4bd2db5e878822294d2a5bc7c3fba8196"
},
"downloads": -1,
"filename": "monedadigitalm-1.0.10.post2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "64874f8b05a00566804ecce1f203ad6e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.0",
"size": 27297,
"upload_time": "2024-05-29T13:25:18",
"upload_time_iso_8601": "2024-05-29T13:25:18.493522Z",
"url": "https://files.pythonhosted.org/packages/62/54/5dcc0fa138b4f63966cdd1d53cb66bf535c0c86773716306e66bd3ec1982/monedadigitalm-1.0.10.post2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6f0b0410e98b5bacac5715dae0606a946e4e7dfaaaa1a3f5205fcb269345d08b",
"md5": "e106726a0fdc5669ae05bf9429407e2e",
"sha256": "8bf7c76f0d3c4a50f0466466ded9f2e7b070cc4f02f444c7fbce4f42d027f441"
},
"downloads": -1,
"filename": "monedadigitalm-1.0.10.post2.tar.gz",
"has_sig": false,
"md5_digest": "e106726a0fdc5669ae05bf9429407e2e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 25666,
"upload_time": "2024-05-29T13:25:20",
"upload_time_iso_8601": "2024-05-29T13:25:20.199408Z",
"url": "https://files.pythonhosted.org/packages/6f/0b/0410e98b5bacac5715dae0606a946e4e7dfaaaa1a3f5205fcb269345d08b/monedadigitalm-1.0.10.post2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-29 13:25:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AmadoRamos",
"github_project": "pymexc",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "monedadigitalm"
}