Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ScenarioAnalyticImpl Class Reference

#include <orea/app/analytics/scenarioanalytic.hpp>

+ Inheritance diagram for ScenarioAnalyticImpl:
+ Collaboration diagram for ScenarioAnalyticImpl:

Public Member Functions

 ScenarioAnalyticImpl (const QuantLib::ext::shared_ptr< InputParameters > &inputs)
 
void runAnalytic (const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader, const std::set< std::string > &runTypes={}) override
 
void setUpConfigurations () override
 
const QuantLib::ext::shared_ptr< ore::analytics::Scenario > & scenario () const
 
void setScenario (const QuantLib::ext::shared_ptr< ore::analytics::Scenario > &scenario)
 
void setUseSpreadedTermStructures (const bool useSpreadedTermStructures)
 
const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > & scenarioSimMarket () const
 
void setScenarioSimMarket (const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > &ssm)
 
- Public Member Functions inherited from Analytic::Impl
 Impl ()
 
 Impl (const QuantLib::ext::shared_ptr< InputParameters > &inputs)
 
virtual ~Impl ()
 
virtual void runAnalytic (const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader, const std::set< std::string > &runTypes={})=0
 
virtual void setUpConfigurations ()
 
virtual QuantLib::ext::shared_ptr< ore::data::EngineFactoryengineFactory ()
 build an engine factory More...
 
void setLabel (const string &label)
 
const std::string & label () const
 
void setAnalytic (Analytic *analytic)
 
Analyticanalytic () const
 
void setInputs (const QuantLib::ext::shared_ptr< InputParameters > &inputs)
 
bool generateAdditionalResults () const
 
void setGenerateAdditionalResults (const bool generateAdditionalResults)
 
bool hasDependentAnalytic (const std::string &key)
 
template<class T >
QuantLib::ext::shared_ptr< T > dependentAnalytic (const std::string &key) const
 
QuantLib::ext::shared_ptr< AnalyticdependentAnalytic (const std::string &key) const
 
const std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > & dependentAnalytics () const
 
void addDependentAnalytic (const std::string &key, const QuantLib::ext::shared_ptr< Analytic > &analytic)
 
std::vector< QuantLib::ext::shared_ptr< Analytic > > allDependentAnalytics () const
 
virtual std::vector< QuantLib::Date > additionalMarketDates () const
 

Static Public Attributes

static constexpr const char * LABEL = "SCENARIO"
 

Private Attributes

QuantLib::ext::shared_ptr< ore::analytics::Scenarioscenario_
 
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketscenarioSimMarket_
 
bool useSpreadedTermStructures_ = false
 

Additional Inherited Members

- Protected Attributes inherited from Analytic::Impl
QuantLib::ext::shared_ptr< InputParametersinputs_
 
std::string label_
 label for logging purposes primarily More...
 
std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > dependentAnalytics_
 

Detailed Description

Definition at line 29 of file scenarioanalytic.hpp.

Constructor & Destructor Documentation

◆ ScenarioAnalyticImpl()

ScenarioAnalyticImpl ( const QuantLib::ext::shared_ptr< InputParameters > &  inputs)

Definition at line 33 of file scenarioanalytic.hpp.

33 :
34 Analytic::Impl(inputs) {
36 }
void setLabel(const string &label)
Definition: analytic.hpp:189
static constexpr const char * LABEL
+ Here is the call graph for this function:

Member Function Documentation

◆ runAnalytic()

void runAnalytic ( const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &  loader,
const std::set< std::string > &  runTypes = {} 
)
overridevirtual

Implements Analytic::Impl.

Definition at line 32 of file scenarioanalytic.cpp.

