Functional Weave
Code in Python

invest.drawdown-sustainability@1.0.1

README.md

2,698 bytes · view raw

# invest.drawdown-sustainability

How long a pot lasts when a fixed (or inflation-rising) income is drawn from
it each year and the rest grows at a constant rate: the arithmetic behind
"will my pension last?" and the 4% rule.

## The convention

Each year, in whole minor units:

1. The withdrawal is taken at the **start** of the year: the planned amount,
   or everything left if that is less.
2. What remains grows by `annualGrowthBasisPoints`, rounded half away from
   zero (`money.apply-rate`, half-up).
3. The next year's planned withdrawal rises by
   `withdrawalIncreaseBasisPoints`, rounded the same way.

The run stops in the year the pot reaches zero, or after `maxYears`.
`fullYears` counts the years in which the whole planned income was paid; a
last, partial year appears in the schedule but not in `fullYears`. A pot that
reaches exactly zero on a full withdrawal counts that year and is
`exhausted`.

Taking the withdrawal first and growing the remainder is the cautious order,
and the one an income drawn in advance follows. Growing first and then
withdrawing gives a longer life for the same inputs; the vectors pin the
order used here.

## What it does not do

It uses a single constant growth rate, so it says nothing about sequence of
returns risk; run it for several rates, or use a stochastic model, for that.
It ignores charges (see `invest.fee-drag`), tax on withdrawals and the tax-free
lump sum; pass net figures if you need them.

## Errors

A negative pot, a withdrawal of 0 or less, growth or an increase below
-10000, `maxYears` outside 1-100, fractional amounts and mixed currencies.

## Before you rely on this

**Not professional advice.** This capability calculates investment 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 a tax adviser 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 tax adviser 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.