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
sports-betting
is currently available on the PyPi's repository, and you can install it via pip
:
pip install sports-betting
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.2.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65118e06edd569589cc9438571e06e77686f7d3770eb775a1b1e6c81274f0e55 |
|
MD5 | c917617f354338236566c6348f5a3b49 |
|
BLAKE2b-256 | 012fa79300170e95764bf8c005397b69138fe5d67ef88b3c6eff5d2531006414 |