ffbot


Nameffbot JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/amarvin/fantasy-football-bot
SummaryAutomate playing Yahoo Fantasy Football
upload_time2023-11-17 18:37:52
maintainer
docs_urlNone
authorAlex Marvin
requires_python>=3.0
license
keywords fantasy-football bot yahoo
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fantasy-football-bot (ffbot)

[![PyPI Latest Release](https://img.shields.io/pypi/v/ffbot.svg)](https://pypi.org/project/ffbot/)
[![PyPI downloads](https://static.pepy.tech/badge/ffbot)](https://pepy.tech/project/ffbot)
[![License](https://img.shields.io/github/license/amarvin/fantasy-football-bot)](https://github.com/amarvin/fantasy-football-bot/blob/main/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![codecov](https://codecov.io/gh/amarvin/fantasy-football-bot/branch/main/graph/badge.svg?token=CH6M9DR7VX)](https://codecov.io/gh/amarvin/fantasy-football-bot)

Automate playing Yahoo Fantasy Football

## Installation

```sh
pip install ffbot
```

## Usage

```python
>>> 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.

```python
>>> 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:

```python
>>> 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.

```python
>>> 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.

## Contribution

Please add Issues or submit Pull Requests!

For local development, install optional testing dependencies and pre-commit hooks using

```sh
pip install ffbot[test]
pre-commit install
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/amarvin/fantasy-football-bot",
    "name": "ffbot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": "",
    "keywords": "fantasy-football bot yahoo",
    "author": "Alex Marvin",
    "author_email": "alex.marvin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/34/0b/dd45377c5aceca473d07a071730f4a48478da3a00c08c126c1b03f4df1c9/ffbot-1.2.4.tar.gz",
    "platform": null,
    "description": "# fantasy-football-bot (ffbot)\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/ffbot.svg)](https://pypi.org/project/ffbot/)\n[![PyPI downloads](https://static.pepy.tech/badge/ffbot)](https://pepy.tech/project/ffbot)\n[![License](https://img.shields.io/github/license/amarvin/fantasy-football-bot)](https://github.com/amarvin/fantasy-football-bot/blob/main/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![codecov](https://codecov.io/gh/amarvin/fantasy-football-bot/branch/main/graph/badge.svg?token=CH6M9DR7VX)](https://codecov.io/gh/amarvin/fantasy-football-bot)\n\nAutomate playing Yahoo Fantasy Football\n\n## Installation\n\n```sh\npip install ffbot\n```\n\n## Usage\n\n```python\n>>> import ffbot\n```\n\n### Scrape player forecasts\n\nTo connect to your Yahoo league and team, you need your league ID and team ID.\nVisit your team at <https://football.fantasysports.yahoo.com/f1/>, and the url will also include your league and team ID.\n\n```python\n>>> LEAGUE = 123456\n>>> TEAM = 1\n>>> POSITIONS = \"QB, WR, WR, WR, RB, RB, TE, W/R/T, K, DEF, BN, BN, BN, BN, IR\"\n>>> week = ffbot.current_week()\n>>> df = ffbot.scrape(LEAGUE)\n>>> # If playing an Individual Defensive Player (IDP) league, then scrape additional players with:\n>>> # df = ffbot.scrape(LEAGUE, is_IDP=True)\nScraping all QB...\nScraping all WR...\nScraping all RB...\nScraping all TE...\nScraping all K...\nScraping all DEF...\nScraping weekly forecasts...\nTotal runtime: 0:10:33.784455\n```\n\nOptional methods to save data to CSV, and load data:\n\n```python\n>>> ffbot.save(df, week)\n>>> df, week = ffbot.load()  # loads latest file, but you can also provide a filepath\n```\n\n### Optimize add and drop players\n\n`ffbot.optimize()` is used to find players to add and drop that maximize your team's performance.\nThe optimizer decides which players to add and drop, and how to assign each player to positions each week.\nOptimization is repeated for current roster, for one player add/drop, two player add/drops, etc.\n\n```python\n>>> df_opt = ffbot.optimize(df, week, TEAM, POSITIONS)\n>>> print(df_opt)\n                              Add              Drop Total points Discounted points     VOR\n0                <current roster>                        1583.94            367.51  226.73\n1                     Kansas City                          16.27              2.24   -7.98\n2                     Matt Bryant         Joey Slye          4.6              1.67   -3.63\n3                  Dede Westbrook      Kenyan Drake         4.27              0.65    2.75\n4 Jordan Howard - Waivers (Oct 2)  Marvin Jones Jr.        10.37             17.23   -3.54\n```\n\nwhich means that optimal weekly rosters of your current players scores 1583.94 points\nacross the season and 367.51 discounted points (points in week 1 are worth more than week 12).\nThe 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).\nTwo other free agent pickups improve discounted points.\nOnly one Waiver claim (for Jordon Howard) increases discounted points.\n\n## Contribution\n\nPlease add Issues or submit Pull Requests!\n\nFor local development, install optional testing dependencies and pre-commit hooks using\n\n```sh\npip install ffbot[test]\npre-commit install\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Automate playing Yahoo Fantasy Football",
    "version": "1.2.4",
    "project_urls": {
        "Homepage": "https://github.com/amarvin/fantasy-football-bot"
    },
    "split_keywords": [
        "fantasy-football",
        "bot",
        "yahoo"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "611d831e08df83a7e4ed98eb6db285f3523624dc6d7f00f6d71587291c40ff6e",
                "md5": "fd65d99fc185c0ebb44873355c7c2724",
                "sha256": "85966f1f32f24438063c1376922738234b9d0989637baff14eac5c5b3abc2993"
            },
            "downloads": -1,
            "filename": "ffbot-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd65d99fc185c0ebb44873355c7c2724",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 9629,
            "upload_time": "2023-11-17T18:37:50",
            "upload_time_iso_8601": "2023-11-17T18:37:50.170719Z",
            "url": "https://files.pythonhosted.org/packages/61/1d/831e08df83a7e4ed98eb6db285f3523624dc6d7f00f6d71587291c40ff6e/ffbot-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "340bdd45377c5aceca473d07a071730f4a48478da3a00c08c126c1b03f4df1c9",
                "md5": "045eed178a11a0d18ee86030f7692192",
                "sha256": "717a809ca64ef733dff1dceb5ced48691b0e6dd2e306395bf2e76492525281c1"
            },
            "downloads": -1,
            "filename": "ffbot-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "045eed178a11a0d18ee86030f7692192",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 10378,
            "upload_time": "2023-11-17T18:37:52",
            "upload_time_iso_8601": "2023-11-17T18:37:52.375466Z",
            "url": "https://files.pythonhosted.org/packages/34/0b/dd45377c5aceca473d07a071730f4a48478da3a00c08c126c1b03f4df1c9/ffbot-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-17 18:37:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amarvin",
    "github_project": "fantasy-football-bot",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ffbot"
}
        
Elapsed time: 0.14286s