How to calculate
Add the two shocked prices and subtract twice the original price. Divide by the original price times the square of the yield shock.
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 ≈ 4.531164502799930877 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