I am borrowing from an example in the "Quantlib Python Cookbook" section 7, to ask my question. To make the point as clear as possible I simplify the code a bit. The aim is to strip the EONIA curve from OIS quotes.
The initialization is not to question:
%%capture %pylab inline --no-import-all import math import numpy import utils import matplotlib.pyplot as plt from QuantLib import * today = Date(11, December, 2012) Settings.instance().evaluationDate = today
A list of
OISRateHelpers is set up from which the term structure shall be stripped. The "2" tells the helper object that the quotes correspond to contracts that start +2 days from now.
helpers = [ OISRateHelper(2, Period(*tenor), QuoteHandle(SimpleQuote(rate/100)), eonia) for rate, tenor in [(0.002, (15,Months)), (0.008, (18,Months)), (0.021, (21,Months)), (0.036, (2,Years)), (0.127, (3,Years)), (0.274, (4,Years)), (0.456, (5,Years)), (0.647, (6,Years)), (0.827, (7,Years)), (0.996, (8,Years)), (1.147, (9,Years)), (1.280, (10,Years)), (1.404, (11,Years)), (1.516, (12,Years)), (1.764, (15,Years)), (1.939, (20,Years)), (2.003, (25,Years)), (2.038, (30,Years))] ]
The bootstrapping is then performed by
eonia_curve = PiecewiseLogCubicDiscount(0, TARGET(), helpers, Actual365Fixed() )
The initial "0" above tells the bootstrapping algorithm that the reference date of the term structure should be on the previously defined
I don't want my term structure object to change its reference date later on when I change the evaluation date. So I tried to call
eonia_curve = PiecewiseLogCubicDiscount(today, TARGET(), helpers, Actual365Fixed() )
which I found very natural. But it resulted in: NotImplementedError: Wrong number or type of arguments for overloaded function 'new_PiecewiseLogCubicDiscount'.
Question: How could I correct the above code line to bootstrap with a fixed reference date?
Side note: In section 5 of the mentioned book the author discussed the difference of fixed vs unfixed reference dates. However the code they used did't really help me, because the date was not explicitly specified but taken from an earlier stripped term structure.
# curve1 is an allready stripped term structure object dates, rates = zip(*curve1.nodes()) # first date is taken as reference date curve2 = ForwardCurve(dates, rates, Actual360())
However, I don't want to call the bootstripping algorithm twice: once with the evaluation date as reference date and a second time with
today as reference date.
Thank you very much, Bernd