moneyball
A library for determining what bets to make.
Dependencies 🌐
Python 3.11.6:
- pandas
- numpy
- optuna
- pytz
- python-dateutil
- sportsball
- tqdm
- pandarallel
- joblib
- matplotlib
- pyfolio-reloaded
- fullmonte
- wavetrainer
- riskfolio
- sports-features
- empyrical-reloaded
- textfeats
Raison D'être 💭
moneyball was split out of the library sportsball in order to iterate separately on the quantitative strategies and the data powering them. It aims to be an automated way to come up with an optimal betting strategy when supplied with data in a sportsball format.
Architecture 📐
moneyball is an object orientated library. The entities are organised like so:
- Portfolio: A collection of strategies.
- Strategy: A method to determine what specific bet to make according.
- Features: The features extracted from the data.
- Reducers: The features removed from the data.
- Trainers: The type of models used for training on the data.
- Weights: Weight strategies to apply to the data.
- Strategy: A method to determine what specific bet to make according.
Installation 📥
This is a python package hosted on pypi, so to install simply run the following command:
pip install moneyball
or install using this local repository:
python setup.py install --old-and-unmanageable
Usage example 👀
There are many different ways of using moneyball, but we generally recommend the CLI. This pairs very well with the sister project sportsball.
CLI
The following operations can be run on the CLI:
Train
To train a new strategy:
sportsball --league=nfl - | moneyball test_nfl_strategy train
Portfolio
To develop a portfolio of strategies:
moneyball --strategy=test_nfl_strategy --strategy=test_afl_strategy test_portfolio portfolio
Next
To get a quantitative report on the next bets to place:
moneyball --output=bets.json test_portfolio next
This will result in the following JSON written to stdout:
{
"bets": [{
"strategy": "test_nfl_strategy",
"league": "nfl",
"kelly": 0.32,
"weight": 0.1,
"probability": 0.95,
"teams": [{
"name": "giants",
"probability": 0.1
}, {
"name": "dolphins",
"probability": 0.9
}],
"dt": "2025-01-23T16:03:46Z"
}]
}
Python
To create a portfolio, the following example can be used:
from moneyball import moneyball as mnb
df = ... # Fetch the dataframe from sportsball
moneyball = mnb.Moneyball()
strategy = moneyball.create_strategy(df, "test_strategy")
strategy.fit()
portfolio = ball.create_portfolio([strategy], "test_portfolio")
returns = portfolio.fit()
portfolio.render(returns)
License 📝
The project is available under the MIT License.
Metadata
Release files for moneyball 0.0.253
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| moneyball-0.0.253.tar.gz | 37.9 kB | Without provenance | Details |
Release files / moneyball-0.0.253.tar.gz
| Download URL | moneyball-0.0.253.tar.gz |
|---|---|
| Size | 37.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a2e796f034ec3c2e96387a66730344b38100ebfeac759e01f7c035d1b52384b
|
|
BLAKE2b-256 checksum How to use checksums |
42929478b11f31b13b072fe7737b19a359e519056295ccbf4e0e515aeaba8c8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Security for moneyball 0.0.253
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.