Betfair Bot: Environment/Setup

Hi folks,

here is the first blog post of the series “Creating A Betfair Bot With C#”.

This section will give some information about the environment and setup of our work. This section is not a tutorial about using the presented tools, because there are also other tools available and giving a complete overview of all developer tools would cost too much time.

Hardware Environment:
There is no special hardware required. Make sure you are using a computer with Microsoft Windows. I started working on the bots under Windows XP and now I am working under Windows 7.

Software Environment:
I am working with Microsoft Visual Studio Professional 2005. vs_screenshot I am sorry, but my version of Visual Studio is in German and I can not change the language so far. If there are any questions feel free to ask.

Visual Studio is not only a code editor. It has also a forms designer which let you create windows user interfaces via drag and drop, which saves you a lot of time.

An alternative for Visual Studio might be Microsoft Visual Studio Express. I must admit I do not have any experiences with VS Express, but I am sure there are many tutorials out there about this tool.

You also need to have Microsoft .NET Framework installed on those computers you are running your bot. When installing Visual Studio I think the framework is installed too. But if you want to run your bot on another machine, maybe a Virtual Private Server, make sure that the framework is installed. To download the framework just visit Google and enter “.NET Framework”. You will get a lot of results for downloading. It is free to use.

Generally my bots are using local databases. Therefore I am using Microsoft SQL Server Compact 3.5. This is an embedded database, which means you will have a single database file with file extension SDF. You can use this database like a common and well known database like Oracle or MySQL. The advantage is you do not need to care about database management handling like table spaces and user privileges etc. You just need to create your database tables and save your data.
It is really easy to use. You can save your matched bets and prices of single selections for tracking etc.
I am using the database for saving matched selections, so I can start and stop my bot without losing data, because they are stored in my local database. If those data are only available in memory in variables an objects I would lose them if my bot crashes or if I would stop the bot. It is not required, but it is really helpful.

When using Microsoft SQL Server Compact 3.5 you need to be able to have a look at your SDF files. I am doing this via SDF-Viewer. You can also use Visual Studio for that, but for me it is much more comfortable to use SDF-Viewer.

Today’s section did not help much about getting really in touch with Betfair, but I think it is necessary to give an overview which tools I am using. If there is anybody also working on betting bots feel free to add your thoughts and comments about the tools I am using and also about the tools you are using which are not mentioned in this blog post.

The next section “Basic Functionality” will handle all the stuff I am using for logging, data management (database), settings and bot handling. We will also see how I am organising my bot projects, which will help us to use the same source code easily in another bot again without recoding the same stuff again and again. At the end of the next section we will have our first self created software. We will be able to start and stop the bot, create logging entries, we will use registry settings and we will get in touch with threading and event handling.

That’s it so far.
If there are any comments or questions feel free to drop an email or leave a comment.

Cheers, Loocie


Creating A Betfair Bot With C#


programmierer_binary I get many emails from readers about my betting bots. I think it is clear that I can not give too many details away how the bots are working. If I would do that I will lose the small edge I might have, but I know there are people out there having a strategy in mind, but they have troubles to get them working, because they can not sit down in front of a computer day in day out.

I want to publish a series of blog posts about how to get the Betfair API stuff working. The aim is to create a basic framework of a betting bot, which means a betting bot with the following features:

  • Login/Logout
  • User Interface with market details
  • Debug logging
  • Database connection
  • Betfair API functions (get prices, etc)

The series will contain the following sections:

1. Environment and Setup

2. Basic Functionality

3. Betfair API I

4. Betfair API II

5. Final Thoughts

I will update the link to each section, if it is published. At the end of every section I will provide the current progress of the bot as a download of a Visual Studio 2005 project, so you can play around.

I will not go too much into technical detail, so it might be helpful to have some experience with software development. You should know the common program flow controls like “the for loop” etc. If you are not familiar with it, try this tutorial

C# Tutorial

I will more concentrate on the “higher technical aspects” like multi threading or event handling, because I get many emails from people struggling with it and having a bot with freezes from time to time.

This series will be far away from being professional. I taught myself how to work with C# and Visual Studio, so feel free to give helpful comments for me and all the other readers, if there is something not that correct or if you have an idea how to do some things easier or faster.

This series will not create a bot you can use and make a lot of money just by running it. For demonstration I think we will implement a simple strategy, but right now I have not a certain strategy in mind.

That’s it so far. Currently I have not yet a time schedule when to publish the blog posts. I hope I can finish one post per week.

Cheers, Loocie


Still Here


a long time since the last blog entry. I am sorry, but at the moment I do not have much time to write about my betting stuff.

As mentioned so often, I do not want to bore you every day with figures how much I lost or won.

I totally stopped manual trading on Betfair. No tennis, no football, no Formula 1.
I concentrated on working on the betting bots and it seems there is an edge for me. The semi automated version of HorstBecker is running really well at the moment. I had a really long run of up and downs before I identified a bug in the source code. I am really glad I found it, because results changed a lot in my favour with the new version of the software. Currently I am up for this month 152 points!

That’s it so far. Will keep you updated!

Cheers, Loocie