Hi,
I've very new to QuantLib and I've got a question. I would like to create a MC engine to price a multi asset path dependent option. The closest engine I've found in QuantLib is MCBasketEngine, but it only prices BasketOption (or BasketPayoff) which is not path dependent (BasketPayoff returns the payoff as a function of the array of the last values of the path). I can write a new Engine + Payoff + Option that price an option as a function of the multi path. What I cannot understand is the class Payoff which is base class for BasketPayoff. Why does it have a member function: virtual Real operator()(Real price) const = 0; that only accepts Real numbers? In my case it should accept at least an array, even better a matrix of values. I guess I can create a new PathDependentPayoff like that class PathDependentPayoff : public Payoff { virtual Real operator()(Real price) const { ERROR("DO NOT CALL") } virtual Real operator()(Matrix values) const = 0; }; and then inherit my path dependent payoffs. Later in the new Path Dependent Basket MC Engine, in the function Real EuropeanPathMultiPathPricer::operator()(const MultiPath& multiPath) const I would call the PathDependentPayoff::operator() with a Matrix and not the one with a Real. But I don't like to kill a virtual function so I think: Am I missing something? ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Mario Rossi wrote:
> What I cannot understand is the class Payoff which is base class for BasketPayoff. > Why does it have a member function: > > virtual Real operator()(Real price) const = 0; > > that only accepts Real numbers? In my case it should accept at least an array, even better a matrix > of values. I've digged a bit more into the code and I think what I need is to create a Multi Asset Multi Time option inheriting from Instrument and not from Option (that requires a Payoff which is too restrictive in my opinion). Afterwards I can create a new Multi Asset Multi Time Payoff. Since what I really need is to call Instrument::setPricingEngine(const boost::shared_ptr<PricingEngine>&); on my product. BUT I would rather reuse as much as possible of the existing code. Could someone please address me towards the best place where to start coding for a Generic Multi Asset Path Dependent Product. mcbasketengine.cpp is very close to what I need, but on the product side I am a bit lost. Thank you Andrea ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |