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.

  • $\begingroup$ Is this for a 'standard' FRN duration, or have you got a separate discounting curve, or...? $\endgroup$
    – Phil H
    Aug 5, 2013 at 14:18
  • $\begingroup$ 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). $\endgroup$
    – L1meta
    Aug 6, 2013 at 8:02
  • $\begingroup$ What about the principle payments / cash flows? Why are these not taken into account in the duration calculations? $\endgroup$
    – 291890964
    Jun 17, 2019 at 21:07
  • $\begingroup$ I am not very fond of duration because its economic meaning is not very clear. It is cleaer to think of interest rate sensitivity. The change in the value of the instrument due to a change in all interest rates in parallel gives you exactly the same information as duration, but makes more sense to me. The change in value due to one key rate changing gives the same information as key rate duration. For a floater, if you use exactly the same curves to project its coupons, and to discount the cash flows, then only the current coupon (which has already been set) has sensitivity to interest rates. $\endgroup$ Jul 13, 2019 at 10:29

1 Answer 1


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 is $r_f$ and current interest rate for time $t$ id $r_c$ then the price is $$P = \frac{1+r_f T / 365}{1+ r_c t / 365}$$ and the 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}$$ in other words, the present value 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.