Functional Weave
Code in Rust

property.mortgage-affordability@1.0.0

README.md

2,098 bytes · view raw

# property.mortgage-affordability

The two checks a UK mortgage lender runs on how much a buyer can borrow:

1. **Income multiple (loan-to-income).** The loan divided by gross annual
   income, against the lender's ceiling, typically 4 to 4.5 times income
   (`maxIncomeMultipleBasisPoints` 45000 = 4.5×). Returned as a multiple in
   basis points, rounded up, and as the largest loan the multiple allows,
   rounded down.
2. **Stress-tested repayment.** The monthly repayment at the actual rate and
   at a higher stress rate, plus existing commitments, as a share of monthly
   income, against the lender's ceiling. This is `lending.affordability`
   unchanged: its full result comes back as `repayment`.

`affordable` is true only when both pass.

## Everything rounds against the borrower

The monthly income is annual ÷ 12 rounded down; the multiple is rounded up;
the maximum loan down; and lending.affordability rounds repayments and
ratios up. A test that passes only because of a rounding is not a pass. The
multiple test itself is exact: `withinMultiple` is loan × 10000 ≤ income ×
ceiling, with no rounding in it.

## The ceilings are the lender's

Neither ceiling is a rule in this code. The Bank of England Financial Policy
Committee's loan-to-income flow limit restricts the share of a lender's new
mortgages at or above 4.5× income, but it is a portfolio limit, not a cap on
any one loan; the lender's own policy sets the multiple for each applicant.
The stress rate is also the lender's: the FCA's MCOB 11.6.18R requires
lenders to allow for likely rate rises, and the FPC's specific stress test
was withdrawn from 1 August 2022 (see lending.affordability for the sources).

## What it does not do

Joint applications are the caller's to add up (pass the combined income the
lender counts). Expenditure models, credit scores, deposit and loan-to-value
(see lending.ltv), and interest-only lending are out of scope. Annual income
may be up to £100,000,000 (10,000,000,000 minor units) and the multiple up to
20× (200000), which keeps the arithmetic exact in every language.