BetfairApiConsoleFSharp code - help

Hello all

I have copied across some code generously put up by Stefan.

For those of you that might not know, Stefan has kindly pointed out that since the Aus end point no longer exists  no reference to GBR inside the brackets in line 8 is now required, it is left with closed brackets.

let main argv =

    if argv.Length <> 2
        failwith "Please enter your Betfair Username and Password!"
    let username, password = argv.[0], argv.[1]
    let betfairServiceProvider = BetfairServiceProvider()

I have since found, courtesy of this forum that a commandline argument is used by the console application.

8/7/2016 12:23:25 PM

Actually all you need is just to read the code. To any console application you can enter command line arguments, and in the code of the console application those arguments are passed as array of strings.


static void Main(string[] args)
    if (args.Length != 2)
        throw new Exception("Please enter your betfair user name and password!");

    var username = args[0];
    var password = args[1];

    var task = ExecuteMyTest(username, password);



In the code you can see that the first argument (args[0]) represents your username and the second argument (args[1]) your password. 

Go to the Solution Explorer and on the BetfairApiConsole project click with your right mouse button, select Properties menu item, and click on it. 

In the project properties window select Dubug, and in the Start Options sections, in the Command line arguments, enter your username and password. (the argument separator character is space).

Execute your bot sdk project, and your betfair credentials will be used to login to betfair thriugh betfair api. You can debug your test bot project or create your own ones.

In bfexplorer bot sdk you can find projects in C# or F# programming languages.

I can't seem to get this working, as it simply works through the code and prints nothing to the screen.

I suspect that I have a problem at the Visual Studio end of things, and am unsure of how it interacts with the Bfexplorer application.

I appreciate Stefan's feedback that I need to learn how to work with Visual Studio first.

Any help here would be great.

To date I have been manually punching in the code and watching videos and looking on the net.

Rather than cut and pasting code, this way I get familiar with the syntax. agreed very slow.

However, I can't even get the simple 1 line scripts working in the Bfexplorer console.

I am usually reluctant to ask for help without first spending the time to research.

I have spent days trying to get this to work.

I do not have the bfexplorer bot sdk that Stefan refers to.

In closing, I think the BFexplorer program is great. Just need to get over this hurdle.

Thanks in advance.



Comments ( 1 )

  • Betfair Bot
    29.8.2017 15:19:24

    When you create a new project in Visual Studio, into your project are automatically included referenced libraries. 

    Even the simplest program like Console.WriteLine("Hello world!") would not be compiled without referenced System.dll library. 

    Your built app (project) must include all external libraries used by your app/by your code.


    For simple betfair api program using bfexplorer betfair api libraries, you must add 2 libraries, references:

    BeloSoft.Data, BeloSoft.Betfair.API


    In your program code you must open namespaces of used libraries:

    open BeloSoft.Betfair.API

    open BeloSoft.Betfair.API.Models

    In C# code we use: using keyword.


    Betfair api http servers expects http request with header Expect100Continue set to false.

    To execute betfair api program you must set it either in code, or in App.config file.


    Now you can start writing your betfair api code. Visual Studio intelisense will help you with type/object or method declaration showing what properties are implemented, what parameters you must enter to methods and so on:

    Familiarize yourself with .net programming first, it does not matter in what programming language.