Repository navigation
v0.0.85
Fixes the second half of #552, which 0.0.84 did not address.
Fixed
-
rar()charged the annual risk-free rate once per period (#552).
It passedrfto_prepare_returns()without aperiodsargument, so at a daily
frequency a 5% annual rate was subtracted from every single day. The series was
wiped out and the Risk-Adjusted Return pinned to −100% for any non-zerorf.rar()now takesperiods(default 252) and de-annualizes the rate;reports.metrics()
passes the report's ownperiods_per_yearthrough. On a sample series the row reads
0.37 against 0.44 gross, where 0.0.82 through 0.0.84 read −1.00.Note that 0.0.81 was not correct here either — it printed a plausible number only
becausemetrics()never passedrfintorar()at all, so the rate was silently
ignored. The standalonestats.rar(returns, rf=0.05)call has been wrong in every
release that had it.
This is the same bug class as #549 (fixed in 0.0.83 for rolling_sharpe/rolling_sortino).
Every rf-taking function in stats has now been swept for it; rar() was the only one
left, and there is a regression test asserting that no rf-aware metric collapses to −100%
under a 5% annual rate.
Thanks again to @none2003, who named both affected metrics in the original report.