35 const Date& issueDate,
39 :
Bond(settlementDays, schedule.calendar(), issueDate),
exercise_(
std::move(exercise)),
40 conversionRatio_(conversionRatio), callability_(callability), redemption_(redemption) {
46 "last callability date (" <<
callability.back()->date()
56 const Date& issueDate,
77 const ext::shared_ptr<Exercise>& exercise,
80 const Date& issueDate,
82 const std::vector<Rate>& coupons,
86 const Period& exCouponPeriod,
89 bool exCouponEndOfMonth)
113 const ext::shared_ptr<Exercise>& exercise,
114 Real conversionRatio,
116 const Date& issueDate,
118 const ext::shared_ptr<IborIndex>& index,
120 const std::vector<Spread>& spreads,
124 const Period& exCouponPeriod,
127 bool exCouponEndOfMonth)
155 QL_REQUIRE(args !=
nullptr,
"wrong argument type");
163 args->callabilityDates.clear();
164 args->callabilityTypes.clear();
165 args->callabilityPrices.clear();
166 args->callabilityTriggers.clear();
167 args->callabilityDates.reserve(
n);
168 args->callabilityTypes.reserve(
n);
169 args->callabilityPrices.reserve(
n);
170 args->callabilityTriggers.reserve(
n);
171 for (
Size i = 0; i <
n; i++) {
173 args->callabilityTypes.push_back(
callability_[i]->type());
174 args->callabilityDates.push_back(
callability_[i]->date());
175 args->callabilityPrices.push_back(
callability_[i]->price().amount());
177 args->callabilityPrices.back() +=
179 ext::shared_ptr<SoftCallability> softCall =
180 ext::dynamic_pointer_cast<SoftCallability>(
callability_[i]);
181 if (softCall !=
nullptr)
182 args->callabilityTriggers.push_back(softCall->trigger());
184 args->callabilityTriggers.push_back(
Null<Real>());
191 args->settlementDate = settlement;
202 "positive conversion ratio required: " <<
conversionRatio <<
" not allowed");
206 "positive redemption required: " <<
redemption <<
" not allowed");
213 "different number of callability dates and types");
215 "different number of callability dates and prices");
217 "different number of callability dates and triggers");
void addRedemptionsToCashflows(const std::vector< Real > &redemptions=std::vector< Real >())
virtual Real accruedAmount(Date d=Date()) const
accrued amount at a given date
const Leg & cashflows() const
const ext::shared_ptr< CashFlow > & redemption() const
void setSingleRedemption(Real notional, Real redemption, const Date &date)
Date settlementDate(Date d=Date()) const
std::vector< Date > callabilityDates
ext::shared_ptr< Exercise > exercise
std::vector< Real > callabilityTriggers
std::vector< Callability::Type > callabilityTypes
std::vector< Real > callabilityPrices
void validate() const override
base class for convertible bonds
void setupArguments(PricingEngine::arguments *) const override
const CallabilitySchedule & callability() const
ConvertibleBond(ext::shared_ptr< Exercise > exercise, Real conversionRatio, const CallabilitySchedule &callability, const Date &issueDate, Natural settlementDays, const Schedule &schedule, Real redemption)
ext::shared_ptr< Exercise > exercise_
CallabilitySchedule callability_
ConvertibleFixedCouponBond(const ext::shared_ptr< Exercise > &exercise, Real conversionRatio, const CallabilitySchedule &callability, const Date &issueDate, Natural settlementDays, const std::vector< Rate > &coupons, const DayCounter &dayCounter, const Schedule &schedule, Real redemption=100, const Period &exCouponPeriod=Period(), const Calendar &exCouponCalendar=Calendar(), BusinessDayConvention exCouponConvention=Unadjusted, bool exCouponEndOfMonth=false)
ConvertibleFloatingRateBond(const ext::shared_ptr< Exercise > &exercise, Real conversionRatio, const CallabilitySchedule &callability, const Date &issueDate, Natural settlementDays, const ext::shared_ptr< IborIndex > &index, Natural fixingDays, const std::vector< Spread > &spreads, const DayCounter &dayCounter, const Schedule &schedule, Real redemption=100, const Period &exCouponPeriod=Period(), const Calendar &exCouponCalendar=Calendar(), BusinessDayConvention exCouponConvention=Unadjusted, bool exCouponEndOfMonth=false)
ConvertibleZeroCouponBond(const ext::shared_ptr< Exercise > &exercise, Real conversionRatio, const CallabilitySchedule &callability, const Date &issueDate, Natural settlementDays, const DayCounter &dayCounter, const Schedule &schedule, Real redemption=100)
helper class building a sequence of fixed rate coupons
FixedRateLeg & withNotionals(Real)
FixedRateLeg & withPaymentAdjustment(BusinessDayConvention)
FixedRateLeg & withCouponRates(Rate, const DayCounter &paymentDayCounter, Compounding comp=Simple, Frequency freq=Annual)
FixedRateLeg & withExCouponPeriod(const Period &, const Calendar &, BusinessDayConvention, bool endOfMonth=false)
helper class building a sequence of capped/floored ibor-rate coupons
IborLeg & withSpreads(Spread spread)
IborLeg & withPaymentAdjustment(BusinessDayConvention)
IborLeg & withPaymentDayCounter(const DayCounter &)
IborLeg & withNotionals(Real notional)
IborLeg & withExCouponPeriod(const Period &, const Calendar &, BusinessDayConvention, bool endOfMonth=false)
IborLeg & withFixingDays(Natural fixingDays)
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
const Date & endDate() const
BusinessDayConvention businessDayConvention() const
#define QL_ENSURE(condition, message)
throw an error if the given post-condition is not verified
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
Coupon paying a fixed annual rate.
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
std::size_t Size
size of a container
Coupon paying a Libor-type index.
std::vector< ext::shared_ptr< Callability > > CallabilitySchedule
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
empty deleter for shared_ptr
const ParametricExercise & exercise_