[P3/low] feat(eod): decompose Rotation sleeve per-ticker#348
Open
ne-groomer[bot] wants to merge 2 commits into
Open
[P3/low] feat(eod): decompose Rotation sleeve per-ticker#348ne-groomer[bot] wants to merge 2 commits into
ne-groomer[bot] wants to merge 2 commits into
Conversation
…bucket Refactor compute_alpha_attribution to emit one 'rotation' kind component per exited/trimmed ticker instead of a single aggregate 'Rotation (exited)' label. The per-ticker pattern mirrors the prior Pricing & Timing decomposition (PR347) and supplies the granular attribution the dashboard already renders generically. Preserves the tie-out identity and trim-double-counting guard: only the sold portion's rotation P&L appears in the ticker's rotation row (retained shares get their own position row). Closes #2050
The PR's decompose-per-ticker refactor had two bugs: 1. rotation_dollar was being reassigned instead of accumulated, causing per-ticker alpha calculation to fail when using the accumulated value 2. Test data used wrong unattributed_usd (700 instead of 1700) 3. Test assertions expected raw realized, not alpha (missing SPY cost) Fixes: rotation_dollar now accumulates across all tickers, per-ticker rotation_alpha uses only that ticker's realized - SPY_cost, and test data/expectations are corrected to match the accounting identity. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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.
Priority: P3 · Complexity: low
Summary
Refactor
compute_alpha_attributionto emit onekind: "rotation"component per exited/trimmed ticker instead of a single aggregate "Rotation (exited)" bucket. This mirrors the per-ticker decomposition pattern from PR347 (Pricing & Timing) and enables the dashboard to render granular ticker-level rotation attribution.Implementation
rotatedflag with unconditional append (already guarded byif sold <= 0: continue)pt_by_tickerslice for fully exited tickers (trim's retained-share P&L stays in its position row)rotation_spy_baseaccumulated for idle-cash calculationCloses
Closes #2050