When using 'listMarketCatalogue' how can I determine which race the results refer to.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SteveDev
    Junior Member
    • Oct 2018
    • 11

    #1

    When using 'listMarketCatalogue' how can I determine which race the results refer to.

    Hi

    If I make a call to listMarketCatalogue using a specific event ID (for example Horse Racing, 2018-10-26,
    Cheltenham [28975064]) I appear to get the results for all races.

    The Betfair exchange shows 7 races for this event but I can't see a way to group the markets by race.

    How can I break this down into individual races?

    Also, how can I determine the race start time?


    Cheers
  • BetfairDeveloperProgram
    Administrator
    • Oct 2008
    • 679

    #2
    Hi SteveDev

    You need to include MARKET_START_TIME in the listMarketCatalogue request to receive that data in the response:

    Code:
    [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"eventIds":["28975064"]},"maxResults":"90","marketProjection":["MARKET_START_TIME","RUNNER_METADATA","RUNNER_DESCRIPTION","EVENT_TYPE","EVENT","COMPETITION"]}, "id": 1}]
    Code:
    [{"jsonrpc":"2.0","result":[{"marketId":"1.150159610","marketName":"2m5f Nov Hrd","marketStartTime":"2018-10-26T13:00:00.000Z","totalMatched":0.0,"runners":[{"selectionId":11570544,"runnerName":"Make My Heart Fly","handicap":0.0,"sortPriority":1,"metadata.......
    You can group the individual markets by marketStartTime within the same event.

    Neil

    Comment

    • jabe
      Senior Member
      • Dec 2014
      • 705

      #3
      It's been a while since I did any coding, but when I started out I created all the classes I needed for every API call. The information is in the documentation. Doing it all myself showed me how all the data is connected. There are examples of API calls in the documentation and these can be very helpful. Something else that was also helpful was to get a program to make calls to return all examples of something (perhaps something small, such as EventTypes) and pasting them into a file for inspection and future reference.

      Comment

      • SteveDev
        Junior Member
        • Oct 2018
        • 11

        #4
        Thanks for the response jabe.

        Have spent some more time reading the docs and playing with requests/responses and have found the answers I need. Not being familiar with betting terminology at the same time as figuring out an API makes things tricky! The following may help people with similar issues.

        Once an event ID has been obtained, use listMarketCatalogue filtering by event ID using the filter param. Use the marketProjection param to get extra details - which will result in an array of objects like,

        Code:
        {
          "marketId": "1.150143256",
          "marketName": "Over/Under 4.5 Goals",
          "marketStartTime": "2018-10-26T18:45:00.000Z",
          "description": {
            "persistenceEnabled": true,
            "bspMarket": false,
            "marketTime": "2018-10-26T18:45:00.000Z",
            "suspendTime": "2018-10-26T18:45:00.000Z",
            "bettingType": "ODDS",
            "turnInPlayEnabled": true,  
            "marketType": "OVER_UNDER_45",
            "regulator": "GIBRALTAR REGULATOR",
            "marketBaseRate": 5,
            "discountAllowed": true,
            "wallet": "UK wallet",
            "rules": "<content removed for this sample>",
            "rulesHasDate": true,
            "priceLadderDescription": {
              "type": "CLASSIC"
            }
          },
          "totalMatched": 0,
          "runners": [
            {
              "selectionId": 1222347,
             "runnerName": "Under 4.5 Goals",
             "handicap": 0,
             "sortPriority": 1
            },
            {
             "selectionId": 1222346,
             "runnerName": "Over 4.5 Goals",
             "handicap": 0,
             "sortPriority": 2
            }
          ],
          "eventType": {
            "id": "1",
            "name": "Soccer"
          },
          "event": {
            "id": "28974266",
            "name": "BSC Glasgow v Vale of Leithen",
            "countryCode": "GB",
            "timezone": "Europe/London",
            "openDate": "2018-10-26T18:45:00.000Z"
          }
        },
        Key things I've found,
        • All times are UTC, use event->timezone to convert to local times.
        • For Horse racing, marketStartTime is the start time of the race, races can be grouped by this field. description->marketTime and description->suspendTime always appear to match, not sure what the difference is.
        Hope that helps someone!

        Comment

        • SteveDev
          Junior Member
          • Oct 2018
          • 11

          #5
          Sorry Neil, somehow I missed your answer yesterday. Thanks for the response

          Comment

          Working...
          X