Collection of sports betting AI tools.
[scikit-learn]: [black badge]: [black]: [docformatter badge]: [docformatter]: [ruff badge]: [ruff]: [mypy badge]: [mypy]: [mkdocs badge]: [mkdocs]: [safety badge]: [safety]: [bandit badge]: [bandit]: [pytest badge]: [pytest]: [coverage badge]: [coverage]: [interrogate badge]: [interrogate]: [pre-commit badge]: [pre-commit]: [nox badge]: [nox]: [version badge]: [pythonversion badge]: [downloads badge]: [discussions]: [discussions badge]: [ci]: [ci badge]: [doc]: [doc badge]:
[![ci][ci badge]][ci] [![doc][doc badge]][doc]
| Category | Tools |
|---|---|
| Development | [![black][black badge]][black] [![ruff][ruff badge]][ruff] [![mypy][mypy badge]][mypy] [![docformatter][docformatter badge]][docformatter] |
| Testing | [![pytest][pytest badge]][pytest] [![coverage][coverage badge]][coverage] [![interrogate][interrogate badge]][interrogate] |
| Security | [![safety][safety badge]][safety] [![bandit][bandit badge]][bandit] |
| Automation | [![nox][nox badge]][nox] [![pre-commit][pre-commit badge]][pre-commit] |
| Package | ![version][version badge] ![pythonversion][pythonversion badge] ![downloads][downloads badge] |
| Documentation | [![mkdocs][mkdocs badge]][mkdocs] |
| Communication | [![discussions][discussions badge]][discussions] |
sports-betting is a set of tools for building, testing, and using sports betting models. You can use it from an AI
agent, from Python, or from the command line.
The library has two main parts, dataloaders and bettors.
A bettor finds value bets. The execution part places one of them. It takes a fitted bettor, one match, and a stake. It watches the match. At the moment the model was fitted for, it places the bet once. Some bookmakers have a betting API, and the library places the bet through the API. Other bookmakers have no API, so your agent drives their website on your own account. You place the bet at a bookmaker where you hold an account. This spends real money.
sports-betting is on PyPI. Install it with pip.
pip install sports-bettingThe MCP server lets you drive the library from an AI agent. Install it with the mcp extra.
pip install 'sports-betting[mcp]'Execution places bets. It also drives a bookmaker's website, which needs a browser. Install the extras, then install the browser.
pip install 'sports-betting[mcp,execution]'
python -m playwright install chromiumFor development, clone the repository and install the project with PDM. This installs the main and development dependencies.
git clone https://github.com/georgedouzas/sports-betting.git
cd sports-betting
pdm installThe agent is a first-class way to use the library. It reaches everything that Python and the command line reach. It also does more. It explores the data, builds tables, plots results, and writes the model. A betting model is a scikit-learn estimator. An agent can write one, run it, and tell you how well it did.
Install the MCP server and register it with your agent.
pip install 'sports-betting[mcp]'
claude mcp add sportsbet -- sportsbet-mcpYou can then ask the agent to work through a full task. A typical session runs in these steps.
The agent names the environment variable that holds your API key. It never prints the key. Extracting the data downloads it, so a paid odds feed spends money only when you extract. Extract once and save the dataloader instead of extracting again. Driving a bookmaker's website on your account breaches most bookmakers' terms of service and risks the account and its balance.
You can do the same work in code. You build a dataloader from a statistics source and an odds source.
from sportsbet.dataloaders import DataLoader
from sportsbet.sources import FootballDataOdds, FootballDataStats
dataloader = DataLoader(
param_grid={'league': ['Germany', 'Italy', 'France'], 'division': [1, 2], 'year': [2021, 2022, 2023, 2024]},
stats=FootballDataStats(),
odds=FootballDataOdds(),
)
X_train, Y_train, O_train = dataloader.extract_train_data(odds_type='market_maximum')
X_fix, _, O_fix = dataloader.extract_fixtures_data()A betting model is any scikit-learn estimator wrapped in a bettor. The next example backtests a bettor that wraps a logistic regression classifier.
……Fit it with bettor.fit(X_train, Y_train, O_train), then bettor.bet(X_fix, O_fix) returns the value bets of the
upcoming matches.
extract_fixtures_data downloads the fixtures separately and returns the upcoming betting events. The training data and
the fixtures data share their columns, so the model trained on the history can bet on the fixtures.
The command line mirrors the API. The dataloader command extracts the data. The evaluation command works a model on
it. dataloader train extract downloads the seasons once and saves the dataloader. The evaluation commands read that
file, so the download runs once and the training runs once.
…The last command prints the value bets of the upcoming matches. --stats and --odds say where the data comes from.
dataloader train extract downloads it. The ready-made models cover the common cases. You can also write your own model
in a Python file and name it, as in --model models.py:bettor, where bettor is the object below.
…No open issues yet, or sync has not completed.