Stock Robot
Solo system
A Python robot that runs unattended and speaks only when there is something to do. Today it is two things: a stop guardian that checks the stops on single stocks and coins every hour, and a long-term thesis book kept on paper, where an LLM reads each new annual filing against the deal-breakers stored with its thesis. The short-term engine was retired after paper testing showed no edge. Runs 24/7 as a daemon since March 2026 and is still being built, behind tests that keep a stop from ever being lowered.
- Type
- AI / Fintech
- Status
- Internal
From sources to a thesis and a stop. In order: Data sources, prices · fundamentals · macro · filings; TTL cache, rate limiter, circuit breaker; then Evidence dossier, typed, with coverage ratios; then Long-term engines, stocks and crypto, reviewed weekly; then LLM chain, primary → reviewer → fallback, under a daily budget; then Thesis book, paper positions; a broken deal-breaker is the one exit; then Stop guardian, stops on single stocks and coins, checked hourly; then Telegram, the monthly action and a Sunday briefing.
Side lane — kept state: Scheduler, 9 jobs; a job up to an hour late runs once on wake; SQLite, 24 tables.
- 1A bad update caused 17,235 restarts in 18 hours. I rolled back fifteen changes to the last working version; now a crashed robot waits five minutes before restarting, and AI calls are capped at 150 an hour.
- 2The model reads only the filing and the stored deal-breakers, never a price.
- 3The short-term engine was retired after paper testing showed no edge.
- Problem
- Someone who cannot read a chart still has to know when a stop needs placing again or a thesis has broken, and why, in plain words.
- Constraint
- Free market data only, no paid feeds. The AI runs through the Claude Code CLI as a subprocess. One process on a Mac, kept alive by launchd.
- Decision
- A stop guardian for the positions and a long-term thesis book on paper. A broken deal-breaker is the one way a thesis closes: price and age never close one. Every broken thesis is read again from an anonymised filing.
- Outcome
- Every hour it checks the stops, every month it sends the month's action, and on Sundays a briefing, in plain words. Often: nothing.
General notes
- 01By default, the AI tools run from an empty folder, so the project's instructions and memory are not loaded automatically.
- 02Every broken thesis is read again from an anonymised filing, to test reading against recall.
- 03A stop is raised and never lowered, and a fall far under it is read as a split before a hit.
Bill of quantities · As-built 2026-11
| Item | Quantity |
|---|---|
| SQLite tablesunique CREATE TABLE IF NOT EXISTS in src, origin/main | 24 |
| Scheduled jobsgit show origin/main:src/scheduler.py | grep -cE '^ scheduler\.add_job' | 9 |
Detail 1:1
The ten-month rule: the latest monthly close against the mean of the last ten. Fewer than ten months, or one close that is no price, and the answer is unknown, never "below".
def ten_month_trend(monthly: list[float]) -> str | None: """Faber: the latest monthly close against the mean of the last ten. None with fewer than ten months, or with a close that is no price (NaN, 0): unknown, never "below".""" if len(monthly) < TEN_MONTHS: return None window = monthly[-TEN_MONTHS:] if not all(math.isfinite(v) and v > 0 for v in window): return None return "above" if window[-1] > sum(window) / len(window) else "below"