# Duration of a floating rate note

I have the following C# code for calculating the modified duration of fixed coupon bonds:

    public Double duration(Bond bond, DateTime dtSettle)
{
double duration = 0.0;
double timeDiff1;
double timeDiff2;
double ytm = YTM(bond,bond.marketPrice,dtSettle);
double impPrice = ImpliedBPFfromYTM(bond,ytm,dtSettle);

timeDiff1 = getDayCount(dtSettle, bond.termdates[0], "ACT/365", false);

for (int i = 0; i < bond.termdates.Count; i++)
{
timeDiff2 = getDayCount(bond.termdates[0], bond.termdates[i],bond.dayCountConvention, false) + timeDiff1;
duration = duration + timeDiff2*(cpn/Math.Pow((1+ytm),timeDiff2));
}

timeDiff2 = getDayCount(bond.termdates[0], bond.termdates[bond.termdates.Count - 1], bond.dayCountConvention, false) + timeDiff1;
duration = duration + timeDiff2 * (bond.workoutPar / Math.Pow((1 + ytm), timeDiff2));
return (duration / (impPrice + bond.accrued_interest)) / (1 + ytm / bond.freq);
}


Could anyone give me any pointers as to how I can create a similiar function that calculates the modified duration for Floating Rate Notes?

Some explanation of the code: the YTM function returns yield to maturity given bond characteristics. ImpliedBPFromYTM returns the price of the bond given the yield to maturity, market price etc. getDayCount returns the days between two different dates given the day-count-convention of the bond. Please let me know if there is anything else you need clarified.

-
Is this for a 'standard' FRN duration, or have you got a separate discounting curve, or...? – Phil H Aug 5 '13 at 14:18
I don't really know what kind of different durations are used for FRN's. I have a list with "curve+spread" elements on a quarterly basis that I reckon would be the coupon payments, (thus replacing the cpn term in the code). – L1meta Aug 6 '13 at 8:02

Do you have any strict definition of YTM of FRN? I googled and asked many times but I failed to find good and clear explanation.

The problem with FRNs is that we do not know what are the future coupons except for only one. If we solved this problem, we could treat FRN just like standard bond.

In the text below I will first consider spread to be zero. In case spread is not equal to zero, FRN can be considered as a pack of two bonds, first is FRN with zero spread, and the second is a spread-only fixed-coupon bond (with no final redemtion of face value!), and their prices and durations can be estimated separately.

The easiest way to solve this problem is to say that FRN coupons will be equal to current values of forward rates on correspoding periods. This does make some sense because forward rates must be equal (in theory) to risk-neutral expectations of future values of the reference rate.

In this case we do have coupons on FRN and we can now apply techniques applicable to standard bonds and find its yield and duration.

But this approach is somehow questionable The main problem is duration.

In case we have 5 year FRN with quarterly coupon reset, its duration (calculation in a way described above) will be for example 2 or 3 years.

At the same time, such FRN can be considered as a pack of 5*4 = 20 bonds with maturity of 3 months with single coupon at maturity. All these bonds, except for the first, have no sensitivity to interest rates. This means, that the only source of duration is the first bond with known coupon, and its duration is simply its time to maturity. This means that such FRN's duration will be in any case less than three months, which is very different from 2 or 3 years obtained in previous calcultaion.

This approach is also questionalbe with respect to price. Using the same approach as we used for duration, we can show that FRN price is just a discounted value of it's first payoff.

Conclusion: If I was to calculate FRN price and duration, I would simply use discounted value of it's first payoff and time to first payoff respectively.

Formula: if FRN reset time is $T$, time until next payment is $t$, year is 365 days long, next interest rate to be paid by FRN if $r_f$ and current interest rate for time $t$ id $r_c$ then

$P = \frac{1+r_f T / 365}{1+ r_c t / 365}$

and modified duration is $-\frac{1}{P}\frac{dP}{dr_c} = -\frac{t}{365}\left(-\frac{1}{1+ r_c t / 365}\right) = \frac{t}{365}\frac{1}{1+ r_c t / 365}$ = PV of $\frac{t}{365}$

Remark: If I were a more advanced guy, I would employ some kind of tree or MC model, which would simulate paths of reference rate and hence I would be able to calculate anything I really need. But in this case I would also need some volatility curve which it seems you do not have at hands.

-