MLB DraftKings lineup optimizer
invoke_mlb_optimizerBuilds DraftKings MLB classic lineups under the $50,000 cap from the BankrollSZN pool: 2 P, C, 1B, 2B, 3B, SS, 3 OF. contest_type loads the BankrollSZN preset (20max, 150max, 3max, single) and the preset's own lineup count: up to 20 for 20max and 150 for 150max. Stacks a primary and a secondary team, limits hitters against its own pitchers, and supports locks, excludes, an ownership cap, exposure caps per player, a stack plan per team and unique lineups. Every lineup has dk_upload (DK ids in slot order) and the result has csv: a DraftKings upload file in the site export format (P,P,C,1B,2B,3B,SS,OF,OF,OF, one "Name (DK id)" cell per slot). A big portfolio is built over several calls: when the result has next_call, call again with its prior_lineups and total_lineups until remaining is 0, then use the last csv. Postponed games are removed. Classic only. For Showdown use mlb_showdown_optimizer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lock | No | Player names that must be in every lineup. | |
| mode | No | Default gpp. | |
| stack | No | Stack shape, primary-secondary. For example 4-2 (default), 4-3, 5-2, 5-3, 3-3, or 5. | |
| exclude | No | Player names to leave out. | |
| lineups | No | Number of new lineups. Up to the preset count: 20 for 20max, 150 for 150max, 3 for 3max, 5 for single. The free plan gets 1. | |
| slate_id | No | Slate ID from mlb_list_slates. Defaults to the main slate. | |
| team_caps | No | Most lineups with a team as the primary stack, for example {"LAD": 6}. Below 1 is a share of the lineups. | |
| min_salary | No | Minimum total salary. | |
| min_unique | No | Players each lineup must differ from the ones before it. Default 3. | |
| own_lambda | No | Override the gpp ownership penalty. Default comes from contest_type. | |
| stack_plan | No | Primary stack team per lineup as counts, for example {"LAD": 6, "TB": 6, "MIL": 5}. The lineups are interleaved across the run. | |
| stack_teams | No | Teams allowed as the primary stack. Default: the top 6 teams by TeamROO score. | |
| contest_type | No | DraftKings contest type. 20max is the base projection. | |
| exposure_caps | No | Most lineups for a player, for example {"Drew Rasmussen": 0.55, "Robbie Ray": 3}. Below 1 is a share of the lineups, 1 or more is a lineup count. Replaces the preset cap for that player. | |
| max_total_own | No | Cap on the summed ownership of the 10 players, in percent. | |
| prior_lineups | No | dk_upload strings of lineups already built in this portfolio (from next_call). They count toward exposure, caps and uniqueness and are not built again. | |
| total_lineups | No | The portfolio size the caps are computed on, from next_call. | |
| confirmed_only | No | Only use players in confirmed lineups. | |
| secondary_teams | No | Teams allowed as the secondary stack. | |
| pitcher_own_line | No | Ownership line for pitchers, in percent, used with max_pitchers_over_line. Example 40. | |
| max_batting_order | No | Stack hitters must bat at or above this spot. Default 9. | |
| max_low_owned_hitters | No | Most hitters under 3 percent ownership in a lineup. Default from the preset. | |
| max_hitters_vs_pitcher | No | Most hitters allowed against your own pitchers. Default 1. | |
| max_pitchers_over_line | No | Most pitchers above pitcher_own_line in one lineup. Example 1. |