replaceOrders: Change the price of a set of unmatched bets

View source: R/replaceOrders.R

replaceOrdersR Documentation

Change the price of a set of unmatched bets

Description

https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3lu3yomq5qye0ni/replaceOrders

Usage

replaceOrders(
  marketId,
  betId,
  newPrice,
  customerRef = NULL,
  marketVersion = NULL,
  async = FALSE,
  suppress = FALSE,
  sslVerify = TRUE
)

Arguments

marketId

String. The market ID of the bets to be replaced. 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 replaced- 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.

newPrice

vector <String>. The new price of the original bets (e.g "1.01", "2.22","10.0",etc). This parameter needs to be a set of quoted doubles (see Betfair's online documentation for more information on accepted price doubles (e.g. 2.02 is viable, while 10.02 is not). Requred. 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.

marketVersion

Integer. Optional parameter allowing the client to specify which version of the market the orders should be placed on. If the current market version is higher than that sent on an order, the bet will be lapsed.

async

Boolean. An optional flag (not setting equates to FALSE) which specifies if the orders should be placed asynchronously. Where this is set to TRUE, orders can be tracked via the Exchange Stream API or or the API-NG by providing a customerOrderRef for each place order. An order's status will be PENDING and no betId will be returned. This functionality is available for all bet types - including MARKET_ON_CLOSE and LIMIT_ON_CLOSE.

suppress

Boolean. By default, this parameter is set to FALSE, meaning that a warning is posted when the replaceOrders 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.

Details

replaceOrders changes the price of a specific set of unmatched bets from the same market.

Important Info: This operation is logically a bulk cancel followed by a bulk place. The cancel is completed first then the new orders are placed. The new orders will be placed atomically in that they will all be placed or none will be placed. In the case where the new orders cannot be placed, the cancellations will not be rolled back.

Value

Response from Betfair is stored in replaceOrders variable, which is then parsed from JSON as a list. The status column recognises whether the call was successful. If the replaceOrders 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 change the price for a bet to the price at which it is already set).

Note on replaceOrders

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.

See Also

loginBF, which must be executed first. Do NOT use the DELAY application key. The DELAY application key does not support price data.

Examples

## Not run: 
Change the price of two bets. The following
variables are for illustrative purposes and don't represent actual Betfair IDs:

updateOrder(marketId = "1.19991480", betId = c("61385423029","61385459133"),
           newPrice = c("1.44","2.02")
           )

Note that if you run this function again (after changing the bet IDs remember,
replaceOrders places new bets), it will return an error (BET_TAKEN_OR_LAPSED),
as the bet price hasn't changed.

Note that, unlike \code{updateOrders}, \code{replaceOrders} is an all or
nothing process. One error is sufficient to prevent any replacement across the
entire set of bet IDs.


## End(Not run)


phillc73/abettor documentation built on June 10, 2022, 4:43 p.m.