Python SDK for OKX
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/learn/spot-trading-with-jupyter-notebook
- Derivative trading: https://www.okx.com/learn/derivatives-trading-with-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
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-0.1.6.tar.gz
(20.9 kB
view hashes)
Built Distribution
python_okx-0.1.6-py3-none-any.whl
(10.7 kB
view hashes)
Close
Hashes for python_okx-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b228d50aba8e7cd440b85b39fad0f50ef3a3535db506bd7bdb5436bf39b2498 |
|
MD5 | deff22b96e596eb15909782427c961d3 |
|
BLAKE2b-256 | ff773bbaa9797a3f2ba40a1d1578ebbd0bac192f5ee0cf5aaec129c982241d10 |