Skip to contents

Fetches historical closing lines for model calibration and CLV analysis. Available books, markets and dates depend on the dataset and account. Requires an API key; errors in sandbox mode.

Usage

pa_closing_odds(
  sport,
  markets = "h2h",
  bookmakers = NULL,
  season = NULL,
  date = NULL,
  date_from = NULL,
  date_to = NULL,
  player = NULL,
  odds_format = c("american", "decimal"),
  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().

markets

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

bookmakers

Optional bookmaker keys to filter to.

season

Optional season filter, e.g. "2023".

date

Optional single date filter ("YYYY-MM-DD").

date_from, date_to

Optional date range filters.

player

Optional player name filter for prop closing lines.

odds_format

"decimal" or "american".

sandbox

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

Value

Parsed closing-lines data.

Examples

if (FALSE) { # \dontrun{
closes <- pa_closing_odds(
  "basketball_nba",
  markets = "h2h",
  date_from = "2024-01-01",
  date_to = "2024-01-07"
)
} # }