# Monte Carlo approach to RAN bonds in Quantlib or suggestions

This is a problem from Schlogl's book in the chapter on the HJM model:

Price option of the RAN instrument with 3 month coupons and maturity 3 years using Monte Carlo(Exercise 4 Range Accrual Note).

Is the code in the Quantlib library? If so can you tell me its location, thank you. If not can you give me some suggestions on how to approach it.

The background

A bond's value and payoff are of the form:

$$V=\sum_{i}^{N} c_{i} B(T_{i-1},T_{i}) \text{ and } [V-K]^{+},$$ where K is the strike, $c_{i}$ are the coupons and $B(T_{i-1},T_{i})$ is the price of a zero bond at time $T_{i-1}$ with maturity $T_{i+1}$.

In the FRN the coupons $c_{i}$ are determined by some asset or floating rate. Specifically in R AN with 3-month coupons (90 days) and interest compounded daily we have:

$$c_{i}=\bar{r}\frac{1}{90}\sum_{k=90\cdot i}^{90\cdot (i+1)}L(t_{k},t_{k+1}),$$

where the Libor rate is $L(t_{k},t_{k+1})=\frac{1}{t_{k+1}-t_{k+1}}(\frac{1}{B(t_{k},t_{k+1})}-1)$ and $\bar{r}$ is a fixed number or the Libor rate plus a spread s.

So we are searching to price the option with payoff $(\sum_{i}^{N} c_{i} B(T_{i-1},T_{i})-K)^{+}$ with the above $c_{i}$.

Glasserman in his Monte Carlo book section 3.7, describes how to go about the Libor rate option. I will try that as well.