Build Notes

What's Under The Hood

A written record of how Aftershock is built, and why it was built this way. Every decision below shaped a specific failure mode we hit and fixed.

01

The Stack

A Python event-study engine using pandas and yfinance does the measurement. Supabase PostgreSQL stores every event, every measurement, and every precedent. GitHub Actions runs the pipeline unattended on a schedule. The Anthropic API handles event detection and precedent research. A React frontend reads directly from the database. There is no application server to maintain, no queue, no cache to invalidate.

02

Why The Information Date Matters

This is the single most consequential decision in the engine. When we measured the Strait of Hormuz closure, the obvious anchor was the day Iran officially announced it. That is the date in every news archive. It was wrong. Markets had already repriced days earlier, when the strikes began.

Moving the anchor to the information date, the first day markets could plausibly have known, flipped the results entirely. Sectors recorded as unaffected turned out to have moved significantly. Sectors that appeared to react had not. In event studies the hardest question is not what you measure. It is when you start measuring.

03

Why Precedents Get Rejected

When the system researches a historical precedent, it measures it with the same engine that measures live events, then tests whether the result holds up. If an oil supply shock produced falling oil prices, either the date is wrong or something else dominated that window.

Those precedents are discarded rather than published. A precedent that fails its own measurement is not evidence. The rejected count is reported honestly on the homepage.

04

Why Detection Runs On A Schedule

Detection could run on demand, triggered by a user. It does not. Measuring an event takes minutes, the API costs money, and a stranger clicking refresh repeatedly would burn credits for no benefit.

The pipeline runs on a cron schedule, writes to the database, and the site reads from it. The frontend stays a static read layer. This makes the site cheap, fast, and predictable.

05

The Event Lifecycle

An event enters as Breaking. There is no market reaction to measure yet, so the report draws on measured historical precedents instead.

At ten days it becomes Developing and the snap window is measured. Significance is flagged provisional while the window is partial.

At thirty five days it becomes Settled and the full window is complete. Settled events then serve as precedents for future breaking events. The archive teaches itself.