| Title: | Client for the 'SharpAPI' Real-Time Sports Betting Odds API |
|---|---|
| Description: | Access real-time sports betting odds, no-vig fair odds, expected value (+EV) and arbitrage opportunities from the 'SharpAPI' REST API <https://sharpapi.io>. Covers 45+ sportsbooks normalized into one schema. Requires a 'SharpAPI' key; a free tier is available. |
| Authors: | SharpAPI [aut, cre, cph] |
| Maintainer: | SharpAPI <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-09-24 10:46:36 UTC |
| Source: | https://github.com/Sharp-API/SharpAPI-R |
Requires a Hobby tier key or higher.
sharpapi_arbitrage(...)sharpapi_arbitrage(...)
... |
Filters passed to the API. |
A data frame with one row per arbitrage opportunity. Columns
include event_id, sport, market_type and profit_percent. The
individual sides live in a nested legs column rather than as top-level
fields. A key below the Hobby tier raises an HTTP error rather than
returning an empty frame.
# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"event_id": "evt-1", "sport": "baseball", "market_type": "moneyline", "profit_percent": 1.8} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_arbitrage(sport = "baseball")) }) } if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { arb <- sharpapi_arbitrage(sport = "baseball") head(arb) }# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"event_id": "evt-1", "sport": "baseball", "market_type": "moneyline", "profit_percent": 1.8} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_arbitrage(sport = "baseball")) }) } if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { arb <- sharpapi_arbitrage(sport = "baseball") head(arb) }
Requires a Pro tier key or higher.
sharpapi_ev(...)sharpapi_ev(...)
... |
Filters passed to the API. |
A data frame with one row per +EV opportunity. Columns include
event_id, sportsbook, market_type, selection and ev_percentage.
A key below the Pro tier raises an HTTP error rather than returning an
empty frame.
# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"event_id": "evt-1", "sportsbook": "draftkings", "market_type": "moneyline", "selection": "Yankees", "ev_percentage": 3.42} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_ev(sport = "baseball")) }) } if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { ev <- sharpapi_ev(sport = "baseball") head(ev) }# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"event_id": "evt-1", "sportsbook": "draftkings", "market_type": "moneyline", "selection": "Yankees", "ev_percentage": 3.42} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_ev(sport = "baseball")) }) } if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { ev <- sharpapi_ev(sport = "baseball") head(ev) }
Current odds as a data frame
sharpapi_odds(...)sharpapi_odds(...)
... |
Filters passed to the API, e.g. sport = "soccer", league = "mlb", sportsbook = "pinnacle", market_type = "moneyline", limit = 500. |
A data frame with one row per odds line. Columns include
event_id, sportsbook, market_type, selection, odds_american,
odds_decimal and odds_probability.
# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"event_id": "evt-1", "sportsbook": "pinnacle", "market_type": "moneyline", "selection": "Yankees", "odds_american": -145, "odds_decimal": 1.69, "odds_probability": 0.5918} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_odds(sport = "baseball", limit = 5)) }) } if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { odds <- sharpapi_odds(sport = "baseball", limit = 5) head(odds) }# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"event_id": "evt-1", "sportsbook": "pinnacle", "market_type": "moneyline", "selection": "Yankees", "odds_american": -145, "odds_decimal": 1.69, "odds_probability": 0.5918} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_odds(sport = "baseball", limit = 5)) }) } if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { odds <- sharpapi_odds(sport = "baseball", limit = 5) head(odds) }
List sports with live event counts
sharpapi_sports()sharpapi_sports()
A data frame with one row per sport. Columns include id,
name, numerical_id, event_count and live_count.
# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"id": "baseball", "name": "Baseball", "numerical_id": 3, "event_count": 51, "live_count": 4} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_sports()) }) } # Requires SHARPAPI_KEY to be set; get a free key at https://sharpapi.io if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { sports <- sharpapi_sports() head(sports) }# Toy example. A canned response stands in for the API, so this block runs # offline -- no key, no network -- and returns the same shape a live call does. if (requireNamespace("withr", quietly = TRUE)) { json <- '{"data": [ {"id": "baseball", "name": "Baseball", "numerical_id": 3, "event_count": 51, "live_count": 4} ]}' mock <- function(req) { httr2::response( status_code = 200L, headers = list(`Content-Type` = "application/json"), body = charToRaw(json) ) } withr::with_envvar(c(SHARPAPI_KEY = "toy-key"), { httr2::with_mocked_responses(mock, sharpapi_sports()) }) } # Requires SHARPAPI_KEY to be set; get a free key at https://sharpapi.io if (nzchar(Sys.getenv("SHARPAPI_KEY"))) { sports <- sharpapi_sports() head(sports) }