THE BRAIN
A quantitative system that tracks live sports-betting markets in real time, spots mispriced odds, and acts on them automatically. It has a Python backend, a React control room, a large data pipeline, and an automated test suite that gates every change. I designed and built it end to end, using Claude Code and ChatGPT to move faster.
| What it is | An automated, real-time market-analysis and decision system that runs on my own machine |
| Stack | Python (~40 modules) · React / JSX control room · local market database · Kalshi API · Discord |
| Scale | ~50,600 lines of Python · ~9,500-line React app · 335 automated tests |
| My role | Designed, built, tested, and iterated the whole system |
| Built with | Claude Code and ChatGPT as coding collaborators |
| Status | Running locally actively developed |
| Note | A personal research project. Not investment advice. Most performance figures come from backtests and are labeled as such. |
Overview
The idea is simple. A betting market is made of many sportsbooks, and they don’t all update at the same speed. When the fast, professional books move and the rest of the market hasn’t caught up yet, there’s a brief, measurable gap between the current price and the “true” price.
THE BRAIN watches for that gap across about 30 books, decides whether it’s real, and places a bet with no human in the loop. Then it grades the result and retrains overnight. It’s a closed loop: collect data, decide, record, learn, repeat.
What makes it a real engineering project rather than a script is everything built around that loop to keep it honest — a full automated test suite, a permanent record that can’t be quietly edited, and a validation step that has to approve any change before it’s allowed to risk money.
How it works
Data flows one direction, from raw prices to a placed bet. Every step only uses information that existed at decision time, and if data is missing or stale the system stops instead of guessing.
↓
PRICE · strip the bookmaker margin, blend books into one fair price
↓
ANALYZE · read who’s moving the market + run an independent game model
↓
DECIDE · bet only when several signals agree (see below)
↓
EXECUTE · place the bet on the Kalshi exchange, fees included
↓
RECORD · write every decision to a permanent log
↓
LEARN · overnight: grade results, retrain, repeat
The system stays out of the market by default. It only bets when the fast books are leading, the wider market agrees on a price, and at least four of these six checks line up:
I didn’t hand-pick that rule. I found it by testing thousands of candidate rules, then confirmed it held up on data it had never seen and beat a “shuffled-data” test designed to show what pure luck could look like.
Engineering highlights
Most of the work is infrastructure. These are the parts that took real engineering, and the skills they map to:
- Real-time data pipeline. Collects and stores millions of price updates from ~30 sources, keeping only actual changes so the full history stays compact and can be replayed exactly.
- Statistical validation. Every proposed change is tested on data it wasn’t built on, and against a luck baseline, before it’s allowed to affect real money. This has repeatedly killed my own ideas that only looked good in hindsight.
- Automated testing. 335 checks run before any deploy. They confirm the system behaves correctly and that removed features stay removed, so nothing quietly creeps back.
- Safe execution. Bets are placed with exact fee accounting and reconciled against the account every night. Any unexplained gap halts trading automatically until I review it.
- Fail-safe by default. Missing, stale, or inconsistent data blocks a decision rather than triggering a guess.
The control room
The React control room is the cockpit. It shows every game the system is watching, a live market feed, a performance page, and the safety switches that decide whether it can place real bets. There’s also a chat panel where I can ask the system, in plain English, why it did or didn’t bet a game and get the real reasoning back — which turned out to be the fastest way to audit a decision.
Built with AI tools
This project is where my interest in AI reliability became a real tool instead of a study. I worked as the architect: I decided what to build, defined how it should behave, and wrote the tests. Claude Code did most of the implementation inside the codebase and ran the test suite. ChatGPT was a thinking partner for the design and the math.
What stayed with me is the judgment — the overall design, every decision about risking money, and the discipline to throw out my own ideas when the data proved them wrong.
How it evolved
I built THE BRAIN across 115 versions. Each one was an experiment that either survived contact with reality or got cut. The through-line is a steady move from “trust my model” to “trust the measured market, and prove everything.”
A basic model-vs-market bet with a permanent decision log and strict “stop if the data is bad” rules.
The market became the anchor instead of my model, after I proved the model lost money on its own.
A proper testing and validation layer that any new rule has to pass before it can risk money.
One clear, validated betting rule, plus a deeper market-reading engine that feeds the next one.
Honest about results
The engineering I’m confident in. The profits I’m careful about, on purpose.
The record looks strong, but most of it comes from replaying the strategy on past data, which is not a promise about the future. The real-money sample is small, the stake is tiny by design, and one sport (baseball) does most of the work right now. The control room shows these limits plainly — real bets and backtested ones are always labeled separately — because a system that flatters its own record is worse than useless.
The point of the project was never the betting. It’s the engineering around it: a real-time data system, careful statistical testing, honest record-keeping, and a workflow that gets the most out of AI coding tools.