๐ค How To Use AI Trading Bot
Complete guide to setting up and running your automated OKX trading bot
โ
1. Prerequisites
Before you start, make sure you have:
- An OKX account โ Sign up here
- Funds deposited on OKX โ minimum $20 USDT (recommended $50-100)
- A modern web browser โ Chrome, Firefox, Edge, or Safari
- Both tabs open โ index.php (signals) + dashboard.php (trades)
- Stable internet connection โ for uninterrupted trading
๐ฐ About OKX fees: OKX charges 0.10% per side (Taker), which is 0.20% per trade (buy + sell). This is significantly lower than Kraken's 0.80% per side.
โ ๏ธ Never trade more than you can afford to lose. Cryptocurrency trading is high risk.
๐ 2. Getting OKX API Keys
Step 2.1 โ Create API Key on OKX
- Log in to your OKX account
- Click your profile icon (top right) โ API
- Click "Create V5 API Key"
- Give your key a name (e.g., "AI Trading Bot")
- Set the following permissions:
| Permission |
Required? |
Purpose |
| Read |
Required |
Read account balance |
| Trade |
Required |
Place buy/sell orders |
| Withdraw |
NOT needed |
โ ๏ธ Never enable for a bot |
Step 2.2 โ Set Passphrase
OKX requires a Passphrase in addition to API Key and Secret Key. This is a password you create yourself.
Rules:
- 8-32 characters
- At least 1 lowercase letter (a-z)
- At least 1 uppercase letter (A-Z)
- At least 1 number
- At least 1 special character (! @ # $ %)
๐จ Save the Passphrase immediately! OKX cannot recover it. If you lose it, you must create a new API key.
Step 2.3 โ Add Trusted IP (Recommended)
Add your server's IP address to the whitelist. This prevents anyone else from using your API key even if it leaks.
๐ Why this matters: Without IP restriction, OKX will automatically delete your API key after 14 days of inactivity if it has Trade permissions. With IP restriction, the key stays permanent.
Step 2.4 โ Copy Your Keys
After creating, you'll see three values:
- API Key โ a UUID like
c37c9427-c...
- Secret Key โ a long alphanumeric string
- Passphrase โ the one you just created
๐จ Save all three immediately! OKX shows the Secret Key only once. If you lose it, you must create a new API key.
๐ 3. Connecting the Bot
Step 3.1 โ Open the dashboard at /dashboard.php
Step 3.2 โ Locate the "OKX API" panel on the left side
Step 3.3 โ Click the โ๏ธ gear icon to open the API form
Step 3.4 โ Paste your API Key, Secret Key, and Passphrase
Step 3.5 โ Click Save
You should now see:
โ
Connected โ green indicator next to "OKX API"
๐ฏ Take Profit %
Auto-sell when profit reaches this percentage net after fees. Lower = more trades, quicker wins. Higher = fewer trades, bigger gains.
Recommended: 3.0% โ accounts for OKX's 0.20% round-trip fee.
๐ Stop Loss %
Auto-sell when loss reaches this percentage net after fees. Protects capital from large drawdowns.
- No Stop Loss โ position stays open until TP or max hold time
- -1.0% โ recommended (accounts for fees + volatility)
- -1.5% โ wider, allows more market fluctuation
๐ฐ Trade Size (USD)
How much USD to spend on each trade.
- Minimum $5 โ OKX has no strict minimum, but $5+ is practical
- Recommended $7-10 โ balance between risk and reward
- $20+ โ for larger accounts (less affected by fees)
๐ Max Trades
Maximum number of positions open at the same time.
- Recommended: 6 โ good diversification
- Total capital needed: Trade Size ร Max Trades
- Example: $7 ร 6 = $42 minimum balance
๐ฏ Threshold %
Minimum price movement to trigger a trade signal.
- 0.05% โ more signals, more trades
- 0.1% โ recommended balance
- 0.2%+ โ fewer but stronger signals
โฑ๏ธ Max Hold (min)
Auto-close a position if TP/SL is not hit within this time. Prevents capital from getting stuck.
Recommended: 240 min (4 hours)
Save Your Settings
Click the Save settings button at the bottom of the Trading Settings panel.
๐ 5. Starting the Bot
โ ๏ธ You must have BOTH tabs open for the bot to work:
- Tab 1:
index.php โ runs the AI and generates signals
- Tab 2:
dashboard.php โ executes trades on OKX
- Open
index.php in a new tab
- Wait for the AI to load (30-60 seconds)
- Return to
dashboard.php
- Select a symbol from the dropdown in the navbar
- Click the green Start button
You should see:
- Bot Status changes to Active (green with pulsing dot)
- Start button becomes Stop button
- Open Positions counter begins tracking
๐ 6. Monitoring Your Trades
Top Stats Bar
| Stat | Meaning |
| Bot Status | Active (running) or Stopped |
| Current Price | Live price of selected symbol |
| Open Positions | Number of active trades |
| 24h PnL | Profit/loss in last 24 hours |
| Total PnL | Cumulative profit/loss |
Open Positions
Each card shows:
- Symbol and direction โ BUY or SELL with color coding
- Live PnL โ % and USD profit/loss
- Entry / Current / TP / SL prices
- Progress bar โ visual to TP or SL
- Time held โ how long position has been open
Trading History
Shows closed positions with:
- Symbol and direction
- Win/Loss badge
- Close time
- Final PnL %
๐ง 7. Understanding the Interface
Signal Flow
- index.php runs the LSTM neural network
- AI generates a strong buy signal (only BUY signals โ SELL is handled by auto-sell)
- Signal is saved to the database
- dashboard.php reads the signal
- Trade is executed via OKX API
- Position appears in Open Positions
- Auto-sell monitors TP/SL every 15 seconds
- When closed, moves to Trading History
Bot Behavior
- Checks for new signals every 2 seconds
- Updates position status every 5 seconds
- Monitors TP/SL every 15 seconds
- Refreshes balance every 60 seconds
๐ง 8. Troubleshooting
โ "OKX API: Not configured"
Fix: Add your API keys via the โ๏ธ icon in the OKX API panel. All three fields required: API Key, Secret Key, Passphrase.
โ "50119 โ API key doesn't exist"
Fix: Your server is trying to reach the wrong OKX domain. For EEA (Europe), it must use eea.okx.com, not www.okx.com. Contact support if this persists.
โ "50113 โ Invalid sign"
Fix: Your Secret Key or Passphrase is wrong. Re-paste both from OKX. Ensure there are no extra spaces.
โ "50111 โ Invalid API key"
Fix: The API Key is wrong. Re-copy it from OKX.
โ "51008 โ Insufficient balance"
Fix: Deposit more USDT on OKX. Minimum required = Trade Size + fees.
โ "51000 โ Parameter error"
Fix: Order parameters are wrong. Check that the symbol exists on OKX and trade size is valid.
โ Bot doesn't open trades
Check:
- Is
index.php open in another tab?
- Are signals being generated? (check Open Positions count)
- Is the bot running? (Bot Status = Active)
- Do you have enough USDT balance?
- Is the selected symbol the same in both tabs?
โ Trades not closing
Check:
- Is dashboard.php still open?
- Is TP or SL actually reached net after 0.20% fees?
- Is Max Hold time expired?
๐ 9. Best Practices
- Start small โ begin with $20-50 to test
- Use Stop Loss โ always set -1.0% or wider (to cover fees)
- Keep both tabs open โ bot stops otherwise
- Monitor daily โ check that trades are executing
- Review performance โ adjust settings based on results
- Don't chase losses โ if bot is losing, stop and reassess
- Use Trusted IP โ on OKX API for security
- Backup your API keys โ store securely offline
โ ๏ธ 10. Important Risks
๐จ Trading involves risk of loss. Never trade more than you can afford to lose.
Bot Limitations
- Only runs when tabs are open โ if browser closes, bot stops
- No 24/7 operation โ no server-side automation (yet)
- Internet dependent โ connection loss pauses the bot
- AI is not perfect โ predictions can be wrong
Market Risks
- Volatility โ crypto prices can swing dramatically
- Slippage โ actual fill price may differ from expected
- Fees โ OKX charges 0.10% per side = 0.20% per trade (buy + sell)
- Liquidity โ some pairs may have thin order books
๐ก Fee calculation example:
Trade size: $7 USDT
Buy fee: $7 ร 0.10% = $0.007
Sell fee: $7 ร 0.10% = $0.007
Total fee per trade: ~$0.014 (0.20%)
AI-Specific Risks
- Overfitting โ model may perform well on past data but poorly on new
- Regime changes โ model trained on bull market may fail in bear market
- Black swan events โ extreme events not in training data
๐ก Remember: This is an educational tool. For serious trading, always consult a financial advisor and consider professional risk management.
โ๏ธ 11. Legal Disclaimer
๐ Important โ please read carefully
Our Role
This website and its software ("the Tool") is provided for
educational and informational purposes only.
We provide a software tool that generates AI-based trading
signals. We are NOT:
- A financial advisor or investment advisor
- A portfolio manager or asset manager
- A broker, dealer, or trading platform
- A cryptocurrency exchange or custodian
- A provider of crypto-asset services under MiCA (EU Regulation 2023/1114)
- A party to any transaction you make
Your Responsibility
All trading decisions and all orders are made by you,
using your own account at a third-party exchange
(e.g., OKX), with your own funds. You are solely
responsible for:
- All trading decisions and their outcomes
- All orders placed via your API key
- All profits and all losses
- Complying with all applicable laws in your jurisdiction
- Securing your API keys and account credentials
No Crypto-Asset Services
We do NOT provide crypto-asset services within the
meaning of MiCA. Specifically, we do NOT:
- Custody or administer crypto-assets on behalf of clients
- Execute orders on behalf of clients
- Receive or transmit orders on behalf of clients
- Provide portfolio management of crypto-assets
- Provide personalized advice on crypto-assets
- Operate a trading platform
All users trade for their own account, using their
own exchange accounts. We do not act as agent,
counterparty, or intermediary in any transaction.
No Financial Advice
Nothing on this website constitutes financial, investment, legal,
or tax advice. All signals, predictions, and analyses are
automatically generated and should be treated as
informational only. Always do your own research
before making any trading decision.
Third-Party Services
This Tool interacts with third-party exchanges (e.g., OKX) via
API. We are not affiliated with, owned by, or endorsed by
OKX or any other exchange. All trades are executed by the exchange
under the exchange's own terms and conditions. You are responsible
for reading and complying with those terms.
Limitation of Liability
To the fullest extent permitted by law, we disclaim all liability
for any direct, indirect, incidental, or consequential losses
arising from your use of this Tool, including but not limited to
trading losses, missed opportunities, data loss, or service
interruptions.
No Warranty
This Tool is provided "as is" and
"as available", without any warranty of any kind,
express or implied, including but not limited to fitness for a
particular purpose or non-infringement.
Changes to This Disclaimer
We may update this disclaimer at any time. Continued use of the
Tool after changes constitutes acceptance of the updated terms.
โ ๏ธ By using this Tool, you acknowledge that you have
read, understood, and agreed to this disclaimer.