elo-system
An Elo rating system for fantasy sports leagues. It scrapes weekly scoreboards from a fantasy platform, converts them into per-week Elo ratings, and supports multi-season dynasty ratings with an offseason regression-to-mean adjustment.
- Platforms: Fantrax (NBA, head-to-head categories) and Sleeper (NFL,
head-to-head points). Sleeper needs its optional extra:
pip install -e .[sleeper]. - Scoring: football is rated against the league median by default
(
scoring: median), so a team's week stands or falls on its own score rather than on who it was scheduled against;scoring: defaultrates each matchup head to head on the two teams' share of the points instead. - Outputs: per-season and combined-dynasty rating frames, written to CSV or
published to a Postgres star schema. Either backend can serve as the reader
or the writer, and the two round-trip to the same frames. The schema keeps a
person (
dim_manager) separate from the accounts they play under (dim_manager_platform), so one manager can be in several leagues, on several Discord servers, across more than one platform.
Installation
The project depends on a fork of fantraxapi (the PyPI release is broken for
H2H-rotisserie leagues), so it installs from source rather than from PyPI:
python -m venv .venv
source .venv/bin/activate
pip install -e . # add [dev] for the test/lint tooling
requirements.frozen holds the exact, reproducible dependency pins (including
the fantraxapi fork commit) used during development.
Layout
elo_system/
elo_system.py EloSystem orchestrator (config + reader/writer wiring)
tools/
elo_league.py EloLeague: season management + run/dynasty pipeline
elo_data.py EloCSV / EloSQL persistence backends
basics/ LeagueBase/DataBase, Elo math, config IO, constants
helpers/ scraper, league, formatter, calculator, frame_manager
Configuration
resources/configs/ holds one shared config for each backend and one ratings
config per league:
resources/configs/
sys_config.yml reader/writer, and the ratings config of each league
csv_config.yml shared: where CSV frames are written
sql_config.yml shared: the Postgres connection
ratings_macho_mandarins.yml one league
ratings_die_nasty.yml another
sys_config.yml names the leagues, and one EloSystem drives one of them:
ratings_configs:
macho_mandarins: ratings_macho_mandarins.yml
die_nasty: ratings_die_nasty.yml
default_league: macho_mandarins
EloSystem('resources/configs/sys_config.yml') # default_league
EloSystem('resources/configs/sys_config.yml', 'die_nasty') # a named league
Each league's CSV frames go in their own subdirectory of the CSV config's
write_loc, named for the league key, since the frames are named by season
alone and would otherwise collide:
resources/ratings/
macho_mandarins/2024_season_elo.csv ... dynasty_elo.csv
die_nasty/2022_season_elo.csv ... dynasty_elo.csv
Override one league's subdirectory with ratings_dir in its ratings config.
Tests
python -m pytest # run from the repo root
See CONTRIBUTING.md for development notes and conventions, and CHANGELOG.md for release history.
Metadata
Release files for elo-system 2.0.3
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 | Actions |
|---|---|---|---|---|
| elo_system-2.0.3.tar.gz | 117.3 kB | Without provenance | Details for elo_system-2.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elo_system-2.0.3-py3-none-any.whl | Python 3 | none | any | Details for elo_system-2.0.3-py3-none-any.whl |
Total release size: 198.3 kB
Release files / elo_system-2.0.3.tar.gz
| Download URL | elo_system-2.0.3.tar.gz |
|---|---|
| Size | 117.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d2c118cdae43890b155d64ab141f6c54095d50e19793ebbbc0afa0af387d7b0
|
|
BLAKE2b-256 checksum How to use checksums |
02bd92121722be3b17768304e5a38e15b56a1272ec14d5481e06acc965c17025
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / elo_system-2.0.3-py3-none-any.whl
| Download URL | elo_system-2.0.3-py3-none-any.whl |
|---|---|
| Size | 81.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
396e13dac1527752a7f9574aa22096be1af92c7d0b408beb60b48a5e90aa5007
|
|
BLAKE2b-256 checksum How to use checksums |
d27cf2302e5862c0e7a5afdde3c4fe106e974bad552ed1b912d68ac45e3f1fb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for elo-system 2.0.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.