Announcement

Collapse
No announcement yet.

Basic connection for c#, not console

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic connection for c#, not console

    Sorry if this is a basic question. I am a relative noob to c# coding (I was a VB programmer many years ago). I'm trying to get a sample or documentation for just connecting to the Exchange API using c# and not as per the console application sample. I've been through the RTFM steps and am just getting nowhere, confused and hitting brick walls. Is there some really basic c# code anywhere that just shows how to connect to the Exchange API?

    Once I've got that I'll be able to hunt through the methods.

    I don't know how to 'translate' from the console application to a Windows Forms approach as the using statements don't appear to work. I just don't know what I don't know and am going around in circles. I'm probably missing the basics but it's the basics that I need and just can't find.

    Any and all guidance very much appreciated.

  • #2
    Use my bot sdk:

    https://github.com/StefanBelo/Bfexplorer-BOT-SDK

    On BOT SDK solution you have got 3 examples for C#, VB and F#:

    https://github.com/StefanBelo/Betfair-Tutorials
    Betfair BOT SDK

    Comment


    • #3
      Did you manage to get the Betfair C# console App up and running OK, that wasnt clear to me in your post ?

      Comment


      • #4
        Thanks Stefan, I'll hunt through those now for a windows or non-console way of connecting. Appreciate the fast response.

        Geoff, I've just managed to get the console app working now. At least, I can save log in details but I'm not sure what to do with the other commands. However, if I can just get the connection from windows then I should be good to step through the properties to work what I need to send from there.

        Many thanks both for your quick replies.

        Comment


        • #5
          Hi
          I hadnt looked at this example code for years, so downloaded it this afternoon for a quick peruse, see if it had changed much. I got it working OK pretty quickly but something about it is puzzling me. I will post as a separate message thread here, so hopefully tech support might notice it and reply.

          P.S how did you get your AppKey and SessionToken for pasting into the Console Demo ? You seem to have already figured out the most tricky part
          Last edited by geoffw123; 15-05-2022, 07:26 PM.

          Comment


          • #6
            BertrumGlut

            Betfair sample code is just rest api wrapper code for communication with api in C#, I do not know why betfair did not make swagger definition of their rest api, so then client code could be generated for any programming language, the code they manually programmed. Yes, they make swagger definition for streaming api, but the problem is that swagger is not able to generate client code for streaming, you can use it to auto generate data transfer objects or models only.

            I am not quite sure if you understand what I have said above so here is example of what I have explained.

            Here there is my code in VB showing how to use streaming api in Visual Basic:

            https://github.com/StefanBelo/Bfexpl...iVB/Program.vb

            Basically what happens is to login to betfair api, on line 46, then subscribing to horse racing markets on line 63. Subscribing of market updates means that you will get automatically populated data of markets and their prices, you will get Market objects and all data available through api. It is done quite a lot of magic here from your point of you. Using just betfair api wrapper code you would have to call a lot of different api calls to get market catalogue data then prices (market book in rest api), just put the break point on the line 24, and browse market data in VS.

            Well yes, you will get api client code working, but what is your goal then? I think to automate your betting or trading on betfair markets, and that requires a lot of coding.

            The difference in my code base is that my bot sdk is not just api client wrapper, it is framework with already built infrastructure.

            In my bot sdk there is winform sample code in C# presenting the use of the framework in the simple app covering all features you need:

            https://github.com/StefanBelo/Bfexpl...UI/MainForm.cs

            The code implements login to betfair, populating market data, in this case app loads all horse racing markets for a day, updating market data automatically, executing preprogrammed strategies, and so on.

            App uses practice mode so no bets are placed on betfair when bot strategy is executed, but if you place real bets then bet data are populated for you automatically as well.

            The same BOT SDK code is used to build my desktop app, this one:

            http://bfexplorer.net/Products/Bfexplorer
            ​​​​​​​
            Last edited by bfexplorer; Yesterday, 08:01 AM.
            Betfair BOT SDK

            Comment

            Working...
            X