编程

Yahoo Fantasy Baseball

试用

查询 Yahoo 梦幻棒球联赛:阵容、排名、对战、自由球员、交易记录与每日先发优化建议。

它能做什么

面向 Yahoo 梦幻棒球联赛的只读命令行工具。可查询阵容、先发、排名、积分榜、选秀结果、交易记录与伤病报告,按位置、状态和数据项筛选自由球员(FA)、认领名单(W)、已选球员(T)。`optimize` 命令基于约束求解器给出打者位置互换、投手轮换与伤病名单(IL)调整建议,并与 MLB 官方公布先发交叉核对;每日相关命令(`today`、`day`、`standouts`、`lineup-check`)会把球员分为 ACTIVE、NOT PLAYING、INJURED、BENCH,并显示开赛时间。输出支持 text、JSON 与 Discord 三种格式。

什么时候用它

  • 查看今日阵容状态与当晚出战球员
  • 按位置与数据项检索自由球员和认领名单球员
  • 在首打前拿到先发优化建议
  • 查看联赛排名、本周对战与近期交易记录

技能文档

Yahoo Fantasy Baseball

Query your Yahoo Fantasy Baseball league: view data and optimize your daily lineup via the Yahoo Fantasy Sports API. Read-only — no roster modifications are made.

Requirements

  • Python 3.10+
  • yahoo_fantasy_api — Yahoo Fantasy Sports API wrapper

Installation: Before first use, run --setup to create a local .deps/ virtual environment and install dependencies from requirements.txt. Subsequent runs reuse the existing venv. To force a clean reinstall, delete the .deps/ directory and run --setup again.

python3 yahoo-fantasy-baseball.py --setup

Setup

1. Create a Yahoo Developer App

  1. Go to https://developer.yahoo.com/apps/
  2. Click "Create an App"
  3. Set Redirect URI to oob (out-of-band — Yahoo displays the auth code on screen instead of redirecting to a URL)
  4. Copy the Consumer Key and Consumer Secret

2. Authenticate

python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py auth

Follow the prompts to enter your Consumer Key and Secret. A browser window opens for Yahoo OAuth authorization. Tokens are cached automatically — you only need to do this once.

3. Find Your League

python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py leagues

4. Set Defaults

python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py config --league 12345

The skill auto-detects your team within the league. You can also set it explicitly:

python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py config --league 12345 --team 3

Quick Start

# View your roster
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py roster

# Daily roster status (who's playing, who's off)
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py today

# Roster status for a specific date
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py day --date 2026-03-25

# Get optimization suggestions
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py optimize

# League standings
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py standings

Commands

Data Commands (Read)

# Auth & Config
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py auth
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py config --league 12345 --team 3 --season 2026
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py config

# Leagues & Teams
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py leagues [--season YEAR]
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py teams

# Roster & Lineup
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py roster [--date YYYY-MM-DD]
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py lineup [--week N]

# Standings & Matchups
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py standings
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py matchup [--week N]
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py scoreboard [--week N]

# Players & Draft
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py players [--search NAME] [--position POS] [--status FA|A|T|W|ALL] [--sort OR|AR|PTS|NAME|HR|ERA|...] [--sort-type season|lastweek|lastmonth] [--stat-season YEAR] [--count N]
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py draft [--team ID]
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py transactions [--type add,drop,trade] [--since 3d]
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py injuries

# Lineup Check — confirmed MLB lineups vs fantasy roster
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py lineup-check [--date YYYY-MM-DD]

Daily Management

# Today: roster status with MLB schedule awareness (shortcut for 'day' with today's date)
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py today

# Day: roster status for a specific date
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py day --date 2026-03-25

Groups your roster into ACTIVE (team playing), NOT PLAYING (team off), INJURED, and BENCH. Shows each player's eligible positions, game start times (local timezone), and flags probable starting pitchers. Displays "First pitch" time at the top so you know when to finalize your lineup. The today command is a shortcut for day with today's date.

# Standouts: yesterday's top performers across all league teams
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py standouts [--date YYYY-MM-DD] [--min-points N] [--count N]

