|
From: Luigi B. <lui...@gm...> - 2008-03-13 10:47:39
|
On Sun, 2008-03-02 at 20:48 +0000, Andrea wrote: > The PathPricer receives the MultiPath, extract the values of the > assets on the times requested by the product (the time grind having > potentially more dates than the product needs) into some sort of > matrix and passes it to the product. > The product return (for the time being) one single number, and the > PathPricer takes care of discounting it. > > I want to write only one instance of the PathPricer and many > Products/Payoffs. > > Is it correct? Andrea, just to remove ambiguity, I wouldn't speak of product---that suggests an instance of the Instrument class (and in fact, it got me confused earlier.) Let's use "Payoff" instead. This said: some path pricers happen to use a Payoff instance, but this is not necessarily always the case. True, you could expand the Payoff hierarchy until it becomes some kind of interpreted language (at which point the PathPricer becomes little more than a discounter.) But if you want to express a number of exotic path-dependent payoffs, and if you don't need to specify the formula for your payoff at run-time (in which case you'll have to go for the interpreter, but it's a lot of work) you might be better off if: a) you write a general engine which does the setup, defines an abstract pathPricer() method to instantiate the payoff, and runs the simulation; b) you inherit specific engines which implement pathPricer() by returning a derived PathPricer with the specific formula you need. The path pricer doesn't need to use a Payoff object, mind you: it can just implement the formula itself. Luigi -- Ogden's Law: The sooner you fall behind, the more time you have to catch up. |