Sensitivity Scenario Generator. More...
#include <orea/scenario/sensitivityscenariogenerator.hpp>
Inheritance diagram for SensitivityScenarioGenerator:
Collaboration diagram for SensitivityScenarioGenerator:Public Member Functions | |
| SensitivityScenarioGenerator (const QuantLib::ext::shared_ptr< SensitivityScenarioData > &sensitivityData, const QuantLib::ext::shared_ptr< Scenario > &baseScenario, const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &simMarketData, const QuantLib::ext::shared_ptr< ScenarioSimMarket > &simMarket, const QuantLib::ext::shared_ptr< ScenarioFactory > &sensiScenarioFactory, const bool overrideTenors, const std::string &sensitivityTemplate=std::string(), const bool continueOnError=false, const QuantLib::ext::shared_ptr< Scenario > &baseScenarioAbsolute=nullptr) | |
| Constructor. More... | |
| ~SensitivityScenarioGenerator () | |
| Default destructor. More... | |
| const std::map< RiskFactorKey, QuantLib::Real > & | shiftSizes () const |
| const std::map< RiskFactorKey, ShiftScheme > & | shiftSchemes () const |
| const std::map< RiskFactorKey, QuantLib::Real > & | baseValues () const |
| Size | numScenarios () const |
| QuantLib::ext::shared_ptr< Scenario > | baseScenarioAbsolute () const |
Public Member Functions inherited from ShiftScenarioGenerator | |
| ShiftScenarioGenerator (const QuantLib::ext::shared_ptr< Scenario > &baseScenario, const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &simMarketData, const QuantLib::ext::weak_ptr< ScenarioSimMarket > &simMarket) | |
| Constructor. More... | |
| ~ShiftScenarioGenerator () | |
| Default destructor. More... | |
| QuantLib::ext::shared_ptr< Scenario > | next (const Date &d) override |
| Scenario Generator interface. More... | |
| void | reset () override |
| Reset the generator so calls to next() return the first scenario. More... | |
| Size | samples () |
| Inspectors. More... | |
| const QuantLib::ext::shared_ptr< Scenario > & | baseScenario () |
| Return the base scenario, i.e. cached initial values of all relevant market points. More... | |
| const std::vector< QuantLib::ext::shared_ptr< Scenario > > & | scenarios () |
| Return vector of sensitivity scenarios, scenario 0 is the base scenario. More... | |
| std::vector< ScenarioDescription > | scenarioDescriptions () |
| Return vector of scenario descriptions. More... | |
| const std::map< RiskFactorKey, std::string > & | keyToFactor () |
| const std::map< std::string, RiskFactorKey > & | factorToKey () |
| Return revers map of factors to RiskFactorKeys. More... | |
| void | applyShift (Size j, Real shiftSize, bool up, ShiftType type, const vector< Time > &shiftTimes, const vector< Real > &values, const vector< Time > ×, vector< Real > &shiftedValues, bool initialise) |
| Apply 1d triangular shift to 1d data such as yield curves, public to allow test suite access. More... | |
| void | applyShift (Size j, Size k, Real shiftSize, bool up, ShiftType type, const vector< Time > &shiftX, const vector< Time > &shiftY, const vector< Time > &dataX, const vector< Time > &dataY, const vector< vector< Real > > &data, vector< vector< Real > > &shiftedData, bool initialise) |
| Apply 2d shift to 2d matrix such as swaption volatilities, public to allow test suite access. More... | |
| QuantLib::ext::shared_ptr< Scenario > | baseScenario () const |
| return the base scenario More... | |
Public Member Functions inherited from ScenarioGenerator | |
| virtual | ~ScenarioGenerator () |
| Default destructor. More... | |
| virtual QuantLib::ext::shared_ptr< Scenario > | next (const Date &d)=0 |
| Return the next scenario for the given date. More... | |
| virtual void | reset ()=0 |
| Reset the generator so calls to next() return the first scenario. More... | |
Private Attributes | |
| QuantLib::ext::shared_ptr< SensitivityScenarioData > | sensitivityData_ |
| QuantLib::ext::shared_ptr< ScenarioFactory > | sensiScenarioFactory_ |
| std::string | sensitivityTemplate_ |
| const bool | overrideTenors_ |
| const bool | continueOnError_ |
| std::map< RiskFactorKey, QuantLib::Real > | shiftSizes_ |
| Holds the shift sizes for each risk factor key. More... | |
| std::map< RiskFactorKey, ShiftScheme > | shiftSchemes_ |
| Holds the delta shift schemes for each risk factor key. More... | |
| std::map< RiskFactorKey, QuantLib::Real > | baseValues_ |
| Holds the base valuesfor each risk factor key. More... | |
| QuantLib::ext::shared_ptr< Scenario > | baseScenarioAbsolute_ |
Additional Inherited Members | |
Protected Attributes inherited from ShiftScenarioGenerator | |
| const QuantLib::ext::shared_ptr< Scenario > | baseScenario_ |
| const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > | simMarketData_ |
| const QuantLib::ext::weak_ptr< ScenarioSimMarket > | simMarket_ |
| std::vector< QuantLib::ext::shared_ptr< Scenario > > | scenarios_ |
| Size | counter_ |
| std::vector< ScenarioDescription > | scenarioDescriptions_ |
| std::map< RiskFactorKey, std::string > | keyToFactor_ |
| std::map< std::string, RiskFactorKey > | factorToKey_ |
Sensitivity Scenario Generator.
This class builds a vector of sensitivity scenarios based on instructions in SensitivityScenarioData and ScenarioSimMarketParameters objects passed.
The ScenarioSimMarketParameters object determines the scope and structure of a "simulation" market (currencies, currency pairs, curve tenor points, vol matrix expiries and terms/strikes etc) to which sensitivity scenarios are applied in order to compute their NPV impact.
The SensitivityScenarioData object determines the structure of shift curves (shift tenor points can differ from the simulation market's tenor points), as well as type (relative/absolute) and size of shifts applied.
The generator then produces comprehensive scenarios that can be applied to the simulation market, i.e. covering all quotes in the simulation market, possibly filled with "base" scenario values.
Both UP and DOWN shifts are generated in order to facilitate delta and gamma calculation.
The generator currently covers the IR/FX asset class, with shifts for the following term structure types:
For Credit the generator covers shifts to the following termstructure types:
To apply shifts to the integrated hazard rates let:
The relationship between these three can be expressed as:
\[ S(t) = e^{-&Lambda(t) t} \]
\[ &Lambda(t) = \frac{ \int_{0}^t &lambda(t) du}{t} \]
The survival probability quotes from the scenarioSimMarket default curves are then converted as follows:
\[ &Lambda(t) = - \frac{ ln( S(t) )}{t} \]
Note:
If sensitivityData_->generateSpreadScenarios() = true spread scenarios will be generated for supported risk factor types.
Definition at line 102 of file sensitivityscenariogenerator.hpp.
| SensitivityScenarioGenerator | ( | const QuantLib::ext::shared_ptr< SensitivityScenarioData > & | sensitivityData, |
| const QuantLib::ext::shared_ptr< Scenario > & | baseScenario, | ||
| const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > & | simMarketData, | ||
| const QuantLib::ext::shared_ptr< ScenarioSimMarket > & | simMarket, | ||
| const QuantLib::ext::shared_ptr< ScenarioFactory > & | sensiScenarioFactory, | ||
| const bool | overrideTenors, | ||
| const std::string & | sensitivityTemplate = std::string(), |
||
| const bool | continueOnError = false, |
||
| const QuantLib::ext::shared_ptr< Scenario > & | baseScenarioAbsolute = nullptr |
||
| ) |
Constructor.
Definition at line 43 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:| const std::map< RiskFactorKey, QuantLib::Real > & shiftSizes | ( | ) | const |
Return the map of absolute shift sizes by risk factor key for this generator
Null<Real>() is added for the given risk factor key Definition at line 124 of file sensitivityscenariogenerator.hpp.
| const std::map< RiskFactorKey, ShiftScheme > & shiftSchemes | ( | ) | const |
Definition at line 127 of file sensitivityscenariogenerator.hpp.
| const std::map< RiskFactorKey, QuantLib::Real > & baseValues | ( | ) | const |
Similarly, reeturn the base values for each risk factor
Definition at line 130 of file sensitivityscenariogenerator.hpp.
Here is the caller graph for this function:| Size numScenarios | ( | ) | const |
Definition at line 132 of file sensitivityscenariogenerator.hpp.
| QuantLib::ext::shared_ptr< Scenario > baseScenarioAbsolute | ( | ) | const |
Definition at line 134 of file sensitivityscenariogenerator.hpp.
|
private |
Definition at line 267 of file sensitivityscenariogenerator.cpp.
Here is the caller graph for this function:
|
private |
Definition at line 273 of file sensitivityscenariogenerator.cpp.
Here is the caller graph for this function:
|
private |
Definition at line 279 of file sensitivityscenariogenerator.cpp.
Here is the caller graph for this function:
|
private |
Definition at line 285 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 291 of file sensitivityscenariogenerator.cpp.
Here is the caller graph for this function:
|
private |
Definition at line 85 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 621 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 415 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 518 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 298 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 357 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 721 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1261 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1274 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 823 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 941 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1287 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1416 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1523 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1613 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1927 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1711 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1815 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2039 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2154 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2255 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2480 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2368 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 1062 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2559 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2576 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2593 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2521 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2610 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2531 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2541 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2635 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2659 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2686 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2707 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2731 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2749 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2769 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2787 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2828 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2805 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2854 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2876 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2894 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2943 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 2918 of file sensitivityscenariogenerator.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 206 of file sensitivityscenariogenerator.hpp.
|
private |
Definition at line 207 of file sensitivityscenariogenerator.hpp.
|
private |
Definition at line 208 of file sensitivityscenariogenerator.hpp.
|
private |
Definition at line 209 of file sensitivityscenariogenerator.hpp.
|
private |
Definition at line 209 of file sensitivityscenariogenerator.hpp.
|
private |
Holds the shift sizes for each risk factor key.
Definition at line 212 of file sensitivityscenariogenerator.hpp.
|
private |
Holds the delta shift schemes for each risk factor key.
Definition at line 214 of file sensitivityscenariogenerator.hpp.
|
private |
Holds the base valuesfor each risk factor key.
Definition at line 216 of file sensitivityscenariogenerator.hpp.
|
private |
Definition at line 218 of file sensitivityscenariogenerator.hpp.