Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Caching-the-pricing-engine-tp6574p6576.html
On Sun, 2008-09-14 at 19:16 -0400, Robert Kubrick wrote:
> Is there a way to dynamically change the engine process parameters,
> volatility and yield in particular?
Yes---when you write:
> > Handle<BlackVolTermStructure> flatVolTS
> > (shared_ptr<BlackVolTermStructure>(new BlackConstantVol(_settlement,
> >
> > _calendar,
> >
> > vol,
> >
> > _dayCounter)));
> >
Do instead:
shared_ptr<SimpleQuote> volQuote(new SimpleQuote(0.20));
Handle<BlackVolTermStructure>
flatVolTS(shared_ptr<BlackVolTermStructure>(
new BlackConstantVol(_settlement,
_calendar,
Handle<Quote>(volQuote),
_dayCounter)));
after you've built your options, you can execute:
volQuote->setValue(0.25);
and all the options will see the new volatility (i.e., they'll return a
different value when you call NPV() etc.)
Luigi
--
Better to remain silent and be thought a fool than to speak out and
remove all doubt.
-- Abraham Lincoln
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users