Murali
Murali

Reputation: 601

quantmod - Quarterly and Annual reports - Is it possible to extract past 10 historic periods?

Is there way I can extract the data for last 10 historic periods? As of now I am getting 5 historic quarterly reports and 4 historic Annual reports via this code.

Please help me.

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

Upvotes: 1

Views: 328

Answers (2)

user7075507
user7075507

Reputation:

BTW, if you want 10 years worth of metrics and ratios, you can use this methodology.

read.csv("http://financials.morningstar.com/ajax/exportKR2CSV.html?&t=AAPL",header=T,stringsAsFactors = F,skip = 2)[,-c(12)]->spreadsheet
#str(spreadsheet)
View(spreadsheet)

Upvotes: 1

user7075507
user7075507

Reputation:

You can use this, but I think the limitation is 4 years of historical data.

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=""))
}

Upvotes: 0

Related Questions