Building an FVG Trading Bot for OKX with Rejection Logic and AI Agents
Description and use
The author built the FVG Killer bot for OKX using the Fair Value Gap strategy. Key features include strict signal filtering (rejecting 99% of noise), Kelly criterion risk management, and consensus from six AI agents. The project includes robust engineering safeguards like unit tests and circuit breakers.
Problem
Manual crypto futures trading is prone to emotional errors, missed entries, and catastrophic liquidations due to poor risk management and signal noise.
Outcome
The bot successfully filters out 99% of noisy signals using strict gates. It implements a risk management system that survives edge decay better than fixed sizing, supported by 197 unit tests and AI agent consensus.
Workflow
- Clone the repository and install dependencies.
- Configure OKX API keys in config.json.
- Run the bot in paper/dry-run mode to validate logic without real funds.
- Bot scans top 100 contracts for Fair Value Gaps (3-sigma move, 5x volume).
- Apply five rejection gates: Freshness, ATR grade, Direction, Depth, and Liquidity.
- Six AI analyst agents debate the signal and reach a consensus.
- Calculate position size using rolling fractional Kelly criterion.
- Execute trade with circuit breakers and atomic state writes.
- Monitor performance and auto-withdraw profits on-chain.
Evidence
A naive detector spits out dozens of signals a day and 99% of them are garbage.
Rolling Kelly median drawdown 83.1%, fixed 30% sizing wipes out 100% of accounts
- Record date: 2026-09-05T12:48:57.964Z