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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 1 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-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonerror-400
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
38.1k 71 35 53

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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea