Login  Register

Re: Negative Rates - QuantLib Python - Cap / Floors - QL_NEGATIVE_RATES ??

Posted by Luigi Ballabio on Jul 27, 2017; 12:49pm
URL: http://quantlib.414.s1.nabble.com/Negative-Rates-QuantLib-Python-Cap-Floors-QL-NEGATIVE-RATES-tp18453p18454.html

Hello,
    negative rates have been enabled by default for a while now, so you don't have to do it.  The problem is that, regardless of what the settings say, you can't put a negative rate in a logarithm.  You'll need to use a displacement together with your volatility (google for "shifted lognormal interest rate model" if you're not familiar with the idea).  If the volatility you have is a quoted one, it's very likely that it was calculated with a displacement already and you'll have to ask your provider.  If you calculated it yourself instead, you'll have to choose a displacement and use it to recalculate the volatility.

Hope this helps,
    Luigi


On Thu, Jul 27, 2017 at 2:39 PM Anthony Calleja <[hidden email]> wrote:
Hi Community,

I am using a QuantLib Python (quantlib-python v1.9) Extension package WHL plugin  (from http://www.lfd.uci.edu/~gohlke/pythonlibs/)  installed into Spyder python-3.5.3.amd64.

I've run into the below runtime error when valuing a capped floating rate bond and this error is also reproducible with the attached python code.

It looks like this problem can be resolved if I enable the QL_NEGATIVE_RATES setting but I can't find a way to do this in Python.  Is this feature available here or is it only available in C?

Traceback (most recent call last):
  File "C:\Users\cala\workspace\ScrapBook\src\negative.py", line 44, in <module>
    print(cap.NPV())
  File "C:\dev\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\QuantLib\QuantLib.py", line 8918, in NPV
    return _QuantLib.Instrument_NPV(self)
RuntimeError: forward + displacement (-0.00738464 + 0) must be positive

Thanks

Anthony

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users