Warning: Declaration of Suffusion_MM_Walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /home/betfairs/public_html/wp-content/themes/suffusion/library/suffusion-walkers.php on line 0
May 262011
 

About two weeks ago i started working on a new bot which would pick up game states from Betfairs exchange blackjack and log them into a database. The idea being that the bot will run for a couple weeks logging data which can be used at a later date for analysing betting strategies and general testing when i’m offline.

It took a little longer than expected, mostly due to work commitments, but RICO is now online and logging data. Currently running on my laptop i can only log about an hour at a time, i will be moving it onto a spare desktop soon and then it can run 24 hours uninterrupted.

RICO blackjack bot datbase schemaThe backend is a SQL Server database, mySQL was nearly an option, but i use SQL Server daily and have been for about six years so just made more sense. It’s not often that i get to create a new database from scratch, normally i just have to put up with whats already there, i think i over egged the normalisation a little. Creating it all from scratch also refreshed some parts of SQL Server i haven’t used for a while, i had to google the syntax for adding foreign key constraints! shameful i know.

rico betfair exchange bot interfaceThe interface is nothing special. The aim is that once the application is started it can be left to get on with it, this also meant that i couldn’t do what i normally do and get hung up on pixel level alignment when arranging the components.

The code took a little longer although i was able to use a lot of the XML manipulation code from my first proof of concept. There were still a lot of cases which were not handled in the original incarnation and needed to be to handled stop the application crashing on empty strings or null references. I included error logging in a database table and also handling for network issues, again didn’t exist before. If the network is lost now the bot will cycle 100 times trying to reconnect and if all attempts fail it will turn itself off, no point killing the hard drive logging the same error message.

Originally i wanted to include output to twitter for logging, i can just check the twitter feed and see the status of the bot etc. Unfortunately this has not been included yet. Twitter have changed the way they allow updates from third party applications and it wasn’t worth investing too much time in to. I have a few examples and some code taken from a couple of sites so it’s not gone for good, but will not be ready straight away.

By logging games over a long period of time i should be able to build up a good representation of the truth, with that i can build a betting strategy that should regularly make profit. They say if you flip a coin 10 time you could get 7 heads and 3 tails, however flip it 10000 times and the results will be closer to 5000 heads and 5000 tails, representing the true 50% chance of either heads or tails.

So what kind of reports can be run on the data? The bot is logging every game state at the beginning of each round, logging a final game state once the winners have been decided and then stores the final XML game state should there be anything which has not been extracted. With that i think i can build reports on pretty much anything I can think of and as the database is in SQL Server it’s just a short hop and a skip to plug it into SSAS and look at some mining scenarios.

Couple of basic reports i knocked up in SQL…

Total times a bet wins and percentage

Number of times a bet wins and percentage that is of total

The starting hands for winning players

Starting hands for winning positions and their starting points

And finally a pivot to show the final available back and lay price for a bet and whether it won or lost per game

Pivot Table showing the last available back and lay price per bet win or lose

Sorry, the comment form is closed at this time.