Having logged in using the betfair
function, the environment contains the eventTypes
method. This method can be used to get the number of events that belong to an event type, eg. Football, Horse Racing, etc.
bf$eventTypes(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 eventTypes, with data about the number of markets.
variable | details |
---|---|
eventType_id |
the eventType id |
eventType_name |
the eventType name (eg. Football, Horse Racing) |
marketCount |
number of markets associated with this country |
library(betfaiR)
# login
bf <- betfair(usr = Sys.getenv("bf_usr"),
pwd = Sys.getenv("bf_pwd"),
key = Sys.getenv("bf_key"))
Login successful
# return all countries
tmp <- bf$eventTypes()
head(tmp)
eventType_id eventType_name marketCount
1 1 Soccer 8074
2 2 Tennis 1565
3 3 Golf 34
4 4 Cricket 180
5 5 Rugby Union 64
6 1477 Rugby League 23
# return all horse racing events
tmp <- bf$eventTypes(filter = marketFilter(marketCountries = "GB"))
head(tmp)
eventType_id eventType_name marketCount
1 1 Soccer 1672
2 2 Tennis 19
3 7522 Basketball 1
4 3 Golf 6
5 4 Cricket 7
6 7524 Ice Hockey 7
# return all horse racing events whose start date is beyond next week
tmp <- bf$eventTypes(filter = marketFilter(eventTypeIds = 7, from = Sys.Date() + 7))
head(tmp)
eventType_id eventType_name marketCount
1 7 Horse Racing 86