QuantLib for sports betting — open-source quantitative analysis toolkit
Project description
Quant-Sports — Quantitative Sports Betting Toolkit
Mathematical toolkit for sports betting. Bring your own data.
Quant-Sports is a professional-grade quantitative analysis toolkit designed for analysts, not tipsters. Think of it as "QuantLib for sports betting"—it provides the rigorous mathematical infrastructure needed to translate raw odds and statistics into actionable, risk-adjusted betting signals.
Quick Start
# 1. Install the desktop package
uv add quantitative_sports[notebook]
# 2. Start the storage layer
cd ~/Projects/Infrastructure/quantitative_sports
make docker-up
# 3. Open a notebook
uv run jupyter lab labs/01_getting_started.ipynb
Architecture
Quant-Sports v0.2.0 is decoupled into three primary layers to ensure scalability and separation of concerns:
+-----------------------+ +-------------------------------------------+
| Desktop Package | | Docker Compose Stack |
| (CLI, Library, Labs) | | (timescaledb + poller + web dashboard) |
+-----------+-----------+ +-------------------+-----------------------+
| |
| Data Flow |
| [ Poller ] ----> [ TimescaleDB ] <---+
| | |
+-------+----------------+
|
v
[ Notebooks / CLI / Web UI ]
- Desktop Package: The core Python library providing the math, models, and CLI.
- Infrastructure Stack:
timescaledb: High-performance time-series storage (PG 18 + TimescaleDB 2.28).quant-sports/poller: Background container for data collection (Odds API, ESPN).quant-sports/web: Operations dashboard for health monitoring and metrics.
- Data Flow: The poller fetches live data $\rightarrow$ writes to TimescaleDB $\rightarrow$ consumed by the web dashboard and your analytical notebooks.
Features
🧮 Betting Mathematics
- Expected Value (EV): Precise calculation including implied probability and vig removal.
- Kelly Criterion: Full and fractional Kelly sizing for optimal bankroll growth.
- Middling Detection: Automatic identification of multi-book spread/total middles.
📈 Predictive Modeling
- NFL Game Prediction: XGBoost ensemble for win probability, spreads, and totals.
- Ratings Systems: Implementation of Elo, Massey, PageRank, and Glicko systems.
- Custom Strategies: Extensible registry to define, backtest, and deploy your own logic.
⚙️ Infrastructure & Ops
- Backtesting Engine: Professional walk-forward validation and parallel execution.
- Live Data: Integrated polling for Odds API and ESPN injury reports.
- Web Ops Dashboard: Monitor poller health, run history, log tailing, and system metrics.
Package Layout
quantitative_sports/
├── core/ # Betting math (EV, Kelly, middling, metrics)
├── models/ # XGBoost, ratings, predictive models
├── backtest/ # Backtest engine
├── data/ # Data sources (Odds API, ESPN, nflverse)
├── infra/
│ ├── db/ # TimescaleDB connection, schema, queries, writers
│ └── poller/ # Background data fetcher
├── web/ # FastAPI ops dashboard
└── cli/ # Click commands
labs/ # 10 comprehensive Jupyter walkthroughs
docker/
├── Dockerfile.poller
├── Dockerfile.web
└── init-db.sql # TimescaleDB schema
docker-compose.yml # timescaledb + poller + web
Running
Installation
uv add quantitative_sports[notebook]
Usage
# Run a CLI command
quantitative_sports nfl predict-game
# Start the docker stack (DB, Poller, Web)
make docker-up
# Run tests
make test
Configuration
cp .env.example .env
# Edit .env with your Odds API key
# Then: make docker-up
Disclaimer
Quant-Sports is a mathematical toolkit provided for analytical purposes only. It does not provide betting advice or guaranteed returns. You are solely responsible for compliance with your local laws and regulations regarding sports wagering.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantitative_sports-0.2.0.tar.gz.
File metadata
- Download URL: quantitative_sports-0.2.0.tar.gz
- Upload date:
- Size: 768.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd626f242a7cb98980cf7e83feb37f18101479471aa37fc35b5cfe7c48baa68d
|
|
| MD5 |
0ec7a47f12f6d2262a1987df28ab3c66
|
|
| BLAKE2b-256 |
4807b4d5d09fcea0f4e910751821b1dfbe1c0869f9ba0032199b9dded809a9b7
|
Provenance
The following attestation bundles were made for quantitative_sports-0.2.0.tar.gz:
Publisher:
release.yml on Veedubin/quantitative-sports
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantitative_sports-0.2.0.tar.gz -
Subject digest:
fd626f242a7cb98980cf7e83feb37f18101479471aa37fc35b5cfe7c48baa68d - Sigstore transparency entry: 1899013318
- Sigstore integration time:
-
Permalink:
Veedubin/quantitative-sports@e48ccee493f1730a6623c392c612554da2da4d9d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Veedubin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e48ccee493f1730a6623c392c612554da2da4d9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file quantitative_sports-0.2.0-py3-none-any.whl.
File metadata
- Download URL: quantitative_sports-0.2.0-py3-none-any.whl
- Upload date:
- Size: 538.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ff663de77954d5d15046dd26317ee8593be43c0f89b3bd6d308dfe833b466af
|
|
| MD5 |
3fd70aa5997c2235b8d6dd1db4d5378d
|
|
| BLAKE2b-256 |
edf12377fc99fc2f4ef8a6ddc5737757d998a4c0f188ab9ab57b18bf0c6a64ef
|
Provenance
The following attestation bundles were made for quantitative_sports-0.2.0-py3-none-any.whl:
Publisher:
release.yml on Veedubin/quantitative-sports
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantitative_sports-0.2.0-py3-none-any.whl -
Subject digest:
1ff663de77954d5d15046dd26317ee8593be43c0f89b3bd6d308dfe833b466af - Sigstore transparency entry: 1899013547
- Sigstore integration time:
-
Permalink:
Veedubin/quantitative-sports@e48ccee493f1730a6623c392c612554da2da4d9d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Veedubin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e48ccee493f1730a6623c392c612554da2da4d9d -
Trigger Event:
push
-
Statement type: