Login  Register

Swaption pricing with negative rates in python

Posted by Björn on Sep 10, 2016; 5:01pm
URL: http://quantlib.414.s1.nabble.com/Swaption-pricing-with-negative-rates-in-python-tp17714.html

Hello,

I was really excited when I learned that support for negative rates had been added to the QL option models. However, I can't get the shifted normal model or the Bachelier model to work via the QL-Python SWIG bindings. Is there a tutorial available showing how to use them?

What I'm trying to do is something along the lines:

vol1  = QuoteHandle(SimpleQuote(0.1533))
swaption1.setPricingEngine(BlackSwaptionEngine(termStructure, vol1, -0.03))
swaption2.setPricingEngine(BachelierSwaptionEngine(termStructure, vol1))

But already the first setPricingEngine() fails:

  File "<stdin>", line 1, in <module>
  File "EuropeanSwaption.py", line 207, in <module>
    swaption1.setPricingEngine(BlackSwaptionEngine(termStructure,vol1,-0.03))
  File "/Library/Python/2.7/site-packages/QuantLib/QuantLib.py", line 17495, in __init__
    this = _QuantLib.new_BlackSwaptionEngine(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_BlackSwaptionEngine'.
  Possible C/C++ prototypes are:
    BlackSwaptionEnginePtr::BlackSwaptionEnginePtr(Handle< YieldTermStructure > const &,Handle< Quote > const &)
    BlackSwaptionEnginePtr::BlackSwaptionEnginePtr(Handle< YieldTermStructure > const &,Handle< SwaptionVolatilityStructure > const &)

What am I doing wrong here?

Thanks,
Björn