How to Connect TradingView to OKX for Automated Trading
Automate your TradingView strategy on OKX in under 10 minutes. OKX is a major global exchange offering spot, futures, and options trading with advanced features for professional traders.
What You'll Need
Before starting, ensure you have:
- TradingView Pro or higher - Webhooks require a paid TradingView subscription
- Verified OKX account - Identity verification (KYC) completed
- SignalBee account - Free to sign up at signalbee.trade
- 5-10 minutes - Quick setup process
Step 1: Create Your OKX API Key
Create an API key on OKX with trading permissions.
- Log in to OKX
- Click your profile icon → API
- Click Create API Key
- Select API trading
Configure API Settings
| Setting | Value |
|---|---|
| API Key Name | SignalBee Trading |
| Passphrase | Create a secure passphrase (you'll need this!) |
| Permissions | Trade |
Required Permissions
| Permission | Enable? |
|---|---|
| Read | ✅ Yes |
| Trade | ✅ Yes |
| Withdraw | ❌ Never |
- Complete 2FA verification
- Save your API Key, Secret Key, AND Passphrase
OKX Requirement: OKX requires a passphrase for API authentication. You must provide this to SignalBee along with your API key and secret.
Step 2: Connect OKX to SignalBee
Link your OKX credentials to SignalBee.
- Log in to SignalBee
- Go to Exchanges in the sidebar
- Click Add Exchange → Select OKX
- Enter your API Key
- Enter your Secret Key
- Enter your Passphrase (OKX-specific requirement)
- Click Save and Test Connection
- Verify you see ✅ "Connection successful"
Your OKX balances should now appear in SignalBee.
Step 3: Create Your SignalBee Webhook
SignalBee provides a unique webhook URL for your alerts.
- In SignalBee, go to Webhooks
- Click Create Webhook
- Select your OKX exchange connection
- Copy your webhook URL
Step 4: Configure Your Trading Settings
Set up safety limits before enabling trading.
- Go to Configuration in SignalBee
- Whitelist pairs you want to trade (e.g., BTC-USDT, ETH-USDT)
- Set Max order size to limit trade amounts
- Enable Trading when ready
OKX Ticker Format
OKX uses hyphenated ticker format:
| Type | Format | Example |
|---|---|---|
| Spot | BASE-QUOTE | BTC-USDT, ETH-USDT |
| Perpetual | BASE-USDT-SWAP | BTC-USDT-SWAP |
Use the appropriate format based on your trading type.
Step 5: Set Up Your TradingView Alert
Connect TradingView to SignalBee.
- Open TradingView and load your strategy
- Click Alert (clock icon)
- Configure your alert conditions
- In Notifications, enable Webhook URL
- Paste your SignalBee webhook URL
- In the Message field, enter your signal JSON:
{
"action": "buy",
"ticker": "BTC-USDT",
"quantity_type": "percentage",
"quantity": "50"
}
Signal Format Reference
| Field | Required | Values |
|---|---|---|
action | Yes | buy, sell, or close |
ticker | Yes | OKX pair (e.g., BTC-USDT) |
quantity_type | Yes | percentage or fixed |
quantity | Yes | Amount to trade |
Example signals:
Buy 40% of USDT balance:
{"action": "buy", "ticker": "BTC-USDT", "quantity_type": "percentage", "quantity": "40"}
Sell 2 ETH:
{"action": "sell", "ticker": "ETH-USDT", "quantity_type": "fixed", "quantity": "2"}
Step 6: Test Your Setup
Verify everything works.
- In TradingView, click Test on your alert
- In SignalBee, check Signals page
- Verify Orders shows the executed trade
- Confirm in OKX trade history
OKX-Specific Notes
Account Modes
OKX supports different account modes:
| Mode | Description |
|---|---|
| Simple | Single currency margin |
| Single-currency Margin | One margin currency |
| Multi-currency Margin | Multiple margin currencies |
| Portfolio Margin | Cross-margin across products |
Check your OKX account settings to understand your mode.
Trading Fees
| Tier | Maker | Taker |
|---|---|---|
| Lv 1 | 0.08% | 0.10% |
| Lv 2 | 0.07% | 0.09% |
| VIP | Lower rates |
Fee discounts available with OKB holdings.
Minimum Order Sizes
| Pair | Minimum |
|---|---|
| BTC-USDT | 0.00001 BTC |
| ETH-USDT | 0.0001 ETH |
| Most pairs | ~$5 USD equivalent |
Passphrase Security
Your OKX API passphrase:
- Is required for every API call
- Should be unique and secure
- Is stored encrypted in SignalBee
- Cannot be recovered if lost (create new API key)
Troubleshooting
| Issue | Solution |
|---|---|
| Invalid passphrase | Verify passphrase matches exactly (case-sensitive) |
| API key invalid | Check key hasn't expired or been revoked |
| Instrument not found | Use OKX format (BTC-USDT not BTCUSDT) |
| No trading permission | Enable Trade permission in OKX API settings |
Summary
You've connected TradingView to OKX in 6 steps:
- ✅ Created OKX API key with passphrase
- ✅ Connected OKX to SignalBee (including passphrase)
- ✅ Created a SignalBee webhook
- ✅ Configured settings with OKX ticker format
- ✅ Set up TradingView alert with webhook
- ✅ Tested the complete flow
Your TradingView strategy now executes automatically on OKX.
Need help? Contact support@signalbee.trade or visit our Help Center.