Skip to content
SH-02DDetail D

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.

Fig. 01 — From sources to a thesis and a stop
  1. 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.
  2. 2The model reads only the filing and the stored deal-breakers, never a price.
  3. 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

  1. 01By default, the AI tools run from an empty folder, so the project's instructions and memory are not loaded automatically.
  2. 02Every broken thesis is read again from an anonymised filing, to test reading against recall.
  3. 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, and the command that measured it.
ItemQuantity
SQLite tablesunique CREATE TABLE IF NOT EXISTS in src, origin/main24
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"
Detail 1:1 — src/guardian/protection.py, lines 262–270, as of 2026-10-20 (0abfeac).

Stack used

PythonpandasnumpyTA-LibAPSchedulerpython-telegram-botpydanticyfinanceClaude Code CLIGemini CLICodex CLISQLite
Detail DContact

Legend — the marks on these sheets

SH-xx
Sheet number. Every drawing in a set carries one, and the set is read in that order.
ESC 1:20
Scale. One unit on the drawing stands for twenty on the thing drawn.
DETAIL A/B/C
Detail callout. A lettered part of a drawing, enlarged on a sheet of its own.
SECTION C-C
Section mark. The line a cut is taken along, lettered at both ends.
BH-01
Borehole log. What a trial hole found, recorded downward by depth.
EOB
End of borehole. The depth at which the log stops.
REV. 2026
Revision. The issue a sheet belongs to; a later revision supersedes it.
As-built register
A table of what was actually built, set against what was drawn.

Press ? in the title block to open or close. Escape closes.