Updated C# Betfair API-NG library to support Exchange Streaming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joelpob
    Junior Member
    • Jun 2014
    • 6

    #1

    Updated C# Betfair API-NG library to support Exchange Streaming

    I've updated the Betfair API-NG C# client library to include support for Exchange Streaming: http://docs.developer.betfair.com/do...nge+Stream+API

    Check out the "StreamingExample" class in the ConsoleExample project for an example on how to connect, authenticate and stream market price ticks.

    You'll need to get your App Token enabled for Streaming API support, then you're good to go. The Streaming API is pretty slick -- very happy the Betfair folks put in the work for this.
  • zeal
    Junior Member
    • Nov 2014
    • 20

    #2
    It worked for me. Thank you very much!

    Comment

    • Guest

      #3
      Away at friends this weekend and nowhere near my betbot code at home but is this streaming so we can also watch the live game ie soccer or rugby or is it just betfair pumping out odds instead of us requesting??? I need time to read but wifey is saying we got to go

      Comment

      • betdynamics
        Junior Member
        • Sep 2010
        • 534

        #4
        It's an odds stream and an orders stream.

        You subscribe to a set of markets to monitor (or a set of bets) and they send a message whenever anything changes.

        Comment

        • Guest

          #5
          Originally posted by betdynamics View Post
          It's an odds stream and an orders stream.

          You subscribe to a set of markets to monitor (or a set of bets) and they send a message whenever anything changes.
          Ta Betdynamics, I have busy coding away my BetBot I have not been out to the forums for a while. I must note I thought the Request / Response rate has slowed down since last year. I normally view 20 markets and then when I call the update MarketBook the call and response takes almost 1 sec.

          I will do some reading on stream but does it cost, are there limits, I assume as odds change rapidly prior to race starting you would be receiving heaps of data.

          Comment

          • zeal
            Junior Member
            • Nov 2014
            • 20

            #6
            I have got a problem with the error handling when I lost connection.

            JoelPob's library works fine, but I have failed to implement a right try-catch block here (Network.cs, line 183):

            Code:
            var continuation = result
                            .ContinueWith(stream =>
                                {
                                    stream.Result.Write(postData, 0, postData.Length);
                                    Task<WebResponse> task = Task.Factory.FromAsync(
                                    request.BeginGetResponse,
                                    asyncResult => request.EndGetResponse(asyncResult),//throws an error from here
                                    (object)null);
            
                                    return task.ContinueWith(t => GetResponseHtml((HttpWebResponse)t.Result));
            }).Unwrap();
            Catching exceptions, webexceptions does not work. I have tried to google it, but did not find any working solution.
            Any idea folks?

            Comment

            • Olla00z
              Junior Member
              • Aug 2016
              • 1

              #7
              Originally posted by joelpob View Post
              I've updated the Betfair API-NG C# client library to include support for Exchange Streaming: http://docs.developer.betfair.com/do...nge+Stream+API

              Check out the "StreamingExample" class in the ConsoleExample project for an example on how to connect, authenticate and stream market price ticks.

              You'll need to get your App Token enabled for Streaming API support, then you're good to go. The Streaming API is pretty slick -- very happy the Betfair folks put in the work for this.

              I am trying to get the Examples in the Solution to work. The solution will not compile in Visual Studio 2017. I get the error message "Failed to add reference. The package 'System.Reactive.Windows.Threading' tried to add a framework reference to 'System.Windows' which was not found in the GAC". Any suggestions on resolving this?

              Comment

              Working...
              X