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 2 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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-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.

escalated to Olivier/Pierre Faurel

Hi @brendan

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,

AHS

Hello again!

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

@brendan

Greetings,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
78.8k 250 52 74

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.