[R-SIG-Finance] Interanual Return

Pedro páramo percent||101 @end|ng |rom gm@||@com
Sat Jul 25 12:15:07 CEST 2020


Hi all,

I want to calculate interanual (not year to date) variation of a stock, I
am able to obtain year to date with annualReturn, but no way to obtain the
interanual increase. It says me no numerical output.

Can anyone guide me to obtain it.

library(PerformanceAnalytics)
library(dplyr)
library(tibble)
library(lubridate)
library(PerformanceAnalytics)
library(quantmod)
library(ggplot2)
library(png)
library(RCurl)

fecha<-Sys.Date()-365 #with this I obtain one year back beginning
precio<-getSymbols("ACX.MC <http://acx.mc/>",from='fecha')
ret2<- na.omit(CalculateReturns(Cl(ACX.MC <http://acx.mc/>)))
g<-annualReturn(ACX.MC <http://acx.mc/>) #This is year to date
d<-CalculateReturns(Cl(ACX.MCC))
aaa<-getQuote('ACX.MC <http://acx.mc/>',from='fecha')
Lastprice<-aaa[1,2]

lo<-c(diff(log(aaa),250))  #With this I try  to obtain interanual year
variation but error


Hope you can help me

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list