Python SDK for OKX async
Project description
Overview
This is an unofficial Python wrapper for the OKX exchange v5 API
If you came here looking to purchase cryptocurrencies from the OKX exchange, please go here.
Source code
https://github.com/okxapi/python-okx
OKX API Telegram
API trading tutorials
- Spot trading: https://www.okx.com/help/how-can-i-do-spot-trading-with-the-jupyter-notebook
- Derivative trading: https://www.okx.com/help/how-can-i-do-derivatives-trading-with-the-jupyter-notebook
Make sure you update often and check the Changelog for new features and bug fixes.
Features
- Implementation of all Rest API endpoints.
- Private and Public Websocket implementation
- Testnet support
- Websocket handling with reconnection and multiplexed connections
Quick start
Prerequisites
python version:>=3.9
WebSocketAPI: websockets package advise version 6.0
Step 1: register an account on OKX and apply for an API key
- Register for an account: https://www.okx.com/account/register
- Apply for an API key: https://www.okx.com/account/users/myApi
Step 2: install python-okx
pip install python-okx
Step 3: Run examples
- Fill in API credentials in the corresponding examples
api_key = ""
secret_key = ""
passphrase = ""
- RestAPI
- For spot trading: run example/get_started_en.ipynb
- For derivative trading: run example/trade_derivatives_en.ipynb
- Tweak the value of the parameter
flag
(live trading: 0, demo trading: 1 ) to switch between live and demo trading environment
- WebSocketAPI
- Run test/WsPrivateTest.py for private websocket channels
- Run test/WsPublicTest.py for public websocket channels
- Use different URLs for different environment
- Live trading URLs: https://www.okx.com/docs-v5/en/#overview-production-trading-services
- Demo trading URLs: https://www.okx.com/docs-v5/en/#overview-demo-trading-services
Note
-
To learn more about OKX API, visit official OKX API documentation
-
If you face any questions when using
WebSocketAPI
,you can consult the following links-
asyncio
、websockets
document/github
:https://docs.python.org/3/library/asyncio-dev.html https://websockets.readthedocs.io/en/stable/intro.html https://github.com/aaugustin/websockets
-
About
code=1006
:https://github.com/Rapptz/discord.py/issues/1996 https://github.com/aaugustin/websockets/issues/587
-
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
Built Distribution
File details
Details for the file python-okx-async-django-0.2.11.tar.gz
.
File metadata
- Download URL: python-okx-async-django-0.2.11.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3994ade247aa84883c2909fa13b2b5e9029cb74566b9c369aebebe2101230742 |
|
MD5 | 08eae9bd0c7fd8f8b22e5d1a22f514d8 |
|
BLAKE2b-256 | 55b10623f14ac01ef49011801d7141d7383e62e3d733b353506b8a2c8a696bd9 |
File details
Details for the file python_okx_async_django-0.2.11-py3-none-any.whl
.
File metadata
- Download URL: python_okx_async_django-0.2.11-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ba150047edaf5105e7a3f89c52e65620e8249d16fe1b11815f1adcde0a2f243 |
|
MD5 | f21858b36ded38d64ca1b561b701a6cd |
|
BLAKE2b-256 | bdb19fd7503bc17cc3a03ee1dbda8c8784c40a2f6a5c5fa16d6f8d1029a59236 |