Betfair BOT programming in C# or VB.net (Visual Basic)

From my inbox:

I am in the process of learning VB.net having programmed for many years with the older Basic Languages, I thought it time I came up to date.

The question is I would like to start with a project to write my own simple betfair betting bot, to get to grips with the language, as i have an interest in betfair, it will provide a good incentive to start with this type of project.

At first I would only need the Free API to start the development, my question is which product in the BFexplorer range would be most suited for my needs, and If there is some available start-up code in VB.net within the product to get me started, just the very basic login / load markets etc, then I would like to develop it from there.

Please advise if there is such a product and how much subscription would it be.

Comments (2)

  1. StefanBelo Says:
    Saturday, January 17, 2009

    Bfexplorer BOT SDK for C# and Visual Basic betfair bot programming

    Actually, if using the Bfexplorer PRO as the bot development platform you do not need to program anything for betfair api interface. It means you do not need any code for login into the betfair, browsing events, loading markets and prices, placing, updating and cancelling bets, you really do not need to write any code as you will use the bfexplorer infrastructure.

    It offers that all without a line of code, and it offers more than that. It offers you the practice mode so you can test your bot code without risking your money, it offers even the bet settling simulation in the practice mode for markets listed in the betfair result feed, so after running your bot in the practice mode you will know your results, profit or loss.

    The bfexplorer offers multi market monitoring so you can run your bot on many markets simultaneously. You can run your bot with Bot Executor on manually selected markets, or you can run your bot in automated mode with the Trade opportunity lookup service tool, or with Execute my strategy on my selections. You can write your bot scripts in the C# or Visual Basic. With the Bfexplorer PRO you will receive source code of simple bot scripts (MyBots folder) and Bfexplorer BOT SDK so you will be able to develop your bot scripts in Visual Studio and then used them with Bfexplorer PRO.

    You can find more resources about betfair bot programming for Bfexplorer PRO on Betfair Bot Paradise and also read following articles:

    A HelloBetfairVB bot in Visual Basic

    Imports System
    Imports Microsoft.VisualBasic
    Imports BeloSoft.Betfair.Data
    Imports BeloSoft.Betfair.Trading
    
    Namespace Bfexplorer.Scripting
    
      Public Class HelloBetfairVB
        Inherits Bot
    
        Public Sub New(ByVal betfairService As IBetfairService, _
            ByVal monitoredMarket As MonitoredMarket, ByVal runner As Runner)
          MyBase.New(betfairService, monitoredMarket, runner)
        End Sub
    
        Public Overrides Sub DoYourJob()
          MyBase.DoYourJob()
    
          MyBase.AddMessage("Hello Betfair")
    
          Dim betPrice As BetPrice = MyBase.runner.BestPriceToBack
    
          MyBase.AddMessage( _
            String.Format("The current back price on selection: {0}", _
                 IIf((Not betPrice Is Nothing), betPrice.ToString, "No back offer")))
    
          MyBase.Stop()
        End Sub
    
      End Class
    
    End Namespace
    

    A HelloBetfair bot in C#

    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");
    
          BetPrice betPrice = runner.BestPriceToBack;
    
          AddMessage(
            string.Format("The current back price on selection: {0}", 
               betPrice != null ? betPrice.ToString() : "No back offer")
          );
    
          Stop();
        }
      }
    }
    

    To run your simple betfair Visual Basic bot script run the Bfexplorer PRO and open any market. Open the My Bots tool and open your visual basic bot source code into the editor and compile it. Using the Visual Studio for Visual Basic bot programming you will write and debug your code in the Visual Studio directly, but before running your bot in the Bfexplorer PRO is a good idea to check the bot code by compiling it with Bfexplorer PRO, as you could miss to add some assemblies for instance.

    Now open the Selection Property (View/Selection Property) and set the parameter BotType to MyBot, and the parameter MyBotClassName to your full bot class name, that is all. To run the bot click on the toolbar button Start Bot. If you will run the bot from my sample above, the bot will write into the Output window text: Hello betfair and the current back price of the selection on which the bot was executed.

    If you will decide to use Bfexplorer PRO you will receive full transactional betfair API access for 30 Euro monthly fee, and of course as a PRO subscriber you will be able to use all bfexplorer applications.

  2. StefanBelo Says:
    Thursday, March 17, 2011

    Or you can create your bot without programming

    If I want my bot to place the bet again after it has been fully matched (ie. if I want the bot to function twice on the selection) is this simple (like changing a bot's parameter), or does it require special programming?

    Betfair Bot Programming/Development

    How to test betfair bot


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