.NET api-ng library

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

    #1

    .NET api-ng library

    Hi all,

    I took the C# sample code, extended it a lot (it covers most of the API, minus the vendor stuff right now) and wrapped it in a TPL/Reactive Extensions concurrency model. You have the choice of using just the BetfairClient class to hit the api-ng endpoints, or a Rx.NET subscription model through the MarketListener class.

    Library here on Github: https://github.com/joelpob/betfairng

    It looks like api-ng will be moving to a pub/sub reactive model (http://forum.bdp.betfair.com/showthr...lish+subscribe), and using MarketListener will set you up very nicely for that.

    Happy to take pull requests.

    Enjoy.
  • kawafan
    Junior Member
    • May 2011
    • 33

    #2
    thats some wonderfull work you have done ,

    I was hoping you could give us working example with some batch script or gui

    Comment

    • desertoak
      Junior Member
      • Jun 2014
      • 2

      #3
      Wonderful work

      GUI example appreciated

      Comment

      • kawafan
        Junior Member
        • May 2011
        • 33

        #4
        yeh , there are allot of dump people like me , who are trying to understand wth is api-ng at all

        Comment

        • betdynamics
          Junior Member
          • Sep 2010
          • 534

          #5
          @joelpob

          Nice work. I hadn't come across Rx before but this is something worth looking into further.

          A couple of questions:

          1. How many markets can you add into the MarketListener at any one time? Is it limited? Will the call to listMarketBook be able to cope if you supply lots of markets?
          2. You seem to do an OnComplete return when the market status is SUSPENDED. I'm not sure this is sensible as it is quite common for markets to be suspended whilst still active (for example, in football matches where the market may suspend when a goal is scored). Surely it would be better to raise OnComplete only when the status is CLOSED or INACTIVE.

          Look forward to seeing how this progresses.

          Comment

          • desertoak
            Junior Member
            • Jun 2014
            • 2

            #6
            Anyone got this working?

            I can login = SUCCESS

            But when i try TestAPI.Test(); i simply can get nothing from the output. Nothing crasch.

            Comment

            • joelpob
              Junior Member
              • Jun 2014
              • 6

              #7
              Originally posted by betdynamics View Post
              @joelpob

              Nice work. I hadn't come across Rx before but this is something worth looking into further.

              A couple of questions:

              1. How many markets can you add into the MarketListener at any one time? Is it limited? Will the call to listMarketBook be able to cope if you supply lots of markets?
              2. You seem to do an OnComplete return when the market status is SUSPENDED. I'm not sure this is sensible as it is quite common for markets to be suspended whilst still active (for example, in football matches where the market may suspend when a goal is scored). Surely it would be better to raise OnComplete only when the status is CLOSED or INACTIVE.

              Look forward to seeing how this progresses.
              RE: 1. It's not limited, it simply passes the list of market id's through to the Betfair API call. I haven't stressed it in testing, but I'd be curious to see how far you can push it.

              RE: 2. Good catch. Removed SUSPENDED from the OnComplete list.

              Thanks for the message.

              Comment

              • betdynamics
                Junior Member
                • Sep 2010
                • 534

                #8
                Originally posted by desertoak View Post
                I can login = SUCCESS

                But when i try TestAPI.Test(); i simply can get nothing from the output. Nothing crasch.
                Yes - I get the same. The program appears to sit waiting for a response from ListCurrencyRates.

                Comment

                • LankyStreak
                  Junior Member
                  • Aug 2011
                  • 5

                  #9
                  Originally posted by betdynamics View Post
                  Yes - I get the same. The program appears to sit waiting for a response from ListCurrencyRates.
                  I see you've trodden the same path as me betdynamics. Did you manage to unravel the multi-threading and get this code to return responses from the API? I've been looking at this for half a day and it's got me beaten. Any clues on how to make this work would be gratefully received.

                  Comment

                  • betdynamics
                    Junior Member
                    • Sep 2010
                    • 534

                    #10
                    No - I've given up on it for the moment. I'll have another look at it when I have some free time.

                    Comment

                    • LankyStreak
                      Junior Member
                      • Aug 2011
                      • 5

                      #11
                      Infuriatingly I got this to work just once this evening. I had been tinkering with the code, commenting out the asynchronous bits that I don't understand to make it single-threading, and it worked like a charm. The API returned all the requests from the TestAPI class lightning fast, but when I rebuilt the solution (Visual Studio 2013 Professional) it threw up loads of errors so I couldn't replicate it. I'm too weary to continue now but will persevere.

                      Comment

                      • joelpob
                        Junior Member
                        • Jun 2014
                        • 6

                        #12
                        There was a rogue 'await' in the Network.cs class that would have prevented a thread from making forward progress in STA apps (winforms etc). That's been fixed.

                        I've also included a "BetfairClientSync" class, which wraps all the "async" stuff to give you a synchronous blocking request/response experience.

                        Hope that helps.

                        Comment

                        • LankyStreak
                          Junior Member
                          • Aug 2011
                          • 5

                          #13
                          Thank you joelpob

                          This is an excellent piece of work. I've spent the last hour studying your code and have learnt a lot.

                          Many thanks!

                          Comment

                          Working...
                          X