Building historical index constituents
You can read the full article on the Developer Portal.
Overview
While identifying the current members of an index is straightforward, uncovering this information for previous periods sometimes presents significant challenges. Indexes are subject to frequent changes due to regular rebalancing, mergers, acquisitions, and delistings. Thus, those interested in historical data must navigate these changes to maintain the accuracy of their analyses.
This article aims to streamline this process. We will introduce a series of functions designed to simplify access to historical index data, allowing users to retrieve this information through a single request. By automating the management of index rebalancing over the change dates, we alleviate the burden on users, enabling them to focus on their analytical and investment strategies without getting entangled in the complexities of data retrieval.
The full article can be found on LSEG’s Developer Portal and you can check the complete source folder on GitHub.
Steps of the process
We define several helper functions which are further wrapped into a separate function allowing to get the historical constituents of a given index through a single function call. The functions cover:
- Getting the initial list of constituents as of a date
- Getting the Joiners and Leavers during the requested period
- Updating index constituents with Joiners and Leavers
The actual functions along with the explanations can be found in the main article here.
Wrapping all together
We encapsulate the previously discussed functions into a single, comprehensive function named get_historical_constituents. This function efficiently returns a DataFrame containing the historical constituents. Below we present the function.
def get_historical_constituents(index, start, end):
initial_constituents = get_constutents_as_of(index, start)
constitent_changes = get_constituent_changes(index, start, end)
historical_constituents = update_constituents(start, initial_constituents, constitent_changes)
return historical_constituents
Let’s also show how the function will be called.
ftse_constituents = get_historical_constituents('.FTSE', '2014-01-01', '2024-03-14')
ftse_constituents
Additionally, we wrapped the above mentioned function within a singleton object accessible in GitHub folder of the project.
Economic use case: Sectoral distribution of an index over time
Given our straightforward method for accessing the historical constituents of an index, we delve into a use case: examining the historical sectoral distribution within an index. This analysis can serve as an effective proxy for understanding the broader economic trends of a country.
Below is the distribution of several sectors within FTSE 100 over 10 year period. The details and the full code can be found in the main article.
References
Downloads
Related Articles
- Calculating the Median of an Index’s Constituents with Datastream (DSWS), February 28, 2021, Jonathan Legrand
- Reconstructing RICs for expired futures contracts, January 24, 2023, Haykaz Aramyan
- Functions to find Option RICs traded on different exchanges, April 24, 2022, Haykaz Aramyan
- How to build an end-to-end transaction cost analysis framework, February 07, 2024, Haykaz Aramyan, Gurpreet Bal, Marios Skevofylakas
- Explore all Articles