I am trying to compute quarterly returns with daily stock prices. However, I don't want to use the quantmod function "quarterlyReturn(x)" for each single stock but instead for the whole list of stocks...
I would be happy about any advice on how to get there.
The beginning looks like this:
TickerList <- c("SPG", "AKR","AIV", "ARE", "AAT", "AMT", "ARI", "ABR", "ARR" )
ClosingPricesRead <- NULL for (Ticker in TickerList) ClosingPricesRead <- cbind(ClosingPricesRead,
getSymbols(Ticker, from="1950-01-01", >verbose=FALSE, auto.assign=FALSE)[,6])
ClosingPrices <- ClosingPricesRead[apply(ClosingPricesRead,1,function(x)
all(!is.na(x))),]
Now I would like to convert my daily closing Prices to quarterly returns, in such a way that I get a new dataframe with the returns for all Stocks. I tried to use the quantmod package so that:
apply(ClosingPrices, 2, function(x),quarterlyReturn(x))
But I am just receiving error messages...
Since I am fairly new to R, I would really appreciate your help!
Many thanks