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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 1 2

Discrepancy between TotalReturn for given period and TotalReturn for the same period calculated with daily total returns

I am working on adjusting the prices for dividends and therefore need to calculate total return index for every given day. This is the function is wrote:

def get_ts_for_ric(ric):
    ric_tr = ek.get_data(ric, ["TR.TotalReturn.date","TR.TotalReturn.value"], parameters={"Frq": "D", "SDate": "2011-01-01", "EDate": "2020-12-31"})[0].set_index("Date").sort_index()
    for i in range(ric_tr.shape[0]):
        if i == 0:
            ric_tr.loc[ric_tr.index[i], 'tri'] = 1 + ric_tr['value'][i]/100
        else:
            ric_tr.loc[ric_tr.index[i], 'tri'] = ric_tr['tri'][i-1] * (1 + ric_tr['value'][i]/100) 
    ric_close = ek.get_data(ric, ['TR.ClosePrice.Date', 'TR.ClosePrice.Value'], parameters={"Frq": "D", "SDate": "2011-01-01", "EDate": "2020-12-31"})[0].set_index("Date").sort_index().dropna()
    ric_ts = ric_tr.join(ric_close['Close Price'], how='inner')
    cp_to_tri = ric_ts['Close Price'][-1]/ric_ts['tri'][-1]
    ric_ts['adjusted'] = ric_ts['tri'] * cp_to_tri
    return ric_ts

When I use it for a RIC, for example:

get_ts_for_ric('PKN.WA')

I get the following last row as a result:

So that the total return index ('tri' column) indicates a Total Return for the period of 48,88%.

However when I try to get from the API the Total Return for this period directly:

ek.get_data('PKN.WA',['TR.TotalReturn'],{'SDate':'2011-01-01', 'EDate':'2020-12-31'})[0]

I get this:

So over 10 percentage points more than calculated from daily total returns.

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
1611927276012.png (5.4 KiB)
1611927405063.png (5.4 KiB)
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
39.2k 75 11 27

For some reason daily timeseries of total returns for this stock contain duplicate rows for 28-Mar-2013 and 15-Apr-2013, which messes up your calculations. The figure returned by ek.get_data('PKN.WA',['TR.TotalReturn'],{'SDate':'2011-01-01', 'EDate':'2020-12-31'}) is correct, whereas your calculation from daily total returns is off, as it applies the return for 28-Mar-2013 and 15-Apr-2013 twice. I opened a ticket with Refinitiv Support on your behalf to look into why the timeseries of daily total returns contain duplicate rows. For your reference the case number is 09578725. Refinitiv Support will reach out to you with the results of their investigation. In the meantime you can easily workaround this issue by dropping duplicate rows from the dataframe before calculating cumulative returns.

Update:

Refinitiv Support advised that to retrieve daily timeseries of TR.TotalReturn one should use TR.TotalReturn.calcdate instead of TR.TotalReturn.date, as the latter may contain duplicate entries.

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