Skip to content

APR: annualise buy-to-close over days held; no APR on rolled legs - #150

Merged
heyitsStylez merged 1 commit into
mainfrom
fix/closed-apr
Oct 15, 2026
Merged

heyitsStylez merged 1 commit into
mainfrom
fix/closed-apr

Conversation

@heyitsStylez

Copy link
Copy Markdown
Owner

Summary

  • Closed early: CLOSED trades with a closeDate are annualised over the days actually held (open → close, min 1) instead of the full term. The full-term basis understated every early close (e.g. MES $7,550: 4.5% → ~8.2%; PURR $10: 45.6% → ~147%).
  • Rolled legs: APR is null (renders "—"), because the buy-back belongs to the roll and isn't a standalone loss (PURR $11: −106.2% → —).
  • Done in compute(), so history table, mobile cards, CSV export and the Portfolio APR tile stay consistent. Crypto closes never set closeDate, so HyperWheel APRs are unchanged.

Test plan

  • python3 build.py --check
  • npm test: 205 pass (new compute test: days-held, no-closeDate fallback, rolled → null, new leg unaffected)
  • Check APR column + Portfolio APR tile on the gowheeler preview

🤖 Generated with Claude Code

CLOSED trades with a closeDate are annualised over open→close days
(min 1) instead of the full term, which understated early closes. Legs
rolled into a new option (another trade has rolledFrom = id) get a null
APR, since the buy-back is part of the roll. Flows through history,
cards, CSV and the Portfolio APR tile via compute().
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
gowheeler Ready Ready Preview Oct 15, 2026 2:50pm UTC
hyperwheel Ready Ready Preview Oct 15, 2026 2:50pm UTC

@heyitsStylez
heyitsStylez merged commit bee786b into main Oct 15, 2026
5 checks passed
@heyitsStylez
heyitsStylez deleted the fix/closed-apr branch October 15, 2026 14:51

This branch was successfully deployed

2 active deployments
Preview – gowheeler — 3a4d7687 Deployed Oct 15, 2026 by vercel[bot]
Preview – hyperwheel — 3a4d7687 Deployed Oct 15, 2026 by vercel[bot]
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