R client for ParlayAPI, a real-time sports odds API with 30+ sportsbook sources, player props and historical endpoints. Availability varies by sport, bookmaker, market, date and account access. The package provides HTTP clients and local calculations for devigging and Kelly sizing; those calculations depend on their inputs and do not establish a profitable betting strategy.
Browse the searchable R function reference for package arguments, return values and examples.
Try a fictional board with pa_odds("nba", sandbox = TRUE). The sandbox
also provides sports, scores and player props. Price calculations run locally.
For historical odds or closing lines, check your account’s archive access
and the request cost before using your key.
Rebuild what was known at a decision time compares the price a backtest would assign with the quote the analyst had received. Try eight cutoffs in your browser, inspect the illustrated timeline, or run the fictional replay offline. For two bookmakers, compare the recorded prices at one cutoff and see when a withdrawal or a source-age limit rules out the comparison.
Score two pregame basketball models that both picked eight of twelve winners. Download the fictional games and run the same Brier-score comparison on your own saved forecasts in base R.
Choose the right fixture for a two-sided report uses two games between the same teams. Download the base-R exercise to see which away price the editor could publish at each deadline.
Prevent accidental many-to-many joins in R uses synthetic quotes to show why event, period, outcome and handicap line belong in a comparison key. Run it with base R, no packages or API key.
Featured as a Highlight in R Weekly 2026-W38. The tutorial includes a next step for checking your own books, markets and request budget before selecting a paid plan.
Where did 49 NFL team-games go? Compare two ways of counting teams that made an extra point. The offline RStudio project includes the 2025 game and kicker tables.
Use the free API workload planner to record active time, refresh interval, required endpoints and pages, separately polled sports and active days. It needs no key and makes no API request. Leave credit cost unknown until you verify the cost for your exact request shape.
For several request shapes with different or unknown unit costs, use the offline request-budget kit. It includes a CSV template, exact JSON export and a self-contained notebook for Python 3.9 or later. Unpriced work keeps the total credit estimate unknown.
The released package is available from R-multiverse Community. In R, install it and check one American price locally:
install.packages(
"parlayapiR",
repos = c(Community = "https://community.r-multiverse.org",
CRAN = "https://cloud.r-project.org"),
type = "source"
)
packageVersion("parlayapiR")
parlayapiR::pa_american_to_decimal(150)
# 2.5The calculation uses no API key or sports data request. Source installs may require compilation tools for dependencies. You can also use the maintainer's package repository:
install.packages(
"parlayapiR",
repos = c(ParlayAPI = "https://jacobiusmakes.github.io/parlayapiR/r",
CRAN = "https://cloud.r-project.org"),
type = "source"
)
packageVersion("parlayapiR")This repository supports R 4.1 or later. For development builds, use pak::pak("JacobiusMakes/parlayapiR"). The CRAN submission notes track the separate CRAN process.
Open the webR console and paste the following. The first line downloads the community WebAssembly package and its dependencies into the browser session. The second runs locally.
webr::install("parlayapiR", repos = c("https://community.r-multiverse.org", "https://repo.r-wasm.org"))
parlayapiR::pa_american_to_decimal(150)
# 2.5Use the documented R package for this keyless example. The sandbox returns fictional NBA events with team names, scores and a completion flag.
games <- parlayapiR::pa_scores("basketball_nba", sandbox = TRUE)
finals <- games[games$completed %in% TRUE, ]
if (nrow(finals)) finals$scores[[1]]These examples list fictional sports and inspect game odds and player props from the keyless sandbox.
library(parlayapiR)
pa_sports(sandbox = TRUE)
# Short league names work too, including nba, nfl, mlb, nhl and epl.
events <- pa_odds("nba", markets = "h2h", sandbox = TRUE)
events$home_team
props <- pa_props("basketball_nba", sandbox = TRUE)
head(props[, c("bookmaker", "player_name", "market_key", "line",
"over_price", "under_price")])The math functions never touch the network at all:
# Remove the bookmaker margin from a -110 / -110 market
# Both sides of one fictional two-way market quoted by the same book
100 * pa_hold(c(-110, -110), odds_format = "american")
#> [1] 4.761905
pa_devig(c(-110, -110), odds_format = "american")
#> implied fair_prob fair_decimal
#> 1 0.5238095 0.5 2
#> 2 0.5238095 0.5 2
# Three-way market, power method (shrinks long shots harder)
pa_devig(c(2.45, 3.40, 3.10), method = "power")
# Kelly stake: 55% win probability at +110, quarter Kelly, 1000 bankroll
pa_kelly(0.55, +110, odds_format = "american", fraction = 0.25,
bankroll = 1000)Once your sandbox request works, create a free account to get your own API key. Check the current plans and credit allowances for your workload. Set the key in your R session before making a live request.
pa_auth("your-api-key") # or set PARLAY_API_KEY in .Renviron
events <- pa_odds("basketball_nba", markets = "h2h,spreads,totals")
props <- pa_props("baseball_mlb", markets = "player_strikeouts")
# Closing lines, the calibration target for backtests
closes <- pa_closing_odds("basketball_nba", season = "2024")Start with the free archive lookup for your sport and source. The earliest and latest dates can have gaps between them. Choose a UTC game date inside your plan's lookback. When you are ready to spend credits, this request uses 10 for one region and one moneyline market, even if the lookup returns no events.
# Replace the example date with your chosen UTC game date.
games <- pa_historical("basketball_nba", date = "2026-11-29",
regions = "us", markets = "h2h")Passing a timestamp still selects its first ten characters for the game-date lookup. For example, 2026-11-29T23:30:00-05:00 falls on November 30 UTC. Pass "2026-11-30" if that is the game date you intend. To replay the price your system saw at a particular time, retain timestamped quote arrivals as shown in the decision-time tutorial.
| Function | What it does |
|---|---|
pa_sports() |
List available sports |
pa_odds() |
Game odds across books, The Odds API v4 event shape |
pa_props() |
Player props as a flat over/under quote table |
pa_historical() |
Available archived game odds for a UTC game date |
pa_closing_odds() |
Historical closing lines, including prop closes |
pa_hold() |
Calculate quoted overround for one complete market |
pa_devig() |
Remove the vig: multiplicative, additive, or power |
pa_kelly() |
Kelly criterion stake sizing (vectorized, clamped at 0) |
pa_implied_prob(), pa_american_to_decimal(), pa_decimal_to_american() |
Odds conversions |
pa_auth(), pa_sandbox() |
Key management and sandbox toggle |
Compare two fictional basketball books in R. The Comets are −110 at North and +105 at South. Use the four moneyline quotes bundled with the package to find the best price for each team, then see how changing your win estimate from 50% to 48% changes the expected return. The exercise runs offline after installation. The last section includes an optional, metered request for current NBA odds.
To open the vignette from an installed copy of version 0.1.8:
vignette("line-shopping-and-devigging", package = "parlayapiR")pa_odds() uses nested event, bookmaker, market and outcome objects and
accepts familiar filters such as regions, markets and bookmakers. Check
the actual returned R structures, supported parameters, event identities
and odds formats when migrating an existing client. Similar JSON shapes
do not guarantee unchanged parsing or equivalent coverage.
pa_devig()implements the multiplicative, additive, and power methods and returns the overround as an attribute. For a broader set of devigging methods (Shin, odds ratio, and others), see theimpliedpackage on CRAN; the two compose fine sincepa_devig()accepts raw probabilities too.pa_kelly()matches the semantics of the keyless/v1/calc/kellyendpoint, including clamping negative-edge stakes to zero.- WebSocket streaming exists on the API (Business tier and up) but is not wrapped here; this package is deliberately plain HTTP.
Use your own account and API key for personal analysis or internal tools. The package's code license does not grant rights to publicly display odds, share a data feed or redistribute API data. Sandbox examples are synthetic; inspect actual coverage and source timestamps when working with your key.
MIT. R packages are often GPL-licensed by tradition, but MIT is fully
CRAN-compatible (via the standard MIT + file LICENSE template) and
matches the rest of the ParlayAPI SDK family.
Part of the ParlayAPI ecosystem: a real-time sports odds API with a free tier of 1,000 credits per month, no card required. Explore all the tools at github.com/JacobiusMakes.