Betfair Developers


.NET
Discussion about the .NET Framework (C#/VB), Microsoft's platform for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.

Post Reply
joelpob joelpob is offline
Junior Member
 
Default 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 zeal is offline
Junior Member
 
Default

It worked for me. Thank you very much!
troyedwards8 troyedwards8 is offline
Member
 
Default

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
betdynamics betdynamics is offline
Senior Member
 
Default

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.
troyedwards8 troyedwards8 is offline
Member
 
Default

Quote:
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.
zeal zeal is offline
Junior Member
 
Default

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?
Olla00z Olla00z is offline
Junior Member
 
Default

Quote:
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?
Post Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump