Connecting OKX
This guide walks you through connecting your OKX account to TradeStaq for futures trading.
Prerequisites
Before connecting OKX:
- A verified OKX account
- API key with trading permissions
- Funds in your trading account
Creating API Keys on OKX
Log into OKX
Go to okx.com and log into your account.
Navigate to API Management
- Click your profile icon
- Select API under Account
- Click Create API Key
Select API Type
Choose API Trading (not Fast API).
Configure Key Settings
- Label:
TradeStaq Trading Bot - Passphrase: Create a secure passphrase (required by OKX)
- Permissions:
- ✅ Read
- ✅ Trade
Note: Never enable Withdraw permission. Store your passphrase securely - it's needed for API authentication.
Set IP Restrictions (Recommended)
- Click Link IP address
- Add TradeStaq server IPs
- Multiple IPs can be added separated by commas
Complete Verification
- Enter your fund password
- Complete email/SMS verification
- Complete 2FA verification
Save Your Credentials
You'll receive three credentials:
- API Key
- Secret Key
- Passphrase (you created this)
Note: Save all three credentials immediately. The Secret Key is only shown once.
Adding OKX to TradeStaq
Open Exchange Wizard
- Navigate to Dashboard → Exchanges
- Click Add Exchange
Select OKX
Choose OKX from the exchange list.
Select Exchange Type
| Type | Description |
|---|---|
| Futures | Trade perpetual swaps |
| Paper Trading | Simulated trading |
Enter API Credentials
For live trading, enter all three:
- API Key
- Secret Key
- Passphrase
Configure Settings
- Exchange Name: Descriptive name
- Default Leverage: Your preferred leverage
Review and Create
Verify settings and click Create Exchange.
OKX-Specific Configuration
Account Modes
OKX offers multiple account modes:
| Mode | Description |
|---|---|
| Simple | Basic spot trading |
| Single-Currency Margin | One currency as margin |
| Multi-Currency Margin | Multiple currencies as margin |
| Portfolio Margin | Combined margin calculation |
Note: TradeStaq works best with Multi-Currency Margin mode for maximum flexibility.
Position Mode
OKX supports:
| Mode | Description |
|---|---|
| Long/Short | Independent positions |
| Net | Single net position |
To change on OKX:
- Go to Trading → Derivatives
- Click Settings → Trading Settings
- Select Position Mode
Contract Types
OKX offers various contract types:
| Type | Settlement | Example |
|---|---|---|
| USDT-Margined | USDT | BTC-USDT-SWAP |
| Coin-Margined | Crypto | BTC-USD-SWAP |
| Expiry Futures | Date-based | BTC-USD-240329 |
TradeStaq primarily supports USDT-Margined perpetual swaps.
Common Issues
"Invalid Credentials"
- Verify API Key is correct
- Check Secret Key for errors
- Ensure Passphrase matches exactly (case-sensitive)
"API Permission Denied"
- Verify Trade permission is enabled
- Check Read permission is enabled
- Ensure API key hasn't been disabled
"IP Restriction Error"
- Add TradeStaq IPs to your whitelist
- Or temporarily disable IP restrictions
"Insufficient Margin"
- Transfer funds to your trading account
- Check margin mode requirements
OKX API Specifics
Rate Limits
| Category | Limit |
|---|---|
| Order requests | 60/2 sec |
| Cancel requests | 60/2 sec |
| Account info | 10/2 sec |
Symbol Format
OKX uses specific symbol formats:
- Spot:
BTC-USDT - Perpetual:
BTC-USDT-SWAP - Futures:
BTC-USD-240329
Note: TradeStaq automatically handles symbol conversion. Use standard format like
BTCUSDTin your signals.
Security Recommendations
- Use unique passphrase - Don't reuse from other services
- Enable all 2FA options - Email, SMS, Google Auth
- Set IP whitelist - Restrict API access
- Review API activity - Check OKX logs regularly
- Use sub-accounts - Isolate trading funds
Trading Notes
Funding Fees
Perpetual swaps have funding fees every 8 hours:
- Positive rate: Longs pay shorts
- Negative rate: Shorts pay longs
Minimum Order Sizes
OKX has minimum order requirements:
- Varies by contract
- Check contract specifications on OKX
Next Steps
Start Trading
Ready to automate your trading on OKX? Explore available trading pairs and strategies:
- Browse OKX Trading Bots — see all available trading pairs and deploy a bot
- Explore Strategies — find the right strategy for your goals
- Try Backtesting — test strategies on historical data before going live
Strategies available on OKX
Deploy any of these 12 automated strategies on OKX.