A Claude plugin (Cowork or Claude Code) for building, validating, and operating quant-trading strategies on prediction markets. Nine skills covering the full loop from idea to live trading, plus runnable Python behind them.
Distilled from seven weeks of running a Kalshi weather-market bot with real money, 483 settled trades. The GEO demo repo is the concrete bot this toolkit was abstracted from. This repo is the venue-agnostic framework: bring your own model and your own exchange.
| Skill | Use when you need to… |
|---|---|
kelly-sizer |
Compute optimal bet size with fractional Kelly, edge discount, and caps |
calibration-audit |
Check whether your model's "70% confident" actually comes true 70% of the time |
backtest-runner |
Run a walk-forward historical simulation with honest execution assumptions |
maker-pricing |
Quote one tick inside the spread to capture the maker-fee tier |
pnl-attribution |
Slice realized P&L by side, price bucket, edge, and cohort to find leaks |
pre-flight-checklist |
Run the 10-item safety check before flipping to live trading |
emos-bias-correction |
Fit Platt scaling / EMOS to correct systematic forecast bias |
market-scanner |
Surface candidate trades from open markets with a stacked filter pipeline |
drawdown-monitor |
Track running drawdown and trigger warn / de-risk / halt at configured levels |
Each skill ships with:
- A
SKILL.mdthat Claude reads when you ask about the topic. It guides reasoning, surfaces failure modes, and tells Claude how to respond. - A runnable Python script under
scripts/: drop-in helpers you can call from your strategy code or run as one-off CLIs. The pre-flight checklist is the one exception, since it is procedure rather than math.
Most retail quant tutorials stop at "here's the Kelly formula" or "here's how to run a backtest." That's the easy half. The hard half, the half this toolkit is built around, is everything that goes wrong between the formula and a live, sized order:
- A model that looks well-calibrated on average is wildly miscalibrated on one side (YES vs NO, favorite vs longshot).
- A backtest that ignores maker-vs-taker fees overstates ROI by 5–15 percentage points.
- Sizing at full Kelly when your edge estimate is even slightly wrong drives the bankroll to zero faster than you can react.
- A pre-flight checklist sounds like overkill until the day two processes acquire the same lock and place duplicate live trades.
Each of the nine skills here exists because of a specific incident or a specific paper that re-shaped how the underlying bot decided things. Where relevant, the SKILL.md cites the source.
Once installed, the skills load automatically when you ask Claude relevant questions:
- "How much should I bet on this trade?" → triggers
kelly-sizer. - "Is my model calibrated?" → triggers
calibration-audit. - "Run a backtest on this strategy" → triggers
backtest-runner. - "Where am I losing money?" → triggers
pnl-attribution. - "I'm about to go live, run pre-flight" → triggers
pre-flight-checklist.
You can also reach the scripts directly if you'd rather work in code:
python skills/kelly-sizer/scripts/kelly.py --p 0.62 --price 0.48 --bankroll 1000
python skills/calibration-audit/scripts/calibration_audit.py --csv predictions.csv
python skills/pnl-attribution/scripts/attribute.py --db trades.sqlite --since 2026-01-01The first of those, a 62% model against a 48-cent contract on a $1,000 bankroll, prints this:
Raw Kelly fraction: +0.2692
After edge discount: +0.2308
After 0.25 multiplier: +0.0577
Final fraction (post-caps): +0.0200
Dollar stake: $19.68
Contract count: 41
Binding constraint: per-trade cap
Full Kelly says 27% of the bankroll. The sizer says $19.68, and tells you which rule did it.
- A model that produces a probability for each contract you might trade. The plugin doesn't include a model. Bring your own.
- An exchange to trade on (the plugin is venue-agnostic; see
CONNECTORS.md). - A trade ledger (CSV or SQLite) for the attribution and drawdown skills.
- Fractional Kelly only. Full Kelly is the wrong default for retail bankrolls. The sizer recommends ¼ Kelly and pushes back if you ask for more.
- Honest backtests. Walk-forward by default; no look-ahead; explicit fill-probability assumption; report n and confidence intervals.
- Asymmetric calibration. Audit YES and NO sides separately. Most models are systematically biased on one side.
- Pre-flight every launch. The 10-item checklist is the difference between a clean rollout and an incident.
- Halt before deeper losses. Drawdown monitor halts at 20% by default; this is conservative, not optional.
- Not a trading bot. It's a toolkit. You write the strategy; this plugin gives you the math and the discipline.
- Not a model. Calibration tools can correct bias in your model's output, but the underlying signal has to be yours.
- Not financial advice. Trading prediction markets is risky. Use at your own risk.
git clone https://github.com/apeabody007/Quant-toolkit.git
claude --plugin-dir ./Quant-toolkitIn Cowork, add the cloned directory as a plugin instead. Either way Claude scans the skills and loads them on demand.
python3 -m unittest discover -s tests -v66 cases over the maths, standard library only, nothing to install. They cover the Kelly fraction and every guardrail that can bind a stake, the maker quote and the books it refuses to quote into, the Brier decomposition, the high-water mark and the drawdown verdict, and the Wilson interval behind the hit rates. CI runs them on Linux and macOS on every push, then checks that every script can still print its own help.
platt_fit.py is left out: it needs numpy and scipy, and the point of the
suite is that it runs anywhere with nothing installed.
- GEO: The Kalshi Weather Bot (demo), the live trading bot this toolkit was distilled from. Frozen snapshot for portfolio purposes; not actively developed in public.
MIT. See LICENSE.
The skills cite a working bibliography across Kelly criterion theory, calibration scoring rules, market microstructure, and weather forecasting (the original use case). Read any SKILL.md's References section for the relevant papers.