Extend Scheduling.fs to support balloon and bullet repayments#56
Extend Scheduling.fs to support balloon and bullet repayments#56Copilot wants to merge 3 commits into
Conversation
…e constructor Agent-Logs-Url: https://github.com/simontreanor/FSharp.Finance.Personal/sessions/d8ff30cd-81f2-4bf0-a96a-f024eec63084 Co-authored-by: simontreanor <4550815+simontreanor@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simontreanor/FSharp.Finance.Personal/sessions/d8ff30cd-81f2-4bf0-a96a-f024eec63084 Co-authored-by: simontreanor <4550815+simontreanor@users.noreply.github.com>
Implemented in commit a1f4920. Here's what was added:
The bisection solver now targets
Three new tests cover: a PCP loan (£20 k, £8 k GFV, 7%), a bullet/interest-only loan (£10 k principal = balloon, 5%), and the |
Extends
Scheduling.fsto support balloon and bullet repayment structures — a final lump-sum payment larger than the regular instalments.Changes Made
AutoGenerateSchedule.BalloonPayment: int64<Cent>A new field on
AutoGenerateSchedulerepresenting the deferred principal due at maturity (PCP Guaranteed Future Value, HP option price, or the full principal for bullet/interest-only loans). Defaults to0L<Cent>for fully amortising products. All 92 existing call sites updated withBalloonPayment = 0L<Cent>.Correct payment and APR calculation
principalBalance - balloonAmount = 0, so regular payments amortise onlyprincipal - balloon.last regular instalment + balloonby the existingadjustFinalPaymentfunction.equaliseInterest) also accounts for the balloon when computing the level payment and the convergence check.balloonAmountis clamped to[0, principal]to guard against invalid inputs.pcpconvenience constructorA new
pcpfunction inScheduling.fsthat builds aBasicParametersrecord with the GFV set asBalloonPayment. Pass the result tocalculateBasicScheduleto derive the regular monthly payments, full amortisation schedule, and APR automatically.HTML output
ScheduleConfig.toHtmlTablenow shows the balloon payment amount when it is non-zero.Testing
BalloonTest_Pcp_20000_gfv8000_7pct_36m— PCP loan (£20k principal, £8k GFV, 7% annual, 36 months)BalloonTest_Bullet_10000_5pct_12m— Bullet/interest-only loan (full principal as balloon, 5% annual, 12 months)BalloonTest_Pcp_Convenience_25000_gfv10000_6p9pct_36m— PCP viapcpconvenience constructor