27using namespace boost::filesystem;
33 const auto stressData =
inputs_->stressScenarioData();
43 const std::set<std::string>& runTypes) {
47 LOG(
"StressTestAnalytic::runAnalytic called");
49 Settings::instance().evaluationDate() =
inputs_->asof();
50 ObservationMode::instance().setMode(
inputs_->observationModel());
52 CONSOLEW(
"StressTestAnalytic: Build Market");
57 auto stressData =
inputs_->zeroToParShiftScenarioData();
62 Date
asof = market->asofDate();
66 market,
inputs_->iborFallbackConfig());
68 std::set<RiskFactorKey::KeyType> disabled;
70 auto instruments = parAnalysis->parInstruments();
72 DLOG(
"Build Stress Scenario Generator");
74 QuantLib::ext::shared_ptr<Scenario> baseScenario = simMarket->baseScenario();
75 auto scenarioFactory = QuantLib::ext::make_shared<CloneScenarioFactory>(baseScenario);
76 QuantLib::ext::shared_ptr<StressScenarioGenerator> scenarioGenerator =
77 QuantLib::ext::make_shared<StressScenarioGenerator>(stressData, baseScenario, simMarketData, simMarket,
78 scenarioFactory, simMarket->baseScenarioAbsolute());
79 simMarket->scenarioGenerator() = scenarioGenerator;
83 QuantLib::ext::shared_ptr<InMemoryReport> report = QuantLib::ext::make_shared<InMemoryReport>();
85 report->addColumn(
"ScenarioLabel",
string());
86 report->addColumn(
"ParKey",
string());
87 report->addColumn(
"ParShift",
double(), 6);
91 scenarioGenerator->reset();
92 for (
size_t i = 0; i < scenarioGenerator->samples(); i++) {
93 auto scenario = scenarioGenerator->next(
asof);
94 auto label = scenario->label();
95 auto shifts = shiftConvert.
parShifts(scenario);
96 for (
const auto& [key, shift] : shifts) {
97 if (std::abs(shift) > 1e-6) {
Analytic * analytic() const
const std::string & label() const
void setGenerateAdditionalResults(const bool generateAdditionalResults)
QuantLib::ext::shared_ptr< InputParameters > inputs_
analytic_reports & reports()
Result reports.
Configurations & configurations()
virtual void buildMarket(const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader, const bool marketRequired=true)
const QuantLib::ext::shared_ptr< ore::data::Market > & market() const
std::pair< QuantLib::ext::shared_ptr< ScenarioSimMarket >, QuantLib::ext::shared_ptr< ParSensitivityAnalysis > > computeParSensitivity(const std::set< RiskFactorKey::KeyType > &typesDisabled) const
ZeroToParShiftAnalytic(const boost::shared_ptr< InputParameters > &inputs)
void setUpConfigurations() override
void runAnalytic(const boost::shared_ptr< ore::data::InMemoryLoader > &loader, const std::set< std::string > &runTypes={}) override
std::unordered_map< RiskFactorKey, double > parShifts(QuantLib::ext::shared_ptr< Scenario > scenario) const
factory class for cloning a cached scenario
std::string to_string(const LocationInfo &l)
Singleton class to hold global Observation Mode.
Convert all par shifts in a stress test to a zero shifts.
Stress scenario generation.
bool sensitivityConfigRequired
QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > sensiScenarioData
QuantLib::ext::shared_ptr< CurveConfigurations > curveConfig
QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > todaysMarketParams
bool simulationConfigRequired
Booleans to determine if these configs are needed.
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > simMarketParams
vector< string > curveConfigs
applies a zero scenario and return the par instrument shifts
ORE ZeroToPar Shift Analytic.