# TraderBro
A 24/7 self-improving agentic AI trader on Deriv and cTrader. A deterministic engine of ~30 indicators, market-structure signals, volume profile, and multi-timeframe checks gates every trade; an LLM council sits around it as a tie-breaker and risk-only veto. Learns from every outcome via a persistent SQLite journal, calibration, and backtested strategy promotion.
Overview
TraderBro is a 24/7 self-improving agentic AI trader on Deriv and cTrader. The part that places trades is ordinary code, not an AI: about 30 indicators, market-structure signals, volume profile, and trend checks across several timeframes, combined into a score. Every candidate trade passes through a fixed sequence of gates — quality score, expected-value check, then hard risk limits — and any one of them can kill it. An AI sits around that engine, not in front of it. It can break a tie, veto a trade the engine wanted, or shrink its size. It can never invent a trade, choose a position size, or loosen a risk limit. On a slower cadence, a council of AI agents — analysts, a bull and a bear that argue, a risk manager, a portfolio manager — reviews the market and files an opinion with read-only tools. Every decision and outcome goes into a local SQLite file: what it did, why, what it predicted, and what actually happened. It compares predictions to reality, writes lessons from losses, and keeps backtesting candidate strategies against the champion. A challenger only replaces the champion by beating it on out-of-sample data. Per-trade stake, total exposure, a daily loss stop, a drawdown kill-switch, and a cooldown after consecutive losses are enforced in code and are customer-editable with plain-language notes about what loosening each one costs. The system starts on a demo account and cannot touch real money until two independent locks are cleared: a settings switch and a track-record promotion gate (30+ trades, 50%+ win rate, profit, 50+ backtest trades, positive average return, wins ahead of losses, drawdown within limits).
Problem
Retail trading bots either hand all decisions to an LLM (uncontrollable, hallucinates prices) or freeze a single strategy (no adaptation). Neither survives contact with live markets. The task was to build a system where the AI can reason but can never invent data, loosen risk, or place a trade the deterministic gates did not approve.
Approach
Two brains, one loop. A fast deterministic pipeline scores every candidate through quality, expected-value, and hard risk gates; an LLM breaks ties inside the loop and can only veto or shrink size after the gates. A slower council (analysts → bull/bear debate → risk manager → portfolio manager) runs on a cadence with read-only data tools — no execution tool exists. Strategies are data (StrategySpec), not code; challengers replace champions only on out-of-sample data. Demo-first with a two-lock promotion gate before any real money.
Impact
- * Brokers: Deriv (WebSocket + REST) and cTrader (Open API + MCP), behind a neutral BrokerAdapter so core modules never branch on broker.
- * Risk guardrails enforced in code: per-trade stake, exposure caps, daily-loss stop, drawdown kill-switch, loss-streak cooldown — all customer-editable with plain-language hints; the LLM can only tighten them.
- * Persistent memory: decision journal, outcome reconciliation, calibration (predicted vs realized), and lessons fed back into future reasoning.
- * Ships as standalone binaries (macOS/Windows via Nuitka/PyInstaller) and a React 19 + Vite dashboard with an interactive agent-council graph and strategy builder.
Architecture
TraderBro is a two-layer agentic trading system: a deterministic decision engine that gates every trade, with an LLM council that can only reduce risk. The entry pipeline is a fixed sequence of gates — any one can kill a candidate — and the council runs on a slower cadence with read-only tools only.
Guardrails
- * Never invent market data — every number traces to a real broker tick or stored artifact. Hallucination is treated as fatal.
- * Demo-first: locked to demo until config explicitly allows live AND the promotion gate is satisfied. Customer can bypass with typed confirmation, accepting full responsibility.
- * The LLM can only reduce risk, never increase it. Strategies are data, not code. Tests only get stronger.
- * Survival-first doctrine ('Survive first. Trade only with an edge. Never invent a number. Cut losers fast.') is injected in code and cannot be edited away.