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

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

+ Inheritance diagram for VarAnalyticImpl:
+ Collaboration diagram for VarAnalyticImpl:

Public Member Functions

 VarAnalyticImpl (const QuantLib::ext::shared_ptr< InputParameters > &inputs, const string &label)
 
virtual void runAnalytic (const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader, const std::set< std::string > &runTypes={}) override
 
virtual void setUpConfigurations () override
 
- 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
 

Protected Member Functions

virtual void setVarReport (const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader)
 

Protected Attributes

QuantLib::ext::shared_ptr< VarReportvarReport_
 
- 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 32 of file varanalytic.hpp.

Constructor & Destructor Documentation

◆ VarAnalyticImpl()

VarAnalyticImpl ( const QuantLib::ext::shared_ptr< InputParameters > &  inputs,
const string &  label 
)

Definition at line 34 of file varanalytic.hpp.

35 : Analytic::Impl(inputs) {
37 }
void setLabel(const string &label)
Definition: analytic.hpp:189
const std::string & label() const
Definition: analytic.hpp:190
+ 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 43 of file varanalytic.cpp.

44 {
45 MEM_LOG;
46 LOG("Running parametric VaR");
47
48 Settings::instance().evaluationDate() = inputs_->asof();
49 ObservationMode::instance().setMode(inputs_->observationModel());
50
51 LOG("VAR: Build Market");
52 CONSOLEW("Risk: Build Market for VaR");
53 analytic()->buildMarket(loader);
54 CONSOLE("OK");
55
56 CONSOLEW("Risk: Build Portfolio for VaR");
58 CONSOLE("OK");
59
60 setVarReport(loader);
61 QL_REQUIRE(varReport_, "No Var Report created");
62
63 LOG("Call VaR calculation");
64 CONSOLEW("Risk: VaR Calculation");
65 ext::shared_ptr<MarketRiskReport::Reports> reports = ext::make_shared<MarketRiskReport::Reports>();
66 QuantLib::ext::shared_ptr<InMemoryReport> varReport = QuantLib::ext::make_shared<InMemoryReport>();
67 reports->add(varReport);
68
69 varReport_->calculate(reports);
70 CONSOLE("OK");
71
72 analytic()->reports()[label_]["var"] = varReport;
73
74 LOG("VaR completed");
75 MEM_LOG;
76}
Analytic * analytic() const
Definition: analytic.hpp:193
std::string label_
label for logging purposes primarily
Definition: analytic.hpp:219
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
virtual void buildPortfolio()
Definition: analytic.cpp:222
virtual void setVarReport(const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &loader)
Definition: varanalytic.hpp:45
QuantLib::ext::shared_ptr< VarReport > varReport_
Definition: varanalytic.hpp:43
#define MEM_LOG
#define LOG(text)
#define CONSOLEW(text)
#define CONSOLE(text)
+ Here is the call graph for this function:

◆ setUpConfigurations()

void setUpConfigurations ( )
overridevirtual

Reimplemented from Analytic::Impl.

Reimplemented in ParametricVarAnalyticImpl, and HistoricalSimulationVarAnalyticImpl.

Definition at line 39 of file varanalytic.cpp.

39 {
40 analytic()->configurations().todaysMarketParams = inputs_->todaysMarketParams();
41}
Configurations & configurations()
Definition: analytic.hpp:128
QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > todaysMarketParams
Definition: analytic.hpp:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setVarReport()

virtual void setVarReport ( const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > &  loader)
protectedvirtual

Reimplemented in ParametricVarAnalyticImpl, and HistoricalSimulationVarAnalyticImpl.

Definition at line 45 of file varanalytic.hpp.

45{};
+ Here is the caller graph for this function:

Member Data Documentation

◆ varReport_

QuantLib::ext::shared_ptr<VarReport> varReport_
protected

Definition at line 43 of file varanalytic.hpp.