Add ex-ante tracking error to Portfolio#89
Open
gyx09212214-prog wants to merge 2 commits into
Open
Conversation
Reviewer's GuideAdds an ex-ante tracking error API to Portfolio that validates benchmark compatibility, computes annualized tracking error from active weights and overlapping monthly asset returns, and introduces regression tests to lock in behavior and input validation. File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
test_ex_ante_tracking_error_uses_annualized_active_weight_covariance, use the same annualization constant as the implementation (e.g.,settings._MONTHS_PER_YEARinstead of hardcoding12) so the test doesn’t drift if the configured period changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `test_ex_ante_tracking_error_uses_annualized_active_weight_covariance`, use the same annualization constant as the implementation (e.g., `settings._MONTHS_PER_YEAR` instead of hardcoding `12`) so the test doesn’t drift if the configured period changes.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Author
|
Reviewed Sourcery feedback. The current PR head already uses Validation:
|
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
Portfolio.get_ex_ante_tracking_error(benchmark)for annualized ex-ante Tracking ErrorCloses #88
Tests
.\.venv\Scripts\python -m pytest tests\portfolio\test_portfolio.py -q$env:RUFF_CACHE_DIR = $env:TEMP\okama-ruff-cache; .\.venv\Scripts\python -m ruff check .$env:JOBLIB_MULTIPROCESSING='0'; .\.venv\Scripts\python -m pytest -q -n 0→358 passed, 3 skippedSummary by Sourcery
Add support for computing annualized ex-ante tracking error for portfolios relative to a benchmark with validation of compatibility.
New Features:
Tests: