Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Attributes | List of all members
Analytic::Impl Class Referenceabstract

#include <orea/app/analytic.hpp>

+ Inheritance diagram for Analytic::Impl:
+ Collaboration diagram for Analytic::Impl:

Public Member Functions

 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 Attributes

QuantLib::ext::shared_ptr< InputParametersinputs_
 
std::string label_
 label for logging purposes primarily More...
 
std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > dependentAnalytics_
 

Private Attributes

Analyticanalytic_
 
bool generateAdditionalResults_ = false
 

Detailed Description

Definition at line 174 of file analytic.hpp.

Constructor & Destructor Documentation

◆ Impl() [1/2]

Impl ( )

Definition at line 176 of file analytic.hpp.

176{}

◆ Impl() [2/2]

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

Definition at line 177 of file analytic.hpp.

177: inputs_(inputs) {}
QuantLib::ext::shared_ptr< InputParameters > inputs_
Definition: analytic.hpp:216
const QuantLib::ext::shared_ptr< InputParameters > & inputs() const
Definition: analytic.hpp:116

◆ ~Impl()

virtual ~Impl ( )
virtual

Definition at line 178 of file analytic.hpp.

178{}

Member Function Documentation

◆ runAnalytic()

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

◆ setUpConfigurations()

virtual void setUpConfigurations ( )
virtual

◆ engineFactory()

QuantLib::ext::shared_ptr< EngineFactory > engineFactory ( )
virtual

build an engine factory

Reimplemented in XvaAnalyticImpl.

Definition at line 161 of file analytic.cpp.

161 {
162 LOG("Analytic::engineFactory() called");
163 // Note: Calling the constructor here with empty extry builders
164 // Override this function in case you have got extra ones
165 QuantLib::ext::shared_ptr<EngineData> edCopy = QuantLib::ext::make_shared<EngineData>(*inputs_->pricingEngine());
166 edCopy->globalParameters()["GenerateAdditionalResults"] = to_string(generateAdditionalResults());
167 edCopy->globalParameters()["RunType"] = "NPV";
168 map<MarketContext, string> configurations;
169 configurations[MarketContext::irCalibration] = inputs_->marketConfig("lgmcalibration");
170 configurations[MarketContext::fxCalibration] = inputs_->marketConfig("fxcalibration");
171 configurations[MarketContext::pricing] = inputs_->marketConfig("pricing");
172 LOG("MarketContext::pricing = " << inputs_->marketConfig("pricing"));
173 return QuantLib::ext::make_shared<EngineFactory>(edCopy, analytic()->market(), configurations,
174 inputs_->refDataManager(),
175 *inputs_->iborFallbackConfig());
176}
Analytic * analytic() const
Definition: analytic.hpp:193
bool generateAdditionalResults() const
Definition: analytic.hpp:196
Configurations & configurations()
Definition: analytic.hpp:128
const QuantLib::ext::shared_ptr< ore::data::Market > & market() const
Definition: analytic.hpp:117
#define LOG(text)
std::string to_string(const LocationInfo &l)
+ Here is the call graph for this function:

◆ setLabel()

void setLabel ( const string &  label)

Definition at line 189 of file analytic.hpp.

189{ label_ = label; }
std::string label_
label for logging purposes primarily
Definition: analytic.hpp:219
const std::string & label() const
Definition: analytic.hpp:190
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ label()

const std::string & label ( ) const

Definition at line 190 of file analytic.hpp.

190{ return label_; };
+ Here is the caller graph for this function:

◆ setAnalytic()

void setAnalytic ( Analytic analytic)

Definition at line 192 of file analytic.hpp.

+ Here is the call graph for this function:

◆ analytic()

Analytic * analytic ( ) const

Definition at line 193 of file analytic.hpp.

193{ return analytic_; }
+ Here is the caller graph for this function:

◆ setInputs()

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

Definition at line 194 of file analytic.hpp.

194{ inputs_ = inputs; }
+ Here is the call graph for this function:

◆ generateAdditionalResults()

bool generateAdditionalResults ( ) const

Definition at line 196 of file analytic.hpp.

+ Here is the caller graph for this function:

◆ setGenerateAdditionalResults()

void setGenerateAdditionalResults ( const bool  generateAdditionalResults)

Definition at line 197 of file analytic.hpp.

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

◆ hasDependentAnalytic()

bool hasDependentAnalytic ( const std::string &  key)

Definition at line 201 of file analytic.hpp.

201 {
202 return dependentAnalytics_.find(key) != dependentAnalytics_.end();
203 }
std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > dependentAnalytics_
Definition: analytic.hpp:221

◆ dependentAnalytic() [1/2]

QuantLib::ext::shared_ptr< T > dependentAnalytic ( const std::string &  key) const

Definition at line 251 of file analytic.hpp.

251 {
252 auto it = dependentAnalytics_.find(key);
253 QL_REQUIRE(it != dependentAnalytics_.end(), "Could not find dependent Analytic " << key);
254 QuantLib::ext::shared_ptr<T> analytic = QuantLib::ext::dynamic_pointer_cast<T>(it->second);
255 QL_REQUIRE(analytic, "Could not cast analytic for key " << key);
256 return analytic;
257}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dependentAnalytic() [2/2]

QuantLib::ext::shared_ptr< Analytic > dependentAnalytic ( const std::string &  key) const

Definition at line 107 of file analytic.cpp.

107 {
108 auto it = dependentAnalytics_.find(key);
109 QL_REQUIRE(it != dependentAnalytics_.end(), "Could not find dependent Analytic " << key);
110 return it->second;
111}

◆ dependentAnalytics()

const std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > & dependentAnalytics ( ) const

Definition at line 206 of file analytic.hpp.

206 {
207 return dependentAnalytics_;
208 }

◆ addDependentAnalytic()

void addDependentAnalytic ( const std::string &  key,
const QuantLib::ext::shared_ptr< Analytic > &  analytic 
)

Definition at line 209 of file analytic.hpp.

209 {
211 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allDependentAnalytics()

std::vector< QuantLib::ext::shared_ptr< Analytic > > allDependentAnalytics ( ) const

Definition at line 97 of file analytic.cpp.

97 {
98 std::vector<QuantLib::ext::shared_ptr<Analytic>> analytics;
99 for (const auto& [_, a] : dependentAnalytics_) {
100 analytics.push_back(a);
101 auto das = a->allDependentAnalytics();
102 analytics.insert(end(analytics), begin(das), end(das));
103 }
104 return analytics;
105}

◆ additionalMarketDates()

virtual std::vector< QuantLib::Date > additionalMarketDates ( ) const
virtual

Reimplemented in PnlAnalyticImpl.

Definition at line 213 of file analytic.hpp.

213{ return {}; }

Member Data Documentation

◆ inputs_

QuantLib::ext::shared_ptr<InputParameters> inputs_
protected

Definition at line 216 of file analytic.hpp.

◆ label_

std::string label_
protected

label for logging purposes primarily

Definition at line 219 of file analytic.hpp.

◆ dependentAnalytics_

std::map<std::string, QuantLib::ext::shared_ptr<Analytic> > dependentAnalytics_
protected

Definition at line 221 of file analytic.hpp.

◆ analytic_

Analytic* analytic_
private

Definition at line 224 of file analytic.hpp.

◆ generateAdditionalResults_

bool generateAdditionalResults_ = false
private

Definition at line 225 of file analytic.hpp.