betfaiR

Having logged in using the betfair function, the environment contains the countries method. This method can be used to get countries and the number of markets in each, these two letter country codes can then be used to help filter and find desired markets.

usage

bf$countries(filter = marketFilter())

arguments

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

return

The function returns a dataframe of countries with available markets, and the number of markets:

variable details
countryCode the ISO-2 code, ISO-2 codes are available on wiki, examples include GB, IE, US, etc
marketCount number of markets associated with this country

examples

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$countries()
head(tmp)
  countryCode marketCount
1          GB        2261
2          PL           1
3          UA           1
4          CH           1
5          IE          68
6          DK          18
# return all countries with horse racing markets
tmp <- bf$countries(filter = marketFilter(eventTypeIds = 7))
head(tmp)
  countryCode marketCount
1          GB         205
2          IN           8
3          US         108
4          CL           9
5          NZ          16
6          AU         223