Package 'oddsrelay'

Title: Client for the 'OddsRelay' Sports Odds API
Description: Provides one function for each read endpoint of the 'OddsRelay' web service <https://oddsrelay.io/docs>, which serves bookmaker and exchange odds for the UK and Ireland. Requests ask for compressed replies, send entity tags so that unchanged data is not transferred again, wait as the service asks when it is busy, and signal refusals as classed conditions that carry the service's error code and request id. Replies are returned as lists and data frames, with the token and rate limit headers attached as attributes.
Authors: James OddsRelay [aut, cre], OddsRelay [cph]
Maintainer: James OddsRelay <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-10-22 10:12:57 UTC
Source: https://github.com/oddsrelay/oddsrelay-r

Help Index


Matched boards and raw odds

Description

or_odds() reads one matched board, where each selection pairs bookmaker back prices with exchange lay prices. or_raw() reads bookmaker and exchange prices by event, unpaired, a page at a time. or_event() reads one event's raw prices. These calls spend tokens: pass quote = TRUE to learn what a call costs without making it.

Usage

or_odds(type, ..., .key = NULL)

or_raw(..., .key = NULL)

or_event(id, ..., .key = NULL)

Arguments

type

The board: "standard", "2up", "dutching", "each-way", "extra-place" or "bog".

...

Filters, named as in the API reference, such as region, sports, bookmakers or markets. snake_case names work too (odds_format is sent as oddsFormat). A vector is sent as one comma-separated value, TRUE as true, and a date-time as a UTC timestamp. The API refuses names and values it does not know.

.key

Your API key. Left out, it is read from the ODDSRELAY_KEY environment variable.

id

An event id: event_id on a board, or id on a raw page or an or_events() row.

Value

The decoded JSON body as a list, with arrays of records as data frames; a format = "bare" call returns the data frame alone. The reply's token and rate limit headers ride along as attributes: see oddsrelay-package.

Examples

# What would it cost?
or_odds("standard", region = "uk", sports = "soccer", quote = TRUE)

board <- or_odds("standard", region = "uk", sports = "soccer", markets = "h2h")
board$data[, c("commence_time", "home_team", "away_team")]
attr(board, "tokens")

page <- or_raw(region = "uk", sports = "tennis", limit = 50)
page$meta$next_cursor

Sports, events, bookmakers and regions

Description

The keys the odds calls filter on. or_sports() lists sport and competition keys and or_events() the upcoming events for one sport key, both a page at a time (pass meta$next_cursor back as cursor). or_bookmakers() lists the bookmakers and exchanges with their keys, and or_regions() the region codes open to your key. These calls spend no tokens.

Usage

or_sports(..., .key = NULL)

or_events(sport, ..., .key = NULL)

or_bookmakers(..., .key = NULL)

or_regions(.key = NULL)

Arguments

...

Filters, named as in the API reference, such as region, sports, bookmakers or markets. snake_case names work too (odds_format is sent as oddsFormat). A vector is sent as one comma-separated value, TRUE as true, and a date-time as a UTC timestamp. The API refuses names and values it does not know.

.key

Your API key. Left out, it is read from the ODDSRELAY_KEY environment variable.

sport

A sport key from or_sports().

Value

The decoded JSON body as a list, with arrays of records as data frames; a format = "bare" call returns the data frame alone. The reply's token and rate limit headers ride along as attributes: see oddsrelay-package.

Examples

sports <- or_sports(region = "uk")
head(sports$data[, c("key", "title")])

or_events("tennis", region = "uk")
or_bookmakers(format = "bare")
or_regions()

Service state

Description

or_status() says whether each product is serving and needs no key. or_coverage() lists which bookmakers, exchanges and sports each product carries; it needs no key, and gives more detail with one. or_health() says when each board was last processed and whether any is behind. or_healthz() is a plain-text liveness check and or_openapi() returns the API description; neither needs a key.

Usage

or_status(..., .key = NULL)

or_coverage(..., .key = NULL)

or_health(.key = NULL)

or_healthz()

or_openapi()

Arguments

...

Filters, named as in the API reference, such as region, sports, bookmakers or markets. snake_case names work too (odds_format is sent as oddsFormat). A vector is sent as one comma-separated value, TRUE as true, and a date-time as a UTC timestamp. The API refuses names and values it does not know.

.key

Your API key. Left out, it is read from the ODDSRELAY_KEY environment variable.

Value

As for or_odds(). or_healthz() returns a single string and or_openapi() a list that keeps the description's own structure.

Examples

or_status(region = "uk")
names(or_coverage(region = "uk")$products)
cat(or_healthz())
or_openapi()$info$version

Your account

Description

or_usage() returns the tokens your account has used and has left, and what your key may read. or_pricing() returns the token rate card. Neither spends tokens.

Usage

or_usage(.key = NULL)

or_pricing(.key = NULL)

Arguments

.key

Your API key. Left out, it is read from the ODDSRELAY_KEY environment variable.

Value

The decoded JSON body as a list, with arrays of records as data frames; a format = "bare" call returns the data frame alone. The reply's token and rate limit headers ride along as attributes: see oddsrelay-package.

Examples

or_usage()$tokens
or_pricing()