Functional Weave
Code in Python

lending.early-settlement@1.0.0

README.md

4,220 bytes · view raw

# lending.early-settlement

**Status: needs review by a consumer-credit specialist before publishing.**

The figure a debtor pays to settle a regulated consumer credit agreement
(a personal loan, hire purchase, a car finance agreement) early, and the
rebate of charges they are entitled to, under the Consumer Credit (Early
Settlement) Regulations 2004 (SI 2004/1483, as amended by the Consumer
Credit (EU Directive) Regulations 2010). Source:
https://www.legislation.gov.uk/uksi/2004/1483, text read 2026-09-23.

## The rules it applies

- **Regulation 4(1), the rebate.** The rebate is "the difference between the
  total amount of the repayments of credit that would fall due for payment
  after the settlement date if early settlement did not take place and the
  amount given by the following formula":

      Σ A_i (1 + r)^a_i  −  Σ B_j (1 + r)^b_j

  A_i are the advances and B_j the repayments made before the settlement
  date; a_i and b_j are the times from each to the settlement date; r is "the
  periodic rate equivalent of the APR". So the formula is the balance
  outstanding at the settlement date, carried forward at the APR, and that is
  the settlement figure; the rebate is what it saves against paying the
  schedule out.
- **Regulation 5(1)(a), the settlement date.** 28 days after the creditor
  receives the debtor's notice under section 94(1) of the Consumer Credit Act
  1974, or any later date the notice names. An earlier date in the notice
  does not shorten the 28 days.
- **Regulation 6, deferment.** Where the credit is repaid over a period of
  more than a year after the relevant date, the creditor may defer the
  settlement date by one month, or elect 30 days where a month would be more
  or less than 30 days. `deferral` is that election; asking for it on an
  agreement of a year or less is an error. A month is a calendar month,
  clamped at the month end (31 January + 1 month is 28 February), as
  dates.add-months does.

## How it is computed

Time is measured in days and a year is 365 days, so each amount is carried
forward by (1 + APR)^(days / 365). That fractional power is irrational; it
is computed in 18-place fixed point with math.fractional-power (the daily
factor (1 + APR)^(1/365) once, then a whole power of it per flow), the same
floors in the same order in every language, accurate to around 10^-15 of the
amount. The formula's result is rounded **down** to the minor unit, because
regulation 2(1) requires a rebate "at least equal" to the calculated one, so
the debtor is never asked for a fraction of a penny more.

- Repayments dated before the settlement date are treated as made, on their
  due dates, which is the creditor's election in regulation 4(2); arrears are
  not modelled, so add any missed instalments to the figure yourself.
- Repayments dated on or after the settlement date are the ones settled
  early; their total is `remainingRepayments`.
- The settlement amount never exceeds `remainingRepayments`, and the rebate
  is never negative.

## What a specialist should check

- **Rate and time basis.** "The periodic rate equivalent of the APR" is read
  as (1 + APR)^(days/365), using the APR as disclosed (rounded to one decimal
  place). Some creditors use monthly periods with part-months, or the
  unrounded APR; the answers differ by pennies.
- **Leap years.** 365 days throughout, as in lending.apr.
- **A repayment due on the settlement date itself** is treated as settled
  early (included in `remainingRepayments`, excluded from the formula). The
  regulations speak of repayments "before" and "after" the settlement date and
  are silent on the day itself.
- **What is in the total charge for credit.** Regulation 3 allows some items
  (taxes, linked transactions, broker fees attributable to the period before
  settlement) to be excluded from the rebate; the flows passed in are taken as
  given.
- **Scope.** Regulation 2(2) excludes running-account credit (credit cards,
  overdrafts) and some land mortgages; partial early settlement (section
  94(3), regulation 4A) is not implemented.
- **Relevant date.** Regulation 6 measures "more than a year" from the
  relevant date; this uses the first advance's date as that date.