API-NG Winform C# Demo (Derived from the Console App. 2022)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoffw123
    Senior Member
    • Mar 2014
    • 250

    #1

    API-NG Winform C# Demo (Derived from the Console App. 2022)

    Hi

    As mentioned in another thread, as requested here is a quick simple Winform App for the API-NG. See attached files

    Adding new commands should be a matter of reading the API-NG Docs and expanding the functionality in similar ways to the implemented demo functions.

    I put this together quickly yesterday afternoon, so let me know if there are any issues with it.

    Geoff

    P. S

    Just noticed the pdf file attached here is very old and out of date now. I cant attach a more recent one as it is too large for the forum attach.

    This link is the latest I think
    https://docs.developer.betfair.com/p...ne6thMay20.pdf
    Attached Files
    Last edited by geoffw123; 23-05-2022, 12:50 AM.
  • BertrumGlut
    Junior Member
    • Apr 2022
    • 13

    #2
    Geoff I'm progressing now thanks to you posting this. Many genuine thanks.

    Comment

    • BertrumGlut
      Junior Member
      • Apr 2022
      • 13

      #3
      I'm hitting a brick wall with getting the relevant data for soccer markets in play and am struggling to see which way to go. From Geoff's (excellent) sample it's clear on how to get the details for individual horse racing markets but I can't see how to get soccer data for current status - scores, team names, latest prices for win, draw or lose, time in play. I'm looking at priceProjection.PriceData after I get the market ID but that doesn't seem to give me what I need. i think it might be Order Projection from listMarketBook but none of it seems clear for in play soccer markets. Can I ask please, am I on the right lines? Is that I need to use listMarketBook and just find the right way of calling that or is there a clearer method to get soccer IP data that you see on the normal BF screen?

      https://docs.developer.betfair.com/d...listMarketBook

      Comment

      • jabe
        Senior Member
        • Dec 2014
        • 705

        #4
        I haven't looked at Geoff's code, but this might help.

        You can get a list of football matches with listEvent.

        From there, for games and markets of interest, you need ListMarketCatalogue. This contains all the FIXED data for the game and market (team names, competition, kick-off time and date, etc). You should look at MarketTypes so you know what to ask for; there are things such as RESULT, CORRECT SCORE, FIRST GOAL SCORER, CORNERS, etc (these are examples and may not be exact).

        For each MarketCatalogue of interest, you need to repeatedly ListMarketBook. This gives you things that change during a game - but chiefly the odds. This is the main information that will prompt you to take action, or not.

        You should be aware that Betfair does not tell you the current score of a football match. It is possible, to a certain extent, to work out the current score from the CORRECT SCORE market. If there has been a decent amount of betting on this market, you can see which outcomes no longer have lay bets waiting to be matched. Those scores are done with and not going to happen (however, don't rush in too soon after a market reset, because some outcomes may not have been repopulated). The current score may be the one with the current lowest LAY odds on offer. See if you can watch how the odds change during matches and after the score changes. Also note that when one team reaches four goals, the remaining options are only home team to get four or more, away team to get four or more, or high scoring draw. You might find other ways to work out the difference between a game ending 6-1 or 7-1 using other markets, but I doubt it. You can also see which team is ahead from the RESULT market (or whatever it's called).
        Last edited by jabe; 28-06-2022, 01:16 PM.

        Comment

        • BertrumGlut
          Junior Member
          • Apr 2022
          • 13

          #5
          Thank you Jabe, that was really useful. I didn't know that I couldn't get the current score but your explanation makes a lot of sense - many thanks.

          Comment

          • BertrumGlut
            Junior Member
            • Apr 2022
            • 13

            #6
            Jabe (et al), can I ask please, is there a straightforward way of getting the start time of the whole match? The value I'm getting seems to be when either the first or second half starts. Short of running through every in play game and adding data to a DB for me to then compare against, I can't see a way around this.

            The HalfTime/FullTime market wouldn't work I think, or be reliable.

            Comment

            • jabe
              Senior Member
              • Dec 2014
              • 705

              #7
              I used OpenDate in the Event class. I did have a problem with adjusting the time for the change from BST to GMT or back, and I can't remember how that was resolved. I do recall some frustration with inconsistent results. However, since there are few (if any) football (perhaps I should say soccer to distinguish it from the US game in which feet are used about 0.0000001% of the time) games worldwide that are playing between the UK hours of 2am and 3am, it wasn't a huge problem for me.

              MarketBook includes InPlay, which you can refer to as required.

              Bear in mind that some events in some countries suffer from the start times being inaccurate. I recall horse racing in the US rarely starting on time, unlike racing in the UK which usually did so. Delays to start times are not uncommon, for a number of reasons. There was one football match that went several days past its kick-off start time. Generally events with decent amounts staked on them will behave, but beware of events in places such as Patagonia with almost nothing staked. Also note that delays can occur during events (perhaps a bad injury in a football match) and it is not unheard of for events to be abandoned.
              Last edited by jabe; 29-07-2022, 05:19 PM.

              Comment

              • BertrumGlut
                Junior Member
                • Apr 2022
                • 13

                #8
                Jabe, many thanks for that. I didn't see that in the Event class. However, I think that does the same as the MarketStartTime as I've just been monitoring it. When the second half starts, the both the Event.OpenDate and MarketStartTime appear to reset. 3 minutes into the second half and OpenDate shows 3 minutes. Could be my code but I'm stepping through it I only (now) use the OpenDate in one place.

                There's a SuspendTime in the Description part so I'm not sure if that would be blank for the first half. I'll report back!

                Thank you for the other background as well. I've seen some of those delays and was trying also to see if I could get around them but at the end of the day, there will always be another match.
                Last edited by BertrumGlut; 28-07-2022, 09:34 PM.

                Comment

                • BertrumGlut
                  Junior Member
                  • Apr 2022
                  • 13

                  #9
                  Nailed the time issue. Suspend time helped! Thanks again Jabe et al

                  Comment

                  Working...
                  X