ranaroussi / quantstats

Portfolio analytics for quants, written in Python
Apache License 2.0
4.59k stars 809 forks source link

Calculation of 3Y and 5Y annualized return date lag #337

Open mf12ca opened 4 months ago

mf12ca commented 4 months ago

The date lag for the calculation of 3Y and 5Y annualized return is based on 35 and 59 months, respectively. This should be years=3/5 (or months=36/60) instead:

Current code: d = today - relativedelta(months=35) metrics["3Y (ann.) %"] = _stats.cagr(df[df.index >= d], 0.0, compounded) * pct

d = today - relativedelta(months=59) metrics["5Y (ann.) %"] = _stats.cagr(df[df.index >= d], 0.0, compounded) * pct