Features/src notebooks update#41
Open
phuo-nv wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes cumulative portfolio value/backtest curves so they begin at the requested regime/trading start date with an initial value of
1.0.Previously, return computation dropped the first price row because the first return is undefined, and cumulative returns were built directly from the first realized return. As a result, cumulative value plots began on the first return date and at
1 + first_return, rather than at the selected start date and100%portfolio value.Changes
Add explicit cumulative-date anchoring in
portfolio_backtester1.0cumulative_datesfor consumersUpdate rebalancing cumulative series assembly
Add regression coverage
1.0Preserve existing KDE helper compatibility
generate_samples_kdeto accept dict-style KDE settings used by existing testsValidation
uv run --extra dev pytestuv run --extra dev ruff check src/backtest.py src/rebalance.py src/cvar_utils.py tests/test_core.pyNotes
This fixes the library/source behavior. Demo-specific progressive plotting changes are handled separately where needed.