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
3 3 2 4

HTTPError: Backend error. 400 Bad Request

Hi I am looping through 14,000 tickers in chunks of 100, retrieving 8 or so fields. The loop fails with error "400 Bad Request" most of the time. I have read various links on the topic, tried adding "set_timeout(500)" but still randomly fails. Is this because of the amount of RICS I am looping through? Is there a way this can be done without crashing? Below is the code.

for i in range(startpos,nosrnd+1,chuncks):
        dfmcap, err = ek.get_data(riclist[i:i+chuncks],['TR.FreeFloatPct','TR.CompanyMarketCap','TR.IssueMarketCap','TR.ShareClass','TR.RegCountryCode','TR.CommonName','TR.CLOSEPRICE','TR.SharesOutstanding'],{'SDate':sd, 'EDate':sd, 'Curn':'USD'})
        dfmcap1, err = ek.get_data(riclist[i:i+chuncks],['TR.CompanyMarketCap','TR.IssueMarketCap','TR.SharesOutstanding','TR.CLOSEPRICE'],{'SDate':setdate, 'EDate':setdate, 'Curn':'USD'})
        print(i)
        dfmcapsum = pd.concat([dfmcapsum,dfmcap], axis = 0)
        dfmcapsum1 = pd.concat([dfmcapsum1,dfmcap1], axis = 0)
eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apierror-400
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.

1 Answer

· Write an Answer
Upvotes
Accepted
85.2k 290 53 77

If it is a processing timeout at the server, set_timeout(500) will not help.

When this happens, the API will throw an exception. Therefore, the application can catch it and re-request for several times, as mentioned in this question.

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.