Skip to content

[P3/low] feat(eod): decompose Rotation sleeve per-ticker#348

Open
ne-groomer[bot] wants to merge 2 commits into
mainfrom
feat/decompose-rotation-per-ticker
Open

[P3/low] feat(eod): decompose Rotation sleeve per-ticker#348
ne-groomer[bot] wants to merge 2 commits into
mainfrom
feat/decompose-rotation-per-ticker

Conversation

@ne-groomer

@ne-groomer ne-groomer Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Priority: P3 · Complexity: low

Summary

Refactor compute_alpha_attribution to emit one kind: "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

  • Move component emission inside the rotation loop so each ticker getting shares sold today emits its own rotation row
  • Replace the rotated flag with unconditional append (already guarded by if sold <= 0: continue)
  • Preserve the pricing_timing allocation logic: only include pt_by_ticker slice for fully exited tickers (trim's retained-share P&L stays in its position row)
  • Keep rotation_spy_base accumulated for idle-cash calculation

Closes

Closes #2050

groom-bot and others added 2 commits July 10, 2026 07:11
…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>
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.

0 participants