minor extension of the FixedCouponBond class...

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

minor extension of the FixedCouponBond class...

Plamen Neykov
Hi all,

sorry to bother with such a trivial thing ....
Is it possible to include the following (very minor extension) of the
FixedCouponBond class in the future releases of QuantLib - just to define two
additional default parameter in the constructor:
1)  bool LongFinal = false
2) const std::vector<Real>& nominals = std::vector<Real>(1, 100.0)

e.g. header:
 FixedCouponBond(const Date& issueDate,
                        const Date& datedDate,
                        const Date& maturityDate,
                        Integer settlementDays,
                        const std::vector<Rate>& coupons,
                        Frequency couponFrequency,
                        const DayCounter& dayCounter,
                        const Calendar& calendar,
                        BusinessDayConvention convention = Following,
                        Real redemption = 100.0,
                        const Handle<YieldTermStructure>& discountCurve
                                              = Handle<YieldTermStructure>(),
                        const Date& stub = Date(),
                        bool fromEnd = true,
                        bool longFinal = false,
                        const std::vector<Real>& nominals = std::vector<Real>(1, 100.0)
                );


and implementation:


   FixedCouponBond::FixedCouponBond(
                             const Date& issueDate,
                             const Date& datedDate,
                             const Date& maturityDate,
                             Integer settlementDays,
                             const std::vector<Rate>& coupons,
                             Frequency couponFrequency,
                             const DayCounter& dayCounter,
                             const Calendar& calendar,
                             BusinessDayConvention convention,
                             Real redemption,
                             const Handle<YieldTermStructure>& discountCurve,
                             const Date& stub, bool fromEnd, bool longFinal,
                                                         const std::vector<Real>& nominals)
    : Bond(dayCounter, calendar, convention, settlementDays, discountCurve) {

        issueDate_ = issueDate;
        datedDate_ = datedDate;
        maturityDate_ = maturityDate;
        frequency_ = couponFrequency;

        redemption_ = boost::shared_ptr<CashFlow>(
                                 new SimpleCashFlow(redemption,maturityDate));

        Schedule schedule(calendar, datedDate, maturityDate,
                          couponFrequency, convention,
                          stub, fromEnd, longFinal);

        cashFlows_ = FixedRateCouponVector(schedule, convention,
                                           nominals/*std::vector<Real>(1,
100.0)*/,
                                           coupons, dayCounter);
    }



Thanks,
Plamen

attachment0 (189 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: minor extension of the FixedCouponBond class...

Luigi Ballabio
On 06/02/2005 04:46:50 PM, Plamen Neykov wrote:
>
> Is it possible to include the following (very minor extension) of the
> FixedCouponBond class in the future releases of QuantLib - just to
> define two additional default parameter in the constructor:
> 1)  bool LongFinal = false
> 2) const std::vector<Real>& nominals = std::vector<Real>(1, 100.0)

Plamen,
        thanks for the contribution. As for longFinal, no problem. But  
as for the notionals: shouldn't the amortization cash flows be included  
in the price? (e.g., for nominals = [100, 90, ...] an additional cash  
flow worth 10 should be added on the first coupon date.)

What is the convention? Anybody?

Thanks,
        Luigi

----------------------------------------

There's no sense in being precise when you don't even know what you're
talking about.
-- John von Neumann



Reply | Threaded
Open this post in threaded view
|

Re: minor extension of the FixedCouponBond class...

Luigi Ballabio
Also, I think there's another convention in the case of seasoned bonds:  
if the notional has been partly amortized (e.g., the current notional  
is 85 with respect to the initial 100) the price should be rescaled so  
that it is always in base 100 (e.g., multiplied by 100/85.)

Anybody?

Thanks,
        Luigi

----------------------------------------

Westheimer's Discovery:
        A couple of months in the laboratory can frequently save a
        couple of hours in the library.



Reply | Threaded
Open this post in threaded view
|

Re: minor extension of the FixedCouponBond class...

Ferdinando Ametrano-4
Luigi Ballabio wrote:
>
> Also, I think there's another convention in the case of seasoned bonds:  
> if the notional has been partly amortized (e.g., the current notional  
> is 85 with respect to the initial 100) the price should be rescaled so  
> that it is always in base 100 (e.g., multiplied by 100/85.)

not completly true. It depends on the bond and/or exchange, and I've see
both possible cases for sinkable bonds:
a) nominal bond price stays at the 100 level, it's the nominal amount in
your portfolio that decrease by 15%
b) nominal bond value goes to 85, and the nominal amount stay fixed.

ciao -- Nando