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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 0

Efficient retrieval of a series of returns data around a date

Hi, my question is about what is an efficiency way of doing this:

Let's say I have a particular date of interest for a RIC, and I want to get 1) the daily total returns for -1 to 1 days around this date and 2) the total return from this date to 30 days after this date.

For now I am retrieving every return data separately by

#for the daily return from -1 to 0
=eikon.get_data([RIC,['TR.TotalReturn'], {'SDate':datetime.strftime(Date - timedelta(1), '%Y-%m-%d'), 'EDate':datetime.strftime(Date - timedelta(0), '%Y-%m-%d')})

This appears very inefficient when I have many of such dates of interest from many RICs, not to mention the Error 400 warnings. Just wonder if anyone have a clever way?



eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
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
18k 21 12 20

Hi @chen.lin

First, I would like to mention that get_data can take in multiple RICs as input. This may reduce your API call if you only pass in a single RIC.

Second, It really depends on the dates of your interest. So you can consider retrieving a range of data and filter them out on your dataframe.

Just make sure that it does not exceed the limitation which explained here.


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.

Hi, many thanks, that's exactly what I tried later on and it worked nicely for my tasks :)


However, there's one minor bug I want to report and an additional question about the limits.

For some RICs, I get duplicated observations, as in the example below:

data_grid, err = eikon.get_data('1992.T',
                                fields = ['TR.TotalReturn1D.date','TR.TotalReturn1D'],
                                parameters={'SDate':'1991-09-01','EDate':'2019-12-01','Frq':'D','CH':'Fd'})


You can immediately spot them

It's not hard to fix this once you are aware, but might be a problem if someone else does not. And it seems this is not an issue when I run the formula in excel add-in.


And just of curiosity, for that same code, I tried to used up to 20 RICs as input and obtained a matrix of size 113,852 X 3. How is that not restricted by the limit of 10,000 data point?



capture.jpg (79.8 KiB)

Hi @chen.lin

I tried using Eikon Excel to retrieve the same RIC and date range data.

I can see the same identical data.

So this should be a content issue.

Refinitiv Helpdesk can help to clarify if there is any content issue or can explain why you get duplicated records.

You can raise query to them at https://my.refinitiv.com/

ahs.png (50.4 KiB)
Click below to post an Idea Post Idea