question

Upvotes
Accepted
3 0 0 2

Historical daily market caps for constituents of ETF

Using Refinitiv Data API with Python:


Exploring if it is possible, especially without looping any requests, to get the daily historical market cap for any given ETF? By that I do not mean the market cap for the ETF but the sum of market caps for the constituents. Is this data that is available?

python#technologyrefinitiv-data-librariesetf
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvote
Accepted
5.6k 18 2 7

Hi @jn02 ,


You can do that in two steps. First, you would need to get ETF constituents as of a date:

import refinitiv.data as rd
rd.open_session()
df = rd.get_data('XIU.TO', fields = ['TR.ETPConstituentRIC','TR.ETPConstituentName', 'TR.ETPConstituentRIC.calcdate', 'TR.ETPConstituentWeightPercent',], parameters = {'SDate': '2024-05-01'})
df

screenshot-2024-05-10-at-131422.png

Unfortunetly, you can't get this historically in a straightforward way. I have a presented a more streamlined way of doing that for index constituents which you may want to adapt for ETFs. Check the article here- Building historical index constituents | Devportal (lseg.com).

Next, once you have the constituents, you can request the historical market cap of those instruments:

rics = df['Constituent RIC'].to_list()
rd.get_history(universe  = rics, fields = "TR.CompanyMarketCap", start = '2020-01-01', end = '2024-05-01')


screenshot-2024-05-10-at-131653.png

Hope this helps.


Best regards,

Haykaz


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks a lot!

Does this take into account if a ticker is no longer a constituent of an ETF? Or if it historically was but is not at date SDate. I am thinking from the perspective of rics not being dynamic. This seems to leave us with having to loop?

The date you provide under SDate will be used to retrieve constituents as of that date. If you need constituents for other dates, you may need to make separate calls.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.