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

  1. Click your profile icon
  2. Select API under Account
  3. Click Create API Key

Select API Type

Choose API Trading (not Fast API).

Configure Key Settings

  1. Label: TradeStaq Trading Bot
  2. Passphrase: Create a secure passphrase (required by OKX)
  3. Permissions:
    • ✅ Read
    • ✅ Trade

Note: Never enable Withdraw permission. Store your passphrase securely - it's needed for API authentication.

Set IP Restrictions (Recommended)

  1. Click Link IP address
  2. Add TradeStaq server IPs
  3. Multiple IPs can be added separated by commas

Complete Verification

  1. Enter your fund password
  2. Complete email/SMS verification
  3. 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

  1. Navigate to Dashboard → Exchanges
  2. Click Add Exchange

Select OKX

Choose OKX from the exchange list.

Select Exchange Type

TypeDescription
FuturesTrade perpetual swaps
Paper TradingSimulated 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:

ModeDescription
SimpleBasic spot trading
Single-Currency MarginOne currency as margin
Multi-Currency MarginMultiple currencies as margin
Portfolio MarginCombined margin calculation

Note: TradeStaq works best with Multi-Currency Margin mode for maximum flexibility.

Position Mode

OKX supports:

ModeDescription
Long/ShortIndependent positions
NetSingle net position

To change on OKX:

  1. Go to Trading → Derivatives
  2. Click Settings → Trading Settings
  3. Select Position Mode

Contract Types

OKX offers various contract types:

TypeSettlementExample
USDT-MarginedUSDTBTC-USDT-SWAP
Coin-MarginedCryptoBTC-USD-SWAP
Expiry FuturesDate-basedBTC-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

CategoryLimit
Order requests60/2 sec
Cancel requests60/2 sec
Account info10/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 BTCUSDT in your signals.

Security Recommendations

  1. Use unique passphrase - Don't reuse from other services
  2. Enable all 2FA options - Email, SMS, Google Auth
  3. Set IP whitelist - Restrict API access
  4. Review API activity - Check OKX logs regularly
  5. 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: