Up-to-date, most-complete, well-organized, well-documented, easy-to-use OKX Exchange Rest and Websocket API SDK for Python
Project description
Overview
This is an unofficial Python wrapper for the OKX exchange v5 API
Source Code
https://github.com/burakoner/okx-sdk
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 = ""
pass_phrase = ""
- 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
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
okx-sdk-1.0.1.tar.gz
(27.4 kB
view hashes)
Built Distribution
okx_sdk-1.0.1-py3-none-any.whl
(35.6 kB
view hashes)