34 const ext::optional<bool>& includeSettlementDateFlows)
35 : probability_(
std::move(probability)), recoveryRate_(recoveryRate),
44 "no discount term structure set");
46 "no probability term structure set");
77 ext::shared_ptr<FixedRateCoupon> coupon =
78 ext::dynamic_pointer_cast<FixedRateCoupon>(
arguments_.
leg[i]);
84 Date paymentDate = coupon->date(),
85 startDate = coupon->accrualStartDate(),
86 endDate = coupon->accrualEndDate();
90 Date effectiveStartDate =
91 (startDate <= today && today <= endDate) ? today : startDate;
93 effectiveStartDate + (endDate-effectiveStartDate)/2;
103 S * coupon->amount() *
109 P * coupon->accruedAmount(defaultDate) *
114 P * coupon->amount() *
132 Real upfrontSign = 1.0;
144 QL_FAIL(
"unknown protection side");
169 static const Rate basisPoint = 1.0e-4;
bool includeSettlementDateFlows_
const YieldTermStructure & discountCurve_
Classes for default-event claims.
ext::shared_ptr< Claim > claim
ext::shared_ptr< SimpleCashFlow > accrualRebate
ext::optional< Rate > upfront
ext::shared_ptr< SimpleCashFlow > upfrontPayment
CreditDefaultSwap::results results_
CreditDefaultSwap::arguments arguments_
Shared handle to an observable.
Handle< YieldTermStructure > discountCurve_
Handle< DefaultProbabilityTermStructure > probability_
ext::optional< bool > includeSettlementDateFlows_
void calculate() const override
MidPointCdsEngine(Handle< DefaultProbabilityTermStructure >, Real recoveryRate, Handle< YieldTermStructure > discountCurve, const ext::optional< bool > &includeSettlementDateFlows=ext::nullopt)
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Coupon paying a fixed annual rate.
Real Probability
probability
std::size_t Size
size of a container
Mid-point engine for credit default swaps.
Maps optional to either the boost or std implementation.
Interest-rate term structure.