Skip to content

Derive return metrics from Portfolio and guard HHI range - #115

Merged
belarusian merged 1 commit into
mainfrom
build39/value-history-hhi-guard
Aug 17, 2026
Merged

Derive return metrics from Portfolio and guard HHI range#115
belarusian merged 1 commit into
mainfrom
build39/value-history-hhi-guard

Conversation

@belarusian

Copy link
Copy Markdown
Owner

Summary

  • Wire Portfolio.record_value() into the simulation loop so the per-day valuation series is tracked on the portfolio itself.
  • Derive Sharpe ratio, ROI, max drawdown, and annualized return from Portfolio.calculate_returns() in the trainer closure instead of an ad-hoc computation.
  • Document the HHI renormalization divergence from the seed's raw-fraction form (which can go negative for cash-heavy portfolios) and add a regression test pinning hhi_normalized to [0, 1].

Testing

  • Full test suite: 573 passed
  • ruff: clean
  • mypy: clean

Wire Portfolio.record_value() into the simulation loop so the per-day
valuation series is tracked on the portfolio, and derive Sharpe ratio,
ROI, max drawdown, and annualized return from Portfolio.calculate_returns()
instead of the ad-hoc computation in the trainer closure.

Document the HHI renormalization divergence from the seed's raw-fraction
form (which can go negative for cash-heavy portfolios) and add a
regression test pinning hhi_normalized to [0, 1].
@belarusian
belarusian merged commit e2dfb4e into main Aug 17, 2026
1 check passed
@belarusian
belarusian deleted the build39/value-history-hhi-guard branch August 17, 2026 01:12
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.

1 participant