Five stages, looped so the system can learn from itself.
A scheduler wakes the agent every 60 seconds. Cheap deterministic work runs every tick; the one LLM decision cycle runs roughly every 15 minutes. What comes back from Learn feeds forward into Think through calibration and attribution — the size the next trade is allowed depends on how honestly the last ones were explained.
Sense
Prices, positions, news, odds, technicals.
every 60s · no LLM
Think
Form a falsifiable view; price ≥2 ways to express it.
~15 min · LLM + arithmetic
Act
Place the multi-leg order, verify against broker truth.
Alpaca MCP
Learn
Guard the position deterministically; judge it honestly.
every 60s · no LLM
Remember
Route what was learned to the store shaped to hold it.
four stores
Prefer to explore it? The Trdrbot Loop is the same system as a clickable diagram, with one real trade stepped through end to end.
Three independent ways to have an idea — then one narrow job for the model.
research
Daily, top-down. Technicals + news + prediction-market odds → a regime page and company dossiers → falsifiable opportunities.
discovery
Bottom-up. The news nominates the companies. Every nominee must clear a deterministic gauntlet — technicals, forecast, fundamentals, options liquidity — before an LLM writes anything up.
the muse
Creative collision. Random wiki concepts × news × odds, argued into domino chains, every candidate pre-registered and adversarially gated. The top two graduate.
- A falsifiable thesis — a claim with a date and a level
- At least two structurally different ways to express it
- An honest probability, and a vol view if the trade is about vol
simulate_experimentsprices every candidate under one declared measure — the thesis's own drift and vol, market pricing shown beside itsize_positioncomputes Kelly from the conditional payoff and shrinks the claim by measured calibration- A no-op is a logged, legitimate answer. Theo declines far more often than it trades.
Place the order, then double-check it against the broker.
- The model authors every tool argument. A guard rewrites the order id before it leaves — without it, idempotency is whatever the model invented.
- Risk is repriced from the fill, not the model's word. Every book cap
sums
max_loss_usd; if that came from a model and never met a fill, every later cap is denominated in fiction. - A whole-book close is refused above one open position, and an orphan found at the broker is adopted into the managed set rather than just logged.
| class | mleg — one ticket, both legs |
| type | limit, net debit, day |
| id | client_order_id, derived deterministically |
Every position traces back to its reasoning through one position_id — journal, wiki, memory, and back to the broker.
Guard the position without consulting the agent. Then judge it honestly.
Exit rules are the agent's own commitments, executed deterministically. One signal registry: every rule reads a signal, compares to a threshold, debounces. Thesis-level stops watch the underlying, not the noisy option mark.
Attribution asks the two questions once the horizon named in the thesis passes. A profit on a wrong view is recorded as luck and teaches nothing. Calibration then scores every stated probability with a Brier score and its Murphy decomposition.
Attribution is deliberately expensive to earn: promotion past the second rung requires that most resolved theses were actually explicable. A book of luck is not competence, however good the P&L looks.
Four stores, one for each kind of knowledge.
journal
Append-only events. What happened, when, and which model said so. Never rewritten.
wiki
Stable reference that rewrites itself: position pages, company dossiers, the regime page.
elfmem
Evolving memory with decay and reinforcement — credited by verdict, never by raw P&L.
ledger
Every falsifiable claim ever made, traded or not — the trial count a multiple-testing correction needs.
The ledger is the quiet one that matters most. Forecasts on setups declined are scored too, at zero capital risk — the only realistic route to a calibration sample that means anything inside a week.
How Alpaca is used — and three things that were harder than they look.
MCP, one session per tick
Alpaca's MCP server runs as a local stdio subprocess. The adapter's default spawns a fresh process per tool call — six calls cost 12.3s. Sharing one session across the tick cut it to 2.75s.
−78% wall clock, measured
Real multi-leg options orders
Verticals go as mleg tickets with per-leg position_intent. Calendars and diagonals are refused,
not approximated — pricing the far leg needs a model this deliberately does not have.
a confident wrong payoff is worse than a refusal
Only 19 of 72 tools bound
Binding all 72 MCP tools cost ~21k tokens of schema per call, 71% of it for tools never used once — and a bigger menu measurably worsens tool selection.
$3.46 → $1.32 per decide cycle
The lesson that generalises. All three of those had already shipped as
code that ran and did nothing — each looked healthy in the logs. That is why trdrbot health exists and asks a different question from the tests: "you ran, but did you produce anything?"
Risk & sizing.
Kelly on the conditional payoff, the calibration shrink, the three caps, and the two rules the agent cannot override.
Read the risk modelThe Coach.
Subsystems that improve themselves — paired A/B trials on the muse's prompt, promoted only on real evidence.
Open the live reportEvery decision.
Trades, declines and resolved forecasts, newest first, in the agent's own words.
Open the ledger