3 min read

Inside My Fantasy Baseball Analyzer

Table of Contents

Every year, I’d draft based on gut instinct, cheat sheets, and tab-hopping across ESPN and FanGraphs. Then I got tired of it.

So I built something better.

đź§  What This Does

This tool fetches your fantasy league data from ESPN, pulls projection and current performance data from FanGraphs, merges it all, and surfaces who you should add, drop, or draft.

But it doesn’t just list the top players. It:

  • Normalizes stats across categories using z-scores
  • Separates projected vs current performance
  • Applies custom weights to each, using Advanced Stats like:
    • wOBA, wRC+, etc… for hitters
    • FIP and WHIP for pitchers
  • Evaluates positional scarcity and depth
  • Suggests replacements position by position for your team
  • Generates a draft strategy using adjusted ADP + tiering
  • Optionally, enable the call to db_loader.py to execute the ETL process into your local database for long-term analysis and reporting!

🛠️ How It Works

1. Fetch ESPN Data

from espn_data import get_all_players

I pull in every rostered player and free agent, using your ESPN cookies (SWID, S2) from the .env.

2. Get FanGraphs Stats

from fangraphs_api import get_fangraphs_merged_data

I merge:

  • Projected stats (Steamer)
  • Current season stats

…and prefix all of them (proj_ and curr_) so I can keep track.

3. Merge and Score

from analysis import rank_free_agents

Z-scores normalize the stat distribution. Weighted scores (80% projection, 20% current by default) give a CompositeScore.

4. Streamlit Interface

Launch the app:

streamlit run team_analyzer.py

Click Run Scraper, and within seconds, information about how your team is performing with views like this:

Strengths and Delta

OVer and Under Achievers

Free Agent Suggestions with statistical breakdowns:

Free Agent suggestions

5. Draft Strategy

Run the GUI:

python gui.py

Get a sortable, filterable workbook broken into tabs (C, 1B, OF, P, etc.) with draft tracking, VADP (Value over ADP), and adjusted scores that reflect the market and positional need.

⚡ Why It’s Cool

  • It unifies three sources: ESPN, FanGraphs (Steamer Projections), FanGraphs (Current stats)
    • All of these are updated daily to make sure you’re getting the most accurate information.
  • It handles cleanup: name mapping, injury flags, stat formatting
  • It applies game theory: scarcity bonuses, draft tiering, movement caps
  • It’s fast: no login or web scraping after setup
  • Works on both Desktop and Mobile devices
  • It looks good: themed Streamlit UI + PySide GUI with custom styling

đź”— Try It or Clone It

Check it out on GitHub:
github.com/ChandlerCGray/FantasyBaseball

Pro tip: Toggle the Select Team dropdown to view exactly what your league-mates see—and leverage that insight to gain the upper hand.


Let your league-mates draft based on hunches. You’ve got math.