Skip to contents

Fetches current odds for a sport. The response uses the same event shape as The Odds API v4 (events containing bookmakers, each with markets, each with outcomes). Validate the returned R structures, identities and supported filters when migrating an existing client.

Usage

pa_odds(
  sport,
  regions = "us",
  markets = "h2h",
  odds_format = c("decimal", "american"),
  bookmakers = NULL,
  event_ids = NULL,
  commence_time_from = NULL,
  commence_time_to = NULL,
  sandbox = NULL
)

Arguments

sport

A sport key such as "basketball_nba" or a short league name such as "nba", "nfl", "nhl" or "epl". See pa_sports().

regions

Comma-separated regions string or character vector, default "us".

markets

Markets to include, e.g. "h2h,spreads,totals". Character vectors are collapsed with commas.

odds_format

"decimal" or "american".

bookmakers

Optional bookmaker keys to filter to.

event_ids

Optional event ids to filter to (live mode only).

commence_time_from, commence_time_to

Optional ISO 8601 bounds on event start time (live mode only).

sandbox

Logical or NULL. TRUE uses the keyless sandbox endpoint, FALSE the live endpoint, NULL (default) defers to the global pa_sandbox() toggle.

Value

A data frame of events with a bookmakers list-column.

Details

In sandbox mode the endpoint is keyless and serves synthetic events; sandbox prices are always American regardless of odds_format.

Examples

# \donttest{
events <- pa_odds("basketball_nba", markets = "h2h", sandbox = TRUE)
events$home_team
# }