Last Total Return value returned ad infinitum
Hi
I am getting daily total return data and I have a problem when no price data exists, e.g. the stock has been delisted:
If you look at the below data returned
Instrument TR.TOTALRETURN TR.TOTALRETURN.DATE TR.TOTALRETURN.CalcDate
0 0FUN.L^D15 0.127319929 2014-08-18T00:00:00Z 2021-03-26
1 0FUN.L^D15 0.127319929 2014-08-18T00:00:00Z 2021-03-25
2 0FUN.L^D15 0.127319929 2014-08-18T00:00:00Z 2021-03-24
3 0FUN.L^D15 0.127319929 2014-08-18T00:00:00Z 2021-03-23
4 0FUN.L^D15 0.127319929 2014-08-18T00:00:00Z 2021-03-22
... ... ... ... ...
3325 0FUN.L^D15 NaN 2008-01-31
3326 0FUN.L^D15 NaN 2008-01-30
3327 0FUN.L^D15 NaN 2008-01-29
3328 0FUN.L^D15 NaN 2008-01-28
3329 0FUN.L^D15 NaN 2008-01-25
Total return should be zero on a daily basis after 2014-08-18 but the API returns the last daily value ad infinitium which makes no sense, so how can I get zero returned for dates after 2014-08-18?
I am trying to create a total return price index so I need to calculate the product of these values. Alternatively is there a field for since issue total return (price + dividend return)
call:
params = {'SDate': '2008-01-25', 'EDate': '2021-03-26', 'Frq': 'D'}
df, err = ek.get_data(
'0FUN.L^D15', ['TR.TotalReturn', 'TR.TotalReturn.Date', 'TR.TotalReturn.CalcDate'], field_name=True,
parameters=params)
thanks
Best Answer
-
@john.lupton so I do have a more elegant workaround if you change Frq parameter to NA it will appear correctly as expected and will not repeat:
params = {'SDate': '2008-01-25', 'EDate': '2014-08-18', 'Frq': 'NA'}
df, err = ek.get_data('0FUN.L^D15', ['TR.TotalReturn', 'TR.TotalReturn.Date', 'TR.TotalReturn.CalcDate'], field_name=True,
parameters=params)
dfI hope this can help.
0
Answers
-
@john.lupton please can you post the API call code in python here thanks. The instrument you are looking at is an expired contract. For expired contracts its best to know the start and end date. If you post your code we can look at it and make a suggestion.
You can also try the following which should return the index of the last non-nan value:
df['TR.TOTALRETURN'].last_valid_index()
0 -
@jason.ramchandani Hi i added the call in the OP. Its not futures contract its an equity. thanks for taking the time to look
0 -
That I know but what you suggest it does not address the problem. The problem is what eikon returns not manipulating a pandas dataframe
0 -
@john.lupton yup - i already changed it - its a delisted equity - did you try the last_valid_index() code I sent.
0 -
see my response to your first mentioning the suggestion above - your suggestion does not relate to the question posed
0 -
@john.lupton ok apols got it - you mean you want it to stop at 2014-08-18T00:00:00Z or the last total return date. We can check for the date of the last closing price using:
df,err = ek.get_data('0FUN.L^D15',['TR.PriceCloseDate'])
end_date = pd.to_datetime(df['Date']).dt.date.astype(str)
end_date[0]We can then use that in the main api call:
params = {'SDate': '2008-01-25', 'EDate': end_date[0], 'Frq': 'D'}
df, err = ek.get_data('0FUN.L^D15', ['TR.TotalReturn', 'TR.TotalReturn.Date', 'TR.TotalReturn.CalcDate'], field_name=True,
parameters=params)
dfIs this the kind of thing you mean? I do notice the totalreturn.date is repeating.
0 -
@john.lupton I have opened case 09793728 on your behalf as this is more of a content issue and have asked the content team to explain why multiple repeat values are being returned. I hope this is ok.
0 -
Hi @jason.ramchandani thanks for taking the time. I agree, this should not be a programming thing, I can code my way around it: I feel it is a bug in the API that if you ask for a total return for a period that ends and/or starts after a security has been delisted you get a non-zero value - that makes no sense in reality and it should be zero. Thanks p.s. how can I follow this ticket 09793728 ? thanks
0 -
@john.lupton Apols the case has been assigned to me - the first response I received from them was incorrect - so I have followed up and its now being investigated and they will come back to me. Apols I will report as soon as they get back to me - but its probably safe to say this won't be resolved quickly so I would for the moment implement a workaround in code. I hope this can help.
0 -
@john.lupton So the Analytics team have got back to me and said 'The current behaviour is expected per ADC design. Is it possible ask the client to filter out records where date not equal to calc date?' - which is all I can offer at present as a workaround.
I have asked the team to change the behaviour of this field as it is clearly not correct. For days where an instrument does not trade total return should be zero not the total return from the last traded day.
I hope this can help.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