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

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

+ Inheritance diagram for IMScheduleAnalyticImpl:
+ Collaboration diagram for IMScheduleAnalyticImpl:

Public Member Functions

 IMScheduleAnalyticImpl (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
 
- 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 = "IM_SCHEDULE"
 

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 31 of file imscheduleanalytic.hpp.

Constructor & Destructor Documentation

◆ IMScheduleAnalyticImpl()

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

Definition at line 35 of file imscheduleanalytic.hpp.

35 : Analytic::Impl(inputs) {
37 }
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 65 of file imscheduleanalytic.cpp.

66 {
67
68 if (!analytic()->match(runTypes))
69 return;
70
71 LOG("IMScheduleAnalytic::runAnalytic called");
72
73 analytic()->buildMarket(loader, false);
74
75 auto imAnalytic = static_cast<IMScheduleAnalytic*>(analytic());
76 QL_REQUIRE(imAnalytic, "Analytic must be of type IMScheduleAnalytic");
77
78
79 imAnalytic->loadCrifRecords(loader);
80
81 // Calculate IMSchedule
82 LOG("Calculating Schedule IM")
83 auto imSchedule = QuantLib::ext::make_shared<IMScheduleCalculator>(
84 imAnalytic->crif(), inputs_->simmResultCurrency(), analytic()->market(),
85 true, inputs_->enforceIMRegulations(), false, imAnalytic->hasSEC(),
86 imAnalytic->hasCFTC());
87 imAnalytic->setImSchedule(imSchedule);
88
89 Real fxSpotReport = 1.0;
90 if (!inputs_->simmReportingCurrency().empty()) {
91 fxSpotReport = analytic()
92 ->market()
93 ->fxRate(inputs_->simmResultCurrency() + inputs_->simmReportingCurrency())
94 ->value();
95 DLOG("SIMM reporting currency is " << inputs_->simmReportingCurrency() << " with fxSpot "
96 << fxSpotReport);
97 }
98
99 QuantLib::ext::shared_ptr<InMemoryReport> imScheduleSummaryReport = QuantLib::ext::make_shared<InMemoryReport>();
100 QuantLib::ext::shared_ptr<InMemoryReport> imScheduleTradeReport = QuantLib::ext::make_shared<InMemoryReport>();
101
102 // Populate the trade-level IM Schedule report
103 LOG("Generating Schedule IM reports")
104 ore::analytics::ReportWriter(inputs_->reportNaString())
105 .writeIMScheduleTradeReport(imSchedule->imScheduleTradeResults(), imScheduleTradeReport,
106 imAnalytic->hasNettingSetDetails());
107
108 // Populate the netting set level IM Schedule report
109 ore::analytics::ReportWriter(inputs_->reportNaString())
110 .writeIMScheduleSummaryReport(imSchedule->finalImScheduleSummaryResults(), imScheduleSummaryReport,
111 imAnalytic->hasNettingSetDetails(), inputs_->simmResultCurrency(),
112 inputs_->simmReportingCurrency(), fxSpotReport);
113
114 LOG("Schedule IM reports generated");
115 MEM_LOG;
116
117 analytic()->reports()["IM_SCHEDULE"]["im_schedule"] = imScheduleSummaryReport;
118 analytic()->reports()["IM_SCHEDULE"]["im_schedule_trade"] = imScheduleTradeReport;
119}
Analytic * analytic() const
Definition: analytic.hpp:193
QuantLib::ext::shared_ptr< InputParameters > inputs_
Definition: analytic.hpp:216
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::data::Market > & market() const
Definition: analytic.hpp:117
#define LOG(text)
#define DLOG(text)
+ Here is the call graph for this function:

◆ setUpConfigurations()

void setUpConfigurations ( )
overridevirtual

Reimplemented from Analytic::Impl.

Definition at line 40 of file imscheduleanalytic.hpp.

40{}

Member Data Documentation

◆ LABEL

constexpr const char* LABEL = "IM_SCHEDULE"
staticconstexpr

Definition at line 33 of file imscheduleanalytic.hpp.