Posts Tagged ‘betting automation’

Comparing horses from different sources – the solution

Friday, May 7th, 2010

In yesterday’s post we discussed the problem of using information from different data sources for research and automated betting, where the name of the horse differs according to the data source.

The most common problems are incorrect capitalization within horse names (eg.  Sea the Stars instead of Sea The Stars) and omission, misplacement and other misdemeanors with apostrophes.

Various programming solutions are presented to this problem in Automatic Exchange Betting, but there is an even simpler solution where one of the information sources is the Smartform Racing Database.  Firstly, we know the runner names in Smartform are correct, so we can use this as our master source.   Secondly, Smartform uses straightforward SQL, which provides for many basic operations on character strings, such as conversion to lower case and pattern matching (so that we have access to search and replace functions).

This means that we can easily convert a horse name in Smartform to an equivalent name which has no capitals, no whitespace and no apostrophes.  If we do the same transformation on the name from the target data source, our correct name will match our incorrect name, and we can start to use information from both data sources in our betting strategy.  If we want to keep the correct name, we just select the correct name to be displayed but match the information on the transformed names.

If you’re not familiar with these functions in MySQL, you can download a copy and test this sort of functionality out easily without selecting any database, as in the queries below:

#Sea The Stars would normally be a variable in the database, so the query would not need quotations around the name.
>select lower("SEA THE STARS");
;

This will produce the name sea the stars.

Or use the replace functions to produce a name without white space (which also applies to apostrophes):

#The replace function takes three arguments separated by commas - the string to transform, the elements to replace, and the string to replace it with, as in:
>select replace("SEA THE STARS", ' ', '');
;

which produces the name SEATHESTARS

#Put the above functions together within one statement to produce a horse name that can be matched against another without issues:
>select replace("SEA THE STARS", ' ', '');
;

So at last we get seathestars.

If you’re unfamiliar with SQL, the syntax can take a little getting used to, but on the whole is a gentler introduction than learning a programming language – and allows you to achieve an awful lot when it comes to horseracing analysis.

Performing the same operation on the target horse name in another database table let’s us match data up between horses using a table join without leaving the database.  Returning to our original example from yesterday, this means, for example, we could match any form or forecast odds data in Smartform with any market data available in Betfair.  Of course, automatically creating an additional database table of Betfair prices does some programming, though re-usable step by step code is provided in Automatic Exchange Betting for exactly this job.

Finding winners automatically

Thursday, April 29th, 2010

Automating the betting process was possible for some time before the emergence of the Betfair API and writing Automatic Exchange Betting, but making the process reliable was a challenge.  Betfair’s API created a robust way to programmatically access market data and place bets via the exchange (as opposed to a web scraping approach), but there was still no good way to automate the selection of bets themselves.  This required unreliable and/or manual processes to either export data from one of the traditional interactive racing databases, such as Raceform Interactive, or to write robots to scrape the web from online form sources (which was unsatisfactory for various reasons – grey area of site usage, changing page formats, incomplete data, to name a few).

So, to make the selections part of automating the betting process more robust, Betwise created the Smartform database before publication of the book by licensing copious racing data for Members’ personal use back in 2007, designing it for automated updates from original sources, and making it as easy as possible to create and run programs to do just about any aspect of form analysis and output selections for automated betting; no manual ‘data exports’ necessary.

Along with the Betfair API, the service completed the DIY betting automation picture.   For sure, programming is not everyone’s cup of tea, but if a bettor has a manual betting process that can be well described, it is a good candidate for automation since any good betting strategy, automated or otherwise, begins with data.

An example I used in a magazine article just before the book was published illustrated just how simple the principles of automated betting can be.  We looked at a straightforward case that can be considered at one particular racecourse to show how even analysis of a single variable could be turned into a useful automated strategy for certain types of races.  For a more general approach to all races, of course, it makes sense to look at more sophisticated models for predicting performance which use multiple factors.

(more…)