Understanding Draft Groups
Draft groups are a fundamental concept in DraftKings’ daily fantasy sports platform. They represent a collection of players available for selection in a specific contest or set of contests. Understanding draft groups is crucial for effectively participating in DraftKings contests and utilizing the draft.kings
package.
Key aspects of draft groups include:
Player Pool: Each draft group contains a specific set of players from which contestants can build their lineups.
Salary Cap: Draft groups typically have a salary cap, limiting the total “cost” of players that can be selected for a lineup.
Positions: Players in a draft group are categorized by their positions, which vary depending on the sport.
Contest Association: A draft group is linked to one or more contests. Multiple contests may share the same draft group.
Sport and Game Type: Draft groups are sport-specific and may be further categorized by game type (e.g., classic, showdown).
Start Time: Each draft group has a specific start time, usually corresponding to the start of the first game included in the contests.
Player Information: Draft groups contain detailed information about each player, including their salary, team, and projected points.
Roster Requirements: Each draft group has specific roster requirements, such as the number of players to be drafted and position limits.
The draft.kings
package provides several functions to interact with and analyze draft groups, allowing users to retrieve draft group information, player lists, and other relevant data for strategic lineup construction and contest analysis.
Draft Groups in Lobby
dk_get_lobby_draft_groups()
List all the draft groups in the Draft Kings lobby
The dk_get_lobby_draft_groups()
function retrieves information about all available draft groups in the DraftKings lobby. A draft group represents a set of players available for drafting in a particular contest or set of contests. This function can be used to get an overview of the current draft groups across different sports.
draft_groups <- dk_get_lobby_draft_groups()
draft_groups |>
dplyr::select(draft_group_id, game_type, sport, start_date, game_count) |>
head(5)
#> # A tibble: 5 × 5
#> draft_group_id game_type sport start_date game_count
#> <dbl> <lgl> <chr> <chr> <dbl>
#> 1 105573 NA NFL 2024-09-06T00:20:00.0000000Z 16
#> 2 109136 NA NFL 2024-09-08T17:00:00.0000000Z 12
#> 3 112446 NA SOC 2024-09-04T19:00:00.0000000Z 3
#> 4 112460 NA NBA 2024-09-03T23:00:00.0000000Z 4
#> 5 112461 NA NBA 2024-09-04T02:00:00.0000000Z 1
Draft Group Info
dk_get_draft_group()
Get detailed draft group info by draft group ID
The dk_get_draft_group()
function provides detailed information about a specific draft group. This includes data such as the sport, game type, start time, and various rules and settings for the draft group. You can use either the draft group ID directly or provide a contest key, and the function will automatically retrieve the corresponding draft group ID.
dk_get_draft_group(draft_group_id = 75284) |>
dplyr::select(draftable_id, display_name, player_id, salary, position, status, team_abbreviation, team_id, competition_id, competition_name, competition_start_time)
#> # A tibble: 106 × 11
#> draftable_id display_name player_id salary position status team_abbreviation
#> <dbl> <chr> <dbl> <dbl> <chr> <chr> <chr>
#> 1 24633208 Lamar Jackson 877745 18300 QB None BAL
#> 2 24633209 Ja'Marr Chase 1109979 16500 WR None CIN
#> 3 24633210 Joe Burrow 878785 15900 QB None CIN
#> 4 24633211 Mark Andrews 820699 14400 TE None BAL
#> 5 24633212 Joe Mixon 820727 13200 RB None CIN
#> 6 24633213 Tee Higgins 978579 12300 WR None CIN
#> 7 24633261 Lamar Jackson 877745 12200 QB None BAL
#> 8 24633262 Ja'Marr Chase 1109979 11000 WR None CIN
#> 9 24633263 Joe Burrow 878785 10600 QB None CIN
#> 10 24633214 J.K. Dobbins 976513 10500 RB None BAL
#> # ℹ 96 more rows
#> # ℹ 4 more variables: team_id <dbl>, competition_id <dbl>,
#> # competition_name <chr>, competition_start_time <chr>
dk_get_draft_group_info()
Get draft group info
The dk_get_draft_group_info()
function provides a different set of information compared to dk_get_draft_group()
. While dk_get_draft_group()
focuses on player-specific data within a draft group, dk_get_draft_group_info()
offers a higher-level overview of the draft group itself and associated game information.
Key differences include:
Structure:
dk_get_draft_group_info()
returns a list with three main components: info, games, and leagues.Draft Group Details: It provides overall draft group information such as sport_id, start_time_suffix, draft_group_state, and game_type.
Game Information: Unlike
dk_get_draft_group()
, it includes detailed game data like location, time_remaining_status, and sport-specific scores.League Data: It also includes league-specific information not present in
dk_get_draft_group()
.
This function is particularly useful when you need broader context about the draft group, its associated games, and league, rather than individual player details.
Here’s an example of how to use the function:
dgi <- dk_get_draft_group_info(draft_group_id = 75284)
info <- dgi$info
games <- dgi$games
leagues <- dgi$leagues
info |> dplyr::select(sport, start_time_suffix, draft_group_state, game_type)
#> # A tibble: 1 × 4
#> sport start_time_suffix draft_group_state game_type
#> <chr> <chr> <chr> <chr>
#> 1 NFL " (CIN vs BAL)" Historical SalaryCap
games |> dplyr::select(game_id, away_team_id, home_team_id, start_date, location)
#> # A tibble: 1 × 5
#> game_id away_team_id home_team_id start_date location
#> <int> <int> <int> <chr> <chr>
#> 1 5819761 327 366 2022-10-10T00:20:00.0000000Z M&T Bank Stadi…
leagues |> dplyr::select(league_id, league_name, league_abbreviation)
#> # A tibble: 1 × 3
#> league_id league_name league_abbreviation
#> <int> <chr> <chr>
#> 1 1 National Football League NFL
dk_get_draft_group_info2()
Get more draft group info
The dk_get_draft_group_info2()
function provides more information compared to dk_get_draft_group_info()
. Key differences include:
- Structure:
-
dk_get_draft_group_info()
: 3 components (info, games, leagues) -
dk_get_draft_group_info2()
: 6 components (draft_groups, game_types, game_styles, sports, competitions, competition_attributes)
-
- Unique to
dk_get_draft_group_info()
:- Detailed game-specific data like scores and quarter information
- Additional in
dk_get_draft_group_info2()
:- More draft group details (e.g., sort_order, game_set_key)
- Separate game_types and game_styles components
- Detailed sports data
- Expanded competition information (e.g., weather, venue)
- Competition attributes
dk_get_draft_group_info2()
is particularly useful for: - Analyzing contest rules and formats - Accessing detailed sport and competition attributes - Obtaining weather and venue information
Example usage:
dgi2 <- dk_get_draft_group_info2(draft_group_id = 75284)
dgi2 |> names()
#> [1] "draft_groups" "game_types" "game_styles"
#> [4] "sports" "competitions" "competition_attributes"
dgi2$draft_groups |>
dplyr::select(draft_group_id, contest_type_id, draft_group_state, min_start_time, max_start_time)
#> # A tibble: 1 × 5
#> draft_group_id contest_type_id draft_group_state min_start_time max_start_time
#> <int> <int> <chr> <chr> <chr>
#> 1 75284 96 Historical 2022-10-10T00… 2022-10-10T00…
dgi2$competitions |>
dplyr::select(competition_id, name, start_time, venue, weather_icon)
#> # A tibble: 1 × 5
#> competition_id name start_time venue weather_icon
#> <int> <chr> <chr> <chr> <chr>
#> 1 5819761 CIN @ BAL 2022-10-10T00:20:00.0000000Z M&T Bank S… clear-night
Player and Team Data
dk_get_player_list()
Get list of players for a draft group
The dk_get_player_list()
function retrieves a detailed list of players available for drafting in a specific draft group. This function is similar to dk_get_draft_group()
and is useful for analyzing the player pool, understanding salary constraints, and making informed decisions when building lineups. Here’s a breakdown of what this function provides:
- Player details: Names, positions, team affiliations
- Fantasy-relevant information: Salary, projected points, recent performance
- Game-specific data: Opponent, game time, location
- Additional metadata: Player IDs, roster slot IDs, status
This information is particularly useful for: - Conducting pre-draft research - Identifying value picks based on salary and projected points - Analyzing matchups and game conditions - Building optimized lineups within salary constraints
Let’s examine the output:
dk_get_player_list(draft_group_id = 75284) |>
dplyr::select(player_id, first_name, last_name, position, salary, points_per_game, own_rate, is_swappable, in_play_contest, pp, injury_status)
#> # A tibble: 53 × 11
#> player_id first_name last_name position salary points_per_game own_rate
#> <dbl> <chr> <chr> <chr> <dbl> <chr> <dbl>
#> 1 877745 Lamar Jackson QB 12200 23.1 20
#> 2 1109979 Ja'Marr Chase WR 11000 17.4 9
#> 3 878785 Joe Burrow QB 10600 16.3 3
#> 4 820699 Mark Andrews TE 9600 12.6 30
#> 5 820727 Joe Mixon RB 8800 15.9 13
#> 6 978579 Tee Higgins WR 8200 12.0 9
#> 7 976513 J.K. Dobbins RB 7000 11.7 13
#> 8 1108208 Rashod Bateman WR 6400 4.7 20
#> 9 742387 Tyler Boyd WR 6200 8.8 9
#> 10 913163 Tyler Huntley QB 6000 5.1 20
#> # ℹ 43 more rows
#> # ℹ 4 more variables: is_swappable <lgl>, in_play_contest <lgl>, pp <dbl>,
#> # injury_status <chr>
dk_get_team_list()
Get list of teams for a draft group
The dk_get_team_list()
function retrieves information about the teams participating in a specific draft group. This function is useful for understanding the team composition within a contest and can provide valuable context for player selection and matchup analysis. Here’s what this function typically provides:
- Team identifiers: Team IDs and abbreviations
- Game-specific information: Home/away status, opponent
- Team metadata: Full team names, locations
This information is particularly useful for: - Analyzing team matchups - Identifying home and away teams - Cross-referencing team data with player information
Let’s examine the output:
dk_get_team_list(draft_group_id = 75284) |>
dplyr::select(home_team_abbreviation, away_team_abbreviation, competition_start_time, game_status)
#> # A tibble: 1 × 4
#> home_team_abbreviation away_team_abbreviation competition_start_time
#> <chr> <chr> <dttm>
#> 1 BAL CIN 2022-10-09 20:20:00
#> # ℹ 1 more variable: game_status <chr>
dk_get_player_fp()
Get player fantasy points earned
The dk_get_player_fp()
function retrieves fantasy points earned by players for a specific sport, season, and timeframe. Data starts on October 18th, 2022 for NBA.
# `timeframe` represents the week of the season for NFL
dk_get_player_fp(sport = "nfl", season = 2023, timeframe = 10) |>
dplyr::select(player_id, first_name, last_name, team_id, position, salary, fantasy_points, competition_id, points, sport)
#> # A tibble: 286 × 10
#> player_id first_name last_name team_id position salary fantasy_points
#> <dbl> <chr> <chr> <dbl> <chr> <dbl> <dbl>
#> 1 557210 Keenan Allen 357 WR 8800 43.5
#> 2 1062020 CeeDee Lamb 331 WR 8500 42.5
#> 3 591816 Dak Prescott 331 QB 6700 41.9
#> 4 607864 Brandin Cooks 331 WR 4200 35.3
#> 5 1127106 Amon-Ra St. Brown 334 WR 8300 33.5
#> 6 923915 T.J. Hockenson 347 TE 5000 33.4
#> 7 910562 Justin Herbert 357 QB 7700 32.4
#> 8 973966 Brian Robinson Jr. 363 RB 5400 30.7
#> 9 593587 Mike Evans 362 WR 7200 29.3
#> 10 1168245 Sam Howell 363 QB 5900 28.2
#> # ℹ 276 more rows
#> # ℹ 3 more variables: competition_id <dbl>, points <dbl>, sport <chr>
dk_get_competitions()
Get competitions associated to a draft group
The dk_get_competitions()
function retrieves detailed information about the competitions associated with a specific draft group.
dk_get_competitions(draft_group_id = 75284) |>
dplyr::select(competition_id, start_time, home_team_team_name, away_team_team_name, sport, competition_state)
#> # A tibble: 1 × 6
#> competition_id start_time home_team_team_name away_team_team_name sport
#> <int> <chr> <chr> <chr> <chr>
#> 1 5819761 2022-10-10T00:20… Ravens Bengals NFL
#> # ℹ 1 more variable: competition_state <chr>