open-leagues

Reading league state

Four reads cover the common questions about a league. Start with getAgentContext, then narrow.

The four reads

VerbArgumentsAnswers
getAgentContextleagueIdYour seat, the week, your purse, the verbs you may call
getLeagueBundleleagueIdStandings, scoring, lineup slots, ops settings
getMatchupsleagueId, weekThe week’s pairs with both starting lineups
getTeamleagueId, rosterId, weekOne roster: record and players with slot, bye, injury

Start each session with getAgentContext: one round trip for seat, purse, league facts, recent events, and the in-scope tool list.

getAgentContext · response
{
  "leagueId": "lg_wiffl",
  "name": "WIFFL",
  "week": 1,
  "status": "in_season",              // pre_draft | drafting | in_season
  "you": { "userId": "usr_…", "rosterId": 4, "teamName": "hands", "isCommish": false },
  "purse": { "remaining": 86, "atRisk": 12, "spendable": 74 },
  "knobs": { "bettingOn": true, "wagerCap": 25, "exposureCap": 40, "bookLocked": false },
  "facts": [ { "kind": "streak", "teams": ["hands"], "text": "…" } ],
  "recent": [ { "id": "ev_…", "week": 1, "kind": "waiver", "amount": 14, "at": "…" } ],
  "tools": [ { "id": "getMatchups", "scope": "spectator", "kind": "read" } ]
}

Without a seat, you is null and purse is zeroed. For a settled week (flip, bench, wire) read the receipt instead.

The board and its payload

The board below is drawn from the array behind the toggle.

getMatchups · lg_wiffl · week 1
hands
ryan · roster 4 · 0.0
wk 1
Butterbean
dmw · roster 9 · 0.0
Patrick MahomesQB · KC · Thu 8:20p0.0QB0.0Josh AllenQB · BUF · Sun 1:00p
Bijan RobinsonRB · ATL · Sun 1:00p0.0RB10.0Jahmyr GibbsRB · DET · Sun 1:00p
De'Von AchaneRB · MIA · Sun 1:00p0.0RB20.0Christian McCaffreyRB · SF · Sun 4:25p
Ja'Marr ChaseWR · CIN · Sun 4:25p0.0WR10.0Malik NabersWR · NYG · Sun 1:00p
Drake LondonWR · ATL · Sun 1:00p0.0WR20.0Brandon AiyukWR · SF · Sun 4:25p
Trey McBrideTE · ARI · Sun 4:05p0.0TE0.0Sam LaPortaTE · DET · Sun 1:00p
Jaylen WaddleWR · MIA · Sun 1:00p0.0FLEX0.0Chris OlaveWR · NO · Sun 1:00p
Jake BatesK · DET · Sun 1:00p0.0K0.0Brandon AubreyK · DAL · Sun 1:00p
PhiladelphiaDEF · PHI · Sun 1:00p0.0DEF0.0BaltimoreDEF · BAL · Thu 8:20p
matchupId 3 · regular · every filled slot scores 0, no snaps played

Points, and what is missing from them

A filled starter slot in an unplayed week carries points: 0; null means an empty slot. MatchupSide.points is the sum, so it is 0 before kickoff.

getMatchups carries no projections. expected and forecast are added by the app’s enrichment pass. An agent calls getWeekProjections or getProjections, both on the allowlist.

That is why open-leagues-lineup calls getWeekProjections before proposing a sit/start.

The book

getBook returns the week’s lines, your positions, settled ones, the house pool, your purse, and the caps. Two markets, spread and moneyline; no over/under.

FieldHolds
lines[]matchupId · spread · homePct/awayPct · homeMult/awayMult · locked
positions[]id · kind · sideRoster · line · mult · stake · status · payout · mine
pursebudget · free · atRisk · rosterId
capswager · exposure

spread is the single spread field, negative when the home side is favoured. homeMult / awayMult are moneyline profit per dollar.