question

Upvotes
Accepted
9 5 4 5

20 years of total returns

Hi, i need to get 20 year of montly total returns from a little over 5000 Sedols. Right now i'm using this method with the Python API:

aux, err = ek.get_data(list, ['TR.TotalReturn.Date','TR.TotalReturn'], parameters={"Frq": "M",'SDate':'1998-12-31', 'EDate':'2018-12-31'})

but i keep getting this error message:

"headers = [header['displayName'] for header in data_dict['headers'][0]]"

I tried partitioning the the quering on batches of 200, 100 and 50 Sedols, but i still get the same error. Retrying would get more or less iterations randomly (ie, with 100 on my first try i got the first 500 and on the second over a 2000).

Any thoughts?

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apidatatime-series
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
3.8k 4 4 6

Hi @pchauveau

I have tried with the code below and got the outputs

instruments, e = ek.get_data('0#.GDAXI', ['Instrument']) 
instruments=instruments['Instrument'].tolist() 
for ric in instruments: 
	tmp_df = ek.get_data(ric, ['TR.TotalReturn.Date','TR.TotalReturn'], parameters={"Frq": "M",'SDate':'1998-12-31', 'EDate':'2018-12-31'})[0] 
df = tmp_df.append(df) 
df 
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.

Thanks for your solution. I had to add ignore_index=True to the append statement to avoid some issues. :D

Upvotes
39.4k 78 11 27

This is a known issue where the Web service provides an empty response when the backend takes "too long" to process the request. The problem is acknowledged and is being worked on. In the meantime as a workaround the suggestion is to split your list into even smaller chunks (submitting the request of say 20 Sedols at a time), and also resending the same request if and when you receive an empty response.

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.

Thanks for your comment, it is a shame that this issue isnt solved yet. I did lower the number of sedols, but even with 20 or 10 i had the same problem. I had to run one at the time...

The issue with the Web service returning empty response or "Backend error. 400 Bad Request" has been addressed with the release of Eikon Data APIs library for Python v1.0.1 available on PyPI. This does not mean that with Eikon Data APIs library for Python v1.0.1 one can never receive "Bad request" error or that the service can now provide unlimited data downloads. But one should no longer experience random and frequent empty responses or "Backend error. 400 Bad Request" forcing one to resubmit the same requests in a loop until the data is returned.

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.