Description Usage Arguments Details Value

Calculates the convexity of a bond.

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

1 | ```
convexity(yields, maturity, format_out = "xts")
``` |

`yields` |
a series of yields |

`maturity` |
constant bond maturity in years |

`format_out` |
xts or tibble |

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*.

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.