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


Flutter F1 said...

Great stuff. I have had problem's with this in the past but I now seem to be over the worst of it and my bot is running nicely (in test mode!).

What I'm now looking into is getting something to run on a Virtual Private Server so a)I don't have to leave my machine running all day and b)I'm free to access and make amendments to the code/bot anywhere I have a web connection which would free me from one location. Is this something you've ever looked into? Is it even possible?

Loocie said...


thanks for dropping by. Good to hear you are progressing with your bot.

Currently I am running two bots on a VPS. I have remote access to this server via Microsoft Remote Desktop connection, which is great. I can login easily and see the desktop environment of the server. You just need to have a Microsoft Windows based VPS. I know there is somthing possible to run .NET source code in Mono under Linux, but using a Windows based VPS worked good for me.

This is a good point, so I think this is an issue for the last section of the series called "Final Thoughts".
I will also point out my way of automated tracking of data. I have created a web based tracking platform and every bet the bots are placing will be reported to this platform and I can have a look at a private web page, where I can see my bets. This is really nice, because even with a mobile device it is easy to have a look what the bot is doing. So no need to track all data manually via Excel.

Hopefully I can finish 1st section of this series this week.

Cheers, Loocie

Anonymous said...

Hi mate

I've recently had to move my blog and I've created a new list of fellow bloggers. I've added a link to yours and would be grateful if you could return the favour



PS - the "best" bit isn't an ego thing, it's just that I had to come up with a new url thanks to wordpress.com not liking gambling blogs :-(

Loocie said...

Hi Steve,

thanks for your comment. I added your blog to my blog list.

Cheers, Loocie

Anonymous said...

Looking forward to this.
The best bot blog I have read is http://dynamicnotions.blogspot.com/.

It was great how he explained certain details without giving his edge away.

Some of the code was a little ropey but it got the ideas across really well.

Loocie said...


thanks for leaving a comment. I know the dynamicnotions blog. Sad that there is no activity since last year.
I am still working on the first post "Setup and Environment" and I hope I can post it this week.

All the best,


Anonymous said...

As alternative one can build betfair bot using command-line utility klabor bee.
It's not necessary to program on language like C#. One just need skills to work with command-line and tab-delimited text files. For more details please visit http://klabor.com.

I believe it will help many people to automate their betting activity.

Richard Carr said...

Thanks for the link to my tutorial :)