How to extract S&P 500 stock/index prices and fundamental data from WRDS

Marco Montez
3 min readNov 27, 2019

This will be a tutorial on how to extract financial data from the Web using the WRDS (Wharthon Research Data Sevices) platform.

First you require an WRDS account with acess to financial databases. Generally students from business schools have acess to it, or a similar platform.

Go the WRDS website ( https://wrds-www.wharton.upenn.edu/ ) and enter your credentials in the login page.

After logging in, select “Get Data” and “Compustat - Capital IQ”.

Then choose North America-Daily to choose data from American companies.

Then you have the option of choosing Financial statements, both quarterly and annual, pricing information or even Index information.

If you want to get the S&P 500 index prices, you choose “Index Prices”. For Step 1 select the data range. For step 2, choose TIC since we’re getting an Index and write “i0003” which corresponds to the S&P 500 TIC code. GVKEYX is recomended for stocks since it doesn’t change unlike the TIC code, which can change when a company defaults, is adquired, leaves the Index or other situations.The Code look-up option can be used to search for other indexes such as the S&P 400 and 600.

For Step 3, choose the variables to analyse. In this case the Low, High and Close prices were selected.

For step 4 you can select the output format (csv / xlsx …) the compression and the date format.

Finally you hit submit query and go to the download page, which prepares the query and provides the downloadable link.

And voilá, you’ve just downloaded financial data for the S&P 500 index for the last 10 years from the web. To extract other data such as stock prices or financial statements the process is similar and you just choose different options in the North American Daily area.

--

--