Re: Adding a payoff function

Posted by Luigi Ballabio-2 on
URL: http://quantlib.414.s1.nabble.com/Adding-a-payoff-function-tp2939p2941.html

On 2004.05.19 14:50, Daniel J. Duffy wrote:
> I am not familiar with pattern Path; it is not a GOF pattern.

Hi,
        I think he meant that since payoffs can be path-dependent,  
Payoff::operator() should be allowed to take a path, too.
At ths time, our take is that e.g., instead of writing

AveragePricePayoff payoff(Call, strike);
p = payoff(path);

one is probably better off writing

PlainVanillaPayoff payoff(Call, strike);
p = payoff(averagePrice(path));

which has the merit of separating the two concerns of averaging and  
calculating the payoff.

The fact that a payoff could be intrinsically dependent on time is  
another matter, though. Maybe we should augment the signature of  
Payoff::operator() to take a time argument as well...

Later,
        Luigi


> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of
> Wujiang Lou
> Sent: 19 May 2004 14:38
> To: [hidden email]
> Cc: [hidden email];
> [hidden email]
> Subject: Re: [Quantlib-users] Adding a payoff function
>
>
> A more general and extensible payoff class would need implementation
> of concept of State or Path, instead of one argument or two  
> arguments.
>
> Your operator() then has two signatures, one taking in a State while
> the other takes in a Path for Path dependent payoffs.
> -wujiang
>
> Luigi Ballabio wrote:
>
>
> On 2004.05.19 11:20, Nicolas Magnette wrote:
> > Here is my modified payoff. I had to add a
> > funstion "eval" as I need the calculation of the
> > payoff to take more than one argument and this is
> > impossible with the operator which is standard for all
> > payoffs.
> >
> >     class MyPayoff : public StrikedTypePayoff {
> >     public:
> >         MyPayoff(...)
> >         : ...  {}
> >         double operator()(double price) const;
> >         double eval(double price, Time time_elapsed) const;
> >         ...
> >      private:
> >          ...
> >     };
> >
> >     inline double MyPayoff::eval(double price, Time
> > time_elapsed) const {
> >       ...
> > }
>
> Nicolas,
>         besides declaring it, did you actually define operator()
> somewhere?
>
>
> Later,
>         Luigi
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: SourceForge.net Broadband
> Sign-up now for SourceForge Broadband and get the fastest
> 6.0/768 connection for only $19.95/mo for the first 3 months!
> http://ads.osdn.com/?ad_id=2562 
> <http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click>
> &alloc_id=6184&op=click
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
> --
> This is not an offer (or solicitation of an offer) to buy/sell the
> securities/instruments mentioned or an official confirmation.  Morgan
> Stanley may deal as principal in or own or act as market maker for
> securities/instruments mentioned or may advise the issuers.  This may
> refer to a research analyst/research report. Unless indicated, these
> views are the author's and may differ from those of Morgan Stanley
> research or others in the Firm. We do not represent this is accurate
> or complete and we may not update this.  Past performance is not
> indicative of future returns. For additional information, research
> reports and important disclosures, contact me or see
> https://secure.ms.com.  You should not use email to request,  
> authorize
> or effect the purchase or sale of any security or instrument, to send
> transfer instructions, or to effect any other transactions.  We  
> cannot
> guarantee that any such requests received via email will be processed
> in a timely manner.  This communication is solely for the addressee
> (s)
> and may contain confidential information.  We do not waive
> confidentiality by mistransmission.  Contact me if you do not wish to
> receive these communications.  In the UK, this communication is
> directed in the UK to those persons who are market counterparties or
> intermediate customers (as defined in the UK Financial Services
> Authority's rules).
>
>
>