HelloBetfair

If you are a software developer or just enthusiast programmer you certainly already done your HelloWord program in a programming language you have been learning.

So now there is a time to build your first HelloBetfair program, a betfair bot program. What such betfair bot will do? Well no bet will be placed, it will write just its hello world/betfair sentence into the output window as any other HelloWorld program does.

Writing a betfair bot is not so hard, if you are using an infrastructure which will take care of the rest. I will use the Bfexplorer BOT SDK so will utilize its infrastructure for market monitoring, bet operations and money management system.

My HelloBetfair program is written in C# as it is my programming language of choice these days, but you can use Visual Basic as well.

So here there is my code:

using BeloSoft.Betfair.Data;
using BeloSoft.Betfair.Trading;

namespace Bfexplorer.Scripting
{
    class HelloBetfair : Bot
    {
        public HelloBetfair(IBetfairService betfairService, 
            MonitoredMarket monitoredMarket, Runner runner)
            : base(betfairService, monitoredMarket, runner)
        {
        }

        public override void DoYourJob()
        {
            base.DoYourJob();

            AddMessage("Hello Betfair");

            Stop();
        }
    }
}

What you will need to run this HelloBetfair program?

You need to run it by Bfexplorer PRO. You can download it here. After running the Bfexplorer PRO open a market and setup the Bot Executor to execute this bot program setting the following parameters:

  • BotType: MyBot
  • MyBotClassName: Bfexplorer.Scripting.HelloBetfair

The Bot Executor

If you want to write your own betfair bot scripts/programs and run them using the Bfexplorer PRO infrastructure it is a good idea to download the Bfexplorer BOT SDK.

You will need the Visual Studio 2008, the Express version can be downloaded from Microsoft.

How does it work?

After starting the HelloBetfair bot on the selected market selection, the bot script/program is compiled if it was not done before then the bot instance is created and added in the Bot service for execution.

The bot code is executed anytime the market data changes or any bet operation is finalized on the market, if any such operation is done the bot service executes the bot code each 5 seconds (an idle time execution).

If we look at the code of the HelloBetfair bot script, the main execution method is DoYourJob. Our simple HelloBetfair bot script just writes the message:

“Hello Betfair”

And then stops the bot execution.

You can download the source code here. You can download the bot criteria settings to run this bot in the Bot Executor.

Copy the bot script file: Bfexplorer.Scripting.HelloBetfair.cs into the MyBots folder C:\Program Files\BeloSoft\Bfexplorer\MyBots

If you installed the Bfexplorer PRO you can find more bot scripts here. (Copy the link into your file browser.)

Happy coding!


Do you want to comment this article? Sign up here or login.