Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when placing more than two lay/back bets #19

Open
bcaneco opened this issue Mar 22, 2017 · 5 comments
Open

Error when placing more than two lay/back bets #19

bcaneco opened this issue Mar 22, 2017 · 5 comments

Comments

@bcaneco
Copy link

bcaneco commented Mar 22, 2017

Hi,

The function placeOrders() doesn't seem to allow for more than 2 simultaneous back/lay orders, returning "Error: Expectation Failed".

placeOrders(
marketId = "1.130459350",
selectionId = as.character(c(10463405, 10463405, 11160430)),
betSide = rep("LAY", 3),
betType = "LIMIT",
betSize = rep(as.character(2), 3),
reqPrice = rep(as.character(1.2), 3),
persistenceType = rep("LAPSE", 3)
)
Error: Expectation Failed

Am I wrongly specifying any of the arguments? Or is there a limit on the number of bets per request imposed by the betfair API?

Looking at the betfair's API documentation on placing orders, it reads: "The limit of place instructions per request is 200 for the UK/AUS Exchange (...)"

In any case, I must also add that the package works a treat - you've than an excellent job!

Many thanks in advance,
Bruno

@phillc73
Copy link
Owner

Honestly, I've never tried (or even considered) the possibility of placing such simultaneous orders. I'd have to look deeper to figure out what's failing.

As a workaround, have you tried iterating through a list? That is, rather than repeating the individual items within the placeOrders() function, loop through a list of selectionIDs and executing placeOrders() three times, once for each ID.

@bcaneco
Copy link
Author

bcaneco commented Mar 27, 2017

Thanks for your reply Phil.

That's precisely what I've done - running placeOrders() looped over selectionIDs. :)

That, however, led to another issue: due to small time delays in the API's answer to placeOrders(), some of the requests seem to get stumbled on the top of each other between iterations. As a result, some of the requests are not placed. Setting a little waiting period (1sec) between iterations solved the problem.

It'd still be great to be able to place 2+ simultaneous bets in one request inside placeOrders() though! Specially for inplay betting, when market volatility is so high that 1sec lags can display inconvenient price shifts.

Cheers

@phillc73
Copy link
Owner

Thanks for the further feedback. I'll leave this issue open as something for me to investigate, specifically how to place faster simultaneous orders.

@Soccerama
Copy link
Contributor

Soccerama commented Jan 23, 2021

I had a look at this and managed to use a single placeOrder instruction to place back bets on Home, Draw and Away outcomes for a single Premier League game. Not sure if the httr related changes fixed this or if there is some other explanation.as I didn't check before those changes. I'd be interested to hear if you can get it to work now.

I used numbers for betSize and reqPrice but tested using characters for betSize and it still seemed to work. Agree that the issue of bets not being placed because of the delay is a problem and haven't worked out to solve that one yet. Suspect that checking the response in your code would help.

Should add that I only tested this with LIMIT bets as I only do sports so don't have the option of doing SP - and don't have a detailed understanding of it.

@phillc73
Copy link
Owner

Based on @Soccerama feedback placing simultaneous bets should work. @bcaneco any chance you can confirm this?

I'll leave this issue open for a week or so before closing if no further feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants