3
$\begingroup$

Using the quantmod package in R, one can download the S&P500 index using the following command:

getSymbols("^GSPC", env = sp500, src = "yahoo",from = as.Date("1960-01-04"), to = as.Date("2009-01-01"))

The S&P is further broken down in sectors (with their yahoo symbols in brackets): Health care (XLV), industrials (XLI), consumer staples (XLP), consumer discretionary (XLY), materials (XLB), utilities (XLU), financials (XLF or XLFS), energy (XLE), technology (XLK), and Real Estate (XLRE).

These sectors are further broken down in subsectors, but I do not know how to get these indexes. For example, Healtcare is has Managed care, Pharmaceuticals, equipment, as subsectors.
For example,

http://finance.yahoo.com/quote/%5ESP500-3510?p=%5ESP500-3510

is a subsector of the Health care index, but using the symbol given there (^SP500-3510) does not seem to work in the above getSymbol R command. Any suggestion on how to get this index?

$\endgroup$
1
$\begingroup$

This is a Yahoo data issue - you should contact them regarding their symbols and availability of data.
It might just be that the index is not covered by them or they are restricted from providing historical data.

Also note that you have referenced ETFs (XLV, XLI, etc.) that trade on NYSE Arca as being sector-based subsets of the S&P 500. These ETFs are based upon the Select Sector indexes. The "Select" indexes are a little different from the actual S&P 500 sector indexes in that they have more rules associated with index composition (to minimize churn) and also include other GICS classifications.

For example, XLK (Technology Select Sector SPDR ETF) is not a GICS sector - it comprises both Information Technology and Telecommunications companies. From time-to-time it has a different set of components comapred to the S&P 500 Information Technology Sector Index and the S&P 500 Telecommunications Sector Index.

Reference: https://us.spindices.com/documents/methodologies/methodology-sp-us-indices.pdf

$\endgroup$
0
$\begingroup$

There is something wrong with the web page for that index. I tried viewing historical data and there was none. The link to download historical data is also broken. I suggest testing another index.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.