Skip to content

Add payment holidays and partial overpayments to Refinancing.fs#53

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/extend-amortisation-with-holidays-overpayments
Draft

Add payment holidays and partial overpayments to Refinancing.fs#53
Copilot wants to merge 4 commits into
mainfrom
copilot/extend-amortisation-with-holidays-overpayments

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 28, 2026

Extends Refinancing.fs with two new real-world lending scenarios.

Changes Made

Payment holidays / deferrals (paymentHoliday)

  • DeferredInterestHandling DU: CapitaliseAsNewPrincipal | SpreadOverRemainingTerm
  • PaymentHolidayParameters record: HolidayStartDay, HolidayEndDay, InterestHandling, SettlementDay
  • paymentHoliday function: zeroes scheduled payments during the holiday window and recomputes the post-holiday schedule using the chosen interest strategy — capitalising accrued holiday interest into the outstanding balance, or spreading the equivalent payment increase evenly over the remaining term

Partial overpayments (applyOverpayment)

  • OverpaymentHandling DU: ReduceTerm | ReducePayment
  • OverpaymentParameters record: OverpaymentHandling, SettlementDay
  • applyOverpayment function: recomputes the remaining schedule after an overpayment to either shorten the term (same payment amount) or lower the regular payment amount (same number of remaining payments)

Both functions return {| OldSchedules; NewSchedules |} consistent with the existing reschedule and rollOver functions, so statement generation and APR recalculation work correctly on the modified schedule.

Tests

New tests/RefinancingTests.fs with 10 passing tests covering all four scenarios and key edge cases (holiday window with no scheduled payments, over-clearing overpayment). Registered in FSharp.Finance.Personal.Tests.fsproj.

Testing

  • ✅ Library builds successfully (dotnet build src/FSharp.Finance.Personal.fsproj)
  • ✅ All 10 new RefinancingTests pass
  • ✅ 219 pre-existing test failures are unchanged (unrelated HTML-generation issue)

Copilot AI linked an issue Apr 28, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 28, 2026 22:57
Agent-Logs-Url: https://github.com/simontreanor/FSharp.Finance.Personal/sessions/3276f859-9319-4d96-88d8-8655f9634d59

Co-authored-by: simontreanor <4550815+simontreanor@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simontreanor/FSharp.Finance.Personal/sessions/3276f859-9319-4d96-88d8-8655f9634d59

Co-authored-by: simontreanor <4550815+simontreanor@users.noreply.github.com>
Copilot AI requested a review from simontreanor April 28, 2026 23:30
Copy link
Copy Markdown
Owner

@simontreanor simontreanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot continue

Copy link
Copy Markdown
Author

Copilot AI commented Apr 29, 2026

@copilot continue

Continued and completed. The root cause was that ReducePayment's level-payment calculation was anchoring the first generated payment on the evaluation date (day 0) instead of the first remaining scheduled payment date (one period later), so the interest timing was off and the final balance never reached zero. Fixed in commit 16610a9 by restoring firstRemainingDate as the unit-period anchor while keeping StartDate = EvaluationDate so pre-payment interest is still included.

All 10 new RefinancingTests now pass; the 219 pre-existing failures are unchanged.

Copilot AI changed the title [WIP] Add payment holidays and partial overpayments to Amortisation.fs Add payment holidays and partial overpayments to Refinancing.fs Apr 29, 2026
Copilot AI requested a review from simontreanor April 29, 2026 22:47
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.

Amortisation.fs: payment holidays and partial overpayments

2 participants