Fixed Income Risk - Convexity

Overview

The convexity is defined similarly to the duration, but the time value is squared.
{% convexity = \sum t^2 w_t %}
The convexity in conjunction with the duration provides a better approximation to the curve risk.

{% \Delta P / P \approx -D \times \Delta y + 1/2 \times CON (\Delta y)^2 %}
The formula here can be seen as a variation of the Taylor Formula for approximating a function with a polynomial.

Implementation

Convexity is implemented in the duration library.

let du = await import('/code/duration/v1.0.0/duration.mjs'); let cashFlows = [ {t:0.5, value:10}, {t:1.0, value:10}, {t:1.5, value:10}, {t:2.0, value:10}, {t:2.0, value:100}, ]; let rate = function(t){ return 0.05 } let convexity = du.convexity(cashFlows, rate);