Using betfaiR to collect price histories

+1 vote
Hi Colin

Thanks for the fantastic support on using R and the betfaiR guide and code package - I was really struggling with PERL.

I have followed your betfaiR guide and have successfully sourced a collect_prices.R script for the next upcoming race. However I want now to set up a series of R scripts to run from a cron schedule, so that I can collect all UK/IRL horse prices (marketpricescomplete) at say 10-min intervals for 12 hours before the off, and all UK greyhound prices at 5 sec intervals for 10 minutes before the off.

My concern is that (a) I need to populate a pick list for the different race off times each day, and (b) these data collection timeframes will overlap, with perhaps 5 or 6 races being monitored at a given time. How would that work?

I would then like to store the horse and greyhound data in two R dataframes which I can later analyse with Rapid Miner.

For data collection (and eventually betting implementation) I am using a basic PC running Linux Mint. My development machine where Rapid Miner sits, is a very high-spec Windows 7 PC.

I don't expect to be spoon-fed the answer, but a pointer to how to achieve the above would be really appreciated. I suspect the answer lies somewhere in your excellent AEB book - so perhaps just point me to the right pages!

Kind regards, SImon Johns
asked Mar 5, 2013 in betfaiR package by chepstow Plater (180 points)

1 Answer

0 votes
Hi Simon,

So it seems there are 2 questions - just chip in if I'm missing anything here:

a) A pick list for different race off times?

b) Data collection timeframes overlapping?

Not sure what you mean exactly with a) - if you mean that you need to make sure you can collect the right race at the right time, that's covered in AEB (can't remember which pages, but it should be in the sections on scheduling scripts).

b) Is not an issue, except - potentially - for your Betfair access type on your account.  There are various rules about how many markets and prices you can collect concurrently whilst using the Free API which are detailed in the appendices of AEB under the different API access types.

Quick comment on storing the data - you can store in any format, eg. file,  database, and then just read these into R with a script which accesses the data store later - eg. store in a csv file and then read in using read.csv.

Hope this helps

Colin
answered Mar 5, 2013 by colin Frankel (19,280 points)
Thanks  Colin - it's a bit clearer now.

On (a) I assume I need a R script to grab Betfair race IDs and times, then reformat them into Linux cron time format and construct a crontab file. Your AEB book explains how this is done in PERL, so I guess I just need to translate to R ?

On (b) I can now see that a number of R scripts and functions can run in parallel if they are called at different times by cron. So I agree the only constraint would be accessing the API, and I doubt I would ever make enough calls for that to be a problem.

Thanks for your help
Simon
...