"API_ERROR" / Error in getMarket(iMktID)$runners

0 votes
Hi guys,

 

Just getting to grips with your very helpful package again after a little break.

When trying to run Error in getMarket(iMktID) in a loop I am occasionally and unpredictably getting "API_ERROR" returned rather than the market data I'm expecting.

More specifically, I'm running the call in a loop (looping over various different events) and if I run the loop twice (over the same markets) I generally get the error for different markets in each loop.

Am I missing something basic here? Known problem? Any pointers on a fix greatly received!

cheers

Russ
asked Mar 17, 2013 in betfaiR package by russbowdrey Novice (220 points)

1 Answer

0 votes
Are you exceeding the amount of market data that you can collect with the free API?
answered Mar 18, 2013 by colin Frankel (19,320 points)
I don't believe so (though I've found it hard to work out what that is, the language used in the documentation I've been able to find makes it difficult to work out if it's talking about the Free API or the Full API).

I put the call inside a loop with a Sys.sleep(0.2) to space out the calls and that seemed to make it worse.
Whether or not your account is using the Free API is determined by the product code that you use when you log on.  It's 22 for the free API.  To use the paid API, you need to pay a subscription and you get a different product code.  Everything in the manual is about the free API (the paid one only really differs in fewer restrictions on fetching market data).  The specifics of all restrictions in market data fetching escape my memory but they are listed in the Appendices of AEB and on the Betfair website.  It's probably worth checking - from memory, you are limited to 5 different markets per minute, so if you are trying to fetch data from more than 5 markets in a minute, that will likely be the problem.  Sys.sleep(0.2) means that you can call 5 markets in a second...
...