Skip to content

Extract calcPremiumStats from rCharts into 05d-calc-stats.js#64

Merged
heyitsStylez merged 2 commits into
mainfrom
extract-calc-premium-stats
May 16, 2026
Merged

Extract calcPremiumStats from rCharts into 05d-calc-stats.js#64
heyitsStylez merged 2 commits into
mainfrom
extract-calc-premium-stats

Conversation

@heyitsStylez
Copy link
Copy Markdown
Owner

Summary

  • Extracts the inline calcStats closure from rCharts into a standalone pure function calcPremiumStats in src/js/05d-calc-stats.js
  • Drops dead fields (assignmentLoss, callAwayCredit, netPnl) that were never rendered
  • Dual-exports the new function following the same pattern as computePnl and lotEngine

Test plan

  • test/unit/calc-stats.test.js — 5 new tests: HOLDING exclusion, null returnRate when no settled trades, 100% returnRate when all OTM, notional-weighted portfolioAPR, shape/dead-field assertions
  • npm test — 104/104 pass
  • python3 build.py --check — passes
  • Premium P&L Total and Monthly tabs render correctly (no functional change)

Closes #56

🤖 Generated with Claude Code

Moves the inline calcStats closure out of rCharts into a standalone pure
function with dual-export, drops dead fields (assignmentLoss, callAwayCredit,
netPnl), and adds unit tests. Closes #56.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

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

Project Deployment Actions Updated (UTC)
hyperwheel Ready Ready Preview, Comment May 16, 2026 2:39am

@heyitsStylez heyitsStylez merged commit 93383cd into main May 16, 2026
4 checks passed
@heyitsStylez heyitsStylez deleted the extract-calc-premium-stats branch May 16, 2026 02:39
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.

Extract calcPremiumStats from rCharts into 05d-calc-stats.js

1 participant