Skip to content

Refinancing: add remortgage cost comparison and debt consolidation NPV#60

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/extend-refinancing-calculate-comparisons
Draft

Refinancing: add remortgage cost comparison and debt consolidation NPV#60
Copilot wants to merge 4 commits into
mainfrom
copilot/extend-refinancing-calculate-comparisons

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 28, 2026

Extends Refinancing.fs with two borrower/adviser comparison calculations that were missing from the module.

compareRemortgage

Compares the total cost of staying on a current mortgage product vs. switching to a new one.

New types: RemortgageComparisonParameters, RemortgageComparisonResult

let rcp: RemortgageComparisonParameters = {
    EarlyRepaymentCharge = Amount.Percentage(Percent 2m, Restriction.NoLimit)
    ArrangementFee = 999_00L<Cent>
    LegalCosts = 300_00L<Cent>
    NewProductParameters = newProductParams  // principal = outstanding balance
}

let result = compareRemortgage currentParams actualPayments rcp
// result.NetBenefit           – positive = switching saves money
// result.BreakEvenPeriodCount – ValueNone if savings never recover upfront costs within remaining term
  • Outstanding balance sourced from getQuote (settlement quote on evaluation day)
  • ERC computed as an Amount against the outstanding capital balance
  • Break-even = ⌈upfrontCosts / perPeriodSaving⌉; ValueNone if new product isn't cheaper per period or break-even exceeds remaining term

compareDebtConsolidation

Compares the NPV of repaying multiple existing debts individually against replacing them with a single consolidated facility, discounting future cash flows at a caller-supplied rate.

New types: DebtConsolidationParameters, DebtConsolidationResult

let dcp: DebtConsolidationParameters = {
    DiscountRate = Interest.Rate.Annual(Percent 5m)
    ConsolidatedFacilityParameters = consolidatedParams
    ConsolidationFees = 500_00L<Cent>
}

let result = compareDebtConsolidation existingDebts dcp
// result.IndividualPaymentsNpv    – PV of paying each debt separately
// result.ConsolidatedPaymentsNpv  – PV of consolidated payments + upfront fees
// result.NetConsolidationSaving   – positive = consolidation is more economical
  • Discount factors computed once per unique day-count (memoised) to avoid redundant Math.Pow calls
  • Supports Interest.Rate.Zero, Annual, and Daily discount rates
  • Upfront consolidation fees added at discount factor = 1 (paid at reference date)
  • Both strategies filter to payments strictly after each debt's evaluation day for a consistent present-value comparison

Copilot AI changed the title [WIP] Add remortgage cost comparison and debt consolidation NPV calculations Refinancing: add remortgage cost comparison and debt consolidation NPV Apr 28, 2026
Copilot AI requested a review from simontreanor April 28, 2026 23:19
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.

Refinancing.fs: remortgage cost comparison and debt consolidation NPV

2 participants