edwarddistel / yahoo-fantasy-baseball-automater

Automatically start an optimal lineup for your Yahoo Fantasy Baseball team.
14 stars 2 forks source link

Yahoo Fantasy Baseball Automater

This tool automates your starting lineup for Yahoo Fantasy Baseball.

For a simpler app that just pulls in the raw data, and a more complete walkthrough on how to get the correct authorization codes from Yahoo, see my Yahoo Fantasy Baseball Reader.

NEW for 2020: It now also pulls in the list of closers, compares them against your relief pitchers, tells you to drop ones who are no longer closing, then searches your league to see which closers are still available and healthy.

To run that and only that function npm run closers.

Installation

You'll need 3 values from Yahoo to start -- I have a detailed guide here in my Yahoo Fantasy Baseball Reader.

You'll also need to use the Node version specified in the .nvmrc file by running nvm use. (Details)

Logic

  1. Gets probable pitchers for that day
  2. Gets the roster of your players from Yahoo
  3. Gets the stats of all players from MLB.com (Yahoo didn't provide batting average against for pitchers)
  4. Calculates the probability of a hit using the Log5 formula
  5. Makes several passes through the roster to fill out each position using the highest Log5 value for that day
  6. Sets your roster for tomorrow and the following 4 days
  7. Grabs the closers from MLB.com and compares them to your relief pitchers, letting you know if one of your RPs is no longer a closer and letting you know of those who are who is still a free agent in your league.

Usage

Run the app

Navigate to the repo directory and run:

> npm start