The schedule / Entry 02 / Multi-agent AI

Trading Bot.

Paper trading, by designIG demo account / Oracle Cloud, systemd

The four agents from chapter 3. They scan the FTSE 100 every weekday, rate every setup, and hold an absolute veto over every trade. 62 sessions in, they have let zero impulsive trades through. That is the point.

4AI agents, one veto
62sessions run
0trades placed
750GBPhard notional cap, in code
Note 1: The problemThe operator was the risk

I studied financial markets at Jai Hind College and hold a Chartered Wealth Manager certification. I understood markets. But understanding them and trading them profitably turned out to be two different things. I'd watch a stock I'd researched all week drop 2% on a single announcement and sell within five minutes, then watch it recover by close. I'd spot a FTSE dip and buy in, convinced it was the bottom, only for it to keep sliding. After a red day I'd jump into something I hadn't even properly analysed, just to make the loss back.

The analysis was usually fine. It was the real-time decisions that killed it. I'd override my own rules the moment I felt any pressure. So the question became: could I build something that kept the analysis but removed me from the execution?

Note 2: The trading dayNo human input

Every weekday at 10:35 GMT, thirty minutes after London open once the opening noise has settled, the system runs. APScheduler fires five jobs through the day. Nothing is held overnight.

  1. 10:30Start 5-minute candle collection via Lightstreamer
  2. 10:35Full four-agent evaluation across the top 20 FTSE tickers. The only entry window of the day
  3. 12:00Regime recheck: close everything if the FTSE is below -1%
  4. 14:00Second regime recheck
  5. 16:00Liquidate everything. No overnight gap risk, ever
Note 3: The floorFour agents, one veto

First thing each session: kill-switch and market regime check. If either fails, nothing else runs. News gets scanned and classified by tier before the technical check: EMA-50, VWAP, RSI. Only setups that pass everything reach the quality gate, where Claude Sonnet rates them against a strict JSON schema. The last word belongs to Claude Opus as risk auditor. If it vetoes, the trade dies. The rails live in code, not prompts: the agents can assess and recommend, they cannot override the config.

OrchestratorGATE
Kill-switch and regime check. If the equity floor is breached or the FTSE is off more than 0.5%, the session never starts.
Context LeadSCAN
Same-day RNS announcements, classified Tier A (earnings, M&A), Tier B (upgrades, buybacks) or Tier C (skip). No catalyst, no conviction.
AnalystRATE
Technical quality gate. EMA-50, VWAP, RSI-14, then a structured 1 to 5 rating. Marginal setups score exactly what they deserve.
Risk AuditorVETO
Absolute veto, no appeal. Correlation risk, position sizing, session context. 62 sessions of saying no and being right.
trading-bot : session recordSample output
10:35:01 SCAN Kill-switch OK, equity above floor
10:35:02 SCAN FTSE 100: +0.12%, session active
10:35:04 PASS AZN: EMA OK, VWAP OK, RSI 42
10:35:04 SKIP SHEL: RSI 78, overbought
10:35:04 SKIP ULVR: below EMA-50
10:35:05 RATE AZN quality gate: 3/5, no catalyst
10:35:06 VETO Risk audit: marginal setup, capital preserved
10:35:07 DONE Session 62 closed flat. Trades placed: 0
Note 4: Hard railsConfig, not prompts
RailRuleValue
Max notionalPer trade, absoluteGBP 750
Stop loss / take profit1:2 risk-reward, fixed3% / 6%
PositionsOne at a time, no pyramidingMAX 1
Kill switchEquity floor: liquidate and stop until manual resetGBP 750
LeverageNone0
Overnight exposureEverything liquidated at 16:000
Every parameter lives in config.pyThe agents cannot touch it
Note 5: EngineeringThe parts that mattered

A trading bot whose proudest metric is the trades it refused to place.

Note 6: StackCarrying values
Python 3.127,000+ lines across 33 files
Claude OpusRisk auditor, the final veto
Claude SonnetQuality gate, structured outputs
IG REST APIDemo account, spread betting
LightstreamerReal-time 5-minute candles
pandas-taEMA, VWAP, RSI indicators
APSchedulerWeekday-only job scheduling
yfinance + ParquetCached history for backtests
Tenacity + filelockRetries and atomic state
Oracle CloudUbuntu VM, systemd, auto-deploy
Other entriesSame ledger
01 OpsPilot The AI that answers my messages: 6,124+ documents, live finance data, one-click approval. Production
03 Uni-Nation Digital Website, inventory PWA and Hindi voice stock entry for the family fabric business. Live
04 WhatsApp Smart A Chrome extension that gives WhatsApp scheduling, AI replies and summaries. Prototype