Skip to content

v0.0.85

Choose a tag to compare

@ranaroussi ranaroussi released this 26 Sep 20:10
· 2 commits to main since this release

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 passed rf to _prepare_returns() without a periods argument, 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-zero rf.

    rar() now takes periods (default 252) and de-annualizes the rate; reports.metrics()
    passes the report's own periods_per_year through. 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
    because metrics() never passed rf into rar() at all, so the rate was silently
    ignored. The standalone stats.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.