STAT-API

Rank a DFS slate by salary and value

A slate lists every playable player with a salary; projections estimate their points. Page a slate's players by slate_id, rank by salary, then join the top player's projection to compute a value ratio. Use the required-filter-sets recipe to obtain a slate id (91396 is a placeholder here).

  1. 1. Page the slate's players

    slate_players accepts slate_id as a standalone filter; the auto-pager collects every player on the slate.

    curl -sS --compressed \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      'https://api.stat-api.com/api/v1/dfs/slate_players?slate_id=91396'
  2. 2. Rank by salary, highest first

    const bysalary = [...players].sort((a, b) => b.salary - a.salary)
  3. 3. Take the ten priciest players

    const top = bysalary.slice(0, 10)
  4. 4. Fetch the top player's projection

    slate_player_projections is keyed by slate_player_id — the player's id on this slate.

    curl -sS --compressed \
      -H 'Authorization: Bearer YOUR_API_KEY' \
      'https://api.stat-api.com/api/v1/dfs/slate_player_projections?slate_player_id=1'
  5. 5. Compute projected points per $1000 of salary

    Value = projection / salary — the core DFS screen for finding underpriced players.

    if (proj.length > 0 && top.length > 0) {
      const value = (proj[0].projection / top[0].salary) * 1000
      const who = top[0].display_name ?? String(top[0].id)
      console.log(`value(${who}) = ${value.toFixed(2)} projected pts per $1000`)
    }
  6. 6. Print the salary board

    console.log("Highest-salaried players on the slate")
    console.log(["display_name", "position", "salary"].join('\t'))
    for (const row of top) {
      console.log([String(row.display_name ?? ''), String(row.position ?? ''), String(row.salary ?? '')].join('\t'))
    }