2
Problem with my to.monthly. He cuts my data series, I don’t know why.
####install.packages("quantmod")
library(quantmod)
####install.packages("PerformanceAnalytics")
library(PerformanceAnalytics)
####install.packages("zoo")
library(zoo)
####Definindo diretório principal
setDefaults(getSymbols, src='google')
StartDate = as.Date("2004-01-01") ####data de começo
EndDate = as.Date("2017-01-01") ####data de término
ibovespa <- getSymbols('IBOV', from=StartDate, to=EndDate, auto.assign = F)
ibovespa_monthly <- to.monthly(ibovespa) #->->->->->->->->->problem#####
colnames(ibovespa_monthly) <- c("Open", "High", "Low", "Close","Volume")
ibovespa_return <- (Return.calculate(ibovespa_monthly$Close)[-1,])*100
plot.zoo(ibovespa_return, xlab="Mês", ylab = "Porcentagem")
table.CalendarReturns(ibovespa_return)
I hadn’t noticed, but there were NA values in my file. When I applied the function Monthly it only calculated up to the NA value. Thank you, Marcos!!!
– Arduin
I’m glad I could help. Please accept my answer so that in the future other people can consult you and solve this same problem if it arises.
– Marcus Nunes