Login  Register

Re: Python Saving Interest Rate Curve Objects to File

Posted by TSchulz85 on Oct 11, 2016; 11:42am
URL: http://quantlib.414.s1.nabble.com/Python-Saving-Interest-Rate-Curve-Objects-to-File-tp17751p17793.html

I'm actually experiencing a weird problem now. So in the meantime I've build a database with the knots for historical dates (no jump/jump dates) which I save into a dict and then into a pickle file (just as discussed above). Rebuilding the curves (eonia and euribor) works perfectly fine and all knots are identical.
I've used "export_discount_curve(LogCubicDiscountCurve,MonotonicLogCubic);" in the .i file

The unusal thing occures when pricing a forward swap. The original curves priced it fine, but for short swap starts i'm getting errors, e.g. (curve date as of 5-Oct-2010)

for a 1y1y fwd swap:

  File "C:\Users\tschulz_ldg\AppData\Local\Continuum\Anaconda2\lib\site-packages\QuantLib\QuantLib.py", line 14675, in fairRate
    return _QuantLib.VanillaSwap_fairRate(self)

RuntimeError: result not available

for a 6y1y fwd swap:
return _QuantLib.VanillaSwap_fairRate(self)

RuntimeError: 2nd leg: Missing Euribor6M Actual/360 fixing for October 5th, 2016

and a 7y1y fwd swap works fine.

however if i bootstrap a totally random new curve (PiecewiseLogCubicDiscount(...)) under another name, I can suddenly price the 6y1y, but not the 1y1y (pls not with the curves unaltered).
When I bootstrap the curve with the origianl values, but save under a new name, then suddenly the other curves (unaltered) even price the 1y1y.

Before posting all kind of code snippets I thought to first get some feedback what the issue could be.

In case the description above was too confusion, let me sumarize the behaviour:
1. load and rebuild "eonia_curve" and "euribor_curve" from pickle
2. fwd swap pricing for 1y1y, 7y1y (and many others doesnt work)
3. bootstrap a random curve names "curve1", fwd pricing of the 6y1y suddenly works
4. bootstrap the curves from 1. under new named "eonia_cuvre2" and "euribor_curve2" but as originally bootstrapped and not by rebuilding of the knots, suddenly even the 1y1y prices

Please let me know any ideas, happy to post more background, but not quite sure where to start.