Open diegoturing opened 1 year ago
Duplicate of https://github.com/ranaroussi/quantstats/issues/291
Unfortunately, @ranaroussi is merging PR relatively slowly so this still is an active bug although a PR is available
I was coming to report the same error. I'm not sure it's a duplicate because the periods parameter is not being passed at all whereas the other issue recommends using 365 as the default number of periods if I understand correctly.
In line 839 of the file 'reports.py' the function '_stats.cagr' is called without passing the periods per year defined in the main call:
metrics["CAGR﹪%"] = _stats.cagr(df, rf, compounded) * pct
This causes the CAGR to always be calculated with the default periods per year (252), which leads to errors in the calculation when using other periods. It should be solved with:
metrics["CAGR﹪%"] = _stats.cagr(df, rf, compounded, periods=win_year) * pct