4
$\begingroup$

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.

$\endgroup$

1 Answer 1

5
$\begingroup$

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))
$\endgroup$
2
  • $\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
    Commented Dec 8, 2019 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
    Commented Dec 9, 2019 at 8:54

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.