Fetches daily player stats for all rostered players across every team in the league and identifies standout performances. Output is split into two sections:

  1. Top Performers — players in active lineup slots who scored the most fantasy points
  2. Left on the Bench — benched players with notable performances (points that didn't count)

Each player shows their fantasy points, key stat line, and achievement badges (e.g., "Multi-HR", "10+ K", "Gem", "CGSO"). Defaults to yesterday; use --date for a specific date.

# Lineup check: verify active players are in confirmed MLB lineups
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py lineup-check
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py lineup-check --date 2026-04-01

Cross-references active fantasy roster players against confirmed MLB batting lineups (from MLB Stats API hydrate=lineups). Flags position players who are in a starting fantasy slot but NOT in their team's confirmed real-life lineup (e.g., scratched, resting, benched vs lefty/righty). Pitchers are excluded (they don't appear in batting lineups). Players whose team's lineup hasn't been posted are NOT flagged — only players whose lineup IS posted and who are absent. Lineups are typically posted 1-3 hours before game time.

# Optimize: smart roster analysis with suggestions
python3 /home/claw/.openclaw/workspace/skills/yahoo-fantasy-baseball/yahoo-fantasy-baseball.py optimize

Three analysis categories:

  1. Lineup changes — optimal batter assignment via constraint solver (position-aware, fills restrictive slots before UTIL). Outputs grouped swap instructions showing who starts (from bench), who gets benched, and any intermediate position reshuffles needed within that chain (e.g., a UTIL player sliding to 1B to make room). Pure position shuffles among active slots (without bench involvement) are omitted. Also checks confirmed MLB batting lineups — players confirmed not in their team's lineup are treated as unavailable (score 0) and will be moved to bench. Players whose games have already started are locked in place (Yahoo locks roster slots at first pitch) and excluded from the solver.
  2. Pitcher rotation — priority-based pitcher slot optimization with swap suggestions. Relief pitchers whose teams are playing today are prioritized over non-starting SPs or pitchers whose teams are off. Probable starters get highest priority. Outputs grouped swap instructions (same format as batter swaps). Locked games are excluded.
  3. IL management — players with IL designations (IL, IL10, IL15, IL60) not in IL slots, cleared players still in IL. DTD players are excluded since Yahoo does not allow moving them to IL.

