TARGET() macro and default calendar (RuntimeError: option expired)
Posted by Morpheous on Aug 01, 2012; 1:45am
URL: http://quantlib.414.s1.nabble.com/TARGET-macro-and-default-calendar-RuntimeError-option-expired-tp9012.html
I am using the Python binding to Quantlib to perform calculations on historic data.
After setting up the required framework (curves etc), When I call `option.ImpliedVolatility()` I get the following exception thrown (for options that have expired):
File "/usr/local/lib/python2.6/dist-packages/QuantLib/QuantLib.py", line 3683, in impliedVolatility
def impliedVolatility(self, *args): return _QuantLib.VanillaOption_impliedVolatility(self, *args)
RuntimeError: option expired
A snippet of the lines of code for setting up required curves etc is shown below:
dividend_yield = YieldTermStructureHandle(FlatForward(0, TARGET(), div_yield, Actual365Fixed()))
risk_free_rate = YieldTermStructureHandle(FlatForward(0, TARGET(), rf_rate, Actual365Fixed()))
volatility = BlackVolTermStructureHandle(BlackConstantVol(0, TARGET(), annualized_histvol, Actual360()))
I **STRONGLY** suspect that the `TARGET()` macro used defaults to the current system date.
How may I set up the library to use a specific historic date?