As a live stream
Ten years of daily prices and pageviews are replayed through Kafka into Spark Structured Streaming, which flags abnormal days and closes each event’s window the moment its last day arrives.
As a batch study
A classic event study computes the same numbers from whole arrays at once, then tests them for significance. It is the answer key the stream must match.
With a model
A Spark MLlib model, trained on the stream’s own output, scores which retailers are likely to make a big move tomorrow, live.
On screen
One Streamlit dashboard, on a laptop and hosted, showing live runs from a laptop or GitHub’s servers; the dataset and model are on Hugging Face.
How to read these docs
1
Run it
Run it has every command, in the order you would use them: setting up, reproducing the results, refreshing what is published, and the live demo.
2
Take the tour
The Guide tab has ten chapters in reading order. Each explains one stage in plain words, shows its diagram, lists its files in the order to read them, and ends with questions you should be able to answer and ideas to improve it.
3
Open the code
The Code tab has one page per file, in the same order: what the file does (its docstring), what is inside it with line numbers, what it uses and what uses it, and the full source.
4
Look things up
Data and decisions has every dataset’s columns (the data contracts), every design decision with its reasons, and every architecture diagram. Project log has who is doing what, and a note for every piece of work done.
5
Ask questions
The site has a search box, and an MCP server so Claude, Cursor or ChatGPT can answer questions from it. See Ask questions about the code.
One stock-day, start to finish
Follow a single row: Walmart on Black Friday 2024.- Config says Walmart is a store retailer, its Wikipedia article is
Walmart, and Black Friday is the day after the fourth Thursday of November (chapter 2). - ETL downloads Walmart’s prices and pageviews, cleans them, and joins them into one row of
clean/master.parquet: the return that day, the volume ratio, the views, and the event name (chapter 3). - The replay sends that row to Kafka as JSON, one trading day at a time, as if 2024 were happening live, with a few rows deliberately late (chapter 4).
- The streaming job pairs it with the market’s return that day, compares Walmart’s move with what its market model expected (the abnormal return), compares its views with their recent level (an attention spike?), and opens Black Friday’s event window. Five trading days later it closes the window and writes its CAR, the sum of the abnormal returns over days −5 to +5 (chapter 5).
- The batch study computes the same CAR another way, and the statistics say whether Black Friday CARs differ from zero across all retailers and years (chapter 6).
- The comparison checks the two CARs are equal (chapter 7).
- The model scores how likely Walmart is to make a big move the next day (chapter 8), and the dashboard shows all of it as it happens (chapter 9).
- The tests guard every step above, before every commit (chapter 10).
These docs are built from the code by
scripts/build_docs.py, and a test refuses any commit that leaves them out of date. Every page in the Code tab is therefore the code as it is now.