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)

1 Answer 1


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)

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.