How to calculate
Subtract the price after the increase from the price after the decrease. Divide by twice the initial price times the size of the annual yield move.
Worked example
Use Face value (USD) 1000 · Annual coupon rate (%) 5 · Coupon payments per year Two · Years until maturity 2 · Annual quoted yield to maturity (%) 5 · Yield shock in basis points 25. The result is ≈ 1.881000832613067724 years.
Input and result notes
Use an integer number of equal coupon periods. The quoted yield is periodic yield multiplied by coupon payments per year. Values apply at a coupon date. The cash flows are held constant under both shocks.
OpenStax on bond pricing and yield to maturity