Skip to main content

Point-in-time and current constituents for major stock indices (CSI 300, S&P 500, NASDAQ-100), packaged as pandas DataFrames.

Project description

Index Constitution

中文

Purpose

This repository was created to make it easier to train quantitative models on major stock indices. Reliable historical index composition data (constituent additions and removals over time) is notoriously hard to obtain — vendors often charge for it, official sources are scattered across PDFs and announcements, and free APIs rarely expose point-in-time membership. Without this data, backtests suffer from survivorship bias and lookahead bias.

This repo collects and normalizes that information into plain CSV files so it can be consumed directly by research and modeling pipelines.

Datasets

Index Description Source
CSI 300 Top 300 A-share stocks listed on the Shanghai and Shenzhen exchanges Official announcements from China Securities Index Co. (csindex.com.cn)
S&P 500 500 leading large-cap U.S. companies listed on U.S. exchanges Wikipedia: List of S&P 500 companies
NASDAQ-100 100 largest non-financial companies listed on the Nasdaq Stock Market Wikipedia: NASDAQ-100

Structure

src/index_constitution/_data/
    history/
        csi300.csv
        nasdaq100.csv
        sp500.csv
    latest/
        csi300.csv
        nasdaq100.csv
        sp500.csv

Python package

This repo also ships a small Python library that embeds the CSVs and exposes them as pandas DataFrames.

Install:

pip install index-constitution

Usage:

import index_constitution as ic

ic.list_indices()                    # ['csi300', 'sp500', 'nasdaq100']

ic.latest("sp500")                   # current S&P 500 members
ic.history("csi300")                 # full CSI 300 history with opt-in/opt-out
ic.constituents_at("sp500", "2015-06-30")   # point-in-time membership
ic.is_member("sp500", "AAPL", "2020-01-02") # True

Use Cases

  • Check the current constituents of an index
  • Reconstruct point-in-time index membership for backtesting
  • Avoid survivorship bias when training quantitative models
  • Keep a consistent structure for adding more indices later

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

index_constitution-0.1.0.tar.gz (49.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

index_constitution-0.1.0-py3-none-any.whl (61.0 kB view details)

Uploaded Python 3

File details

Details for the file index_constitution-0.1.0.tar.gz.

File metadata

  • Download URL: index_constitution-0.1.0.tar.gz
  • Upload date:
  • Size: 49.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for index_constitution-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f2973ab0aacfef34a0db5d23b8e07d80d2247763ae67c7bdbc5b514571b1d2c
MD5 ad9fd7d43fecbafc3615a3d4efa4ec6f
BLAKE2b-256 a0e5c76be9653b35f7af549baa172fc7973ab2993acb40bd3a9eedc1291289ca

See more details on using hashes here.

File details

Details for the file index_constitution-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for index_constitution-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81520c7179a267dff8e4230eab32f4506f02508b41b29fb4fb443f133fefecf8
MD5 c49c843e2bf747ff037c3e9cc5ebaf80
BLAKE2b-256 b5e79b7ae15df7848a6ad03c7e9a76edba25dfd38baf26213143acb7232c6214

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page