[PATCH] Hybrid products in mcbasket

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Hybrid products in mcbasket

andrea-110
This patch (which contains all outstanding patches for experimental/mcbasket)
enables products to price instruments depending on the yieldTermStructure (which might be stochastic).

For the time being it is still deterministic, but in the future it might change.

The key method of the payoff class is

        virtual void value(const Matrix       & path,
                           const std::vector<Handle<YieldTermStructure> > & forwardTermStructures,
                           Array              & payments,
                           Array              & exercises,
                           std::vector<Array> & states) const = 0;

the 2nd argument is the yield term structure on each fixing date.
An example to use it is

member variables

private:
    mutable RelinkableHandle<YieldTermStructure> m_termStructure;
    boost::shared_ptr<IborIndex> m_euribor3m;
       

then in value()

        const Handle<YieldTermStructure> & yieldTermStructure = forwardTermStructures[i];
        const Date & referenceDate = yieldTermStructure->referenceDate();

        // relink term structure to actual value
        m_termStructure.linkTo(yieldTermStructure.currentLink());

        const Date spotDate = m_euribor3m->fixingCalendar().adjust(referenceDate);
        const Rate spotEuribor = m_euribor3m->fixing(spotDate);

Attached the patch and a little example.

Andrea

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

ql.diff (22K) Download Attachment
example.cpp (7K) Download Attachment