Python sports betting toolbox.
Project description
sports-betting
Category | Tools |
---|---|
Development | |
Package | |
Documentation | |
Communication |
Introduction
Python sports betting toolbox.
The sports-betting
package is a collection of tools that makes it easy to create machine learning models for sports betting and
evaluate their performance. It is compatible with scikit-learn.
Installation
For user installation, sports-betting
is currently available on the PyPi's repository, and you can install it via pip
:
pip install sports-betting
Development installation requires to clone the repository and then use PDM to install the project as well as the main and development dependencies:
git clone https://github.com/georgedouzas/sports-betting.git
cd sports-betting
pdm install
Usage
API
The sports-betting
package makes it easy to download sports betting data:
from sportsbet.datasets import SoccerDataLoader
dataloader = SoccerDataLoader(param_grid={'league': ['Italy'], 'year': [2020]})
X_train, Y_train, O_train = dataloader.extract_train_data(odds_type='market_maximum', drop_na_thres=1.0)
X_fix, Y_fix, O_fix = dataloader.extract_fixtures_data()
X_train
are the historical/training data and X_fix
are the test/fixtures data. The historical data can be used to backtest the
performance of a bettor model:
from sportsbet.evaluation import ClassifierBettor
from sklearn.dummy import DummyClassifier
bettor = ClassifierBettor(DummyClassifier())
bettor.backtest(X_train, Y_train, O_train)
We can use the trained bettor model to predict the value bets using the fixtures data:
bettor.bet(X_fix, O_fix)
CLI
The command sportsbet
provides various sub-commands to download data and predict the value bets. For any sub-command you may
add the --help
flag to get more information about its usage.
Dataloader
Show available sports names:
sportsbet dataloader names
Show available parameters for dataloaders:
sportsbet dataloader params --name soccer
Select some of the above parameters and create a dataloader:
sportsbet dataloader create --name soccer --dataloader-path /path/dataloader.pkl --param-grid "league: Italy, Spain | year: 2021, 2022" --param-grid "league: Greece"
Show available odds types for the above dataloader:
sportsbet dataloader odds-types --dataloader-path /path/dataloader.pkl
Show and export training data:
sportsbet dataloader training --odds-type bet365 --drop-na-thres 1.0 --dataloader-path /path/dataloader.pkl --data-path /another/path/directory
Show and export fixtures data:
sportsbet dataloader fixtures --dataloader-path /path/dataloader.pkl --data-path /another/path/directory
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
Hashes for sports_betting-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbb48a4eb905c72867271e7d0515cd70f5695dbbbf3ec41525af8428437f3460 |
|
MD5 | 65343f73d21631a3f5c1d8eba0161d89 |
|
BLAKE2b-256 | 57e6cd5705d413ffb2972114c606a3a8d7380e3dbf6bb20031d515949f7bb665 |