Last fixing date of a swap with respect to today [Kind of urgent]

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Last fixing date of a swap with respect to today [Kind of urgent]

Leon Sit
Hi all

In quantlib, is there a way to query the last fixing date of a swap
with respect to the evaluation date?

Thanks tons

Leon

------------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

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

Luigi Ballabio

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