Skip to content

New module: Mortgage.fs — offset, equity release, and shared ownership calculations#64

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-mortgage-fs-module
Draft

New module: Mortgage.fs — offset, equity release, and shared ownership calculations#64
Copilot wants to merge 2 commits into
mainfrom
copilot/add-mortgage-fs-module

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 28, 2026

Adds a Mortgage module implementing three specialist mortgage product structures not previously modelled in the library.

Offset Mortgages

  • calculateOffsetMortgage: net interest-bearing balance (mortgage − linked savings), monthly payment/interest saving, estimated term reduction, and total interest comparison.

Equity Release / Lifetime Mortgages

  • calculateEquityRelease: daily-compounding balance projection to a future date, voluntary partial repayments applied on their respective dates, and no-negative-equity guarantee (NNEG) modelling (balance capped at property value, with a trigger flag).

Shared Ownership

  • calculateSharedOwnershipOutgoing: blended monthly outgoing = mortgage payment + rent on unowned share.
  • calculateStaircasing: cost of an additional tranche, updated owned/unowned shares, reduced rent, and new mortgage payment after staircasing.
  • calculateTotalCostComparison: total cost over a given horizon vs. equivalent outright-purchase mortgage.

Usage sketch

open FSharp.Finance.Personal.Mortgage

// Offset mortgage
let result = calculateOffsetMortgage {
    MortgageBalance       = 200_000_00L<Cent>
    LinkedSavingsBalance  =  50_000_00L<Cent>
    AnnualInterestRate    = Percent 3m
    RemainingTermMonths   = 240
    MonthlyPayment        = ValueNone
}
// result.NetInterestBearingBalance = 150_000_00L<Cent>
// result.EstimatedMonthsSaved      = ~55 months

// Equity release — 40 years at 7%, NNEG cap at £200k
let er = calculateEquityRelease {
    InitialAdvance    = 100_000_00L<Cent>
    StartDate         = Date(2000, 1, 1)
    AnnualInterestRate = Percent 7m
    ProjectionDate    = Date(2040, 1, 1)
    PartialRepayments = [||]
    PropertyValue     = ValueSome 200_000_00L<Cent>
}
// er.NnegTriggered    = true
// er.BalanceAfterNneg = 200_000_00L<Cent>

All monetary values use int64<Cent> consistent with the rest of the library; percentages use Percent.

…ity release, and shared ownership

Agent-Logs-Url: https://github.com/simontreanor/FSharp.Finance.Personal/sessions/fdb59fcf-07b5-43ae-a858-21b3e0570cd4

Co-authored-by: simontreanor <4550815+simontreanor@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new module: Mortgage.fs for mortgage product structures New module: Mortgage.fs — offset, equity release, and shared ownership calculations Apr 28, 2026
Copilot AI requested a review from simontreanor April 28, 2026 23:28
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.

New module: Mortgage.fs (offset, equity release, shared ownership)

2 participants