Discrepancy between TotalReturn for given period and TotalReturn for the same period calculated w...

...ith 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.
Best Answer
-
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.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