Trading Dev AcademyFree quant education

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.

P=∑t=1TCFtD(0,t),D(0,t)=e−ztt
Algebra and arithmetic

Reverse continuous compounding at each maturity

  1. One present currency unit grows to eztt. Therefore the present value of one unit paid at t is D(0,t)=e−ztt.
  2. Multiply each payment by its own discount factor and sum. Given D and t>0, invert using zt=−ln⁡Dt.
Work it by hand

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.

P=∑t=1TC(1+y)t+F(1+y)T
Algebra and arithmetic

Sum annual coupon payments and principal

  1. For annual yield y, each payment t periods away is divided by (1+y)t. Add T coupons C and the principal F paid with the final coupon.
  2. The coupon sum is geometric: for nonzero y, P=C[1−(1+y)−T]y+F(1+y)−T. At y=0 use CT+F. Solving y from price usually requires a numerical root finder.
Work it by hand

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
  1. Price a bond from its cash flows
  2. Duration, convexity, and curve hedges
  3. Credit spreads compensate more than expected default
  4. Carry, forward prices, and macro surprises

Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations