pagetitle | output | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pinnacle.API |
|
The Pinnacle manual can be found here :
http://www.pinnacle.com/en/api/manual
To use the Pinnacle API you must have an account with Pinnacle.
Please contact Pinnacle directly at [email protected] for all account questions.
This package is a GUIDELINE only.
All responsibility of activity on Pinnacle lies with the user of the package and NOT with the authors of the package.
Especially wagers placed with the help of this package are the sole responsibility of the user of this package. The authors and maintainers of the package are not liable or responsible in any form. Please see Manual:Fair-Use, API Rules and Terms and Conditions
http://www.pinnacle.com/en/termsandconditions
The API is not accessible from all IP-Ranges. For example, IP addresses from the UK and the USA are Geo IP blocked.
This document covers version >= 2.0 of the package and is intended to be an introduction to the package, it does Not cover all functions.
For a more detailed breakdown, we recommend you explore the functions in the package
The pinnacle.API
package allows an R user to Access:
- Pinnacle's API feed,
- Pregame/Live Odds and Fixtures,
- Personal Settled/Running Wagers,
- Balance Information
While also allowing the usage of this data by
- Placing wagers/parlays.
Detailed information about what is available is in the Pinnacle API Manual: https://www.pinnacle.com/en/api/manual
The most recent stable version is on CRAN, and can be installed with:
install.packages('pinnacle.API')
Development versions are available via github, and can be installed with the devtools package
install.packages('devtools')
devtools::install_github('marcoblume/pinnacle.API')
the package depends on:
data.table
version >= 1.10openssl
httr
jsonlite
uuid
purrr
magrittr
load and configure it as follows:
library(pinnacle.API)
Please make sure that you understand the terms and conditions.
AcceptTermsAndConditions()
Run the following to store your session credentials:
SetCredentials()
Your credentials are the username and password for logging into www.pinnacle.com.
Pull the Sport Data and filter out the leagues that have lines for Soccer available.
# Get Sports
sport_data <- GetSports()
# Get Soccer id
soccer_id <- with(sport_data, id[name == 'Soccer'])
# Get Odds
soccer_data <- showOddsDF(soccer_id)
# Lets select a single record and see what we're looking at
# (transposed for easier reading)
A Record Example:
Data | |
---|---|
league.id | 2117 |
leagues.events.id | 706786965 |
sportId | 29 |
last | 379958992 |
leagues.id | 2117 |
events.periods.lineId | 379958992 |
events.periods.number | 0 |
events.periods.cutoff | 2017-03-22T19:00:00Z |
events.periods.maxSpread | 2000 |
events.periods.maxMoneyline | 500 |
events.periods.maxTotal | 2000 |
events.periods.maxTeamTotal | 750 |
periods.spreads.hdp | -1.25 |
periods.spreads.home | -118 |
periods.spreads.away | 108 |
periods.spreads.altLineId | NA |
periods.totals.points | 2.5 |
periods.totals.over | -107 |
periods.totals.under | -104 |
periods.totals.altLineId | NA |
periods.moneyline.home | -289 |
periods.moneyline.away | 957 |
periods.moneyline.draw | 358 |
teamTotal.home.points | 2 |
teamTotal.home.over | 101 |
teamTotal.home.under | -123 |
teamTotal.away.points | 0.5 |
teamTotal.away.over | 108 |
teamTotal.away.under | -133 |
leagues.events.awayScore | 0 |
leagues.events.homeScore | 0 |
leagues.events.awayRedCards | 0 |
leagues.events.homeRedCards | 0 |
sportId.Fixture | 29 |
last.Fixture | 102176288 |
league.events.starts | 2017-03-22T17:00:00Z |
league.events.home | Czech Republic |
league.events.away | Lithuania |
league.events.rotNum | 30904 |
league.events.liveStatus | 1 |
league.events.status | I |
league.events.parlayRestriction | 2 |
sports.id | 29 |
sports.leagues.id | 2117 |
leagues.events.state | 1 |
leagues.events.elapsed | 5 |
leagues.name | International - Friendlies |
leagues.homeTeamType | Team1 |
leagues.hasOfferings | TRUE |
leagues.container | |
leagues.allowRoundRobins | TRUE |
leagues.leagueSpecialsCount | 0 |
leagues.eventSpecialsCount | 13 |
leagues.eventCount | 13 |
GetClientBalance()
## $availableBalance
## [1] 3896.54
##
## $outstandingTransactions
## [1] 3522
##
## $givenCredit
## [1] 1e+05
##
## $currency
## [1] "USD"
Sports <- GetSports()
head(Sports)
BasketBallLeagues <- GetLeaguesByID(4)
# Get first 5 entries Basketball Leagues
head(BasketBallLeagues)
# Get Basketball Fixtures
BasketballFixtures <- GetFixtures(4)
head(BasketballFixtures)
# Get Live Basketball Fixtures
LiveBasketballFixtures <- GetFixtures(4, islive = 1)
head(LiveBasketballFixtures)
# Get Basketball Odds
BasketballOdds <- GetOdds(4)
head(BasketballOdds)
# Get Live Basketball Odds
LiveBasketballOdds <- GetOdds(4, islive = 1)
head(LiveBasketballOdds)
Combines the GetOdds
, GetFixtures
, and GetInrunning
Calls, to get one picture of lines
Column names are slightly different than in the above calls, in that only the last 3 identifiers are kept
sport.leagues.events.periods.periodNumber
becomes
events.periods.periodNumber
This is done to make the tables easier to work with, but can be overridden (see ?showOddsDF
)
(Default is to show only mainlines, alternate lines are accessible via the tableFormat
option)
# Get Basketball oddsDF
BasketballOddsDF <- showOddsDF(4)
head(BasketballOddsDF)
Once we have our odds information, we can use this to make a bet, or string of bets
for the following example, we will place a bet of $0.01
(Below the minimum bet amount) on the favorite MONEYLINE
BasketballOddsDF <- showOddsDF(4,tableFormat = 'mainlines')
Record example (filtered to only the interesting fields):
Data | |
---|---|
sportId | 4 |
leagues.events.id | 704584684 |
events.periods.number | 0 |
events.periods.lineId | 379913314 |
events.periods.maxMoneyline | 250 |
periods.moneyline.home | -477 |
periods.moneyline.away | 353 |
Now we can use those details to fill out the PlaceBet arguments
PlaceBet(
stake = 0.01,
sportId = 4,
eventId = 704584684,
periodNumber = 0,
lineId = 379913314,
betType = 'MONEYLINE',
team = 'TEAM1'
)
Here, our stake is below the minimum amount, as we can see in the error message that is returned
List of 5:
- status : chr "PROCESSED_WITH_ERROR"
- errorCode : chr "BELOW_MIN_BET_AMOUNT"
- betId : NULL
- uniqueRequestId : chr "b9d95cf0-54bf-47ee-bad5-4a6dc557da7a"
- betterLineWasAccepted: logi FALSE
If we do it for a larger amount:
PlaceBet(
stake = 500,
sportId = 4,
eventId = 704584684,
periodNumber = 0,
lineId = 379913314,
betType = 'MONEYLINE',
team = 'TEAM1'
)
List of 6:
- status : chr "ACCEPTED"
- errorCode : NULL
- betId : int 706865959
- uniqueRequestId : chr "5acf90ff-bbde-4449-af28-b0db7534e249"
- betterLineWasAccepted: logi FALSE
- price : num -477