30 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
34 : arguments_(
std::move(args)), process_(
std::move(process)),
35 creditSpread_(
std::move(creditSpread)) {
37 for (
const auto& dividend : dividends) {
46 Date settlementDate =
process_->riskFreeRate()->referenceDate();
47 for (
Size i=0; i<dividends.size(); i++) {
48 if (dividends[i]->date() >= settlementDate) {
50 dividends[i]->amount() *
52 dividends[i]->date());
94 callabilityTime = grid.
closestTime(callabilityTime);
121 process_->riskFreeRate()->zeroRate(exercise, rfdc,
134 bool convertible =
false;
151 QL_FAIL(
"invalid option type");
185 Real conversionValue =
191 if (grid[j] >= trigger) {
200 }
else if (convertible) {
222 QL_FAIL(
"unknown callability type");
236 if (dividendTime >=
t ||
close(dividendTime,
t)) {
237 const ext::shared_ptr<Dividend>&
d =
dividends_[i];
239 process_->riskFreeRate()->discount(dividendTime) /
242 j +=
d->amount(j) * dividendDiscount;
1-D array used in linear algebra.
Size size() const
dimension of the array
std::vector< Date > callabilityDates
ext::shared_ptr< Exercise > exercise
std::vector< Real > callabilityTriggers
std::vector< Callability::Type > callabilityTypes
std::vector< Real > callabilityPrices
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
bool isOnTime(Time t) const
const ext::shared_ptr< Lattice > & method() const
std::vector< Time > stoppingTimes_
std::vector< Date > dividendDates_
std::vector< Time > couponTimes_
std::vector< Real > couponAmounts_
Array spreadAdjustedRate_
Array conversionProbability_
Array adjustedGrid() const
ConvertibleBond::arguments arguments_
std::vector< Time > dividendTimes_
void postAdjustValuesImpl() override
void applyConvertibility()
DividendSchedule dividends_
std::vector< Time > callabilityTimes_
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
void applyCallability(Size, bool convertible)
Handle< Quote > creditSpread_
DiscretizedConvertible(ConvertibleBond::arguments, ext::shared_ptr< GeneralizedBlackScholesProcess > process, DividendSchedule dividends, Handle< Quote > creditSpread, const TimeGrid &grid=TimeGrid())
void reset(Size size) override
Shared handle to an observable.
template class providing a null value for a given type.
Time closestTime(Time t) const
returns the time on the grid closest to the given t
floating-point comparisons
#define QL_FAIL(message)
throw an error (possibly with file and line information)
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
bool close(const Quantity &m1, const Quantity &m2, Size n)