---
# System prepended metadata

title: Untitled

---

Note that

$$
    P(y) = \sum \frac{C_i}{(1+y)^{t_i}}
$$

Where $P(y)$ is the price of a bond at a given yield $y$, and your $C_i$ are your cashflows at times $t_i$. The derivative of this with respect to yield is called "modified duration". The derivative is calculated (as differentiation distributes over sums/addition) as


$$
    \frac{d}{dy}P(y) = \frac{d}{dy} \sum \frac{C_i}{(1+y)^{t_i}} \\
        = \sum \frac{d}{dy} \frac{C_i}{(1+y)^{t_i}} \\
        = \sum \frac{C_i}{(1+y)^{t_i+1}}*(-t_i) \\
        = - \frac{\sum \frac{C_i * t_i}{(1+y)^{t_i}}}{(1+y)} \\
$$