Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
31 0 0 3

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

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!

eikon-data-api#technology#productesgerror-400indices
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
80.3k 259 52 75

@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.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
31 0 0 3

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.