|
From: Morpheous <tak...@ho...> - 2012-08-01 01:46:05
|
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.
|
|
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
|
|
From: Luigi B. <lui...@gm...> - 2012-08-24 11:05:18
|
Oh, you're using Python. Then the statement would be Settings.instance().evaluationDate = Date(8,February,2011) instead. Luigi On Fri, Aug 24, 2012 at 1:01 PM, Luigi Ballabio <lui...@gm...> wrote: > 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 |
|
From: Morpheous <tak...@ho...> - 2012-08-27 17:05:40
|
Hi Luigi, Hope you had a nice relaxing holiday!. Thanks for the reply. BTW, I am using QuantLib with C++ too, so the original snippet is useful too :) Thanks Luigi Ballabio wrote: > > Oh, you're using Python. Then the statement would be > > Settings.instance().evaluationDate = Date(8,February,2011) > > instead. > > Luigi > > On Fri, Aug 24, 2012 at 1:01 PM, Luigi Ballabio > <lui...@gm...> wrote: >> 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 > > ------------------------------------------------------------------------------ > 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 > > -- View this message in context: http://old.nabble.com/TARGET%28%29-macro-and-default-calendar-%28RuntimeError%3A-option-expired%29-tp34238686p34348195.html Sent from the quantlib-dev mailing list archive at Nabble.com. |