Skip to content
Back to formatted view

Raw Message

Message-ID: <D9C8BCB5-4E3F-4DCA-9CC4-CDC96F0DD68E@web.de>
Date: 2010-12-16T12:41:51Z
From: Marius Hofert
Subject: How to obtain data from *all* companies in the S&P 500 + sector information?

Dear expeRts,

Is it possible to obtain quotes from all companies of the S&P 500 via R?
I know that I can use the following code to get historical data from the index, but what about the 500 companies?

If this is possible, is it also possible to obtain the GICS sector information (see http://en.wikipedia.org/wiki/Global_Industry_Classification_Standard) for each of the 500 companies? Basically, the sector information is given here:
http://en.wikipedia.org/wiki/List_of_S%26P_500_companies (it suffices to have the sector information [not the industry groups etc.])
The problem would then be to match the sector information with the companies. I once obtained the 500 time series from Thompson Datastream and tried to match the GICS sectors (obtained from the webpage) by hand, which was very tedious and prone to errors. That's why I'm asking.

Cheers,

Marius

## ==== snippet start ====

library(quantmod)
sp500.sym <- getSymbols("^GSPC") 
sp500 <- get(sp500.sym)
sp500. <- sp500["2009-01-01::2010-01-01",4] # end-day quotes

## ==== snippet end ====