43 bool paysAtDefaultTime,
44 const Date& startDate,
46 const bool rebatesAccrual,
49 calendar_(
std::move(calendar)), frequency_(frequency), paymentConvention_(paymentConvention),
50 rule_(rule), dayCounter_(
std::move(dayCounter)), recoveryRate_(recoveryRate),
52 paysAtDefaultTime_(paysAtDefaultTime), lastPeriodDC_(
std::move(lastPeriodDayCounter)),
53 rebatesAccrual_(rebatesAccrual), model_(model), startDate_(startDate) {
71 bool paysAtDefaultTime,
72 const Date& startDate,
74 const bool rebatesAccrual,
77 calendar_(
std::move(calendar)), frequency_(frequency), paymentConvention_(paymentConvention),
78 rule_(rule), dayCounter_(
std::move(dayCounter)), recoveryRate_(recoveryRate),
80 paysAtDefaultTime_(paysAtDefaultTime), lastPeriodDC_(
std::move(lastPeriodDayCounter)),
81 rebatesAccrual_(rebatesAccrual), model_(model), startDate_(startDate) {
92 ext::shared_ptr<DefaultProbabilityTermStructure>(ts,
null_deleter()),
120 endDate = refDate +
tenor_;
150 bool paysAtDefaultTime,
151 const Date& startDate,
153 const bool rebatesAccrual,
155 :
CdsHelper(runningSpread, tenor, settlementDays, calendar,
156 frequency, paymentConvention, rule, dayCounter,
157 recoveryRate, discountCurve, settlesAccrual, paysAtDefaultTime,
158 startDate, lastPeriodDayCounter, rebatesAccrual, model) {}
172 bool paysAtDefaultTime,
173 const Date& startDate,
175 const bool rebatesAccrual,
177 :
CdsHelper(runningSpread, tenor, settlementDays, calendar,
178 frequency, paymentConvention, rule, dayCounter,
179 recoveryRate, discountCurve, settlesAccrual, paysAtDefaultTime,
180 startDate, lastPeriodDayCounter,rebatesAccrual, model) {}
183 swap_->recalculate();
184 return swap_->fairSpread();
188 swap_ = ext::make_shared<CreditDefaultSwap>(
195 swap_->setPricingEngine(ext::make_shared<IsdaCdsEngine>(
201 swap_->setPricingEngine(ext::make_shared<MidPointCdsEngine>(
223 bool paysAtDefaultTime,
224 const Date& startDate,
226 const bool rebatesAccrual,
228 :
CdsHelper(upfront, tenor, settlementDays, calendar,
229 frequency, paymentConvention, rule, dayCounter,
230 recoveryRate, discountCurve, settlesAccrual, paysAtDefaultTime,
231 startDate, lastPeriodDayCounter, rebatesAccrual, model),
232 upfrontSettlementDays_(upfrontSettlementDays),
233 upfrontDate_(upfrontDate()),
234 runningSpread_(runningSpread) {}
250 bool paysAtDefaultTime,
251 const Date& startDate,
253 const bool rebatesAccrual,
255 :
CdsHelper(upfrontSpread, tenor, settlementDays, calendar,
256 frequency, paymentConvention, rule, dayCounter,
257 recoveryRate, discountCurve, settlesAccrual, paysAtDefaultTime,
258 startDate, lastPeriodDayCounter, rebatesAccrual, model),
259 upfrontSettlementDays_(upfrontSettlementDays),
260 upfrontDate_(upfrontDate()),
261 runningSpread_(runningSpread) {}
273 swap_ = ext::make_shared<CreditDefaultSwap>(
282 swap_->setPricingEngine(ext::make_shared<IsdaCdsEngine>(
288 swap_->setPricingEngine(ext::make_shared<MidPointCdsEngine>(
299 swap_->recalculate();
300 return swap_->fairUpfront();
const YieldTermStructure & discountCurve_
virtual void setTermStructure(TS *)
sets the term structure to be used for pricing
Date adjust(const Date &, BusinessDayConvention convention=Following) const
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Base class for CDS helpers.
Handle< YieldTermStructure > discountCurve_
RelinkableHandle< DefaultProbabilityTermStructure > probability_
void setTermStructure(DefaultProbabilityTermStructure *) override
DateGeneration::Rule rule_
CreditDefaultSwap::PricingModel model_
CdsHelper(const Handle< Quote > "e, const Period &tenor, Integer settlementDays, Calendar calendar, Frequency frequency, BusinessDayConvention paymentConvention, DateGeneration::Rule rule, DayCounter dayCounter, Real recoveryRate, const Handle< YieldTermStructure > &discountCurve, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &startDate=Date(), DayCounter lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, CreditDefaultSwap::PricingModel model=CreditDefaultSwap::Midpoint)
void initializeDates() override
BusinessDayConvention paymentConvention_
virtual void resetEngine()=0
ext::shared_ptr< CreditDefaultSwap > swap_
Date protectionStart_
protection effective date.
Default probability term structure.
Shared handle to an observable.
MakeSchedule & withConvention(BusinessDayConvention)
MakeSchedule & withTerminationDateConvention(BusinessDayConvention)
MakeSchedule & withRule(DateGeneration::Rule)
MakeSchedule & to(const Date &terminationDate)
MakeSchedule & from(const Date &effectiveDate)
MakeSchedule & withFrequency(Frequency)
MakeSchedule & withCalendar(const Calendar &)
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Bootstrap helper with date schedule relative to global evaluation date.
const std::vector< Date > & dates() const
ext::optional< bool > & includeTodaysCashFlows()
static Settings & instance()
access to the unique instance
void resetEngine() override
SpreadCdsHelper(const Handle< Quote > &runningSpread, const Period &tenor, Integer settlementDays, const Calendar &calendar, Frequency frequency, BusinessDayConvention paymentConvention, DateGeneration::Rule rule, const DayCounter &dayCounter, Real recoveryRate, const Handle< YieldTermStructure > &discountCurve, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &startDate=Date(), const DayCounter &lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, CreditDefaultSwap::PricingModel model=CreditDefaultSwap::Midpoint)
Real impliedQuote() const override
void resetEngine() override
void initializeDates() override
Real impliedQuote() const override
UpfrontCdsHelper(const Handle< Quote > &upfront, Rate runningSpread, const Period &tenor, Integer settlementDays, const Calendar &calendar, Frequency frequency, BusinessDayConvention paymentConvention, DateGeneration::Rule rule, const DayCounter &dayCounter, Real recoveryRate, const Handle< YieldTermStructure > &discountCurve, Natural upfrontSettlementDays=3, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &startDate=Date(), const DayCounter &lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, CreditDefaultSwap::PricingModel model=CreditDefaultSwap::Midpoint)
Natural upfrontSettlementDays_
bootstrap helpers for default-probability term structures
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Frequency
Frequency of events.
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
QL_INTEGER Integer
integer number
ISDA engine for credit default swaps.
Mid-point engine for credit default swaps.
Date cdsMaturity(const Date &tradeDate, const Period &tenor, DateGeneration::Rule rule)
empty deleter for shared_ptr