Skip to content
All library documents

Pricing a Fixed-to-Floating Bond with QuantLib Cash Flows

Article Quant Q&A · Author: Lisa Ann

Summary

The document asks how to price a fixed-to-floating bond in QuantLib when the library documentation does not appear to provide a dedicated instrument class. The proposed workaround is to price the fixed-rate portion as a fixed-rate bond ending on the switch date, with no redemption, and the floating-rate portion as a floating-rate bond beginning on that date, then add their clean prices.

The accepted response considers this decomposition correct. It also suggests creating a clearer instrument class in C++ that inherits from Bond and constructs the desired cash flows from a fixed leg and an Ibor floating leg, drawing on the existing fixed-rate and floating-rate bond constructors. The response notes that making the class available through Excel would be more involved. The exchange gives implementation guidance but no numerical example, pricing comparison, or discussion of conventions that could affect a particular bond’s cash flows.

Key ideas

  • The proposed pricing method splits the instrument into fixed and floating portions at the switch date.
  • The fixed-rate portion ends at the switch date with zero redemption in the suggested setup.
  • The floating-rate portion begins on the switch date, and the clean prices are added.
  • A dedicated Bond subclass can represent the combined cash flows more clearly.
  • Extending such a class to Excel may require additional work.

Tags

Full text
# Pricing Fixed-To-Floater bond in QuantLib


# Pricing Fixed-To-Floater bond in QuantLib












Wandering through QuantLib's Financial instruments documentation, I noticed no class for fixed-to-floater bonds exist.

Then I was wondering what a suitable way to price such an instrument would be without the need to create a new class (in fact, fixed-to-floater should be just the discounted sum of a fixed rate bond and a floating rate one).

My idea is the following:

- to extract the clean price from an object of class FixedRateBond whose Schedule has termination date equal to the "swap" date and whose redemption is equal to zero;

- to extract the clean price from an object of class FloatingRateBond whose issue date is equal to the "swap" date;

- to sum 1 and 2.

Is the above proceeding correct?

Is there any faster way?

## Answer by Luigi Ballabio (score 5, accepted)

https://quant.stackexchange.com/a/9083

I believe it's correct. However, consider that it would be easy enough, and more clear, to create a new class (at least in C++; the task is more difficult if you also want to export it to Excel). The new instrument should only inherit from `Bond` and implement a constructor that builds the desired cash flows via a call to `FixedLeg` and another to `IborLeg`; you can look at the constructors of `FixedRateBond` and `FloatingRateBond` to see how it's done. Any other functionality would be inherited from the `Bond` class.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.