Skip to content

fix(lib): CLI-side XIRR uses Excel's 365-day basis (was 365.25)#63

Merged
ebootheee merged 1 commit into
mainfrom
fix/cli-xirr-365-basis
Jun 9, 2026
Merged

fix(lib): CLI-side XIRR uses Excel's 365-day basis (was 365.25)#63
ebootheee merged 1 commit into
mainfrom
fix/cli-xirr-365-basis

Conversation

@ebootheee

Copy link
Copy Markdown
Owner

Follow-up to #62 (which fixed the engine-side computeXIRR to the 365-day basis): lib/irr.mjs — the CLI-side XIRR used by ete carry IRR-solved life and scenario fallbacks — still divided by 365.25.

  • One-line basis fix with a comment pinning it to the engine-side contract.
  • Negative-controlled leap-span regression in tests/lib/test-lib.mjs: −100 on 2020-01-01 → +110 on 2021-01-01 (366 days) solves to 1.1^(365/366) − 1; the old basis lands ~3.6e-5 away, outside the 1e-6 gate. RED pre-fix with exactly the 365.25-basis value, GREEN post-fix.
  • Full npm test green (45/45 lib, 132/132 use-case suite).

🤖 Generated with Claude Code

The engine-side computeXIRR was fixed to the 365-day basis in PR #62;
lib/irr.mjs (used by ete carry --solve-life and scenario IRR fallbacks)
still divided by 365.25, drifting every solved rate by ~1e-5 per leap
span. Negative-controlled leap-span case added to tests/lib/test-lib.mjs
(RED on 365.25 with the predicted value, GREEN on 365).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ebootheee ebootheee merged commit 20aedcc into main Jun 9, 2026
2 checks passed
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