[R-SIG-Finance] How to obtain data from *all* companies in the S&P 500 + sector information?

Marius Hofert m_hofert at web.de
Thu Dec 16 13:41:51 CET 2010


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 ====


More information about the R-SIG-Finance mailing list