Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
stressscenariodata.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 scenario/stressscenariodata.hpp
20 \brief A class to hold the parametrisation for building sensitivity scenarios
21 \ingroup scenario
22*/
23
24#pragma once
25
27
30
32
33namespace ore {
34namespace analytics {
35using namespace QuantLib;
39using std::map;
40using std::pair;
41using std::string;
42using std::vector;
43
44//! Description of sensitivity shift scenarios
45/*! \ingroup scenario
46 */
48public:
51 vector<Real> shifts;
52 vector<Period> shiftTenors;
53 };
54
58 };
59
60 struct VolShiftData {
62 vector<Period> shiftExpiries;
63 vector<Real> shifts;
64 };
65
68 vector<Period> shiftExpiries;
69 vector<double> shiftStrikes;
70 std::map<Period, vector<Real>> shifts;
71 };
75 vector<Period> shiftExpiries;
76 vector<Period> shiftTerms;
77 map<pair<Period, Period>, Real> shifts;
78 };
79
81 string label;
82 map<string, CurveShiftData> discountCurveShifts; // by currency code
83 map<string, CurveShiftData> indexCurveShifts; // by index name
84 map<string, CurveShiftData> yieldCurveShifts; // by yield curve name
85 map<string, SpotShiftData> fxShifts; // by currency pair
86 map<string, VolShiftData> fxVolShifts; // by currency pair
87 map<string, SpotShiftData> equityShifts; // by equity
88 map<string, VolShiftData> equityVolShifts; // by equity
89 map<string, CapFloorVolShiftData> capVolShifts; // by currency
90 map<string, SwaptionVolShiftData> swaptionVolShifts; // by currency
91 map<string, SpotShiftData> securitySpreadShifts; // by bond/security
92 map<string, SpotShiftData> recoveryRateShifts; // by underlying name
93 map<string, CurveShiftData> survivalProbabilityShifts; // by underlying name
94 bool irCurveParShifts = false;
95 bool irCapFloorParShifts = false;
97
99 };
100
101 //! Default constructor
103
104 //! \name Inspectors
105 //@{
106 const vector<StressTestData>& data() const { return data_; }
108
109 const bool hasScenarioWithParShifts() const {
110 for (const auto& scenario : data_) {
111 if (scenario.containsParShifts())
112 return true;
113 }
114 return false;
115 }
116
117 const bool withIrCurveParShifts() const {
118 for (const auto& scenario : data_) {
119 if (scenario.irCurveParShifts)
120 return true;
121 }
122 return false;
123 }
124
125 const bool withCreditCurveParShifts() const {
126 for (const auto& scenario : data_) {
127 if (scenario.creditCurveParShifts)
128 return true;
129 }
130 return false;
131 }
132
133 const bool withIrCapFloorParShifts() const {
134 for (const auto& scenario : data_) {
135 if (scenario.irCapFloorParShifts)
136 return true;
137 }
138 return false;
139 }
140 //@}
141
142 //! \name Setters
143 //@{
144 vector<StressTestData>& data() { return data_; }
146 //@}
147
148 //! \name Serialisation
149 //@{
150 virtual void fromXML(XMLNode* node) override;
151 virtual XMLNode* toXML(ore::data::XMLDocument& doc) const override;
152 //@}
153
154 //! \name Equality Operators
155 //@{
156 // bool operator==(const StressTestScenarioData& rhs);
157 // bool operator!=(const StressTestScenarioData& rhs);
158 //@}
159
160private:
161 vector<StressTestData> data_;
163};
164} // namespace analytics
165} // namespace ore
Description of sensitivity shift scenarios.
virtual void fromXML(XMLNode *node) override
const vector< StressTestData > & data() const
virtual XMLNode * toXML(ore::data::XMLDocument &doc) const override
Scenario class.