Skip to content

About

Get the current and historical constituents of popular stock indices.

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

index-constituents

update-daily Website

Get the current and historical constituents of popular stock indices. All symbols are consistent with those in Yahoo Finance.

Table of contents

Supported indices

Code Name Start Download
csi300 CSI 300 (沪深300) 2023/07 json / csv
csi500 CSI 500 (中证500) 2024/02 json / csv
csi1000 CSI 1000 (中证1000) 2024/02 json / csv
sse SSE (上证综指) 2023/07 json / csv
szse SZSE (深证成指) 2023/07 json / csv
nasdaq100 NASDAQ 100 1995/01/27 json / csv
sp500 S&P 500 1970/03/05 json / csv
dowjones Dow Jones 1982/08/30 json / csv
dax DAX 1987/12/30 json / csv
hsi HSI (恒生指数) 2023/07 json / csv
ftse100 FTSE 100 2023/07 json / csv
nifty50 NIFTY 50 2008/01 json / csv
omxs30 OMXS30 2009/06/11 json / csv
nqglci NASDAQ Global Large Cap Index 2012/12/12 json / csv
nqbr NASDAQ Brazil Index 2012/12/03 json / csv
nqbrlc NASDAQ Brazil Large Cap Index 2012/12/03 json / csv
nqca NASDAQ Canada Index 2012/12/03 json / csv
nqcalc NASDAQ Canada Large Cap Index 2012/12/03 json / csv
nqmx NASDAQ Mexico Index 2012/12/03 json / csv
nqmxlc NASDAQ Mexico Large Cap Index 2012/12/03 json / csv

Usage

Direct download

To get the current index constituents, use the links in Supported indices above. You may have noticed the URLs follow a pattern:

wget https://jcoffi.github.io/index-constituents/constituents-$CODE.$FORMAT

Use in your program

Using Python as an example:

import pandas as pd

url = "https://jcoffi.github.io/index-constituents/constituents-csi300.csv"
df = pd.read_csv(url)

Build it yourself

Check requirements.txt. Then run:

./get-constituents.py

This will generate CSV and JSON files under the docs/ folder.

Historical data

To get the historical index constituents, use one of the following URLs:

  • Monthly archive:
https://jcoffi.github.io/index-constituents/$YYYY/$MM/constituents-$CODE.$FORMAT
  • Daily archive:
https://jcoffi.github.io/index-constituents/$YYYY/$MM/$DD/constituents-$CODE.$FORMAT

By default we automatically update the data daily at 22:00 UTC. Historical data of a particular index is only available from the month we start to include it.

Data sources

Original Author

About

Get the current and historical constituents of popular stock indices.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages