updateOrders | R Documentation |
updateOrders( marketId, betId, persistenceType, customerRef = NULL, suppress = FALSE, sslVerify = TRUE )
marketId |
String. The market ID of the bets to be updated. While many bets can be updated in one call, they must be from the same market. Required. No default. |
betId |
vector <String>. The bet IDs of the bets to be updated- bet IDs are displayed (called Ref) on the bet information on the right hand side of market page on the betfair desktop site. Required. No default. |
persistenceType |
vector <String>. The persistence state of updated bets. persistanceType can take three values ("LAPSE","PERSIST" and "MARKET_ON_CLOSE", which correspond to Cancel, Keep and Take SP on the desktop website). Required. No default. |
customerRef |
String. Optional parameter allowing the client to pass a unique string (up to 32 chars) that is used to de-dupe mistaken re-submissions. CustomerRef can contain: upper/lower chars, digits, chars : - . _ + * : ; ~ only. Optional. Defaults to current system date and time. |
suppress |
Boolean. By default, this parameter is set to FALSE, meaning that a warning is posted when the updateOrders call throws an error. Changing this parameter to TRUE will suppress this warning. |
sslVerify |
Boolean. This argument defaults to TRUE and is optional. In some cases, where users have a self signed SSL Certificate, for example they may be behind a proxy server, Betfair will fail login with "SSL certificate problem: self signed certificate in certificate chain". If this error occurs you may set sslVerify to FALSE. This does open a small security risk of a man-in-the-middle intercepting your login credentials. |
updateOrders
changes the persistence type of a specific unmatched bet.
Response from Betfair is stored in updateOrders variable, which is then parsed from JSON as a list. The status column recognises whether the call was successful. If the updateOrders call throws an error, a data frame containing error information is returned. Note that there are two types of error associated with this call. An API error is triggered, for example, when an invalid market ID is entered. Another type of error is returned if no action is required (e.g. call to set to PERSIST for a bet that is already set to PERSIST).
updateOrders
Unlike some other functions that utilised data frames, this function converts the input to a JSON-compatible format. The JSON output is then converted back to a data frame.
loginBF
, which must be executed first. Do NOT use the
DELAY application key. The DELAY application key does not support price
data.
## Not run: # Update two bets on the same market so that they will persist in play. The following variables are for illustrative purposes and don't represent actual Betfair IDs: updateOrders(marketId = "1.10271480", betID = c("61385423029","61385459133"), persistenceType = c("PERSIST","PERSIST") ) Note that if you run this function again, it will return an error (BET_ACTION_ERROR (NO_ACTION_REQUIRED)) as the bets are already set to "PERSIST". Now, if you run the function for a third time, but with one "LAPSE" and one "PERSIST", it will again return a different error (PROCESSED_WITH_ERRORS). This is because all bets need to be successful to return "SUCCESS". Please note, however, that the viable bet IDs will have been succesfully updated i.e. it's not an all or nothing process but rather each update is treated individually (unlike \code{replaceOrders}). ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.