Having logged in using the betfair
function, the environment contains the marketTypes
method. This method can be used to get the various types of markets (eg. WINNER, HANDICAP, OVER_UNDER_25, etc), and the number of markets.
bf$marketTypes(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 marketTypes are returned |
The function returns a dataframe of market Types and the number of markets associated with that type.
variable | details |
---|---|
marketType |
the type of market (eg. WINNER, HANDICAP, OVER_UNDER_25) |
marketCount |
the number of markets currently available associated with this market type |
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$marketTypes()
head(tmp)
marketType marketCount
1 NONSPORT 52
2 WINNER 59
3 SPECIAL 111
4 STEWARDS 1
5 UNUSED 16
6 MATCH_BET 44
# return all horse racing events
tmp <- bf$marketTypes(filter = marketFilter(eventTypeIds = 7))
head(tmp)
marketType marketCount
1 SPECIAL 9
2 STEWARDS 1
3 RACE_WIN_DIST 5
4 OTHER_PLACE 141
5 WIN 219
6 PLACE 166
# return all horse racing events whose start date is beyond next week
tmp <- bf$marketTypes(filter = marketFilter(eventTypeIds = 7, from = Sys.Date() +
7))
head(tmp)
marketType marketCount
1 ANTEPOST_WIN 80
2 SPECIAL 6