Skip to main content

fantasy-football-bot (ffbot)

PyPI Latest Release PyPI downloads License Code style: black Imports: isort codecov

Automate playing Yahoo Fantasy Football

Installation

The source is currently hosted on GitHub.

Binary installers for the latest released version are available at the Python Package Index (PyPI).

pip install ffbot  # uv add ffbot

Usage

>>> import ffbot

Scrape player forecasts

To connect to your Yahoo league and team, you need your league ID and team ID. Visit your team at https://football.fantasysports.yahoo.com/f1/, and the url will also include your league and team ID.

>>> LEAGUE = 123456
>>> TEAM = 1
>>> POSITIONS = "QB, WR, WR, WR, RB, RB, TE, W/R/T, K, DEF, BN, BN, BN, BN, IR"
>>> week = ffbot.current_week()
>>> df = ffbot.scrape(LEAGUE)
>>> # If playing an Individual Defensive Player (IDP) league, then scrape additional players with:
>>> # df = ffbot.scrape(LEAGUE, is_IDP=True)
Scraping all QB...
Scraping all WR...
Scraping all RB...
Scraping all TE...
Scraping all K...
Scraping all DEF...
Scraping weekly forecasts...
Total runtime: 0:10:33.784455

Optional methods to save data to CSV, and load data:

>>> ffbot.save(df, week)
>>> df, week = ffbot.load()  # loads latest file, but you can also provide a filepath

Optimize add and drop players

ffbot.optimize() is used to find players to add and drop that maximize your team's performance. The optimizer decides which players to add and drop, and how to assign each player to positions each week. Optimization is repeated for current roster, for one player add/drop, two player add/drops, etc.

>>> df_opt = ffbot.optimize(df, week, TEAM, POSITIONS)
>>> print(df_opt)
                              Add              Drop Total points Discounted points     VOR
0                <current roster>                        1583.94            367.51  226.73
1                     Kansas City                          16.27              2.24   -7.98
2                     Matt Bryant         Joey Slye          4.6              1.67   -3.63
3                  Dede Westbrook      Kenyan Drake         4.27              0.65    2.75
4 Jordan Howard - Waivers (Oct 2)  Marvin Jones Jr.        10.37             17.23   -3.54

which means that optimal weekly rosters of your current players scores 1583.94 points across the season and 367.51 discounted points (points in week 1 are worth more than week 12). The best free agent to add is Kansas City, which increases discounted points by 2.24 (although lowers total season points by 16.27 and lowers value over replacement by 7.98). Two other free agent pickups improve discounted points. Only one Waiver claim (for Jordon Howard) increases discounted points.

Web app UI

Create and sync the project environment with uv sync. To install the web app UI dependencies, include the ui group:

uv sync --extra ui

Configure your league settings in .ui\app.py, and then run the ffbot web app UI with:

python .ui\index.py

Then open localhost:8050 in a web browser to see:

Scrape tab

Optimize tab

Contribution

Please add Issues or submit Pull Requests!

For local development, install optional testing dependencies and set up Git hooks with prek using

uv sync --all-extras --dev --group test
uv run prek install

Metadata

Release files for ffbot 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ffbot 1.3.0
File Size Uploaded Provenance Actions
ffbot-1.3.0.tar.gz 135.2 kB With provenance Details for ffbot-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ffbot 1.3.0
File Interpreter ABI Platform Actions
ffbot-1.3.0-py3-none-any.whl Python 3 none any Details for ffbot-1.3.0-py3-none-any.whl

Total release size: 246.5 kB

Release files / ffbot-1.3.0.tar.gz

Download URL ffbot-1.3.0.tar.gz
Size 135.2 kB
Tags Source
SHA-256 checksum
How to use checksums
652109fc4e86a54cc1438e755d17b40c1d43e6a6d075f2d40fe7845a00a3bd1c
BLAKE2b-256 checksum
How to use checksums
284bbe229caec5e06e2e2f263e1a9b664d7f464583a48a939e2ff64d75e5a203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / ffbot-1.3.0-py3-none-any.whl

Download URL ffbot-1.3.0-py3-none-any.whl
Size 111.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21c602c75871eea05d280cb7032c4fcf083c83b16cc8560b5faee9eb15dc2368
BLAKE2b-256 checksum
How to use checksums
5423564bf580c5188abfdc6d70b6af62a00bd2a579077367f9c37b2fcf34fda3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for ffbot 1.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ffbot-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page