question

Upvotes
Accepted
38 5 12 18

Get Information for equity indices?

Hello,

I would like to get equity index information, including the begin date, and data on their weighting calculations, issuer, index series type… Where can I find this information? I am assuming it exists since there are fields with these names.

Using the advanced search tool, I filtered US Large equity indices. However, I couldn't get the additional fields values.screen-shot-2022-07-12-at-122439-pm.png

On the DIB tool, for a given index, I couldn't find that info neither.

screen-shot-2022-07-12-at-122318-pm.png

Also on the RDP API, there is no such data.

df, err = ek.get_data(
    instruments = [
        '.SOSGUSSP',
        '.SOSGUSSN',
        '.SOSGUSST'
    ],
    fields = [
        'TR.IndexHistoryBeginDate',
        'TR.IndexBeginDate',
        'TR.IndexName',
        'TR.IndexVariants',
        'TR.IndexIssuerName',
        'TR.IndexMktCapVendor',
        'TR.IndexWeightingSource',
        'TR.IndexWeightingType',
        'TR.IndexWeightingName',
        'TR.IndexWeightingName',
        'TR.IndexTotalReturn1Wk'
    ]
)
eikon-data-apipythonindex
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
6.5k 21 3 6

Hi @ricardo.henriquez;


You can filter to look for what you're after in DIB, as per this video. E.g.: I could find the Country Headquarters by filtering datatypes:

1657631157232.png


and filtering with the gear symbol:


1657630920103.png


You can use the Search API to find the Indices you're after:

import refinitiv.data as rd
from refinitiv.data.content import search
rd.open_session()
# Fields we can collect with INDEX_INSTRUMENTS in Search API
fieldsResponse = search.metadata.Definition(
    view = search.SearchViews.INDEX_INSTRUMENTS
).get_data()
# Export metadata to a spreadsheet for easy viewing
fieldsResponse.data.df.to_excel("INDEX_INSTRUMENTS.xlsx")
# Send Search request
response = search.Definition( # for more on this: `help(search.Definition)`
    view=search.SearchViews.INDEX_INSTRUMENTS, # for more on this: `help(search.SearchViews)`
    query="USA",
    top=20 # 10000 max if memory serves me right
).get_data()

response.data.df

rd.close_session()

1657631157232.png (15.2 KiB)
1657630920103.png (231.2 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.

You can then use the below to collect constituents:


df1 = rd.get_history(
    universe=["0#.SPX"],
    fields=["TR.PE"],
    interval="1D",
    start="2021-10-01",
    end="2021-10-03",
)
display(df1)


1657633965797.png


Then use the DIB for each instrument's data:

1657633934346.png


1657633965797.png (35.3 KiB)
1657633934346.png (69.9 KiB)

I have an additional question regarding the Search API, and the use between filter and query.

If I use filter instead of query to find the indexes within the USA,

    filter = "RCSIndexCountryGroupLeaf eq 'United States' and RCSAssetCategoryLeaf xeq 'Equity Index'",

The search doesn’t returns any “ESG” labelled indices. For example, I would expect that S&P 500 ESG Index USD, Equity Index will be in included in the list, but is not.

If I use query for ESG,

    query = “ESG”,

The search returns all “ESG” labelled indices, irrespective of the country or region, But CountryGroup is empty so I cannot select US indices.

If I use both query and filter,

query = “ESG”,
filter = "RCSIndexCountryGroupLeaf eq 'United States' and RCSAssetCategoryLeaf xeq 'Equity Index'",

The search returns nothing.

response = search.Definition( 
    view=search.SearchViews.INDEX_INSTRUMENTS,
    filter = "RCSIndexCountryGroupLeaf eq 'United States' and RCSAssetCategoryLeaf xeq 'Equity Index'",
    query = “ESG”,
    select ="DocumentTitle,CommonName,RIC,RCSIssuerCountryLeaf,IssuerCommonName, IndexCountryGroupName, RCSIndexCountryGroupLeaf,IndexCountryGroup, Region, RIC,IndexCountryGroup",
    top=10000 
).get_data()
response.data.df.to_excel("esg_us_benchmarks.xlsx")


Ref

Hi @ricardo.henriquez , Have you tried different SearchViews ?

@jonathan.legrand, thanks for the helpful comments and code. This is what I needed and facilitates my index selection process x100 (however, I couldn't find in INDEX_INSTRUMENTS.xlsx all the variables that I was looking for). But that's ok, at least I know I cannot access such info.

`INDEX_INSTRUMENTS.xlsx` is outputted by the code from the object `fieldsResponse` itself created via the search API.

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.