37#include <ql/instruments/inflationcapfloor.hpp>
38#include <ql/math/matrixutilities/sparsematrix.hpp>
40#include <boost/numeric/ublas/vector.hpp>
59 typedef std::map<std::pair<ore::analytics::RiskFactorKey, ore::analytics::RiskFactorKey>, Real>
ParContainer;
63 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters>& simMarketParams,
66 const bool continueOnError =
false,
67 const std::set<ore::analytics::RiskFactorKey::KeyType>&
typesDisabled = {});
88 std::map<ore::analytics::RiskFactorKey, std::pair<QuantLib::Real, QuantLib::Real>>
shiftSizes()
const {
95 void disable(
const std::set<ore::analytics::RiskFactorKey::KeyType>&
types);
108 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarket>& simMarket);
124 static std::set<ore::analytics::RiskFactorKey::KeyType>
parTypes_;
139 std::map<ore::analytics::RiskFactorKey, std::pair<QuantLib::Real, QuantLib::Real>>
shiftSizes_;
200 boost::numeric::ublas::vector<Real>
208 for (
const auto& parKey :
parKeys_) {
210 for (
const auto& rawKey :
rawKeys_) {
Par Sensitivity Analysis.
std::string marketConfiguration_
ore::analytics::SensitivityScenarioData sensitivityData_
Sensitivity data.
void disable(const std::set< ore::analytics::RiskFactorKey::KeyType > &types)
std::set< ore::analytics::RiskFactorKey::KeyType > typesDisabled_
Set of risk factor types disabled for this instance of ParSensitivityAnalysis.
void alignPillars()
align pillars in scenario simulation market parameters with those of the par instruments
ParContainer parSensi_
sensitivity of par rates w.r.t. raw rate shifts (including optionlet/cap volatility)
const ParSensitivityInstrumentBuilder::Instruments & parInstruments() const
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > simMarketParams_
Simulation market parameters.
std::set< ore::analytics::RiskFactorKey > & relevantRiskFactors()
QuantLib::Date asof_
As of date for the calculation of the par sensitivities.
std::map< ore::analytics::RiskFactorKey, std::pair< QuantLib::Real, QuantLib::Real > > shiftSizes_
const ParContainer & parSensitivities() const
Return computed par sensitivities. Empty if they have not been computed yet.
const std::set< ore::analytics::RiskFactorKey > & relevantRiskFactors() const
get / set the relevant scenarios (if empty, these are ignored)
std::set< ore::analytics::RiskFactorKey > relevantRiskFactors_
ParSensitivityInstrumentBuilder::Instruments instruments_
void augmentRelevantRiskFactors()
Augment relevant risk factors.
std::map< ore::analytics::RiskFactorKey, std::pair< QuantLib::Real, QuantLib::Real > > shiftSizes() const
Return the zero rate and par rate absolute shift size for each risk factor key.
void computeParInstrumentSensitivities(const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > &simMarket)
Compute par instrument sensitivities.
std::map< std::pair< ore::analytics::RiskFactorKey, ore::analytics::RiskFactorKey >, Real > ParContainer
virtual ~ParSensitivityAnalysis()
static bool isParType(ore::analytics::RiskFactorKey::KeyType type)
Returns true if risk factor type is applicable for par conversion.
static std::set< ore::analytics::RiskFactorKey::KeyType > parTypes_
void populateShiftSizes(const ore::analytics::RiskFactorKey &key, QuantLib::Real parRate, const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > &simMarket)
Populate shiftSizes_ for key given the implied fair par rate parRate.
const std::set< ore::analytics::RiskFactorKey::KeyType > & typesDisabled() const
Return the set of key types disabled for this instance of ParSensitivityAnalysis.
ParSensitivityConverter class.
void writeConversionMatrix(ore::data::Report &reportOut) const
Write the inverse of the transposed Jacobian to the reportOut.
std::set< ore::analytics::RiskFactorKey > parKeys_
const std::set< ore::analytics::RiskFactorKey > & parKeys()
boost::numeric::ublas::vector< Real > convertSensitivity(const boost::numeric::ublas::vector< Real > &zeroSensitivities)
Takes an array of zero sensitivities and returns an array of par sensitivities.
std::set< ore::analytics::RiskFactorKey > rawKeys_
boost::numeric::ublas::vector< QuantLib::Real > zeroShifts_
Vector of absolute zero shift sizes.
boost::numeric::ublas::vector< QuantLib::Real > parShifts_
Vector of absolute par shift sizes.
const std::set< ore::analytics::RiskFactorKey > & rawKeys()
Inspectors.
QuantLib::SparseMatrix jacobi_transp_inv_
ParSensitivityAnalysis::ParContainer inverseJacobian() const
Data types stored in the scenario class.
KeyType
Risk Factor types.
Description of sensitivity shift scenarios.
static const string defaultConfiguration
void writeParConversionMatrix(const ParSensitivityAnalysis::ParContainer &parSensitivities, Report &report)
Write par instrument sensitivity report.
boost::bimap< std::string, TRS::FundingData::NotionalType > types
A Market class that can be updated by Scenarios.
A class to hold Scenario parameters for scenarioSimMarket.
Perform sensitivity analysis for a given portfolio.
A class to hold the parametrisation for building sensitivity scenarios.
Sensitivity scenario generation.