Sub topic 2
Why prices rise and what it does to a goal
This chapter assumes you know basic budgeting (income, expenses, and monthly surplus), percentages, and how a bank savings account works. Python code uses only built-in functions.
Why prices rise
Inflation is the steady rise in prices over time. At 3% a year, something that costs 100 today costs about 103 next year. Your savings keep the same face value, but they buy less. A goal must account for this loss of buying power.
How interest and compounding work
Interest is what a bank pays you for holding your money. Compounding means interest earns interest. Each period's interest joins the balance, so the next period's interest is calculated on a larger amount. For a monthly rate r (annual rate divided by 12) and n month-end deposits of P, the balance is P × ((1 + r)^n − 1) / r.
Sizing a goal: target amount and deadline
A goal has two parts. The target amount is the future cost of the item after inflation. The deadline is the number of months until you need the money.
def inflated_cost(cost_today, annual_inflation, years):
return cost_today * (1 + annual_inflation) ** years
print(round(inflated_cost(20000, 0.03, 10), 2)) # 26878.33Working out how much to save each month
Solving the compounding formula for P gives the monthly amount. Without interest, it is simply the target divided by the number of months.
def monthly_contribution(target, annual_rate, months):
r = annual_rate / 12
if r == 0:
return target / months
return target * r / ((1 + r) ** months - 1)
print(round(monthly_contribution(26878.33, 0.04, 120), 2)) # about 182.5Matching risk to the time horizon
The time horizon is how long until you need the money. The shorter the horizon, the less risk you can take, because a loss may not recover in time.
| Horizon | Example goal | Typical holding | Risk level |
|---|---|---|---|
| Under 2 years | Car repair fund | Savings account | Low |
| 2 to 5 years | Home deposit | Certificates of deposit, bonds | Low to moderate |
| Over 5 years | Retirement | Diversified stock funds | Higher |
Exercise
A 15000 goal is needed in 5 years, and inflation is 2% a year. What is the target amount?
Show answer
15000 × 1.02^5 = 16561.21, so the target is about 16561.21.