Given a list of dates, I want the individual returns for each of the constituents of an ETF (for each of those dates)
Upgrade from Eikon -> Workspace. Learn about programming differences.
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Given a list of dates, I want the individual returns for each of the constituents of an ETF (for each of those dates)
Hello @arun.sharma3 ,
Thank you for your participation in the forum.
Is the reply below satisfactory in resolving your query?
If yes, please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.
Otherwise please post again offering further insight into your question.
Thanks,
-AHS
Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
AHS
Hello @arun.sharma3,
Reviewing this previous discussion thread may be helpful with the approach to obtaining this result set.
Next I would tweak/tune the approach to your requirements, and Data Item Browser tool can be helpful to look up available Returns for your target ETF constituents and tune the request:
Therefore, a request similar to:
# obtain constituents at date df, err = ek.get_data('RPV',['TR.ETPConstituentRIC','TR.ETPConstituentWeightPercent'],{'SDate': '2017-01-03'}) # create a list of constituents at date list(df['Constituent RIC']) # request returns per list df, err = ek.get_data(list(df['Constituent RIC']),['TR.TotalReturn','TR.TotalReturn1Wk'],{'SDate': '2017-01-03'}) df
Would result in:
And if you require this for a list of dates you would run the tuned request per each required date to obtain the results for the date.
Hope this information helps
@arun.sharma3 Please see the following:
dates =['2021-11-01','2021-10-01'] df = pd.DataFrame() for date in dates: cons, err = ek.get_data(['ISF.L'], ['TR.ETPConstituentRIC.calcdate', 'TR.ETPConstituentRIC', 'TR.ETPConstituentName', 'TR.ETPConstituentPrice'], parameters={'SDate': "'" + date + "'"}) if len(df): df = pd.concat([df, cons], axis=0,ignore_index=True) else: df = cons df
I would then get the daily returns separately as Zoya has described above. I hope this can help.