27 bool withinNextWeek(
Time t1,
Time t2) {
28 static const Time dt = 1.0 / 52;
29 return t1 <= t2 && t2 <= t1 + dt;
37 : arguments_(args), adjustedCallabilityPrices_(args.callabilityPrices) {
39 auto dayCounter = termStructure->dayCounter();
40 auto referenceDate = termStructure->referenceDate();
64 if (withinNextWeek(callabilityTime, couponTime) && callabilityDate < couponDate) {
66 callabilityTime = couponTime;
79 auto calcDiscountFactorInclSpread = [&termStructure, spread](
Date date) {
80 auto time = termStructure->timeFromReference(date);
81 auto zeroRateInclSpread =
82 termStructure->zeroRate(date, termStructure->dayCounter(),
Continuous,
85 auto df = std::exp(-zeroRateInclSpread *
time);
89 auto dfTillCallDate = calcDiscountFactorInclSpread(callabilityDate);
90 auto dfTillCouponDate = calcDiscountFactorInclSpread(couponDate);
110 std::vector<Time> times;
182 QL_FAIL(
"unknown callability type");
1-D array used in linear algebra.
Size size() const
dimension of the array
std::vector< Date > callabilityDates
Real redemption
redemption = face amount * redemption / 100.
std::vector< Real > couponAmounts
std::vector< Date > couponDates
CallabilitySchedule putCallSchedule
bool isOnTime(Time t) const
void applyCallability(Size i)
std::vector< CouponAdjustment > couponAdjustments_
DiscretizedCallableFixedRateBond(const CallableBond::arguments &, const Handle< YieldTermStructure > &termStructure)
std::vector< Time > couponTimes_
void preAdjustValuesImpl() override
void postAdjustValuesImpl() override
std::vector< Time > mandatoryTimes() const override
std::vector< Time > callabilityTimes_
std::vector< Real > adjustedCallabilityPrices_
void reset(Size size) override
CallableBond::arguments arguments_
Shared handle to an observable.
Discretized callable fixed-rate bond class.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container