Fantasy football league simulation and optimization tool.
Project description
fantasyfb
Fantasy football league simulation and optimization toolkit. Pulls projections from nflverse data, syncs roster state from a Yahoo Fantasy league, and runs Monte Carlo season simulations to value pickups, trades, and draft picks.
Install
pip install fantasyfb
For local development:
git clone https://github.com/tefirman/fantasyfb.git
cd fantasyfb
pip install -e ".[dev]"
Python 3.10+ is required.
Quickstart
import fantasyfb as fb
league = fb.League(name="My Team")
schedule_sim, standings_sim = league.season_sims(postseason=True)
print(standings_sim[["team", "wins_avg", "playoffs", "winner"]])
fb.League(name=...) reads from the Yahoo Fantasy API, so you'll need
oauth2.json (and .env with CONSUMER_KEY / CONSUMER_SECRET) set
up alongside the script. See the
yahoo_oauth docs for a
walkthrough.
Command-line tools
After install, four entry points are on your PATH:
| Command | Source | Use |
|---|---|---|
fantasyfb |
fantasyfb.league:main |
Weekly projections + lineup analysis |
snake-draft |
fantasyfb.drafts.snake:main |
Live snake-draft cockpit |
salary-cap-draft |
fantasyfb.drafts.salary_cap:main |
Live salary-cap (auction) draft tool |
draft-prep |
fantasyfb.drafts.prep:main |
Pre-draft tiers / VORP / mocks |
# Weekly run for a team
fantasyfb --team "My Team" --sims 1000 --adds --drops
# Pre-draft analytics
draft-prep tiers --team "My Team"
draft-prep mock --team "My Team" --adp ADP.csv --my-pick 7 --sims 50
# Draft-day cockpit
snake-draft --team "My Team" --adp ADP.csv
salary-cap-draft --team "My Team"
Run any command with --help for the full option list.
Public API
from fantasyfb import (
League, # main entry point
FantasyScorer, # scoring rules -> points
MatchupModel, ProjectionEngineV2, # projection internals
LineupOptimizer,
SeasonSimulator, ScheduleManager,
NflreadpyProvider, # default data backend
)
Lower-level utilities live in submodules and can be imported directly:
from fantasyfb.drafts.tools import compute_vorp, assign_tiers, MockDraft
from fantasyfb.drafts.snake_cockpit import build_board, view_best
from fantasyfb.sim.backtest import run_backtest, evaluate
from fantasyfb.io.excel_exporter import FantasyExcelExporter
| Subpackage | Purpose |
|---|---|
fantasyfb.league |
Top-level League class |
fantasyfb.configs |
League / scoring presets |
fantasyfb.drafts |
Snake, salary-cap, prep, shared draft math |
fantasyfb.data |
Yahoo client + nflverse providers |
fantasyfb.scoring |
Scoring, lineup optimization, matchups |
fantasyfb.projections |
V1 / V2 projection engines, fitter |
fantasyfb.sim |
Season simulation, backtests, schedule |
fantasyfb.analysis |
WAR, move analysis |
fantasyfb.io |
Excel export |
Development
pip install -e ".[dev]"
pytest # full test suite
python -m build # produce sdist + wheel under dist/
The tests/ directory pulls a small slice of nflverse parquet data on
first run; subsequent runs are cached locally.
License
MIT. See LICENSE.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fantasyfb-0.3.0.tar.gz.
File metadata
- Download URL: fantasyfb-0.3.0.tar.gz
- Upload date:
- Size: 116.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd63df826639bcded299ed7d5210bc3b41203707e0e68cfc768de1d299f0d5c2
|
|
| MD5 |
2f678051073497a3ec5f88c47afdcfbb
|
|
| BLAKE2b-256 |
addc88449f7f6118827346abfc6ec3116c94eaddc965eb555a461ab191bb22e0
|
Provenance
The following attestation bundles were made for fantasyfb-0.3.0.tar.gz:
Publisher:
publish.yml on tefirman/fantasyfb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fantasyfb-0.3.0.tar.gz -
Subject digest:
dd63df826639bcded299ed7d5210bc3b41203707e0e68cfc768de1d299f0d5c2 - Sigstore transparency entry: 1516577740
- Sigstore integration time:
-
Permalink:
tefirman/fantasyfb@944e115cadf6f241082a3935e96c52c8c7496bc3 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/tefirman
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@944e115cadf6f241082a3935e96c52c8c7496bc3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fantasyfb-0.3.0-py3-none-any.whl.
File metadata
- Download URL: fantasyfb-0.3.0-py3-none-any.whl
- Upload date:
- Size: 102.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ff3147b21027d83504b5eab96becba7fc1439f667be2043b28cd2ae66d58841
|
|
| MD5 |
4b4961792fc777d812a0019e4b4537a7
|
|
| BLAKE2b-256 |
63c1b1cb5f3c2af7446b6e871c3cbe5f7d9d37a5d7194dc3fa26dfee8a3c8bd3
|
Provenance
The following attestation bundles were made for fantasyfb-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on tefirman/fantasyfb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fantasyfb-0.3.0-py3-none-any.whl -
Subject digest:
7ff3147b21027d83504b5eab96becba7fc1439f667be2043b28cd2ae66d58841 - Sigstore transparency entry: 1516577835
- Sigstore integration time:
-
Permalink:
tefirman/fantasyfb@944e115cadf6f241082a3935e96c52c8c7496bc3 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/tefirman
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@944e115cadf6f241082a3935e96c52c8c7496bc3 -
Trigger Event:
release
-
Statement type: