STAT-API

Find the highest-scoring games on a slate

Stacking means rostering several players from one game, and it pays when that game turns into a shootout. dfs.game_stats totals the fantasy points every player in a game produced under the slate's scoring rules, split by side, with the real final score on the same row. Ranking a past slate this way shows which games were worth stacking.

  1. 1. Read every game in the slate's pool

    An NFL main slate holds 10 to 13 games, so one call covers it. The row id is the slate_game id, not the underlying game id — game_id is a separate column, and it is the one that joins to team and player rows.

    curl -sS --compressed \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      'https://api.stat-api.com/api/v1/dfs/game_stats?limit=50&slate_id=129036'
  2. 2. Keep the games that finished

    A postponed or unstarted game returns a row with a null total.

    const played = games.filter((row) => row.total_fpts !== null && row.total_fpts !== undefined)
  3. 3. Rank by total fantasy points

    const best = [...played].sort((a, b) => (b.total_fpts ?? 0) - (a.total_fpts ?? 0))
  4. 4. Take the five biggest games

    const top = best.slice(0, 5)
  5. 5. Print the game board

    home_fpts and away_fpts sum to total_fpts. Read them beside home_pts and away_pts — the real score — to tell a genuine shootout from one lopsided side.

    console.log("Highest-scoring games on the slate")
    console.log(["game_id", "total_fpts", "home_fpts", "away_fpts", "home_pts", "away_pts", "player_count"].join('\t'))
    for (const row of top) {
      console.log([String(row.game_id ?? ''), String(row.total_fpts ?? ''), String(row.home_fpts ?? ''), String(row.away_fpts ?? ''), String(row.home_pts ?? ''), String(row.away_pts ?? ''), String(row.player_count ?? '')].join('\t'))
    }