Well I have been playing around with a horse race tipping script for a while, it seems reasonably stable and generating reasonable results, its been running for over a year now, so I loaded the tips it has generated in that period into a spreadsheet and looked up the results and starting prices for them, then tried applying some different staking plans to the data to see what returns it might have generated.
One staking plan seems as though it would have generated a profit, whoohoo time to retire, OK maybe not yet.?? One problem with that plan is it requires input throughout the day as the races are run, and I don’t think my current employer is going to be keen on me doing that, they are not very understanding that way for some strange reason.
So its time to automate, for a while now BetFair the gamblling exchange have offered an applications programming interface (API) to their exchange, it uses SOAP (Simple Object Access Protocol) over the Internet and allows you to run programs on your own PC to do automatically whatever you can do on the website, but originally it was by paid subscription only, a while ago they started offering a free level of subscription, not all the services are available at the free subscription level and some of the ones that are have a limit of only so?? many calls allowed per minute, I looked at what was available and thought well there is enough available to do what I want nicely so lets see if I can write a program to run my plan. Programs have been developed to access the Betfair exchange before the API was available by scraping data of a web browser screen, but they where always a bit fragile, if Betfair changed the screen layout the program broke, and BetFair frowned on there use. Now with an officially sanctioned and documented API better programs are starting to appear.
I firstly wanted to develop a program that would run my plan, then maybe extend it with a nice GUI frontend and graphing and such later on, and possibly develop other BetFair bots as well. I also did not want to spend money on development tools, ideally I wanted it to be cross platform Windows/Linux/Mac, ohh and I wanted to write it in C++.
To start with I am developing on Windows, I grabbed the free Microsoft Express Visual C++ compiler from Microsoft, and added the Windows SDK?? also available for free from them. A tip there, download the .ISO and burn it to CD then install from that, the automatic installer does not seem very reliable, it did not work for me and people I have spoken to had the same problem. This gives me quite a reasonable development environment to do Win32 development in, I am not a fan of .NET which is why I loaded the SDK, I have used the full versions in my professional life and so its a familiar environment to me. Next I needed to be able to use SOAP, I tried several different libraries including the native Microsoft tools which are not cross platform and I couldn’t get them to work anyway, I tried the Axis C++ libraries from Apache which don’t seem to have been worked on for a while and seems to lack any support and had no success with them either, then I found gSOAP, which works an absolute treat, available on all the platforms I am interested in, actively being developed and supported, and has a very nice tool for generating interfaces for the SOAP services you want to talk to from the WSDL for the service, one other requirement when using the BetFair API is that it is only available encrypted via SSL, so I installed the OpenSSL libraries told gSOAP to use them and away it went a few lines of code and I was logged in.
For the GUI stage I have installed wxWidgets which is a cross platform GUI and other bits library, I have not gotten to using that yet but it is installed. At the moment I am generating a C++ class to give me easy access to all the free BetFair API calls, so far my code can login and drill down to the race, next step is getting the runners then the prices, the BetFair API provides two SOAP urls, one for global information such as accounts stuff, and the other URL for exchange specific stuff, this was done apparently because places like Australia insist that bets placed there are done on servers physically in Australia, so BetFair have to be able to send bets to the appropriate exchanges, makes it all the more interesting for developers, I had to rebuild my SOAP library to handle it when I got to that stage, but the gSOAP tools made that painless. So hopefully now I am in a position to push on and complete my BetFair class, then sort out interfacing it to my tip generating system and staking plan then let it rip.
Well thats the story so far, I’ll update this as the the code progresses.