Open localperf opened 1 month ago
Hey the reason they differ is because the utils_cagr function is incorrectly counting calendar days instead of trading days when identifying the annualization period.
years = (returns.index[-1] - returns.index[0]).days / periods
this method will unfortunately count calendar days, when in reality it would be more accurate to count the length of the returns object.
hopefully they fix this, I had to do this locally as I was getting incorrect CAGR's.
I'm looking at the last 5 years of FAGIX (5/31/2019 - 5/31-2024).
Morningstar today says the 5-year trailing return is 7.14%
Quantstats tearsheet says the cumulative return is -6.76% and the CAGR is - 0.8%.
Close prices on first and last days of the 5 year period are $9.79 and $9.90 -- a small positive return. Adjusted closing prices on those two days are $7.12 and $9.90, a cumulative return of 39%; and a CAGR of 6.8%
The 6.8% calculated here seems "close" to the 7.14% reported by Morningstar -- I don't know why they differ.
Bottom line: I think quantstats utils.download_returns should calculate returns using the Adj Close prices, not the Close prices.
I may easily be missing something -- but I'd like to be able to check quantstats with other sources.
Thanks for a GREAT package!