Overview
- This plugin facilitates digital currency trading on OKX (formerly OKEx) through the "Kungfu Quant" software platform.
- Supports both live and simulated trading environments.
- For custom development, modifications must be recompiled (see "Compilation" section) and reinstalled into Kungfu's plugin directory.
Installation Guide
Download Required Files:
- Kungfu Client (Latest stable release; ZIP version recommended)
- OKX plugin package (Download from "Release" section on this page)
Locate Installation Directory:
- EXE version: Run Kungfu > "File" > "Open Installation Directory"
- ZIP version: Navigate to
resourcesfolder in decompressed Kungfu directory
Install Plugin:
- Copy the
okxfolder to:{Kungfu Directory}/app/kungfu-extensions - Restart client after installation.
- Copy the
Usage Instructions
API Creation
To enable algorithmic trading, create API keys via OKX:
- Click "Create API" on OKX API Portal
- Select trading account with "API Trading" purpose and "Trade" permissions
- Set a secure passphrase (required for API management)
- Submit and retrieve API key/secret under "View" section
Login Process
Market Data Source:
- Client > "Trading Accounts" panel > Add > "OKX-Digital Currency"
Trading Account:
Enter:
- Custom account name
- API passphrase
- API key and secret
- Toggle "Simulated Trading" if needed
Supported Features
| Feature | Support Status |
|---|---|
| Spot Trading | Full |
| Futures Trading | Cross Margin Only |
| Options Trading | Not Supported |
| Position Sync | 60s Interval/Real-time |
Key Notes:
- Subscribe to market data before trading (e.g.,
context.subscribe(source, ["BCH-BTC"])) Exchange codes:
- Spot:
Exchange.OKX_SPOT - USD-M Futures:
Exchange.OKX_USD_FUTURE - Coin-M Futures:
Exchange.OKX_COIN_FUTURE
- Spot:
Compilation Guide (Windows)
Prerequisites
- Visual Studio Community 2022 (64-bit Shell Required)
- CMake (Included with VS2022)
Build Steps
- Install Kungfu-trader (e.g.,
D:\Kungfu-trader) - Clone
kfx-broker-okxrepository From VS2022 x64 Native Tools Command Prompt:
D:\Kungfu-trader\resources\kfc\kfs.exe extension build- Copy generated
okxfolder fromdistto:D:\Kungfu-trader\resources\app\kungfu-extensions
FAQ Section
Q: Why can't I see leverage trading options?
A: The plugin currently only supports cross-margin mode without multiplier functionality.
Q: How often are account balances updated?
A: Balances sync every 60 seconds or immediately after order execution.
Q: Where do I find demo strategies?
A: Check the README's appendix for included sample strategies.
๐ Explore OKX trading features
Final Notes
For optimal performance:
- Always subscribe to relevant market data before strategy execution
- Monitor logs via Kungfu's interface
- Test strategies in simulated environments before live deployment