Skip to contents

Get the odds for the sports which the Odds API provides coverage

   try(toa_sports_odds(sport_key = 'baseball_mlb', 
                       regions = 'us', 
                       markets = 'spreads', 
                       odds_format = 'decimal',
                       date_format = 'iso'))

Usage

toa_sports_odds(
  sport_key,
  regions = "us",
  markets = "spreads",
  odds_format = "decimal",
  date_format = "iso"
)

Arguments

sport_key

The sport_key to look up odds for. See toa_sports() for a full lookup of sport_key values.

regions

The region to pull odds from. Options include:

  • us

  • uk

  • us

  • eu

  • au Multiple can be specified if comma delimited.

markets

The type of odds to return. Multiple can be specified if comma delimited. Options include:

  • h2h

  • spreads

  • totals

odds_format

The format in which to return odds. Options include:

  • decimal

  • american

date_format

Date format. Options include:

  • iso

  • unix

Value

Sports for which The Odds API provides betting information for as a tibble:

col_nametypes
idcharacter
sport_keycharacter
sport_titlecharacter
commence_timecharacter
home_teamcharacter
away_teamcharacter
bookmaker_keycharacter
bookmakercharacter
last_updatecharacter
market_keycharacter
outcomes_namecharacter
outcomes_pricenumeric
outcomes_pointnumeric

Examples

# \donttest{
   try(toa_sports_odds(sport_key = 'basketball_nba', 
                       regions = 'us', 
                       markets = 'spreads', 
                       odds_format = 'decimal',
                       date_format = 'iso'))
#> ── Sports Odds data from the-odds-api.com ──────────── oddsapiR 0.0.2 ──
#>  Data updated: 2022-12-29 04:27:50 UTC
#> # A tibble: 220 × 14
#>    id    sport…¹ sport…² comme…³ home_…⁴ away_…⁵ bookm…⁶ bookm…⁷ bookm…⁸
#>    <chr> <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>  
#>  1 bb57… basket… NBA     2022-1… Sacram… Denver… draftk… DraftK… 2022-1…
#>  2 bb57… basket… NBA     2022-1… Sacram… Denver… draftk… DraftK… 2022-1…
#>  3 bb57… basket… NBA     2022-1… Sacram… Denver… points… Points… 2022-1…
#>  4 bb57… basket… NBA     2022-1… Sacram… Denver… points… Points… 2022-1…
#>  5 bb57… basket… NBA     2022-1… Sacram… Denver… fanduel FanDuel 2022-1…
#>  6 bb57… basket… NBA     2022-1… Sacram… Denver… fanduel FanDuel 2022-1…
#>  7 bb57… basket… NBA     2022-1… Sacram… Denver… barsto… Barsto… 2022-1…
#>  8 bb57… basket… NBA     2022-1… Sacram… Denver… barsto… Barsto… 2022-1…
#>  9 bb57… basket… NBA     2022-1… Sacram… Denver… twinsp… TwinSp… 2022-1…
#> 10 bb57… basket… NBA     2022-1… Sacram… Denver… twinsp… TwinSp… 2022-1…
#> # … with 210 more rows, 5 more variables: market_key <chr>,
#> #   market_last_update <chr>, outcomes_name <chr>,
#> #   outcomes_price <dbl>, outcomes_point <dbl>, and abbreviated
#> #   variable names ¹​sport_key, ²​sport_title, ³​commence_time,
#> #   ⁴​home_team, ⁵​away_team, ⁶​bookmaker_key, ⁷​bookmaker,
#> #   ⁸​bookmaker_last_update
# }