21#include <ql/cashflows/coupon.hpp>
22#include <ql/termstructures/yield/zerospreadedtermstructure.hpp>
24#include <boost/make_shared.hpp>
31 const Handle<YieldTermStructure>& discountCurve,
32 const std::vector<Handle<DefaultProbabilityTermStructure>>& defaultCurves,
33 const std::vector<Handle<Quote>>& recoveryRates,
const Size mainResultState,
const Handle<Quote>& securitySpread,
34 Period timestepPeriod, boost::optional<bool> includeSettlementDateFlows)
36 securitySpread, timestepPeriod, includeSettlementDateFlows),
37 defaultCurves_(defaultCurves), recoveryRates_(recoveryRates), mainResultState_(mainResultState) {
38 QL_REQUIRE(!
defaultCurves.empty(),
"DiscountingRiskBondEngineMultiState: no default curves / recovery rates given");
45 QL_REQUIRE(mainResultState <
defaultCurves.size(),
"DiscountingRiskBondEngineMultiState: mainResultState ("
46 << mainResultState <<
") out of range 0..."
80 results_.additionalResults[
"stateNpv"] = values;
88 QuantLib::ext::shared_ptr<Coupon> coupon = QuantLib::ext::dynamic_pointer_cast<Coupon>(cf);
94 QL_FAIL(
"could not calculated default value, no alive coupons found");
const Instrument::results * results_
Discounting Risky Bond Engine.
Handle< YieldTermStructure > discountCurve_
boost::optional< bool > includeSettlementDateFlows_
void calculate() const override
Handle< DefaultProbabilityTermStructure > defaultCurve_
Handle< Quote > recoveryRate_
Real calculateDefaultValue() const
void linkCurves(Size i) const
const std::vector< Handle< DefaultProbabilityTermStructure > > defaultCurves_
const Size mainResultState_
DiscountingRiskyBondEngineMultiState(const Handle< YieldTermStructure > &discountCurve, const std::vector< Handle< DefaultProbabilityTermStructure > > &defaultCurves, const std::vector< Handle< Quote > > &recoveryRates, const Size mainResultState, const Handle< Quote > &securitySpread, Period timestepPeriod, const boost::optional< bool > includeSettlementDateFlows=boost::none)
const std::vector< Handle< DefaultProbabilityTermStructure > > & defaultCurves() const
const std::vector< Handle< Quote > > recoveryRates_
Swap::arguments * arguments_