Build a diversified NFL Classic DFS lineup portfolio
The `/optimizer/lineups` endpoint runs MILP lineup optimization in milliseconds. Pass `lineup_min_salary`, `min_unique_players`, and `max_player_exposure_pct` to spread exposure cleanly across a multi-entry portfolio.
- What it is
- Generates 5 projection-optimal DraftKings NFL Classic lineups on slate `1126128` enforcing a $48,500 minimum salary, 2 unique players per pair, and 60% max exposure.
- When to use it
- Use this when you want sub-second deterministic MILP lineup construction before layering full contest simulations.
- What you get back
- Portfolio summary stats (unique players, mean projected points) and the ranked lineups with salary and stack archetypes.
1.Optimize 5 diversified NFL Classic lineups
Call `optimizerLineups` on NFL Classic slate `1126128` with a $48,500 floor, at least 2 unique players between lineups, and a 60% max exposure cap.
POST request (requires your API key in STAT_API_KEY). Run the SDK program on the right or the curl snippet below.
{
"lineup_count": 5,
"lineup_min_salary": 48500,
"min_unique_players": 2,
"max_player_exposure_pct": 60,
"response_format": "json"
}const optRes = await api.dfs.slates.optimizerLineups(1126128, { lineup_count: 5, lineup_min_salary: 48500, min_unique_players: 2, max_player_exposure_pct: 60 })The complete program
Every step as one runnable file. It reads STAT_API_KEY from the environment, and is the same file that ships in the cookbook project for each SDK.
import { StatApi } from '@stat-api/client'
const api = new StatApi() // reads STAT_API_KEY from the environment
// Optimize 5 diversified NFL Classic lineups
const optRes = await api.dfs.slates.optimizerLineups(1126128, { lineup_count: 5, lineup_min_salary: 48500, min_unique_players: 2, max_player_exposure_pct: 60 })
// Print portfolio metrics and ranked lineups
console.log(`Slate ${optRes.slate.id} (${optRes.slate.league}/${optRes.slate.operator}) | lineups=${optRes.portfolio.lineup_count} unique=${optRes.portfolio.unique_players} mean_pts=${optRes.portfolio.mean_projected_points.toFixed(2)}`)
for (const l of optRes.lineups.slice(0, 5)) {
console.log(`Lineup #${l.rank} | salary=${l.salary} pts=${l.projected_points.toFixed(2)} stack=${l.stack.summary}`)
}Verified output across all 4 SDKs
TypeScript, Python, Go, and Java execute cleanly and print byte-identical output:
Slate 1126128 (nfl/draftkings) | lineups=5 unique=22 mean_pts=148.41
Lineup #1 | salary=49900 pts=155.40 stack=QB+1 (NO) + 1 Opp (CAR)
Lineup #2 | salary=50000 pts=155.18 stack=QB (NO) + 1 Opp (CAR)
Lineup #3 | salary=49900 pts=155.12 stack=QB (NO) + 1 Opp (CAR)
Lineup #4 | salary=50000 pts=138.87 stack=Naked QB (SF)
Lineup #5 | salary=49900 pts=137.48 stack=QB (SF) + 1 Opp (DAL)