Warning api on python is slow and can only retrieve one horses odds

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stephanmorel
    Junior Member
    • Apr 2023
    • 3

    #1

    Warning api on python is slow and can only retrieve one horses odds

    I'm enquiring about help with the api for horseracing based on the free api key, essentially not only is it 3 seconds before I get any kind of odds or python output which is a detriment if I want to do betting with live races but also it only allows me to get one horses odds at a time regardless if I use a for loop and try and chain requests. Is this a code issue or betfair issue?
    payload = 'username=' + my_username + '&password=' + my_password
    headers = {'X-Application': my_app_key, 'Content-Type': 'application/x-www-form-urlencoded'}
    resp = requests.post('https://identitysso-cert.betfair.com/api/certlogin',data=payload,cert=('c:/Users/steph/OneDrive/Documents/2023/WORK/BETTING/client-2048.crt','c:/Users/steph/OneDrive/Documents/2023/WORK/BETTING/client-2048.pem.'),headers=headers)
    json_resp=resp.json()
    print(json_resp['loginStatus'])
    SSOID = json_resp['sessionToken']
    bet_url="https://api.betfair.com/exchange/betting/json-rpc/v1"
    event_req = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listEventTypes", "params": {"filter":{ "eventTypeIds":["7"],"marketCountries":["GB","AU"]}}, "id": 1}'
    headers = {'X-Application': my_app_key, 'X-Authentication': SSOID, 'content-type': 'application/json'}
    req = requests.post(bet_url, data=event_req.encode('utf-8'), headers=headers)​
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    The odds are on listMarketBook. All the odds for every horse in the race should be on there in some sort of array.

    Comment

    • SaintOtis
      Junior Member
      • Apr 2023
      • 1

      #3
      Originally posted by jabe View Post
      The odds are on listMarketBook. All the odds for every horse in the race should be on there in some sort of array.
      Hi, where do the ratios in this listMarketBook come from?

      Comment

      • jabe
        Senior Member
        • Dec 2014
        • 705

        #4
        Originally posted by SaintOtis View Post

        Hi, where do the ratios in this listMarketBook come from?
        Hi. I don't know what you mean by "ratios".

        My usual suggestion for new users is to use the documentation to create classe in their programs using information from the documentation. The classes should contain data variables for whatever each API call receives. Doing this exercise should show you where each piece of data can be found and how the classes relate to each other.

        Comment

        • Loraon
          Junior Member
          • Apr 2023
          • 1

          #5
          me too. I don't understand
          Hi, where do the ratios in this listMarketBook come from?
          https://forum.developer.betfair.com/...ne-horses-odds Papa's Pizzeria
          Last edited by Loraon; 25-04-2023, 07:20 AM.

          Comment

          Working...
          X