getting the set of reset dates of a float leg

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

getting the set of reset dates of a float leg

Chak Jack Wong
Hi,
I have got some trouble of getting all the reset dates from a float leg.

Reply | Threaded
Open this post in threaded view
|

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

Luigi Ballabio-2
At 01:31 PM 2/20/03 +0000, Chak Jack Wong wrote:
>Hi,
>I have got some trouble of getting all the reset dates from a float leg.
>
> From the FloatingRateCouponVector function, I can only get a vector<
>handle< cashflow > > , from which I can get  paydates, but not the reset
>dates.  I can't get this from the floatratecoupon either.

Does the following work?

std::vector<Handle<CashFlow> > v = ...
for (int i=0; i<v.size(); i++) {
     Handle<Coupon> c = v[i]; // assigning a Handle<T> to a Handle<U>
                              // performs a dynamic_cast
     Date start = c->accrualStartDate();
     Date end   = c->accrualEndDate();
     // print them or do whatever you need
}

Or maybe I just didn't get your question?

Later,
         Luigi



Reply | Threaded
Open this post in threaded view
|

Re: getting the set of reset dates of a floatleg

Chak Jack Wong
Thanks Luigi,
The reset date for the floating rate coupon is not the accrualStartDate.  The rate is determined two days before (for EUR) or the same date (for GBP ) and those are the reset dates.  see the following code excerpt.
I check the dates, they look right.  But there is no way I can print them.  I was wondering if it will be a good idea to precompute those reset dates and store them.  I think it will be faster.

Jack

// from floatingratecoupon.cpp
 

 double FloatingRateCoupon::amount() const {
            Handle<TermStructure> termStructure = index_->termStructure();
            QL_REQUIRE(!termStructure.isNull(),
                       "null term structure set to par coupon");
            Date today = termStructure->todaysDate();
            Date fixingDate = index_->calendar().advance(
                accrualStartDate_, -fixingDays_, Days, Preceding);
 

Luigi Ballabio wrote:

At 01:31 PM 2/20/03 +0000, Chak Jack Wong wrote:
>Hi,
>I have got some trouble of getting all the reset dates from a float leg.
>
> From the FloatingRateCouponVector function, I can only get a vector<
>handle< cashflow > > , from which I can get  paydates, but not the reset
>dates.  I can't get this from the floatratecoupon either.

Does the following work?

std::vector<Handle<CashFlow> > v = ...
for (int i=0; i<v.size(); i++) {
     Handle<Coupon> c = v[i]; // assigning a Handle<T> to a Handle<U>
                              // performs a dynamic_cast
     Date start = c->accrualStartDate();
     Date end   = c->accrualEndDate();
     // print them or do whatever you need
}

Or maybe I just didn't get your question?

Later,
         Luigi

--
This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation.  Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers.  This may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this.  Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com.  You should not use email to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions.  We cannot guarantee that any such requests received via email will be processed in a timely manner.  This communication is solely for the addressee(s) and may contain confidential information.  We do not waive confidentiality by mistransmission.  Contact me if you do not wish to receive these communications.  In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules).
 

Reply | Threaded
Open this post in threaded view
|

Re: getting the set of reset dates of a floatleg

Chak Jack Wong
In reply to this post by Luigi Ballabio-2
In fact, what I was trying to do is simply to get the reset dates, the
paydates and accruals for some other purpose (to create some exotic
instruments.)
Is the suggestion of factoring these functions out a good idea?

Thanks
Jack

Luigi Ballabio wrote:

> At 01:31 PM 2/20/03 +0000, Chak Jack Wong wrote:
> >Hi,
> >I have got some trouble of getting all the reset dates from a float leg.
> >
> > From the FloatingRateCouponVector function, I can only get a vector<
> >handle< cashflow > > , from which I can get  paydates, but not the reset
> >dates.  I can't get this from the floatratecoupon either.
>
> Does the following work?
>
> std::vector<Handle<CashFlow> > v = ...
> for (int i=0; i<v.size(); i++) {
>      Handle<Coupon> c = v[i]; // assigning a Handle<T> to a Handle<U>
>                               // performs a dynamic_cast
>      Date start = c->accrualStartDate();
>      Date end   = c->accrualEndDate();
>      // print them or do whatever you need
> }
>
> Or maybe I just didn't get your question?
>
> Later,
>          Luigi

--
This is not an offer (or solicitation of an offer) to buy/sell the
securities/instruments mentioned or an official confirmation.  Morgan Stanley
may deal as principal in or own or act as market maker for
securities/instruments mentioned or may advise the issuers.  This may refer
to a research analyst/research report. Unless indicated, these views are the
author's and may differ from those of Morgan Stanley research or others in
the Firm. We do not represent this is accurate or complete and we may not
update this.  Past performance is not indicative of future returns. For
additional information, research reports and important disclosures, contact
me or see https://secure.ms.com.  You should not use email to request,
authorize or effect the purchase or sale of any security or instrument, to
send transfer instructions, or to effect any other transactions.  We cannot
guarantee that any such requests received via email will be processed in a
timely manner.  This communication is solely for the addressee(s) and may
contain confidential information.  We do not waive confidentiality by
mistransmission.  Contact me if you do not wish to receive these
communications.  In the UK, this communication is directed in the UK to those
persons who are market counterparties or intermediate customers (as defined
in the UK Financial Services Authority's rules).