Lesson 8 of 15
Yield to Maturity
Yield to Maturity
Yield to Maturity (YTM) is the single discount rate that equates a bond's present value of cash flows to its market price. It is the bond's implied rate of return if held to maturity.
There is no algebraic solution for , so we solve numerically using bisection search.
Bisection Algorithm
- Set bounds:
lo = 0.0001,hi = 0.9999 - Compute
mid = (lo + hi) / 2 - If
bond_price(mid) > market_price: yield must be higher →lo = mid - If
bond_price(mid) < market_price: yield must be lower →hi = mid - Repeat ~1000 times
Known Relationships
- If price = face value → YTM = coupon rate
- If price < face value → YTM > coupon rate
- If price > face value → YTM < coupon rate
These help sanity-check your implementation.
Python runtime loading...
Loading...
Click "Run" to execute your code.