Skip to content

[codex] Support time-varying report risk-free rates#524

Open
luuhongyii wants to merge 1 commit into
ranaroussi:mainfrom
luuhongyii:fix-time-varying-report-rf
Open

[codex] Support time-varying report risk-free rates#524
luuhongyii wants to merge 1 commit into
ranaroussi:mainfrom
luuhongyii:fix-time-varying-report-rf

Conversation

@luuhongyii

Copy link
Copy Markdown

Summary

  • allow report paths to accept a time-varying risk-free rate series
  • subtract Series risk-free rates from DataFrame returns by date index
  • display time-varying report RF values as an average in report parameters and metrics
  • keep single-value aggregate metrics from expanding when RF is a pandas object

Root cause

reports.html() and reports.metrics() accepted rf as if it were always a scalar. Passing a pandas Series triggered ambiguous truth-value checks and scalar formatting failures. The underlying excess-return helper also subtracted a Series from a DataFrame along columns instead of rows, which broke date-aligned RF calculations inside reports.

Fixes #521.

Testing

  • PYTHONUTF8=1 python -m pytest -q (129 passed)

@luuhongyii luuhongyii marked this pull request as ready for review June 13, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qs.reports.html() function assumes the risk free rate is constant

1 participant