Non credo che Yahoo fornire un elenco di tutti i fondi comuni di investimento che hanno dati per (allo stesso modo, non forniscono un elenco degli stock che coprono). Puoi scaricare l'elenco dal sito web menzionato nei commenti, attraverso tutti i fondi, recuperare la corrispondente pagina "Profilo" da Yahoo, ed estrarre le informazioni che ti servono - il campo "Categoria" sembra essere la cosa più vicina al "settore e industria" che desideri.
# Read the list of funds
# I assume the file was downloaded manually from
# http://www.eoddata.com/Data/symbollist.aspx?e=USMF
# This requires registration (free).
d <- read.delim("USMF.txt", stringsAsFactors = FALSE)
# Retrieve the profile page, for each of the funds.
# It takes 1 second for each, and there are 24,000 of them:
# this may take more than 6 hours.
library(RCurl)
library(stringr)
d$Category <- ""
for(i in seq_len(nrow(d))) {
try({
url <- paste0("http://uk.finance.yahoo.com/q/pr?s=", d$Symbol[i])
cat(url, " ")
profile <- getURL(url)
row <- str_extract(profile, "Category.*?</tr>")
cell <- str_extract(row, "<td.*</td>" )
d$Category[i] <- str_replace_all(cell, "<.*?>", "")
cat(d$Category[i], "\n")
})
}
head(d)
fonte
2013-07-21 09:58:23
La funzione 'stockSymbol' recupera l'elenco dei titoli dal sito Nasdaq (che elenca anche alcune altre borse): se siete a conoscenza di una pagina web simile che elenca le attività che si desidera, è possibile semplicemente recuperalo e analizzalo. –
C'è un sito web che ha un elenco completo di fondi comuni di investimento: eoddata.com per chiunque sia interessato. Il mio problema è che ho bisogno di ottenere i fondi comuni di investimento per settore e industria. L'API di Yahoo Finance probabilmente lo fa –