CallableFixedRateBond::CallableFixedRateBond( Natural settlementDays, Real faceAmount, const Schedule& schedule, const std::vector<Rate>& coupons, const DayCounter& accrualDayCounter, BusinessDayConvention paymentConvention, Real redemption, const Date& issueDate, const CallabilitySchedule& putCallSchedule) : CallableBond(settlementDays, schedule, accrualDayCounter, issueDate, putCallSchedule) { frequency_ = schedule.tenor().frequency(); bool isZeroCouponBond = (coupons.size() == 1 && close(coupons[0], 0.0)); if (!isZeroCouponBond) { cashflows_ = FixedRateLeg(schedule) .withNotionals(faceAmount) .withCouponRates(coupons, accrualDayCounter) .withPaymentAdjustment(paymentConvention); addRedemptionsToCashflows(std::vector<Real>(1, redemption)); } else { Date redemptionDate = calendar_.adjust(maturityDate_, paymentConvention); setSingleRedemption(faceAmount, redemption, redemptionDate); } // used for impliedVolatility() calculation boost::shared_ptr<SimpleQuote> dummyVolQuote(new SimpleQuote(0.)); blackVolQuote_.linkTo(dummyVolQuote); blackEngine_ = boost::shared_ptr<PricingEngine>( new BlackCallableFixedRateBondEngine(blackVolQuote_, blackDiscountCurve_)); }
AmortizingFixedRateBond::AmortizingFixedRateBond( Natural settlementDays, const std::vector<Real>& notionals, const Schedule& schedule, const std::vector<Rate>& coupons, const DayCounter& accrualDayCounter, BusinessDayConvention paymentConvention, const Date& issueDate) : Bond(settlementDays, schedule.calendar(), issueDate), frequency_(schedule.tenor().frequency()), dayCounter_(accrualDayCounter) { maturityDate_ = schedule.endDate(); cashflows_ = FixedRateLeg(schedule) .withNotionals(notionals) .withCouponRates(coupons, accrualDayCounter) .withPaymentAdjustment(paymentConvention); addRedemptionsToCashflows(); QL_ENSURE(!cashflows().empty(), "bond with no cashflows!"); }