From: Luigi B. <lui...@gm...> - 2012-08-24 11:01:09
|
Hi, apologies for the delay, I was on vacation. The TARGET calendar only specifies what days are business days and what days are holidays. If you want to set an evaluation date, you'll have to add, say, Settings::instance().evaluationDate() = Date(8,February,2011); before performing the calculations. If the evaluation date is not set, it defaults to the system date as you inferred. Luigi On Wed, Aug 1, 2012 at 3:45 AM, Morpheous <tak...@ho...> wrote: > > 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? > -- > View this message in context: http://old.nabble.com/TARGET%28%29-macro-and-default-calendar-%28RuntimeError%3A-option-expired%29-tp34238686p34238686.html > Sent from the quantlib-dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev |