Free lesson · Rates, credit & macro
Price a bond from its cash flows
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Each bond payment is a separate claim at its own date. A zero curve values these dates separately; yield-to-maturity compresses the entire payment schedule into a single rate that reproduces price.
Symbols, units & horizon
- P: bond price in currency
- CFₜ: cash paid at year t
- D(0,t): discount factor from t to today
- zₜ: continuously compounded annual zero rate for maturity t
- T: final maturity in whole years for the annual coupon formula
- C: annual currency coupon, not convexity here
- F: currency face value repaid at maturity
- y: annual effective yield above −1
- e: exponential base
When and why to use this
Use cash-flow discounting to check bond valuations, understand curve exposure and distinguish accrued income from market price changes.
Reverse continuous compounding at each maturity
- One present currency unit grows to . Therefore the present value of one unit paid at t is .
- Multiply each payment by its own discount factor and sum. Given D and t>0, invert using .
Payments $5 in one year and $105 in two years at continuous 5% rates have value 5e⁻·⁰⁵+105e⁻·¹≈$99.7641.
The discount factor D is the price today of one currency unit paid at time t; z is the continuously compounded zero rate for that maturity. Coupon cash flows and principal can have different maturities, so one yield-to-maturity compresses an entire curve into a single internal rate of return.
Sum annual coupon payments and principal
- For annual yield y, each payment t periods away is divided by . Add T coupons C and the principal F paid with the final coupon.
- The coupon sum is geometric: for nonzero y, . At y=0 use CT+F. Solving y from price usually requires a numerical root finder.
C=5,F=100,T=2,y=.06 gives 5/1.06+105/1.06²≈$98.1666.
The second expression assumes annual coupons C, face value F, and an annual-compounding yield y. Other coupon frequencies require corresponding periods and rates. Dirty price includes accrued interest; clean price excludes it. Total return includes price movement, coupon income, and reinvestment.
Research sources, review dates and limitations
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
from math import exp
def curve_price(cashflows, times, continuous_zero_rates):
if not len(cashflows) == len(times) == len(continuous_zero_rates):
raise ValueError("Cash flows, times and zero rates must align")
return sum(cf*exp(-z*t) for cf,t,z in zip(cashflows,times,continuous_zero_rates))
def annual_coupon_price(face, annual_coupon, yield_rate, years):
"""Annual coupon periods only; no accrued interest convention."""
return sum(annual_coupon/(1+yield_rate)**t for t in range(1,years+1))+face/(1+yield_rate)**years
print(annual_coupon_price(100, 5, .05, 2))Continue learning
Rates, Credit & Macro — all lessons- Price a bond from its cash flows
- Duration, convexity, and curve hedges
- Credit spreads compensate more than expected default
- Carry, forward prices, and macro surprises
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations