Re: CashFlow Model

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/CashFlow-Model-tp7236p7237.html

On Tue, 2009-03-03 at 03:07 -0800, dhoorens wrote:
> I would like to put every cashflow I have in my asset portfolio, during a
> specific period of time,  in a std::list<>.
> Does a magic fonction exist at Instrument level which will give me all the
> cashflows of a specific instrument?
> For the moment, I have to use polymorphic dynamic_cast to check if the
> instrument provides cashflows and after i have to get those CF...
> It is not a nice solution :-/

No, it's not nice. But unfortunately there's no such method at this
time.


> The second problem I have is in the "vanillaOption" part.
> How to get my plainVanillaPayoff cashFlow?
> Because for a Call (for example), my payoff cashflow is max(0,
> Underlying-strike) at maturity, but I don't have information about
> underlying at maturity....

...and it's hard to extract it, too.  For one thing, it's not in the
option itself, since the option doesn't contain directly the process for
the underlying (on which its forward value depends.)  You should extract
the engine from the instrument, cast it to the correct type, and extract
the stochastic process from it.---assuming that all the inspectors
exist.  Then the expected underlying value at maturity has to be
calculated.

It I may make a suggestion, I'd store the required data in your
portfolio together with your instruments.  As far as I see, your
component_ member already contains other data besides the
shared_ptr<Instrument>.  When you create the instruments (at which point
you know already what each instrument is, and you have its input data at
hand) you might consider getting hold of its cashflows or its underlying
process and add them to the items in component_.

Luigi


--

standards, n.:
The principles we use to reject other people's code.



------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users