cancelOrders | R Documentation |
cancelOrders( marketId, betIds = NULL, sizeReductions = NULL, customerRef = NULL, suppress = FALSE, sslVerify = TRUE )
marketId |
String. The market ID of the bets to be fully or partially cancelled. While multiple bets (up to sixty, actually) can be cancelled in one call, they must all be from the same market. Required. Warning: Setting this parameter to NULL will result in the full cancellation of all unmatched bets across all markets. |
betIds |
List<String>. The bet IDs of the bets to be cancelled - bet
IDs are displayed (called Ref) on the bet information on the right hand
side of market page on the betfair desktop site. They can also be sourced
through |
sizeReductions |
List<Double>. Optional. If supplied, then this is a partial cancel of the order. The default value is NULL, which means complete cancellations are requested. Note on sizeReductions values: The double within the string represents the value to be cancelled. For example, given an unmatched back of GBP100, inputting "2" as the parameter value will cancel GBP2 of the bet and leave GBP98 unmatched. |
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. |
cancelOrders
Cancel all bets OR cancel all bets on a market OR fully
or partially cancel particular orders on a market. Only LIMIT orders can be
cancelled or partially cancelled once placed.
Response from Betfair is stored in cancelOrders variable, which is then parsed from JSON as a list. The status column recognises whether the call was successful. If the cancelOrders 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 cancel a bet that has already been cancelled). For a full list of error codes see https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Betting+Enums#BettingEnums-ExecutionReportErrorCode
If you want to combine partial and full cancellations, use "NULL" to signify the bet IDs that are to be fully cancelled (see examples below).
loginBF
, which must be executed first. Do NOT use the
DELAY application key. The DELAY application key does not support price
data.
## Not run: To cancel all unmatched bets (across all countries), simply run cancelOrders with marketId set to NULL cancelOrders(marketId = NULL) To cancel all unmatched bets on a single market, then just pass the market ID in the marketId parameter: cancelOrders(marketId = "1.2131241") To fully cancel an inidividual bet on a specific market, then include a bet ID in betIds parameter: cancelOrders(marketId = "1.2131241", betIds = c("3431515121") ) To partially cancel an inidividual bet on a specific market, include both betIds and sizeReduction vectors: cancelOrders(marketId = "1.2131241", betIds = c("2451351566"), sizeReductions = c("2.0") ) If you want a mixture of complete and partial cancellations, use "NULL" to in the sizeReductions vector to determine full cancellations. For example, if we wanted to combine our two previous requests: cancelOrders(marketId = "1.2131241", betIds = c("3431515121","2451351566"), sizeReductions = c("NULL","2.0") ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.