Re: Multi-asset options

Posted by Luigi Ballabio-2 on
URL: http://quantlib.414.s1.nabble.com/Multi-asset-options-tp2771p2783.html

Hi,

On 2004.01.21 17:31, Wujiang Lou wrote:
> What about some other idea like this:
>
> //state is a vector of double
> template <int N=1>
> class State<N>;

Hmm, I'm not sure that I like it. Does that mean that a basket option  
would be templated on the number of assets? I'd rather keep the  
possibility to set it at run-time (in which case State looks very much  
like a typedef to std::vector.) Not only that--an Asian option could be  
priced with e.g. a MC simulation (where N = number of fixings) or an  
analytic formula (where N = 1). In this case too, I'd like to have the  
choice at run-time.

> template<class D, int N>
> class Payoff
> {
> public:
>  virtual double operator()(D t, const State<N> & s) const = 0;

or
virtual double operator()(D t, const std::vector<double>& s) const = 0;
if we want the choice of N at run-time.

As for the date, I think that time is taken care of by the Exercise  
instance. Keeping them separated might ease composition.

As for the vector, the same might apply---but I'd prefer Nando to step  
in at this time...

Later,
        Luigi