phillc73 / abettor

An R package for connecting to the online betting exchange Betfair, via their API-NG product, using JSON-RPC.
Other
51 stars 36 forks source link

Horseracing betting at SP #7

Closed Tammboy closed 3 years ago

Tammboy commented 8 years ago

Hi Phil,

I can't seem to get the horseracing place bet at SP working. I'm using either of these lines:

placeOrders(marketId="1.122275822",selectionId="9414882",betSide="BACK",betType="LIMIT_ON_CLOSE",betSize="2",reqPrice ="1.01",persistenceType="MARKET_ON_CLOSE", sslVerify = FALSE) or placeOrders(marketId="1.122275822",selectionId="9414882",betSide="BACK",betType="MARKET_ON_CLOSE",betSize="2",reqPrice ="1.01",persistenceType="MARKET_ON_CLOSE", sslVerify = FALSE)

And checking my betfair account afterwards but nothing appears to be happening. It works find in normal back immediate markets but not SP - Is there a setting that i have wrong?

thanks,

Jake.

phillc73 commented 8 years ago

Hi Jake,

I'll have to run some code tests later, but the first thing is can you confirm you're not logged in with your "DELAY" application key?

Thanks Phill

Tammboy commented 8 years ago

Hi Phill,

Yes, that's correct - I've switched to the non-delay key. Placing a bet with limit at a back price is working, however placing at SP is not.

Thanks,

Jake

Sent from my iPhone

On 14 Dec 2015, at 15:12, Phill notifications@github.com wrote:

Hi Jake,

I'll have to run some code tests later, but the first thing is can you confirm you're not logged in with your "DELAY" application key?

Thanks Phill

— Reply to this email directly or view it on GitHub.

phillc73 commented 8 years ago

It appears Betfair have changed some small things with the API over the last 12 months. The old abettor package would still support placing a LIMIT bet which would then take SP when the market moved in-play. This still works. Try this example:

PlaceBetReturn <- placeOrders(marketId = "1.122285949", 
                              selectionId = "10304526", 
                              betSide = "BACK", 
                              betType = "LIMIT", 
                              betSize = "2", 
                              reqPrice = "1000", 
                              persistenceType = "MARKET_ON_CLOSE"
)

This will place £2 in the PLACE market for Kampton 1410, December 15th 2015 for Putaringonit. The requested price is 1000 BSP, but if that is not matched by the off, BSP will be taken. As a work around, this might have worked for you.

However, I've updated the package now to support BSP only BACK bets. Try the following:

PlaceBetReturn <- placeOrders(marketId = "1.122285949", 
                              selectionId = "10304526", 
                              betSide = "BACK", 
                              betType = "MARKET_ON_CLOSE", 
                              betSize = "2", 
                              reqPrice = "1.01", 
                              persistenceType = "MARKET_ON_CLOSE"
)

This now places £2 in the same market, on the same horse, as an SP only bet. I probably still need to do a little tidying up as reqPrice is not really required by Betfair for an SP bet, but the abettor function placeOrders does still require it.

You'll need to update your version of abettor:

devtools::install_github("phillc73/abettor")

Please let me know if this works for you.

LAY bets at SP don't seem to currently work and will require further investigation.

Tammboy commented 8 years ago

Hi phill,

That's great - many thanks for getting back to me and fixing so quickly.

Is there a function that can tell you your Betfair balance?

Thanks,

Jake

Sent from my iPhone

On 14 Dec 2015, at 21:25, Phill notifications@github.com wrote:

It appears Betfair have changed some small things with the API over the last 12 months. The old abettor package would still support placing a LIMIT bet which would then take SP when the market moved in-play. This still works. Try this example:

PlaceBetReturn <- placeOrders(marketId = "1.122285949", selectionId = "10304526", betSide = "BACK", betType = "LIMIT", betSize = "2", reqPrice = "1000", persistenceType = "MARKET_ON_CLOSE" ) This will place £2 in the PLACE market for Kampton 1410, December 15th 2015 for Putaringonit. The requested price is 1000 BSP, but if that is not matched by the off, BSP will be taken. As a work around, this might have worked for you.

However, I've updated the package now to support BSP only BACK bets. Try the following:

PlaceBetReturn <- placeOrders(marketId = "1.122285949", selectionId = "10304526", betSide = "BACK", betType = "MARKET_ON_CLOSE", betSize = "2", reqPrice = "1.01", persistenceType = "MARKET_ON_CLOSE" ) This now places £2 in the same market, on the same horse, as an SP only bet. I probably still need to do a little tidying up as reqPrice is not really required by Betfair for an SP bet, but the abettor function placeOrders does still require it.

You'll need to update your version of abettor:

devtools::install_github("phillc73/abettor") Please let me know if this works for you.

LAY bets at SP don't seem to currently work and will require further investigation.

— Reply to this email directly or view it on GitHub.

phillc73 commented 8 years ago

There's no function to check your account balance at this time. However, I could certainly write one. If this is a priority for you, that's the motivation I'd need to move forward.

Would you mind raising a new issue as an enhancement request? My goal would be to have the update made over the Christmas period.

I'll also leave this bug open until I have resolved two things:

a) Update the function so now reqPrice is required when betType is MARKET_ON_CLOSE b) Lay bets to SP work

Tammboy commented 8 years ago

Hi Phil,

Many thanks for this - it's a fantastic package. I've opened up a new issue request regarding the bank balance.

Many thanks,

Jake

Sent from my iPhone

On 15 Dec 2015, at 09:11, Phill notifications@github.com wrote:

There's no function to check your account balance at this time. However, I could certainly write one. If this is a priority for you, that's the motivation I'd need to move forward.

Would you mind raising a new issue as an enhancement request? My goal would be to have the update made over the Christmas period.

I'll also leave this bug open until I have resolved two things:

a) Update the function so now reqPrice is required when betType is MARKET_ON_CLOSE b) Lay bets to SP work

— Reply to this email directly or view it on GitHub.

Tammboy commented 7 years ago

Hi Phil,

did you ever get round to fixing the lay at BSP issue?

thanks,

jake.

phillc73 commented 3 years ago

I think everything here is covered. Bets at BSP should work. There is a function now to check account balance (checkBalance( ) function). And I think the lay at BSP issue is covered in #22