minor extension of the FixedCouponBond class...

Posted by Plamen Neykov on
URL: http://quantlib.414.s1.nabble.com/minor-extension-of-the-FixedCouponBond-class-tp10820.html

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