Bond Valuation and Analysis in Python
Joshua Mayhew
Options Trader
Simple interest depends only on the initial deposit or loan.
We deposit USD 1,000 in a savings account
The account pays 5% simple interest each month
How much interest will we have earned after 1 year?
How much will our account be worth?
$PV$ = Present Value = how much our money is worth today
$FV$ = Future Value = how much our money is worth in the future
$r$ = Interest Rate Per Period
$n$ = number of periods
$\text{Simple Interest Earned} = PV \times r \times n$
$\text{Future Value = Present Value + Simple Interest Earned}$
pv = 1000
r = 0.05
n = 12
interest = pv * r * n
print(interest)
600
fv = pv + interest
print(fv)
1600
Compound interest means earning interest on our interest!
Deposit USD 1,000 in a bank account earning 5% compound interest per month.
Month | Starting Amount | Interest Earned | Ending Amount |
---|---|---|---|
1 | 1,000.00 | 1,000.00 * 0.05 = 50.00 | 1,000.00 + 50.00 = 1,050.00 |
2 | 1,050.00 | 1,050.00 * 0.05 = 52.50 | 1,050.00 + 52.50 = 1,102.50 |
3 | 1,102.50 | 1,102.50 * 0.05 = 55.13 | 1,102.50 + 55.13 = 1,157.63 |
... | ... | ... | ... |
12 | 1,710.34 | 1,710.34 * 0.05 = 85.52 | 1,710.35 + 85.52 = 1,795.86 |
USD 1,795.86 – USD 1,000.00 = USD 795.86 in compound interest
For 1 Period:
1,000 + (1,000 * 0.05) = 1,000 * 1.05 = 1,050
For 2 Periods:
1,050 * 1.05
= 1,000 * 1.05 * 1.05
= 1,000 * 1.05 ^ 2
For n Periods:
1,000 * 1.05 ^ n
The General Formula:
$FV = PV \times (1 + r)^n$
pv = 1000, r = 0.05, n = 12
fv = pv * (1 + r) ** n
print(fv)
1795.86
Bond Valuation and Analysis in Python