Posted by
andrea-110 on
URL: http://quantlib.414.s1.nabble.com/One-question-about-instrument-engine-pathpricer-tp13421.html
Hi,
I have a question about the role of PathPricer / Instrument and engines in the MC framework.
I have recently updated the experimental/mcbasket code but I feel I am doing something "wrong" in
the code since I might have misunderstood the role of the above objects.
It looks to me that the PathPricer is ultimately the object that is able to compute the "values" for
a give stochastic path.
The path prices usually needs some information coming from the Instrument (sometime the Payoff
object, other times else) to be able to do this.
And it is directly created by the engine for that particular instrument.
An example of that is
template <class RNG, class S>
inline
boost::shared_ptr<typename MCEuropeanEngine<RNG,S>::path_pricer_type>
MCEuropeanEngine<RNG,S>::pathPricer() const {
....
return boost::shared_ptr<
typename MCEuropeanEngine<RNG,S>::path_pricer_type>(
new EuropeanPathPricer(
payoff->optionType(),
payoff->strike(),
process->riskFreeRate()->discount(this->timeGrid().back())));
}
Now, my question is the following: it looks like an engine can only work with one pathpricer which
can only work with one instrument.
So for every new option (e.g. a digital option, or everest option, himalaya option, pagoda option)
one needs to write (instrument, pathpricer, engine, makeengine)
If the PathPricer was somehow "inferred" from the instrument, one could (maybe) get rid of all
(maybe just some) of the engines (and makeengines) for a generic one.
This is what I did try to do with the code in mcbasket, there is only one engine and the pathpricer
for all instruments (inheriting from PathMultiAssetOption) is always the same.
But I have a feeling I have missed some key points of the design (or the hidden implications of my
idea) and I would be very happy to write a more compliant version of the code.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev