Functional Weave
Code in Python

insurance.mid-term-adjustment@1.0.1

README.md

2,789 bytes · view raw

# insurance.mid-term-adjustment

The additional premium (AP) or return premium (RP) when a policy is changed
part-way through its term: a driver added, a car swapped, cover reduced.

## How it is worked out

Give it the full-term premium before the change and the full-term premium
the policy would cost with the change (as your rating engine quotes it), the
term dates and the date the change takes effect. The difference is pro-rated
on the days left:

    premiumChange = (newPremium - oldPremium) x remainingDays / totalDays

with one rounding, in the caller's mode. Pro-rating the old and the new
premium separately and subtracting rounds twice and can be a penny out (the
vectors have one such case: 60.16, not 60.17).

`expiryDate` is exclusive (a year from 2026-01-01 ends 2027-01-01), and the
days left are `expiryDate - changeDate`, so a change on the inception date is
the whole difference and a change on the expiry date is nothing. Leap years
count their 366 days.

## The admin fee

`adminFee` is added to what is due whichever way the premium moves, which is
how most UK insurers and brokers apply an MTA fee: on a return premium the
fee is deducted from the refund, and if the fee is larger the policyholder
still pays the difference (`amountDue` positive while `kind` is `return`).
Pass zero when no fee is charged. The fee is kept separate from the premium
change because it is usually not premium: IPT (`insurance.ipt`) applies to
`premiumChange`, and to the fee only when the insurer charges it as part of
the premium.

## Not covered here

Short-period loadings on MTAs, minimum additional premiums and "no refund
below X" rules are insurer-specific terms of business; apply them to the
result.

## Before you rely on this

**Not professional advice.** This capability calculates insurance figures from published rules. It is a software component for developers, not financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed above, and have an actuary review how you use it, before anyone relies on the output. Provided "as is" under its licence, without warranty.

**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified actuary has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

1.0.1 marks it unreviewed. The code and the tests are unchanged.