我有没有办法提取过去10个历史时期的数据? 截至目前,我通过此代码获得了5份历史性季度报告和4份历史性年度报告。
请帮帮我。
library(quantmod)
getFin('AAPL') # returns AAPL.f to "env"
viewFin(AAPL.f, "IS", "Q") # Quarterly Income Statement
viewFin(AAPL.f, "CF", "A") # Annual Cash Flows
答案 0 :(得分:1)
read.csv("http://financials.morningstar.com/ajax/exportKR2CSV.html?&t=AAPL",header=T,stringsAsFactors = F,skip = 2)[,-c(12)]->spreadsheet
#str(spreadsheet)
View(spreadsheet)
答案 1 :(得分:0)
你可以使用它,但我认为限制是4年的历史数据。
require(quantmod)
setwd("C:/Users/your_path_here/Desktop")
stocks <- c("AAVL",
"ACAD",
"ACHN")
# equityList <- read.csv("EquityList.csv", header = FALSE, stringsAsFactors = FALSE)
# names(equityList) <- c ("Ticker")
for (i in 1 : length(stocks)) {
temp<-getFinancials(stocks[i],src="google",auto.assign=FALSE)
write.csv(temp$IS$A,paste(stocks[i],"_Income_Statement(Annual).csv",sep=""))
write.csv(temp$BS$A,paste(stocks[i],"_Balance_Sheet(Annual).csv",sep=""))
write.csv(temp$CF$A,paste(stocks[i],"_Cash_Flow(Annual).csv",sep=""))
}