betfaiR: betfair - Betfair Environment w/ methods

Description Usage Arguments Details Value Methods Examples

Description

Supply valid credentials, username, password and API key (see developer.betfair.com), returning a environment with methods (see Methods section below) for returning data from Betfair's API.

Usage

1
betfair(usr, pwd, key, jurisdiction = "default")

Arguments

usr

Betfair username

pwd

Betfair password

key

Betfair API key see developer.betfair.com

jurisdiction

login to different jurisdictions, enter "italy" for Italian exchange, "spain" for Spanish, and "romania" for Romanian

Details

filters can be used in a number of available methods, these filters are to be supplied as a list, the marketFilter function provides assistance in building the list.

Value

returns environment with functions for the various methods available for Betfair's API

Methods

account(pwd)

Return environment with methods for accessing data about your account

competitions(filter = marketFilter())

Retrieve data about the different competitions with current markets, see competitions, see marketFilter for filtering data.

countries(filter = marketFilter())

Retrieve data about the different countries hosting events, see countries, see competitions, see marketFilter for filtering data.

events(filter = marketFilter())

Retrieve data about the different events, see events, see competitions, see marketFilter for filtering data.

eventTypes(filter = marketFilter())

Retrieve data about the different event types, ie. sports, see eventTypes, see competitions, see marketFilter for filtering data.

venues(filter = marketFilter())

Retrieve data about the venues hosting racing, see venues, see competitions, see marketFilter for filtering data.

login(usr, pwd, key, jurisdiction)

Login in, a session token will be returned, over-writing the previous token when betfair(usr, pwd, key, jurisdiction) was used.

session()

Print details about the session, including login in details and session token.

marketBook(marketIds = list(), priceProjection = "EX_BEST_OFFERS", orderProjection = "EXECUTABLE", matchProjection = "NO_ROLLUP", getRunners = NULL)

Retrieve dynamic data about markets, data includes, prices, status of the market, status of selections, the traded volume, and the status of any orders in the market, see marketBook

marketCatalogue(filter = marketFilter(), marketProjection = "EVENT", sort = NULL, maxResults = 1, keepRules = FALSE)

Retrieve data about the different types of markets, see marketCatalogue, see competitions, see marketFilter for filtering data.

marketPnL(marketIds, settled = NULL, bsp = NULL, NET = NULL)

Retrieve data about the current profit/loss for markets you may have existing orders in'

marketTypes(filter = marketFilter())

Retrieve data about the different types of markets, see marketTypes, see competitions, see marketFilter for filtering data.

cancelOrders(..., marketId = NA)

Cancel existing orders, leave function blank to cancel all existing orders, see cancelOrders. You can use a combination of marketId and ... to target specific orders, see cancel_inst to target specific order

clearedOrders(betStatus = "SETTLED", eventTypeIds = NULL, eventIds = NULL, marketIds = NULL, runnerIds = NULL, betIds = NULL, side = "BACK", from = NULL, to = NULL)

Retrieve data about cleared orders, which are orders that have been settled, see clearedOrders, use the various params to help filter bets

currentOrders(betId = NULL, marketId = NULL, orderProjection = "ALL", from = NULL, to = NULL, orderBy = "BY_BET", sort = "EARLIEST_TO_LATEST", fromRecord = NULL, count = NULL)

Retrieve existing unsettled orders, leave function blank to retreive all orders, see currentOrders, use the various params too help filter bets

placeOrders(marketId, selectionId, orderType = "LIMIT", handicap = NULL, side = "BACK", order = limitOrder())

Place an order, see placeOrders, requires a marketId and selectionId (see marketCatalogue and marketBook for details on these params), make use of various helper functions (limitOrder or limitOnCloseOrder) depending on the type of order

replaceOrders(..., marketId)

Replace existing orders, requires marketIds and unique betIds with new prices, use replace_inst to target specific bets

updateOrders(..., marketId)

Update existing orders with new instructions for what to do when the market goes in play, use update_inst to target specific bets

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
bf <- betfair(usr = "username", pwd = "password", key = "API_key")

# to view available methods simply print the bf
bf

# to use a method, for example competitions
bf$competitions(filter = list())

# to use a method with a filter to retrieve just football
bf$competitions(filter = marketFilter(eventTypeIds = 1))

## End(Not run)

durtal/betfaiR documentation built on May 15, 2019, 6:01 p.m.