Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
midpointindexcdsengine.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 midpointindexcdsengine.hpp
20 \brief Mid-point engine for credit default swaps
21*/
22
23#ifndef quantext_mid_point_index_cds_engine_hpp
24#define quantext_mid_point_index_cds_engine_hpp
25
27
28#include <ql/pricingengines/credit/midpointcdsengine.hpp>
29
30namespace QuantExt {
31using namespace QuantLib;
32
34public:
35 // use index curve
36 MidPointIndexCdsEngine(const Handle<DefaultProbabilityTermStructure>&, Real recoveryRate,
37 const Handle<YieldTermStructure>& discountCurve,
38 boost::optional<bool> includeSettlementDateFlows = boost::none);
39 // use underlying curves
40 MidPointIndexCdsEngine(const std::vector<Handle<DefaultProbabilityTermStructure>>&,
41 const std::vector<Real>& underlyingRecoveryRate,
42 const Handle<YieldTermStructure>& discountCurve,
43 boost::optional<bool> includeSettlementDateFlows = boost::none);
44 void calculate() const override;
45
46private:
47 Real survivalProbability(const Date& d) const override;
48 Real defaultProbability(const Date& d1, const Date& d2) const override;
49 Real expectedLoss(const Date& defaultDate, const Date& d1, const Date& d2, const Real notional) const override;
50
51 Handle<DefaultProbabilityTermStructure> probability_;
53
54 const std::vector<Handle<DefaultProbabilityTermStructure>> underlyingProbability_;
55 const std::vector<Real> underlyingRecoveryRate_;
56
58};
59} // namespace QuantExt
60
61#endif
Real survivalProbability(const Date &d) const override
Handle< DefaultProbabilityTermStructure > probability_
const std::vector< Handle< DefaultProbabilityTermStructure > > underlyingProbability_
Real expectedLoss(const Date &defaultDate, const Date &d1, const Date &d2, const Real notional) const override
const std::vector< Real > underlyingRecoveryRate_
Real defaultProbability(const Date &d1, const Date &d2) const override
Index Credit default swap.