Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
discountingriskybondenginemultistate.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/discountingriskybondenginemultistate.hpp
20 \brief Risky Bond Engine
21 \ingroup engines
22*/
23
24#pragma once
25
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. */
37public:
38 DiscountingRiskyBondEngineMultiState(const Handle<YieldTermStructure>& discountCurve,
39 const std::vector<Handle<DefaultProbabilityTermStructure>>& defaultCurves,
40 const std::vector<Handle<Quote>>& recoveryRates, const Size mainResultState,
41 const Handle<Quote>& securitySpread, Period timestepPeriod,
42 const boost::optional<bool> includeSettlementDateFlows = boost::none);
43
44 void calculate() const;
45 Real calculateNpv(const Size state) const;
46 Real calculateDefaultValue() const;
47 Handle<YieldTermStructure> discountCurve() const { return discountCurve_; };
48 const std::vector<Handle<DefaultProbabilityTermStructure>>& defaultCurves() const { return defaultCurves_; };
49 const std::vector<Handle<Quote>>& recoveryRates() const { return recoveryRates_; };
50 Handle<Quote> securitySpread() const { return securitySpread_; };
51
52private:
53 void linkCurves(Size i) const;
54 const std::vector<Handle<DefaultProbabilityTermStructure>> defaultCurves_;
55 const std::vector<Handle<Quote>> recoveryRates_;
56 const Size mainResultState_;
57};
58
59} // namespace QuantExt
Real calculateNpv(const Size state) const
const std::vector< Handle< DefaultProbabilityTermStructure > > defaultCurves_
const std::vector< Handle< Quote > > & recoveryRates() const
const std::vector< Handle< DefaultProbabilityTermStructure > > & defaultCurves() const