Error fetching data for given date. Error code -1 | Backend error. 400 Bad Request Requested univers

Hello

I am running an Eikon API code through Python to generate Excel output for different indices every quarter from 2000-2022.

However, on several occasions, the code generates the following error on a given date:

Error fetching data for 2012-10-01: Error code -1 | Backend error. 400 Bad Request Requested universes: ['0#.FTSE(20121001)']. Requested fields: ['TR.COMMONNAME', 'TR.ISINCODE', 'TR.ENVIRONMENTPILLARSCORE(SDATE=2012-10-01)', 'TR.SOCIALPILLARSCORE(SDATE=2012-10-01)', 'TR.GOVERNANCEPILLARSCORE(SDATE=2012-10-01)', 'TR.TRESGSCORE(SDATE=2012-10-01)', 'TR.TRESGSCOREGRADE(SDATE=2012-10-01)', 'TR.COMPANYMARKETCAP(SDATE=2012-10-01)', 'TR.COMPANYMARKETCAP.CURRENCY', 'TR.PRICECLOSE(SDATE=2012-10-01)', 'TR.OPENPRICE(SDATE=2012-10-01)', 'TR.SHARESOUTSTANDINGCOMMONTOTAL(SDATE=2012-10-01)', 'TR.TOTALRETURN(SDATE=2012-10-01,EDATE=2012-12-30)']

Although once the code is run again the error either changes to another date or is resolved.

Is this related to the nature of my code or Eikon API malfunction/limitation?

Thank You!

Best Answer

  • Jirapongse
    Answer ✓

    @jean-rene.mwizere

    Thank you for reaching out to us.

    According to the Eikon Data API Usage and Limits Guideline, when a request fails because the platform is overwhelmed, an HTTP response with status code 400 and the message "Backend error. 400 Bad Request" is returned. Then the Python library raises an exception with the following message.

    1706075728951.png

    Therefore, you may try to catch this exception and add the retry logic, as shown in this dicussion.


Answers

  • Thank you, your answer is clear and satisfactory.

    I am using another approach given my data set size;
    Instead of the straightforward line provided in the discussion

    retry_max = 5

    retry_count = 1

    I opted for a more flexible line with
    @retry(tries=3, delay=2, backoff=2)
    This means there will be 3 retries, a delay of 2 seconds, and an exponential increase of 2 seconds with each retry attempt. So, for example, if the first attempt fails, it will wait 2 seconds, for the second attempt it will wait 4 seconds, and for the third attempt, it will wait 8 seconds.

    I thought this might help any other person with a similar issue with API delay.