Having logged in using the betfair
function, the environment contains the competitions
method. Which can be used to get competitions (eg. World Cup 2014) associated with various markets.
bf$competitions(filter = marketFilter())
param | details |
---|---|
filter |
select desired markets, see marketFilter for various parameters to filter by, or the relevant help pages on Betfair. If nothing is entered, all competitions are returned |
The function returns a dataframe of competitions associated with the markets selected by the filter
parameter, the dataframe contains the following:
variable | details |
---|---|
competition_id |
competition id |
competition_name |
competition name |
marketCount |
number of markets associated with the competition |
competitionRegion |
region in which this competition is happening |
library(betfaiR)
# login
bf <- betfair(usr = Sys.getenv("bf_usr"),
pwd = Sys.getenv("bf_pwd"),
key = Sys.getenv("bf_key"))
Login successful
# return all competitions
tmp <- bf$competitions()
head(tmp)
competition_id competition_name marketCount competitionRegion
1 10546336 Cricket Specials 2016 1 GBR
2 10526369 Eurocup Men 24 International
3 9233037 World Championship 2017 1 GBR
4 12801 Spanish Cup 202 ESP
5 16901 Aviva Premiership 2 International
6 9249930 Biathlon 2016/2017 2 GBR
# return all football competitions
tmp <- bf$competitions(filter = marketFilter(eventTypeIds = 1))
head(tmp)
competition_id competition_name marketCount competitionRegion
1 12801 Spanish Cup 202 ESP
2 832265 Brazilian Pernambucano 24 BRA
3 11 Dutch Jupiler League 196 NLD
4 15 Bulgarian Premier 1 BGR
5 23 Danish Superliga 15 DNK
6 821269 Tercera Division 24 ESP