Financial Data Analysis and Practice

Logo

Prof. Luke Stein

View the Project on GitHub lukestein-classes/fdap

FDAP Sample Data Files

GitHub requires that files be less than 100MB (50MB recommended). Note that by default GitHub does not turn csv files into downloads, so you may have to choose Save As… in your web browser.

Caution:

  1. Data may not be up to date (and may be inaccurate for other reasons); do not rely on materials in this repository for any critical analysis
  2. Data is undocumented, and variables may not be what you expect

Daily S&P 500 data (sp500d.csv)

Download

Source: CRSP via WRDS

wrds_username = "YOUR_USERNAME"
db = wrds.Connection(wrds_username = wrds_username)
sp500d = db.get_table("crsp", "dsp500", columns=['caldt', 'spindx', 'sprtrn', 'vwretd', 'vwretx'], date_cols=['caldt'], index_col=['caldt'])
db.close()
sp500d.to_csv(r'sp500d.csv')

Monthly S&P 500 data (sp500m.csv)

Download

Source: CRSP via WRDS

wrds_username = "YOUR_USERNAME"
db = wrds.Connection(wrds_username = wrds_username)
sp500m = db.get_table("crsp", "msp500", columns=['caldt', 'spindx', 'sprtrn', 'vwretd', 'vwretx'], date_cols=['caldt'], index_col=['caldt'])
db.close()
sp500m.to_csv(r'sp500m.csv')

Monthly tech stock returns (monthly-tech.csv)

Download

Source: Cameron Pfiffer

Public companies with identifiers and industry codes (compustat_firms_2020.csv)

Download

Source: Compustat via WRDS

See WRDS for variable documentation; note

Canadian housing prices

Sales Prices of Houses in the City of Windsor

Source: R Ecdat Data Sets for Econometrics

import statsmodels.api as sm
import statsmodels.formula.api as smf
houses = sm.datasets.get_rdataset("Housing", "Ecdat").data

Additional submissions welcome!