Re: [Quantlib-users] Last fixing date of a swap with respect to today [Kind of urgent]

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Last-fixing-date-of-a-swap-with-respect-to-today-Kind-of-urgent-tp11671p11672.html


On Jan 20, 2011, at 8:03 PM, Leon Sit wrote:
> In quantlib, is there a way to query the last fixing date of a swap
> with respect to the evaluation date?

Yes, but it's kind of complex.  You'll have to:
- ask the swap for its floating leg; if it's a VanillaSwap, call its  
floatingLeg() method; if it's a generic Swap, use the leg(i) method by  
passing the correct index;
- get a pointer to the last CashFlow; that's leg.back()
- downcast it to FloatingRateCoupon; that's
coupon = boost::dynamic_pointer_cast<FloatingRateCoupon>(leg.back());
- now you can use its fixingDate() method.

Luigi


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev