Re: Negative Rates - QuantLib Python - Cap / Floors - QL_NEGATIVE_RATES ??
Posted by
Luigi Ballabio on
Jul 27, 2017; 1:38pm
URL: http://quantlib.414.s1.nabble.com/Negative-Rates-QuantLib-Python-Cap-Floors-QL-NEGATIVE-RATES-tp18453p18456.html
On Thu, Jul 27, 2017 at 3:31 PM Anthony Calleja <
[hidden email]> wrote:
Thank you very much Luigi. I'm trying to find a python code example where this displacement parameter is passed. I've found the displacement documented in the C files though.
Should you know that this parameter is not supported in python kindly shout back.
Thanks
On Thu, Jul 27, 2017 at 2:50 PM Luigi Ballabio <
[hidden email]> wrote:
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'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