Back to Lab

Case Study — Personal Project

A 3-League Fantasy Baseball
Analytics Engine

橫跨三個聯盟的夢幻棒球數據分析系統

Scope

3 leagues · 56 metrics

三聯盟・56 支隊伍

Status

Live · Season 2026

賽季中持續運轉

Type

Personal Project

個人作戰系統

Role

Solo Developer

開發者與使用者合一

Live

fantasy.mursfoto.com
01

The Problem

起點

Playing in three simultaneous fantasy baseball leagues — each with different scoring systems, roster limits, and trade deadlines — creates an information management problem that spreadsheets cannot solve. Waiver decisions require real-time trend data. Start/sit calls need seven-day projections. FA reports must account for schedule strength, not just raw stats. I built the system I needed.

同時跑三個 Fantasy Baseball 聯盟——各自的計分規則、陣容限制、waiver 時間都不同——等於第二份全職工作。所以我建了一套系統來管理它。

02

The System

系統規模

A unified data pipeline that ingests from four sources, normalizes across three scoring rulesets, and surfaces insights through a Discord bot and a web dashboard.

3

Active leagues

Roto + H2H

56

Tracked metrics

Per player

176+

Scout notes

In D1

1

Discord bot

Real-time queries

03

Toolkit

工具組

Yahoo Fantasy API

Primary data source for roster state, standings, and weekly matchups. Token refresh handled automatically.

FanGraphs Scraper

Pulls advanced metrics — xFIP, BABIP, K%, BB% — not available in the Yahoo API. Rate-limited with polite delays.

Baseball Savant

Statcast data: exit velocity, barrel %, sprint speed, spin rate. Used for projection and scout note generation.

Cloudflare D1

Edge SQLite database for scout notes, player cache, and historical metrics. Zero cold starts on Discord queries.

Discord Bot

Slash commands for /player, /matchup, /waiver, /cheatsheet. Responds in under 2 seconds from D1 cache.

GitHub Actions

Daily sync pipeline for player data refresh, FA report generation, and weekly cheat sheet builds.

Python Analytics

Pandas + NumPy for stat normalization, z-score rankings, and two-start pitcher projections.

Claude Agents

Scout note generation from raw Statcast data. Haiku for bulk notes, Sonnet for detailed analysis.

04

Tech Stack

技術棧

Data Sources

  • Yahoo Fantasy API
  • FanGraphs
  • Baseball Savant (Statcast)
  • MLB Stats API

Backend

  • Python 3.12
  • FastAPI
  • Pandas
  • NumPy

Infrastructure

  • Cloudflare D1 (SQLite)
  • GitHub Actions
  • Cloudflare Workers

Automation

  • Discord.py bot
  • Claude Haiku (bulk notes)
  • Claude Sonnet (analysis)
05

Takeaways

這套系統證明了什麼

  • Multi-source data pipelines require robust fallback logic — Yahoo goes down, FanGraphs changes layout, Savant rate-limits. Handle all of it.

  • Discord as a query interface is underrated. It puts analytics where decisions happen: the team chat.

  • LLM-generated scout notes at scale work best with structured prompts and templated output formats. Haiku is cost-effective for 176+ notes per week.

  • Edge SQLite (Cloudflare D1) eliminates the need for a traditional backend for read-heavy analytics workloads.

Want to build something like this?

想打造類似的系統?

Get in touch →