Started plaing around with the BetfaiR package a week or so ago and am quite a fan already - particularly appreciate hiding all of the session token management stuff from us...
I've followed the manual (loosly) and managed to quickly get a list of the day's win & place markets, the runners, prices etc...
I've also placed and cancelled bets easily.
Where I'm struggling is in getting a bet updated.
Here's a little code snippet:
> betReturn=placeBets(x)
> betID=betReturn$"betId"
> betInfo <- getBet(betID)
>
> updlist=updateBet(betID, newBetPersistenceType="IP")
Error in eval(bet) : object 'bet' not found
betReturn, BetID & betInfo all look exactly as you would expect them to.
updateBet seems to die when it tries to call to getBet - despite that working fine in open code in the line above...
So I thought I'd make the list for updateBets myself.
Here's that list, the call to updateBets and the subsequent return (with session token & bet ID masked):
> updlist=list(betId=betID, newBetPersistenceType="IP",
+ newPrice=x$"price", newSize=betInfo$"remainingSize",
+ oldBetPersistenceType=x$"betPersistenceType",
+ oldPrice=x$"price",
+ oldSize=betInfo$"remainingSize")
> updateBets(updlist)
[1] "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> <soap:Body> <updateBets xmlns=\"http://www.betfair.com/publicapi/v5/BFExchangeService/\"><request><header><clientStamp>0</clientStamp><sessionToken>XXXXXXXXXXXXXXXXXXXXXX</sessionToken> </header><bets><UpdateBets><betId>123456789</betId><newBetPersistenceType>IP</newBetPersistenceType><newPrice>990</newPrice><newSize>2.00</newSize><oldBetPersistenceType>NONE</oldBetPersistenceType><oldPrice>990</oldPrice><oldSize>2.00</oldSize></UpdateBets></bets></request> </updateBets> </soap:Body> </soap:Envelope>"
Any pointers to what I'm doing wrong?
I'm a fairly articulate data analyst/programmer but brand new to R (after 20-something years of SAS)...
Cheers