33 {
34
35 if (!analytic()->match(runTypes))
36 return;
37
38 LOG("ScenarioAnalytic::runAnalytic called");
39
40 analytic()->buildMarket(loader);
41
42 LOG("Building scenario simulation market for date " << io::iso_date(inputs_->asof()));
43 // FIXME: *configurations_.todaysMarketParams uninitialized?
44 auto ssm = QuantLib::ext::make_shared<ScenarioSimMarket>(
45 analytic()->market(), analytic()->configurations().simMarketParams, Market::defaultConfiguration,
46 *analytic()->configurations().curveConfig, *analytic()->configurations().todaysMarketParams, true,
47 useSpreadedTermStructures_, false, false, *inputs_->iborFallbackConfig());
48
50 auto scenario = ssm->baseScenario();
52
53 QuantLib::ext::shared_ptr<InMemoryReport> report = QuantLib::ext::make_shared<InMemoryReport>();
54 auto sw = ScenarioWriter(nullptr, report);
55 sw.writeScenario(scenario, true);
56 analytic()->reports()[label()]["scenario"] = report;
57}
Analytic * analytic() const
Definition: analytic.hpp:193
const std::string & label() const
Definition: analytic.hpp:190
QuantLib::ext::shared_ptr< InputParameters > inputs_
Definition: analytic.hpp:216
analytic_reports & reports()
Result reports.
Definition: analytic.hpp:131
virtual void buildMarket(const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader, const bool marketRequired=true)
Definition: analytic.cpp:178
const QuantLib::ext::shared_ptr< ore::analytics::Scenario > & scenario() const
void setScenario(const QuantLib::ext::shared_ptr< ore::analytics::Scenario > &scenario)
void setScenarioSimMarket(const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > &ssm)
Class for writing scenarios to file.
static const string defaultConfiguration
#define LOG(text)
+ Here is the call graph for this function:

◆ setUpConfigurations()

void setUpConfigurations ( )
overridevirtual

Reimplemented from Analytic::Impl.

Definition at line 27 of file scenarioanalytic.cpp.

27 {
28 analytic()->configurations().todaysMarketParams = inputs_->todaysMarketParams();
29 analytic()->configurations().simMarketParams = inputs_->scenarioSimMarketParams();
30}
Configurations & configurations()
Definition: analytic.hpp:128
QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > todaysMarketParams
Definition: analytic.hpp:68
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > simMarketParams
Definition: analytic.hpp:69
+ Here is the call graph for this function:

◆ scenario()

const QuantLib::ext::shared_ptr< ore::analytics::Scenario > & scenario ( ) const

Definition at line 41 of file scenarioanalytic.hpp.

41{ return scenario_; };
QuantLib::ext::shared_ptr< ore::analytics::Scenario > scenario_
+ Here is the caller graph for this function:

◆ setScenario()

void setScenario ( const QuantLib::ext::shared_ptr< ore::analytics::Scenario > &  scenario)

Definition at line 42 of file scenarioanalytic.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUseSpreadedTermStructures()

void setUseSpreadedTermStructures ( const bool  useSpreadedTermStructures)

Definition at line 43 of file scenarioanalytic.hpp.

43 {
44 useSpreadedTermStructures_ = useSpreadedTermStructures;
45 }
+ Here is the caller graph for this function:

◆ scenarioSimMarket()

const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > & scenarioSimMarket ( ) const

Definition at line 47 of file scenarioanalytic.hpp.

47 {
48 return scenarioSimMarket_;
49 };
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > scenarioSimMarket_
+ Here is the caller graph for this function:

◆ setScenarioSimMarket()

void setScenarioSimMarket ( const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > &  ssm)

Definition at line 50 of file scenarioanalytic.hpp.

50 {
52 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ LABEL

constexpr const char* LABEL = "SCENARIO"
staticconstexpr

Definition at line 31 of file scenarioanalytic.hpp.

◆ scenario_

QuantLib::ext::shared_ptr<ore::analytics::Scenario> scenario_
private

Definition at line 55 of file scenarioanalytic.hpp.

◆ scenarioSimMarket_

QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarket> scenarioSimMarket_
private

Definition at line 56 of file scenarioanalytic.hpp.

◆ useSpreadedTermStructures_

bool useSpreadedTermStructures_ = false
private

Definition at line 57 of file scenarioanalytic.hpp.