Is there a way to price caplets/swaptions in QuantLib python (v 1.6.2) under dual curve i.e. pass projection curve for forwards and discounting curve for discounting the cash flows?

Goutham has an example here but it uses single curve for both forwards and discount. I looked at BlackCapFloorEngine.hpp and could not find function which takes two curves as input.

Secondly, is the Bachelier model exposed to python? Because I could not find it.


Discount vs forward estimation curve

The YieldTermStructureHandle passed to BlackCapFloorEngine corresponds to the discount curve, while the one passed to IborIndex corresponds to the forward estimation curve

In the example you are referring two, it turns out both are identical, but you could very well define two different handles on two different curves, as follows:

disc_term_structure = ql.ZeroCurve(disc_dates, disc_zero_rates, ...)
disc_ts_handle = ql.YieldTermStructureHandle(disc_term_structure)
engine = ql.BlackCapFloorEngine(disc_ts_handle, vols)

Bachelier pricing engine

As for your second question, there is a BachelierCapFloorEngine class in QuantLib, see here: https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/capfloor/bacheliercapfloorengine.hpp

and it is exposed in Python (I am using QuantLib 1.16). You could for example, replace the Black engine instanciation with this line in Goutham's example:

engine = ql.BachelierCapFloorEngine(disc_ts_handle, ql.QuoteHandle(ql.SimpleQuote(0.03))
  • $\begingroup$ Thanks very much. Dual curve part works perfect! But for Bachelier engine, I get this error when using ql.BachelierCapFloorEngine: "AttributeError: module 'QuantLib' has no attribute 'BachelierCapFloorEngine'" $\endgroup$
    – InnocentR
    Dec 8 '19 at 20:57
  • 1
    $\begingroup$ Check the version you are using by doing: import QuantLib as ql then ql.__version__ I guess it will be < 1.16. In which case, please try upgrading it. $\endgroup$
    – byouness
    Dec 9 '19 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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