findDrawdowns fails for specific dates in xts
Opened this issue · 0 comments
ronanalexand commented
library(xts)
library(PortfolioAnalytics)
from = "1900-01-01"
to = "2020-03-24"
getSymbols("^GSPC", src='yahoo',from = from,to = to)
getSymbols("^BVSP", src='yahoo',from = from,to = to)
return_ibov<-na.omit(diff(log(BVSP[,6])))
return_sp500<-na.omit(diff(log(GSPC[,6])))
AverageDrawdown(return_ibov)
AverageLength(return_ibov)
AverageRecovery(return_ibov)
AverageDrawdown(return_sp500)
AverageLength(return_sp500)
AverageRecovery(return_sp500)
I am getting this error:
The data cannot be converted into a time series. If you are trying to pass in names from a data object with one column, you should use the form 'data[rows, columns, drop = FALSE]'. Rownames should have standard date formats, such as '1985-03-15'.