Skip to content

Remove APR duplication in renderExpiryTable — use enriched rows from compute()#66

Merged
heyitsStylez merged 1 commit into
mainfrom
remove-apr-duplication-expiry-table
May 16, 2026
Merged

Remove APR duplication in renderExpiryTable — use enriched rows from compute()#66
heyitsStylez merged 1 commit into
mainfrom
remove-apr-duplication-expiry-table

Conversation

@heyitsStylez
Copy link
Copy Markdown
Owner

Summary

renderExpiryTable was reading raw trades[] and recomputing APR inline, creating two copies of the formula that could silently diverge from r.annual in the Open Positions table. This PR eliminates the duplication.

Three concrete changes:

  1. 08-render.js — passes c.allRows to rStats alongside displayRows
  2. rStats signature — updated to rStats(streams, lots, allRows, displayRows), forwards allRows to renderExpiryTable(allRows)
  3. renderExpiryTable(allRows) — filters enriched rows (not raw trades[]), reads r.annual directly, delegates DTE label to _liveDte(r.expiry). Inline APR formula removed.
  4. Dead branch removedelse renderExpiryTable() in fetchExpiryPrices was unreachable (render is always defined in the built app); replaced with a direct render() call.

Why allRows not displayRows: renderExpiryTable applies its own sFilter asset check internally, so it needs the full unfiltered set. displayRows is already filtered.

Docs updated:

  • docs/architecture.md — data flow edge updated to allRows + displayRows → RT
  • CLAUDE.mdrStats and renderExpiryTable signatures updated in the file map

Test plan

Two new integration tests in test/integration/expiry-table.test.js:

  • APR consistencyrenderExpiryTable APR matches Open Positions APR for the same trade (column 7 in expiry table vs column 9 in open table). Catches any future formula divergence.

  • Asset filter respected — with BTC + ETH trades, setting ETH filter shows only ETH row in Expiring This Week.

  • npm test — 110/110 pass

  • python3 build.py --check — passes

Closes #58

🤖 Generated with Claude Code

…compute()

renderExpiryTable now receives allRows (enriched by compute) via rStats
instead of filtering raw trades[]. Uses r.annual directly and _liveDte
for the DTE label, eliminating the duplicate inline APR formula.
Removes the dead `else renderExpiryTable()` branch in fetchExpiryPrices.
Closes #58.

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 10:39am

@heyitsStylez heyitsStylez merged commit 0afae73 into main May 16, 2026
4 checks passed
@heyitsStylez heyitsStylez deleted the remove-apr-duplication-expiry-table branch May 16, 2026 10:40
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.

Remove APR duplication in renderExpiryTable — use enriched rows from compute()

1 participant