convexity: Calculate the convexity of a bond

View source: R/convexity.R

convexityR Documentation

Calculate the convexity of a bond

Description

Calculates the convexity of a bond.

This function is normally used in combination with total_return() to compute bond total returns.

Usage

convexity(yields, maturity, format_out = "xts")

Arguments

yields

a series of yields

maturity

constant bond maturity in years

format_out

xts or tibble

Details

This function is normally used in combination with total_return() to compute bond total returns.

The convexity is the interest rate sensitivity of the modified duration.

convexity = C_1 - C_2

where

C_1 = \frac{2}{y_t^2} (1-{z_t}^{-2M})

C_2 = \frac{2M}{y_t}{z_t}^{-2M-1}

z_t = 1+\frac{y_t}{2}

M is the maturity in years (e.g. 10), y_t is the yield at time t.

Value

The convexity or a series of convexities of a bond with the given yield and maturity


treasuryTR documentation built on April 3, 2023, 5:39 p.m.