Login  Register

multistepswaption issue

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

multistepswaption issue

Peter Caspers-2
36 posts
Hi,

when pricing a MultiProductComposite consisting of several MultiStepSwaption objects with different start indices (=fixing times), I get wrong npvs for all swaptions except the ones with startIndex = maximum over all start indices of swaptions in the basket. This is because the swaptions generate cashflows also for evolver steps > their respective start index.

I believe the MultiStepSwaption code (ql 1.1) should be modified as follows to avoid this

         if (currentIndex_ == startIndex_)
         {
             genCashFlows[0][0].timeIndex = 0;
 
             genCashFlows[0][0].amount =
                 (*payoff_)(swapRate) * annuity;

             numberCashFlowsThisStep[0] =genCashFlows[0][0].amount != 0.0 ? 1 : 0 ;

-            return true;
         }
         else
         {
             numberCashFlowsThisStep[0] =0;
-            ++currentIndex_;
-            return false;

         }

+        ++currentIndex_;
+        return currentIndex_ > startIndex_;


After that change it works fine imo.

Regards
Peter

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev