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

question

Upvotes
Accepted
2 0 1 3

Index Constituents - Start of every year with Market Cap

Hi

I want to get the index constituents of the .TRXFLDINP index from the start of every years since 2012, along with the Market Cap and Average Value Traded (so Volume x Price) at the start of every year.

I have gone through some of the questions posted but do not find the solution I am looking for.

Thanks

pythonrefinitiv-dataplatform-eikon#technologyconstituents
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.

@vbala

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the 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


1 Answer

· Write an Answer
Upvotes
Accepted
32.2k 40 11 20

Hi @vbala ,

I would try to divide the task:

  1. Compile the list of dates at the beginning of the year
  2. Request the list of constituents
  3. Request the market caps and average values traded

Try this, and you may wish to tune the approach on your side to your requirements:

import datetime
for year in range(2012, 2022):
    sdate_for_year = str(year)+'-01-01'
    print("sdate ", year, " = ", sdate_for_year)
    
    df, err = ek.get_data(
        instruments = ['.TRXFLDINP'],
        fields = ['TR.IndexConstituentRIC',
                  'TR.IndexConstituentName'],
        parameters = {
            'SDate':sdate_for_year
        }
    )
    print('Constituents:')
    print(df)
    
    df2, err = ek.get_data(
        instruments = df['Constituent RIC'].tolist(),
        fields = ['TR.CompanyMarketCap',
                  'TR.AvgMonthlyValTraded1Year'],
        parameters = {
            'SDate': sdate_for_year
        }
    )
    print(df2)

This results in the output:

mcapout.gif

Hope that this suggestion is of help



mcapout.gif (76.7 KiB)
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.

Thank you

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.