Student's corner : ac bond pricer - simplified only full years calculation act/act no accrued annual coupon
© alarius consulting 2019

Change any value in the white boxes below.
"MM/DD/YYYY"
initial inputs:
years to maturity:
yield to maturity (%):
coupon rate (%):
redemption (%):
initial outputs:
price:
time to maturity:
variation (risk):
mod duration:
duration:
convexity:
raw convexity:
shifted inputs:
years to maturity
yield to maturity (%):
coupon rate (%):
redemption (%):
shifted outputs:
price:
time to maturity:
variation (risk):
mod duration:
duration:
convexity:
raw convexity:
FORMULAS

let n= years to maturity , c= coupon rate , y = yield to matutiry, r = redemption price.

General price formula:

❶ Price = f ( n , c , y , r ) =i=1 n c / ( 1 + y ) i + r / ( 1 + y )n

Variation and modified duration:

First derivative of f(x) = 1/( 1 + x )n : ❷ f'(x)= = - n * 1 /( 1 + x )(n+1)

Hence first derivative of price / y = variation =- ∑ i=1 n i * c / ( 1 + y ) (i+1) - n * r / ( 1 + y ) (n+1)

variation (PV01) is a measure of the absolute change in price for a "small" change in y , denoted ∈ .
= So Price ( y + ∈ ) = Price( y ) + variation * ∈
while modified duration is the relative change in price for a a "small" change in y , denoted ∈ .
( Price ( y + ∈ ) -Price( y ) )/Price( y ) = modified duration * ∈

modified duration = variation / price( y ).

Why does it work for "small" changes only? Think as the first derivative as a way to simplify the underlying function with a straight line.
First derivative is a tangent to the function at the point where it was calculated. The more the underlying function is different from a straight line ( convex / concave ), the more difference we will get between f'( y ) and f( y ).

Nota bene: although usually expressed as positive numbers, variation and modified duration are actually negative numbers. (see ❷) ( An increase in y will infer a decrease in price )

Raw convexity / convexity:

Second derivative of f(x) = 1/( 1 + x )n : ❸ f''(x)= = - (n+1) * (- n) * 1 /( 1 + x )(n+2)

Nota bene: In that case f''(x) is always positive! That means the buyer of the bond will lose less (resp earn more) than forecasted with the first derivative as y moves up (resp down). The price function is convex.

raw convexity =i=1 n ( i + 1 ) * i * c / ( 1 + y ) (i+2) + (n+1) * n * r / ( 1 + y ) (n+2)

convexity =raw convexity / price( y )

One step further:

A bond price formula can be "well" replicated with it's two first derivatives.
For any x move in y, f(x+y) ≃ f(y) + x * f'(y) + 0.5 * (x) 2 * f''(y)
f(y + ∈) = f(y) + ∈ * variation + (∈)2 * 0.5 * raw convexity

See general Taylor expansion theory: wiki Taylor series