Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
midpointcdsenginemultistate.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/pricingengines/midpointcdsenginemultistate.hpp
20 \brief Risky Bond Engine
21 \ingroup engines
22*/
23
24#pragma once
25
26#include <ql/pricingengines/credit/midpointcdsengine.hpp>
27
28namespace QuantExt {
29using namespace QuantLib;
30
31/*! The engine takes a vector of default curves and recovery rates. For the given
32 main result state it will produce the same results as the MidPointCdsEngine.
33 In addition a result with label "stateNPV" is produced containing the NPV
34 for each given default curve / recovery rate and an additional entry with
35 a default value w.r.t. the last given recovery rate in the vector. */
36class MidPointCdsEngineMultiState : public QuantLib::MidPointCdsEngine {
37public:
38 MidPointCdsEngineMultiState(const std::vector<Handle<DefaultProbabilityTermStructure>>& defaultCurves,
39 const std::vector<Handle<Quote>> recoveryRates,
40 const Handle<YieldTermStructure>& discountCurve, const Size mainResultState,
41 const boost::optional<bool> includeSettlementDateFlows = boost::none);
42
43 void calculate() const;
44 Handle<YieldTermStructure> discountCurve() const { return discountCurve_; };
45 const std::vector<Handle<DefaultProbabilityTermStructure>>& defaultCurves() const { return defaultCurves_; };
46 const std::vector<Handle<Quote>>& recoveryRates() const { return recoveryRates_; };
47
48private:
49 void linkCurves(Size i) const;
50 Real calculateDefaultValue() const;
51
52 std::vector<Handle<DefaultProbabilityTermStructure>> defaultCurves_;
53 std::vector<Handle<Quote>> recoveryRates_;
55};
56
57} // namespace QuantExt
Handle< YieldTermStructure > discountCurve() const
const std::vector< Handle< Quote > > & recoveryRates() const
std::vector< Handle< DefaultProbabilityTermStructure > > defaultCurves_
const std::vector< Handle< DefaultProbabilityTermStructure > > & defaultCurves() const