29using namespace boost::filesystem;
35 const auto stressData =
inputs_->stressScenarioData();
37 if (stressData !=
nullptr) {
49 const std::set<std::string>& runTypes) {
53 LOG(
"StressTestAnalytic::runAnalytic called");
55 Settings::instance().evaluationDate() =
inputs_->asof();
56 ObservationMode::instance().setMode(
inputs_->observationModel());
57 QL_REQUIRE(
inputs_->portfolio(),
"StressTestAnalytic::run: No portfolio loaded.");
59 CONSOLEW(
"StressTestAnalytic: Build Market");
63 CONSOLEW(
"StressTestAnalytic: Build Portfolio");
66 QuantLib::ext::shared_ptr<InMemoryReport> report = QuantLib::ext::make_shared<InMemoryReport>();
70 CONSOLEW(
"Risk: Stress Test Report");
71 LOG(
"Stress Test Analysis called");
72 QuantLib::ext::shared_ptr<StressTestScenarioData> scenarioData =
inputs_->stressScenarioData();
73 if (scenarioData !=
nullptr && scenarioData->hasScenarioWithParShifts()) {
77 analytic()->configurations().simMarketParams,
analytic()->configurations().sensiScenarioData,
81 }
catch(
const std::exception& e){
86 Settings::instance().evaluationDate() =
inputs_->asof();
88 std::string marketConfig =
inputs_->marketConfig(
"pricing");
89 std::vector<QuantLib::ext::shared_ptr<ore::data::EngineBuilder>> extraEngineBuilders;
90 std::vector<QuantLib::ext::shared_ptr<ore::data::LegBuilder>> extraLegBuilders;
91 QuantLib::ext::shared_ptr<StressTest> stressTest = QuantLib::ext::make_shared<StressTest>(
93 analytic()->configurations().simMarketParams, scenarioData, *
analytic()->configurations().curveConfig,
94 *
analytic()->configurations().todaysMarketParams,
nullptr,
inputs_->refDataManager(),
96 stressTest->writeReport(report,
inputs_->stressThreshold());
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()
analytic_stresstests & stressTests()
virtual void modifyPortfolio()
virtual void buildMarket(const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader, const bool marketRequired=true)
virtual void buildPortfolio()
QuantLib::ext::shared_ptr< ore::analytics::StressTestScenarioData > convertStressScenarioData(const QuantLib::ext::shared_ptr< ore::analytics::StressTestScenarioData > &scenarioData) const
Convert all par shifts to zero shifts for all scenarios defined in the stresstest.
StressTestAnalytic(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
Singleton class to hold global Observation Mode.
Perfrom sensitivity analysis for a given portfolio.
Convert all par shifts in a stress test to a zero shifts.
A Class to write ORE outputs to reports.
A Market class that can be updated by Scenarios.
perform a stress testing analysis for a given portfolio.
bool sensitivityConfigRequired
QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > sensiScenarioData
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
Structured analytics error.