21#include <ql/cashflows/fixedratecoupon.hpp>
22#include <ql/instruments/claim.hpp>
23#include <ql/termstructures/yieldtermstructure.hpp>
30 const std::vector<Handle<DefaultProbabilityTermStructure>>& defaultCurves,
31 const std::vector<Handle<Quote>> recoveryRates,
const Handle<YieldTermStructure>& discountCurve,
32 const Size mainResultState,
const boost::optional<bool> includeSettlementDateFlows)
33 : MidPointCdsEngine(Handle<DefaultProbabilityTermStructure>(), 0.0, discountCurve, includeSettlementDateFlows),
34 defaultCurves_(defaultCurves), recoveryRates_(recoveryRates), mainResultState_(mainResultState) {
37 <<
") must match number of recovery rates ("
39 QL_REQUIRE(!
defaultCurves.empty(),
"MidPointCdsEngineMultiState: no default curves / recovery rates given");
46 QL_REQUIRE(mainResultState <
defaultCurves.size(),
"MidPointCdsEngineMultiState: mainResultState ("
47 << mainResultState <<
") out of range 0..."
65 MidPointCdsEngine::calculate();
72 MidPointCdsEngine::calculate();
81 results_.additionalResults[
"stateNpv"] = values;
85 Date defaultDate = discountCurve_->referenceDate();
86 Real phi =
arguments_.side == Protection::Seller ? -1.0 : 1.0;
const Instrument::results * results_
Real calculateDefaultValue() const
void linkCurves(Size i) const
const std::vector< Handle< Quote > > & recoveryRates() const
MidPointCdsEngineMultiState(const std::vector< Handle< DefaultProbabilityTermStructure > > &defaultCurves, const std::vector< Handle< Quote > > recoveryRates, const Handle< YieldTermStructure > &discountCurve, const Size mainResultState, const boost::optional< bool > includeSettlementDateFlows=boost::none)
std::vector< Handle< DefaultProbabilityTermStructure > > defaultCurves_
std::vector< Handle< Quote > > recoveryRates_
const std::vector< Handle< DefaultProbabilityTermStructure > > & defaultCurves() const
Swap::arguments * arguments_