How it works
Six stages,
one continuous loop.
The agent runs on a schedule — pulling, scoring, gating, executing, and watching. You watch the agent.
- 01
Ingest
Every 15 minutes a server job pulls general and per-ticker news from Finnhub plus an events feed (earnings, FDA, M&A, macro). Headlines are deduplicated and tickers extracted.
- 02
Score
Each fresh news item is sent to Gemini through the Lovable AI Gateway with a structured prompt. The model returns direction (long/short), confidence (0–1), and a short reasoning trace — all persisted to the signals table.
- 03
Match patterns
For events with a known type (earnings, drug approvals, etc.), we pull analogous historical occurrences and compute win rate, average return, drawdown, and the optimal entry/exit window.
- 04
Gate risk
Signals only become trade candidates when confidence, historical win rate, and pattern strength clear configurable thresholds. Capital-per-trade, max-leverage, stop-loss and take-profit are enforced before any order is placed.
- 05
Execute
In demo mode, trades are simulated and logged. In live mode (admin-toggled), eToro's Public API opens and manages the position with the agreed SL/TP. Every fill, partial, and close is written back to the trades table.
- 06
Monitor & alert
A monitoring loop tracks open positions, P&L, and lifecycle events. Anything anomalous — API failures, slippage, risk-gate trips — fires an alert visible in the operator dashboard.
The rebalancing cycle
Read → collate → decide → react
Three times a day — at the Asia, EU and US opens — the agent runs a full pass. It reads every fresh news item and scheduled event in the window, collates them against the current open portfolio, and asks the model to produce a target book plus a per-position verdict (hold, trim or close) with a one-sentence reason citing the fresh evidence. The executor only closes positions the AI explicitly tells it to close — silence on a ticker defaults to hold.
Intraday reactions
Between sessions, the agent still watches
An intraday "react now" pass fires on: a single high-impact headline clearing the confidence threshold, a cluster of headlines on the same ticker within a short window, or an imminent scheduled event (earnings, FOMC, EIA). Opposing signals on the same ticker are blocked, and the loop picks by earliest date then highest confidence among unprocessed items.
Auditability
Every order has a traceable parent decision
Each pass writes a market brief (inputs, target book, close list, verdicts, narrative) and a portfolio-pass run with per-action records. Every signal, trade and brief is stamped with its mode (demo / live) and links back to the news item or event that caused it. Nothing the agent does is opaque.