Skip to content
← Trading engine

An agent in the loop

v5 · 18–24 Sep · An agent in the loop · see v6, the current engine →

I let a model back in with v5, but only after writing a rulebook for the engine, and only with one narrow job: look at the day’s standouts and, at most, place one paper trade through a tool it cannot widen.

Figure 01 · v5 · 18–24 September 2026

An agent with one narrow job

The agent can place one paper trade through a locked tool; code decides its size and whether it passes.

  • Data
  • Decision
  • Next-open fill
  • Score
Yahoo 5m + newsexact receiptsSEC · Alpacagated, not liveYahoo + NasdaqEOD · verifier1DUCKDB · ONE WRITERfactsas-of cutoffspricesrestated cachesim ledgerfills · cashhourly + 4-hour agentsobserve onlydaily agent02:00 UTC · five standouts2SWING ONLYlocked toolone trade, sized by code3paper league21 rule books + agent bookfillnext open onlyagent ledger1 · 5 · 10 · 20-day labels4forward monitorssector · XS · E1operating contractmaintain mode · budgetsSOURCESSTOREDECIDEPROVE
fig. 1 — v5. ① Yahoo's five-minute bars and headlines are kept as exact responses beside the daily prices; SEC and Alpaca adapters exist but stay off. ② At 02:00 UTC the daily agent reads point-in-time facts and assesses five standouts. ③ A swing needs one call to a locked tool; code sizes it, checks risk and places it in an isolated book that fills at the next open. ④ Every decision, including the observe-only intraday agents', lands in a ledger that labels it against a control.

The contract came first

After my 6 out of 10 review on 18 September, with the server code at about 46,000 lines, the engine got an operating contract: maintain mode, an admission test for new work, line budgets that the tests enforce, and short build-log entries. The repo went public the same day.

One trade, through a locked tool

Each night at 02:00 UTC the agent looks at five liquid standouts and marks each one ignore, watch, hold or swing. A swing is only a request. It has to go through one locked submit_paper_trade call, and deterministic code decides whether it passes and how big it is: a risk-on regime, a template pass, confidence of at least 0.65, no earnings within five days, no more than three positions, and a 10% position size. The book is isolated, holds US$10,000 of paper money and fills at the next open like every other book.

The first run on 21 September produced five assessments, two watches and one swing, which was not traded. The hourly and four-hour agents have no order path at all.

Scoring without fooling myself

Every decision is stored with its information cutoff, the exact model and prompt, and labels at one, five, ten and twenty days, next to a paired control. A replay of 2022 showed why that matters: the model picked XOM on all four dates and compounded +19.78%. That says more about what a model already knows about 2022 than about its judgement, so the replay is labelled contaminated and cannot promote anything.

The direction written on 24 September is an engine that runs on its own and makes money, with AI in the decision loop, and it names evidence time, not code, as the constraint. Until the agent has 60 sessions, 90 days and 20 trades behind it, I treat its results as a log, not as evidence.

dates
18–24 September 2026
rule books
21, unchanged
agent book
one isolated US$10k simulator book · first run 21 September
agent buy rules
risk-on · template pass · confidence ≥ 0.65 · no earnings within 5 days · ≤ 3 positions · 10 % size
observers
hourly and four-hour agents · no order authority
ledger labels
1, 5, 10 and 20 days after each decision
verdict gate
60 sessions, 90 days and 20 trades before any P8 verdict
gated sources
SEC EDGAR (probe refused) · Alpaca IEX (no credentials)
blocked
TradingView, under its terms at the time · Stooq

Ong Jun Xiong

SOFTWARE ENGINEER · SINGAPORE

ContactHobbiesArchiveNotesUI PackGitHubLinkedInSource

© 2026 Ong Jun Xiong