convexity: Calculate the convexity of a bond

Description Usage Arguments Details Value

View source: R/convexity.R

Description

Calculates the convexity of a bond.

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

Usage

1
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 = 2/(y_t^2) * (1-z_t^(-2M))

C_2 = 2M/y_t * z_t^(-2M-1)

z_t = 1 + y_t/2

M is the maturity in years (e.g. 10), t_y 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 July 22, 2021, 9:06 a.m.