Fetching Back and Lay odds for all horses given a race name in Australia

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sogi
    Junior Member
    • Jul 2024
    • 2

    #1

    Fetching Back and Lay odds for all horses given a race name in Australia

    Hey! I've only recently got set up with the stuff on this API. I've been testing it out for the past hour but can't figure out how to get the odds listed in the title. Any way to do this?
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    I normally advise new people to create classes for the data that will be returned by each of the betting-related calls to the API. This way you will have seen every data item that you are likely to need. Also, once you have determined what data is returned in each call, use the test thing (I can never remember its name) to make calls and look at what is actually returned.

    This should show you how the data hangs together. As an former IT professional of many years, I find it to be a very well designed system with almost no duplicated data. It is based very soundly on using an Id for almost all items, whether that item is a horse, a jockey, a race, or whatever it is.

    There are many posts on this forum about how to drill down to the data you want. How much of a match there is between the race name you've obtained from, say, your newspaper, and the race name on Betfair is another question.

    Anyway, first you need to find out what the EventType is for your sport (this will never change). Use the test thingy (as I say, I forget its title - haven't used it much as I built a test page into my app) and call ListEventTypes. This will tell you the EventTypeId for all sports for which there are currently events listed on Betfair (some of them may disappear when there is no Event for a sport). There are other List calls that you can probably do once and save the output and then you may not need to call it ever again.

    With the EventTypeId you can call ListEvents for the relevant ListEventId. You can further restrict the data you get back by start date, venueId, and countryCode, among others. The Events returned contain the name of the Event. At a guess, this is what you want to compare with the name you have for the race from whatever your source is.

    For each Event, there will be a number of Markets. There is a Market for whatever type of bet can be made on the Event. For horse race, one Market will be for the winner, with one winning outcome. There will be one for the each-way bets, with one to four winners, depending on the field size and other criteria.

    For each Market, there will be a MarketCatalogue, returnable via ListMarketCatalogue. This contains the data items for the race that are unlikely to changem except for the totalMatched. The data in the MarketCatalogue contains four sub-classes, including an array of the runners, for which there should be a class called RunnerCatalog or ClassRunnerCatalog, depending on what your naming standards might be. This contains fixed data for a horse if this is a horse race.

    For each MarketCatalogue, there is an ever-changing MarketBook, containing all the odds for all the horses, along with further relevant data. Note that odds are called prices and money amounts, including stakes, are referred to as sizes. In the lead up to an Event, the MarketBook will constantly change, and some Events included betting in play, and so the MarketBook changed throughout the duration of the Event.

    I hope this gives you the general idea. As I say, it's worth creating classes for everything to gain familiarity with where everything is. Most ot the classes can then be used in your program. It's a steep learning curve and by no means simple, so keep at it, and good luck.
    Last edited by jabe; 18-07-2024, 04:19 AM.

    Comment

    • Bascoe
      Member
      • Sep 2018
      • 42

      #3
      Jabe,

      Always helpful, as usual. The test "thingy" is called the BF visualiser - here is the link

      https://betfair-developer-docs.atlas...API+Demo+Tools

      Comment

      • Sogi
        Junior Member
        • Jul 2024
        • 2

        #4
        Jabe,

        I followed step by step using the Demo Tool, however, I always end up having the Exchange Prices completely empty...

        Any solution to this?

        Comment

        • jabe
          Senior Member
          • Dec 2014
          • 705

          #5
          Not certain. It might be do do with using a live key or not. There's also some sort of cross-referencing of odds that can happen, but I can neither recall the name for it, nor how it works, and it wouldn't be the difference between nothing and something. A search of the forum might help you, or some other kindly soul might.
          Last edited by jabe; 18-07-2024, 03:07 PM.

          Comment

          Working...
          X