#include <orea/app/analytic.hpp>
Definition at line 46 of file analytic.hpp.
◆ analytic_reports
◆ analytic_npvcubes
◆ analytic_mktcubes
◆ analytic_stresstests
◆ Analytic() [1/2]
◆ Analytic() [2/2]
Analytic |
( |
std::unique_ptr< Impl > |
impl, |
|
|
const std::set< std::string > & |
analyticTypes, |
|
|
const QuantLib::ext::shared_ptr< InputParameters > & |
inputs, |
|
|
bool |
simulationConfig = false , |
|
|
bool |
sensitivityConfig = false , |
|
|
bool |
scenarioGeneratorConfig = false , |
|
|
bool |
crossAssetModelConfig = false |
|
) |
| |
- Parameters
-
impl | Concrete implementation of the analytic |
analyticTypes | The types of all (sub) analytics covered by this Analytic object e.g. NPV, CASHFLOW, CASHFLOWNPV, etc., covered by the PricingAnalytic |
inputs | Any inputs required by this Analytic |
simulationConfig | Flag to indicate whether a simulation config file is required for this analytic |
sensitivityConfig | Flag to indicate whether a sensitivity config file is required for this analytic |
scenarioGeneratorConfig | Flag to indicate whether a scenario generator config file is required for this analytic |
crossAssetModelConfig | Flag to indicate whether a cross asset model config file is required for this analytic |
Definition at line 53 of file analytic.cpp.
61
63
64
65 if (
inputs->curveConfigs().has())
67 if (
inputs->pricingEngine())
69
74
76 impl_->setAnalytic(
this);
77 impl_->setGenerateAdditionalResults(
inputs_->outputAdditionalResults());
78 }
79
81}
Configurations & configurations()
const std::unique_ptr< Impl > & impl()
const QuantLib::ext::shared_ptr< InputParameters > & inputs() const
std::unique_ptr< Impl > impl_
std::set< std::string > types_
list of analytic types run by this analytic
virtual void setUpConfigurations()
const std::set< std::string > & analyticTypes() const
QuantLib::ext::shared_ptr< InputParameters > inputs_
contains all the input parameters for the run
bool sensitivityConfigRequired
bool crossAssetModelConfigRequired
QuantLib::ext::shared_ptr< ore::data::EngineData > engineData
QuantLib::ext::shared_ptr< CurveConfigurations > curveConfig
bool simulationConfigRequired
Booleans to determine if these configs are needed.
bool scenarioGeneratorConfigRequired
◆ ~Analytic()
◆ runAnalytic()
void runAnalytic |
( |
const QuantLib::ext::shared_ptr< ore::data::InMemoryLoader > & |
loader, |
|
|
const std::set< std::string > & |
runTypes = {} |
|
) |
| |
|
virtual |
Run only those analytic types that are inclcuded in the runTypes vector, run all if the runType vector is empty.
Definition at line 83 of file analytic.cpp.
84 {
89 }
90}
const QuantLib::ext::shared_ptr< ore::data::Loader > & loader() const
#define MEM_LOG_USING_LEVEL(LEVEL)
◆ buildConfigurations()
virtual void buildConfigurations |
( |
const bool |
= false | ) |
|
|
virtual |
◆ setUpConfigurations()
void setUpConfigurations |
( |
| ) |
|
|
virtual |
◆ buildMarket()
Definition at line 178 of file analytic.cpp.
179 {
180 LOG(
"Analytic::buildMarket called");
181 cpu_timer mtimer;
182
183 QL_REQUIRE(
loader,
"market data loader not set");
184 QL_REQUIRE(
configurations().curveConfig,
"curve configurations not set");
185
186
188 try {
189
192
193
194 loader_ = QuantLib::ext::make_shared<CompositeLoader>(
loader, bondSpreads);
195
196
198 "There are no quotes available for date " <<
configurations().asofDate);
199
200 market_ = QuantLib::ext::make_shared<TodaysMarket>(
202 inputs()->continueOnError(),
true,
inputs()->lazyMarketBuilding(),
inputs()->refDataManager(),
false,
203 *
inputs()->iborFallbackConfig());
204 } catch (const std::exception& e) {
205 if (marketRequired)
206 QL_FAIL("Failed to build market: " << e.what());
207 else
208 WLOG(
"Failed to build market: " << e.what());
209 }
210 } else {
211 ALOG(
"Skip building the market due to missing today's market parameters in configurations");
212 }
213 mtimer.stop();
214 LOG(
"Market Build time " << setprecision(2) << mtimer.format(default_places,
"%w") <<
" sec");
215}
QuantLib::ext::shared_ptr< ore::data::Market > market_
Configurations configurations_
std::vector< QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > > todaysMarketParams()
QuantLib::ext::shared_ptr< ore::data::Loader > loader_
QuantLib::ext::shared_ptr< Loader > implyBondSpreads(const Date &asof, const QuantLib::ext::shared_ptr< ore::analytics::InputParameters > ¶ms, const QuantLib::ext::shared_ptr< TodaysMarketParameters > &todaysMarketParams, const QuantLib::ext::shared_ptr< Loader > &loader, const QuantLib::ext::shared_ptr< CurveConfigurations > &curveConfigs, const std::string &excludeRegex)
QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > todaysMarketParams
◆ buildPortfolio()
Definition at line 222 of file analytic.cpp.
222 {
224
225
226 portfolio_ = QuantLib::ext::make_shared<Portfolio>(
inputs()->buildFailedTrades());
227
228 tmp->reset();
229
230 for (const auto& [tradeId, trade] : tmp->trades())
231
233
236
237 LOG(
"Build the portfolio");
238 QuantLib::ext::shared_ptr<EngineFactory> factory =
impl()->engineFactory();
240
241
242 Date maturityDate =
inputs()->asof();
243 if (
inputs()->portfolioFilterDate() != Null<Date>())
244 maturityDate =
inputs()->portfolioFilterDate();
245
246 LOG(
"Filter trades that expire before " << maturityDate);
247 portfolio()->removeMatured(maturityDate);
248 } else {
249 ALOG(
"Skip building the portfolio, because market not set");
250 }
251}
const std::string label() const
Inspectors.
QuantLib::ext::shared_ptr< ore::data::Portfolio > portfolio_
const QuantLib::ext::shared_ptr< ore::data::Portfolio > & portfolio() const
virtual void replaceTrades()
◆ marketCalibration()
◆ modifyPortfolio()
virtual void modifyPortfolio |
( |
| ) |
|
|
virtual |
◆ replaceTrades()
virtual void replaceTrades |
( |
| ) |
|
|
virtual |
◆ label()
const std::string label |
( |
| ) |
const |
◆ analyticTypes()
const std::set< std::string > & analyticTypes |
( |
| ) |
const |
◆ inputs()
◆ market()
◆ getMarket()
QuantLib::ext::shared_ptr< MarketImpl > getMarket |
( |
| ) |
const |
Definition at line 119 of file analytic.hpp.
119 {
120 return QuantLib::ext::dynamic_pointer_cast<MarketImpl>(
market_);
121 }
◆ portfolio()
◆ setInputs()
void setInputs |
( |
const QuantLib::ext::shared_ptr< InputParameters > & |
inputs | ) |
|
◆ setMarket()
Definition at line 124 of file analytic.hpp.
const QuantLib::ext::shared_ptr< ore::data::Market > & market() const
◆ setPortfolio()
◆ todaysMarketParams()
Definition at line 147 of file analytic.cpp.
147 {
149 std::vector<QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters>> tmps;
152
153 for (
const auto& a :
impl_->dependentAnalytics()) {
154 auto ctmps = a.second->todaysMarketParams();
155 tmps.insert(end(tmps), begin(ctmps), end(ctmps));
156 }
157
158 return tmps;
159}
virtual void buildConfigurations(const bool=false)
◆ loader()
◆ configurations()
◆ reports()
Result reports.
Definition at line 131 of file analytic.hpp.
analytic_reports reports_
◆ npvCubes()
◆ mktCubes()
◆ stressTests()
Definition at line 134 of file analytic.hpp.
analytic_stresstests stressTests_
◆ getWriteIntermediateReports()
const bool getWriteIntermediateReports |
( |
| ) |
const |
Definition at line 136 of file analytic.hpp.
bool writeIntermediateReports_
◆ setWriteIntermediateReports()
void setWriteIntermediateReports |
( |
const bool |
flag | ) |
|
◆ match()
bool match |
( |
const std::set< std::string > & |
runTypes | ) |
|
Check whether any of the requested run types is covered by this analytic.
Definition at line 118 of file analytic.cpp.
118 {
119 if (runTypes.size() == 0)
120 return true;
121
122 for (const auto& rt : runTypes) {
124 LOG(
"Requested analytics " <<
to_string(runTypes) <<
" match analytic class " <<
label());
125 return true;
126 }
127 }
128 return false;
129}
std::string to_string(const LocationInfo &l)
◆ impl()
const std::unique_ptr< Impl > & impl |
( |
| ) |
|
◆ marketDates()
std::set< QuantLib::Date > marketDates |
( |
| ) |
const |
Definition at line 135 of file analytic.cpp.
135 {
136 std::set<QuantLib::Date> mds = {
inputs_->asof()};
137 auto addDates =
impl_->additionalMarketDates();
138 mds.insert(addDates.begin(), addDates.end());
139
140 for (
const auto& a :
impl_->dependentAnalytics()) {
141 addDates = a.second->impl()->additionalMarketDates();
142 mds.insert(addDates.begin(), addDates.end());
143 }
144 return mds;
145}
◆ allDependentAnalytics()
std::vector< QuantLib::ext::shared_ptr< Analytic > > allDependentAnalytics |
( |
| ) |
const |
◆ impl_
std::unique_ptr<Impl> impl_ |
|
protected |
◆ types_
std::set<std::string> types_ |
|
protected |
list of analytic types run by this analytic
Definition at line 154 of file analytic.hpp.
◆ inputs_
contains all the input parameters for the run
Definition at line 156 of file analytic.hpp.
◆ configurations_
◆ market_
◆ loader_
◆ portfolio_
◆ reports_
◆ npvCubes_
◆ mktCubes_
◆ stressTests_
◆ writeIntermediateReports_
bool writeIntermediateReports_ = true |
|
protected |
Whether to write intermediate reports or not. This would typically be used when the analytic is being called by another analytic and that parent/calling analytic will be writing its own set of intermediate reports
Definition at line 171 of file analytic.hpp.