Each move includes team, opponent, score, and (when set) Yahoo injury status (e.g. DTD, IL10) inline in the parenthetical. If a player suggested to start is DTD, a ⚠️ Day-to-day — confirm in lineup before locking. caution is rendered beneath the line — the optimizer scores ignore status, so a higher-scoring DTD player can still surface as a swap recommendation. Moves to BN may include a reason indicator:

  • ⚠️ — player not in confirmed MLB lineup (urgent — they won't play)
  • 🔒 — player's game has already started (locked by Yahoo)
  • 📅 — player's team is off today

In --format json, every entry in swap_groups[].start, swap_groups[].bench, swap_groups[].reshuffle (and the pitcher equivalents) carries a status field — empty string when the player has no Yahoo status. The flat moves[] and pitcher_moves[] arrays mirror the text view: they include every move that is part of a swap group (each tagged with a swap_group index), including pure active↔active reshuffles (e.g. moving a player from UTIL into an open position slot with no bench involved) — these appear as a reshuffle-only group with an empty start/bench.

Early-season preseason rank blending: The optimizer blends Yahoo's preseason overall rank (OR) into player scores during the first weeks of the season, when current-year stats are too small a sample to be reliable. The blending schedule:

  • Weeks 1–2: Full weight — preseason rank contributes up to 15 bonus points (rank 1 gets the max, last-ranked gets 0)
  • Weeks 3–6: Linear taper — preseason influence decreases by ~20% per week
  • Week 7+: Zero weight — scoring is based entirely on current-season stats

This prevents the optimizer from overreacting to small early-season slumps (e.g., benching a star who went 0-for-8 in the first series). The preseason ranks are fetched via one additional Yahoo API call (sort=OR, status=T) per optimize run.

Common Flags

FlagDescription
--league IDLeague ID (overrides config default)
--team IDTeam ID (overrides config/auto-detect)
--season YEARSeason year (for historical data)
--week NScoring week number
--dateSpecific date — accepts MM/DD/YYYY, M/D/YYYY, MM-DD-YYYY, or YYYY-MM-DD (roster, day commands)
--format text|json|discordOutput format (default: text)
--status FA|A|T|W|ALLPlayer status filter: FA (free agents), A (available=FA+W), T (taken), W (waivers), ALL (every player)
--sort OR|AR|PTS|NAME|{stat}Sort order: OR = overall/preseason rank (default), AR = actual/current rank, PTS = points, NAME = alphabetical, or stat abbreviation. See stat sort reference below
--sort-type season|lastweek|lastmonthSort period (used with --sort)
--stat-season YEARSeason year for stat columns (auto-detects: falls back to previous year if league hasn't started)
--since 3d|1w|24h|2wFilter transactions by time window (h=hours, d=days, w=weeks, m=months)

Sort Reference

Built-in sort modes:

ValueDescription
OROverall Rank (preseason/projected)
ARActual Rank (by real performance)
PTSFantasy Points
NAMEAlphabetical

Batting stats:

AbbrevDescription
RRuns
HHits
1BSingles
2BDoubles
3BTriples
HRHome Runs
RBIRuns Batted In
SBStolen Bases
BBWalks
KStrikeouts
AVGBatting Average
OBPOn-base Percentage
SLGSlugging Percentage
OPSOn-base + Slugging
ABAt Bats
PAPlate Appearances
TBTotal Bases
XBHExtra Base Hits

Pitching stats:

AbbrevDescription
WWins
LLosses
SVSaves
HLDHolds
SV+HSaves + Holds
BSVBlown Saves
ERAEarned Run Average
WHIPWalks + Hits per Inning Pitched
IPInnings Pitched
QSQuality Starts
K9Strikeouts per 9 Innings
BB9Walks per 9 Innings

Output Format

Text (Default)

roster:

Roster — Team Name
Name                      Pos          Slot  Team   Status
----------------------------------------------------------
Aaron Judge               OF,Util      OF    NYY
Mookie Betts              SS,OF,Util   SS    LAD
Zack Wheeler              SP           IL    PHI    IL-60

today / day:

Today — Team Name
  First pitch: 1:10 PM

  ACTIVE (team playing today) (8)
    Aaron Judge            OF,Util        NYY  vs BOS 7:05 PM
    Gerrit Cole            SP             NYY  vs BOS 7:05 PM  [PROBABLE STARTER]

  NOT PLAYING (team off today) (3)
    Mookie Betts           SS,OF,Util     LAD

  BENCH (3)
    Jake Burger            3B,1B,Util     MIA  at ATL 1:10 PM

  INJURED LIST (1)
    Zack Wheeler           SP             PHI                   (IL-60)

optimize:

Roster Optimization Suggestions
==================================================

  LINEUP CHANGES (2 swaps)

    Swap 1 — 3B
      ▶ Start Jake Burger (MIA vs ATL, score: 18.3)
      ▼ Bench Josh Smith (TEX vs SEA, score: 9.2)
        ⚠️  not in confirmed MLB lineup

    Swap 2 — SS / UTIL
      ▶ Start Willy Adames at SS (SF vs PHI, score: 35.0)
      ↔ Move Mookie Betts from SS → UTIL
      ▼ Bench Tyler Fitzgerald (SF, score: 12.0)
        📅  team off today

  PITCHER ROTATION (1 swap)

    Swap 1 — P
      ▶ Start Gerrit Cole (NYY vs BOS, score: 42.1) — probable starter today
      ▼ Bench Nathan Eovaldi (TEX vs SEA, score: 39.0)
        💡  not starting today

  IL MANAGEMENT (1 suggested)
    Move Zack Wheeler (IL-60) from SP slot to IL to free a roster spot.

Total: 4 suggestion(s)

Players on teams whose games are already in progress or finished are locked and excluded from optimization — they will not appear in the move list.

scoreboard:

League Scoreboard — Week 1
------------------------------------------------------------
  Clanker Killerz                  6  vs  4   1% AI 99% hot gas
                                    In progress

  Mossi Possi                      1  vs  7   Normal Men
                                    In progress

transactions:

Recent Transactions
------------------------------------------------------------
add | 1% AI 99% hot gas | Mar 25, 07:38 PM
  Add from Free Agent:Luis Castillo (SEA - SP)

add/drop | 1% AI 99% hot gas | Mar 25, 04:14 AM
  Add from Waivers:   Josh Smith (TEX - 1B,3B,SS,OF)
  Drop:               Luis Robert Jr. (NYM - OF)

JSON

All commands support --format json for structured output.

Discord

All commands support --format discord which wraps text output in code blocks.

Output Fields

  • name — Player's full name
  • player_id — Yahoo player ID (numeric)
  • positions — Eligible fantasy positions (e.g., OF, SP, Util)
  • selected_position — Current lineup slot
  • team — Real MLB team abbreviation
  • status — Injury designation (IL, IL-60, DTD, etc.)
  • game_time — Game start time in local timezone (today/day commands)
  • first_pitch — Earliest game start time across all games (today/day commands, JSON top-level)
  • percent_owned — Ownership percentage (free agents)
  • player_position — Display position (draft results)

Limitations

  • Rate limits: Yahoo enforces API rate limits. Avoid rapid-fire requests.
  • Season scope: Data is scoped to the configured season. Use --season for historical data.
  • OAuth tokens: Tokens auto-refresh but may eventually expire, requiring re-authentication via auth.
  • MLB schedule: The today, day, optimize, and lineup-check commands use the MLB Stats API for schedule data (off days, probable pitchers, confirmed batting lineups). This data is not available from the Yahoo Fantasy API.

Credential Storage

Preferred: Environment variables. Set YAHOO_CONSUMER_KEY and YAHOO_CONSUMER_SECRET via OpenClaw config or your shell environment. The skill will use these automatically — no need to run auth. Note: credentials are still written to oauth2.json on disk because the underlying yahoo_oauth library requires a file for token management. File permissions are set to 0600 on Unix.

Alternative: Interactive setup. Run the auth command to enter credentials interactively. Tokens are stored in ~/.openclaw/credentials/yahoo-fantasy/:

  • oauth2.json — OAuth consumer key/secret and tokens (managed by yahoo_oauth, file permissions set to 0600 on Unix)
  • yahoo-fantasy.json — Default league_id, team_id, season

Legacy YFPY .env credentials are auto-migrated to oauth2.json on first use.

Notes

  • Data is sourced from the Yahoo Fantasy Sports API via the yahoo-fantasy-api library.
  • MLB schedule and probable pitcher data comes from the MLB Stats API (stdlib only, no dependencies).
  • Run --setup to create a local venv at .deps/ and install dependencies before first use.
  • Auto-detect identifies your team using league.team_key(). If detection fails, use config --team to set it manually.

常见问题

这个工具会改动我的 Yahoo 阵容吗?
不会。它是只读的——只会读取 Yahoo 数据并给出建议,不会实际修改你在 Yahoo 上的阵容或设置。
首次使用前需要哪些准备?
需要在 Yahoo 开发者后台创建一个 App(拿到 Consumer Key 与 Consumer Secret,并把 Redirect URI 设为 `oob`),然后运行 `--setup` 在本地 `.deps/` 虚拟环境中安装依赖,再运行 `auth` 完成一次 OAuth 授权,token 之后会自动缓存。
`optimize` 会给出哪些类型的建议?
三类:按位置约束的打者轮换(先填限制位再填 UTIL)、按优先级排序的投手轮换、以及伤病名单(IL/IL10/IL15/IL60)槽位管理(DTD 不参与)。建议会尊重 Yahoo 在比赛首打后锁仓的规则,并跳过未进入 MLB 官方先发名单的球员。

相关技能

Pulls live scores, standings, rosters, player/team stats, and betting odds via the Crawlora API — ESPN (most sports/leagues), SofaScore (global soccer + more), MLB's own stats API, Strava (routes, clubs, challenges), and DraftKings Sportsbook (moneyline/spread/total odds, futures, live events) — returning clean JSON. Use when the user wants a live scoreboard, a team or player's stats, league standings, a game's boxscore/play-by-play, head-to-head history, sportsbook odds, or an endurance-sport route/club.

1 次安装

Live sports alerts for Soccer, NFL, NBA, NHL, MLB, F1 and more. Real-time scoring with the free ESPN API. Track any team from any major league worldwide.

226 次安装2 星标

Researches Yahoo's editorial content network — Autos, Entertainment, Health, Life, News, Shopping, Sports, and Tech — via the Crawlora API, returning clean JSON. Each vertical shares a home/category story-stream plus full-article-content pattern; Yahoo Sports adds deeper sports-data endpoints (scoreboards, standings, team/player/roster, golf, MMA, motorsports, tennis, Olympics). Use when the user wants a Yahoo section's story feed, a Yahoo article's full content, Yahoo News comments, Yahoo Shopping deals/lists, or Yahoo Sports scores/standings/schedules. Yahoo Finance and Yahoo Search are covered by their own separate skills, not this one.

1 次安装

football-data.org (football-data.org). Use this skill for ANY football-data.org request — searching and reading data. Whenever a task involves football-data....

BALLDONTLIE World Cup (fifa.balldontlie.io). Use this skill for ANY BALLDONTLIE World Cup request — searching and reading data. Whenever a task involves BALL...

Live football & basketball odds and scores from InferSports — who's favored, the live score, today's matches and what's worth watching, a specific day's sche...