Python SDK for OKX
Project description
Overview
Forked from https://github.com/okxapi/python-okx/ 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://gitea.nicosanchez.com.ar/nicolas/python-okx
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-earn
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、websocketsdocument/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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_okx_earn-0.3.5.1.tar.gz
(23.6 kB
view details)
File details
Details for the file python_okx_earn-0.3.5.1.tar.gz.
File metadata
- Download URL: python_okx_earn-0.3.5.1.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abfc579df1dd273d475a44ba92cff6a8ad24a2a348a5c7aef4c5e34997624367
|
|
| MD5 |
8d48451052a9ba7336486d084aa08462
|
|
| BLAKE2b-256 |
f590b4ba0ff6c100a6b25116f82b4754e3ea0a5402e8b6e92a072e07521d849a
|