Pricing Capped Floating-Rate Bonds with QuantLib Coupon Pricers
Summary
The document describes how to price a floating-rate bond with capped coupons in QuantLib. A discounting bond engine alone is insufficient when the cash flows include coupon options: the bond's floating-rate cash flows need an option-aware coupon pricer. The proposed setup creates an optionlet volatility structure, wraps it in a handle, and uses it to construct a Black Ibor coupon pricer.
That pricer is then attached to the bond's cash flows before valuing the instrument with the discounting engine. This addresses the reported error about a missing pricer and shows where cap and floor volatility enters the setup. The example uses a constant optionlet volatility and a flat yield curve; it does not discuss calibrating a volatility surface, alternative volatility conventions, or validation against market prices. Users should adapt the volatility structure and index conventions to their own bond and market data.
Key ideas
- Capped floating-rate coupons require an option-aware coupon pricer in addition to a bond pricing engine.
- A Black Ibor coupon pricer can use an optionlet volatility structure for the embedded coupon options.
- Attach the coupon pricer to the bond cash flows before calculating the bond value.
- The example uses constant volatility and does not cover market calibration or pricing validation.
Tags
Full text
# Quantlib - bond with capped coupons # Quantlib - bond with capped coupons Using QuantLib I want to price a Floating rate bond whose coupons are capped at some rate. I understand I could price the coupon caps separately and then add that to a zero-bond. However, I've noticed that in `FloatingRateBond` QuantLib allows to specify `caps` attribute for cap rates of the coupons. What I don't know is how to set a pricer for such a bond with coupon options and how to pass in the implied volatilites. The code below clearly throws an error as it complains about pricer not being set. Can you please tell me how to adjust the code to price the bond with capped coupons? ``` today = ql.Date(22, 10, 2022) ql.Settings.instance().evaluationDate = today curve = ql.YieldTermStructureHandle(ql.FlatForward(today,0.05,ql.SimpleDayCounter())) schedule = ql.MakeSchedule(ql.Date(31, 12, 2022), ql.Date(31, 12, 2037), frequency = ql.Annual) index = ql.Euribor6M(curve) bond = ql.FloatingRateBond(0, 100, schedule, index, ql.Actual360(), caps = [0.04]*5) bond.setPricingEngine(ql.DiscountingBondEngine(curve)) bond.NPV() ``` ## Answer by user35980 (score 2) https://quant.stackexchange.com/a/75765 You need to add a coupon pricer to the bond cashflows e.g. BlackIborCouponPricer with a capfloor vol curve should do ... ``` vol = ql.SimpleQuote(0.005) cfvols = ql.ConstantOptionletVolatility(2, ql.NullCalendar(), ql.Unadjusted, ql.QuoteHandle(vol),ql.Actual360(), ql.Normal, 0.0) flatcfvolsurface = ql.OptionletVolatilityStructureHandle(cfvols) couponpricer = ql.BlackIborCouponPricer(flatcfvolsurface) ql.setCouponPricer(bond.cashflows(), couponpricer) bond.setPricingEngine(ql.DiscountingBondEngine(curve)) ```
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.