Posted by
Robert Kubrick on
URL: http://quantlib.414.s1.nabble.com/Caching-the-pricing-engine-tp6574p6575.html
I found out I can change the option payoff (type/strike) and exercise
through Option::setupArguments():
Option::arguments args;
args.payoff = pPayoff;
args.exercise = pExercise;
eo.setupArguments(&args);
Is there a way to dynamically change the engine process parameters,
volatility and yield in particular?
I don't see any method to change the process term parameters after
instantiation.
On Sep 13, 2008, at 5:47 PM, Robert Kubrick wrote:
> Is there a way to reset the process for the AnalyticEuropeanEngine
> without creating a new engine instance every time?
> I have the following code:
>
> Date exerciseDate(Day(exercise.day()), Month(exercise.month
> ().as_enum()), Year(exercise.year()));
> shared_ptr<Exercise> pExercise(new EuropeanExercise(exerciseDate));
>
> Handle<Quote> underlyingHndl(shared_ptr<Quote>(new SimpleQuote
> (price)));
> shared_ptr<StrikedTypePayoff> pPayoff(new PlainVanillaPayoff(side
> == CALL ? Option::Call : Option::Put, strike));
>
> Handle<BlackVolTermStructure> flatVolTS
> (shared_ptr<BlackVolTermStructure>(new BlackConstantVol(_settlement,
>
> _calendar,
>
> vol,
>
> _dayCounter)));
>
> Handle<YieldTermStructure> _flatTermStructure
> (shared_ptr<YieldTermStructure>(new FlatForward(_settlement,
>
> _riskFreeRate,
>
> _dayCounter)));
>
> shared_ptr<BlackScholesProcess> pProcess(new BlackScholesProcess
> (underlyingHndl,
>
> _flatTermStructure,
>
> flatVolTS));
> EuropeanOption eo(pPayoff, pExercise);
> shared_ptr<PricingEngine> pPE(new AnalyticEuropeanEngine(pProcess));
> eo.setPricingEngine(pPE);
>
> I would like to cache most of the instances here and change the
> contract conditions at runtime to calculate option chains.
-------------------------------------------------------------------------
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