betfaiR

The betfaiR package provides R users full access to the Betfair API, retrieving data and placing bets. A vignette showing how to locate a market, place a bet, replace a bet, and then cancel a bet is available.

The primary function of the package is betfair which requires users to enter their login details, including an API key (see Betfair documentation on how to get an API key). The function returns an environment with various methods for querying and retrieving data from Betfair.

This is not to say that it is the only way to use this package, all the functions that betfair uses are available, but betfair aims to keep the workspace free of unnecessary variables as queries are developed and saved.

The betfair function logs in, and for each of the methods the following functions are called:

step function arguments details return
1 bf_login usr, pwd, key login function with betfair username, password, and key list with a session token
2 bf_basic_req filter, method builds a basic request object list with class that matches method param
3 bf_request x, fleshes out the request object json object ready to be included in a POST request
4 bf_post body betfair POST, includes the request object returned in step 3, and the session token returned in 1 response object
5 httr::content response response object to be parsed into a list list with data
6 bf_check response, method check the response is valid, log errors if not, apply class method to list ahead of step 7 list
7 bf_parse response parses the response object list of dataframes or dataframe

To Do List

Add issues here