Re: getting the set of reset dates of a float leg

Posted by Kim Kuen Tang on
URL: http://quantlib.414.s1.nabble.com/getting-the-set-of-reset-dates-of-a-float-leg-tp7489p7490.html

mudcrab schrieb:

> I tried everything listed therein, but nothing seemed to work.  In
> particular,
> I could not convert the Leg to a Handle<Coupon> or boost:shared_ptr<Coupon>.
>
> Could you please help me output the reset dates starting from
>
> Leg fixedCF = MySwap.fixedLeg();
>
>
>  
Not sure what you are trying to do. But if you want to cast from
Cashflow to Coupon, here is the code

const Leg& fixedCF=MySwap.fixedLeg();
std::vector<boost::shared_ptr<Coupon> > coupons(fixedCF.size());
        for (Size i=0; i<leg.size(); ++i) {
            coupons[i] =
boost::dynamic_pointer_cast<Coupon>(fixedCF[i]); // dont forget to
include shared_ptr.hpp
        }

Best regards,
Kim Tang


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users