Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findDrawdowns fails for specific dates in xts #146

Open
ronanalexand opened this issue Mar 24, 2020 · 0 comments
Open

findDrawdowns fails for specific dates in xts #146

ronanalexand opened this issue Mar 24, 2020 · 0 comments

Comments

@ronanalexand
Copy link

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant