私はRで作成した回答を提供すると考えていました(そしてR-Bloggersで共有しました)。私が提供している答えはC#ではなく、XPathとXMLはすべての言語でサポートされているので、このアプローチを使用することができます。ブログへのURLです - あなたはBarChart.comから主要な統計情報を使用して気にしない場合はhttp://www.r-bloggers.com/pull-yahoo-finance-key-statistics-instantaneously-using-xml-and-xpath-in-r/
#######################################################################
##Alternate method to download all key stats using XML and x_path - PREFERRED WAY
#######################################################################
setwd("C:/Users/i827456/Pictures/Blog/Oct-25")
require(XML)
require(plyr)
getKeyStats_xpath <- function(symbol) {
yahoo.URL <- "http://finance.yahoo.com/q/ks?s="
html_text <- htmlParse(paste(yahoo.URL, symbol, sep = ""), encoding="UTF-8")
#search for <td> nodes anywhere that have class 'yfnc_tablehead1'
nodes <- getNodeSet(html_text, "/*//td[@class='yfnc_tablehead1']")
if(length(nodes) > 0) {
measures <- sapply(nodes, xmlValue)
#Clean up the column name
measures <- gsub(" *[0-9]*:", "", gsub(" \\(.*?\\)[0-9]*:","", measures))
#Remove dups
dups <- which(duplicated(measures))
#print(dups)
for(i in 1:length(dups))
measures[dups[i]] = paste(measures[dups[i]], i, sep=" ")
#use siblings function to get value
values <- sapply(nodes, function(x) xmlValue(getSibling(x)))
df <- data.frame(t(values))
colnames(df) <- measures
return(df)
} else {
break
}
}
tickers <- c("AAPL")
stats <- ldply(tickers, getKeyStats_xpath)
rownames(stats) <- tickers
write.csv(t(stats), "FinancialStats_updated.csv",row.names=TRUE)
#######################################################################
の絶対GEMです回答。ありがとうございました!私は古いバージョンのYahoo! Managed(CodeProject - [link](http://www.codeproject.com/Articles/42575/Yahoo-Finance-Managed))、テストアプリケーションのすべての回答がゼロまたはN/Aとして出てくる。あなたが与えたリンクは完璧に機能します。あなたにもう一度お悔やみして申し訳ありませんが、方法がしばしば転用される必要があるかどうかは分かりますか?あなたが忙しければ心配しないでください。今のところ情報を得ることができて本当にうれしいです。 – HockeyJ
あまり頻繁ではありません。これらの統計データは、yahooの公式CSV-APIの一部ではありません。代わりに、libは通常のyahooページを解析します(YQL経由で、最終データは公式APIからです^^;これはライセンスのために重要です)。だから、yahooがサイト(表の部分)を変更するたびに、libに更新が必要です。 greetz – Maas
クール。情報をありがとう。私はそれが本当に良いので、私が支払ったときに私はプロジェクトに寄付します! – HockeyJ