34#include <ql/errors.hpp>
35#include <ql/math/comparison.hpp>
46 const QuantLib::ext::shared_ptr<ore::data::Portfolio>& portfolio,
const QuantLib::ext::shared_ptr<ore::data::Market>& market,
47 const string& marketConfiguration,
const QuantLib::ext::shared_ptr<ore::data::EngineData>& engineData,
48 const QuantLib::ext::shared_ptr<ScenarioSimMarketParameters>& simMarketData,
49 const QuantLib::ext::shared_ptr<SensitivityScenarioData>& sensitivityData,
const bool recalibrateModels,
50 const QuantLib::ext::shared_ptr<ore::data::CurveConfigurations>& curveConfigs,
51 const QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters>& todaysMarketParams,
52 const bool nonShiftedBaseCurrencyConversion,
const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceData,
54 : market_(market), marketConfiguration_(marketConfiguration), asof_(market ? market->asofDate() : Date()),
55 simMarketData_(simMarketData), sensitivityData_(sensitivityData), recalibrateModels_(recalibrateModels),
56 curveConfigs_(
curveConfigs), todaysMarketParams_(todaysMarketParams), overrideTenors_(false),
57 nonShiftedBaseCurrencyConversion_(nonShiftedBaseCurrencyConversion), referenceData_(referenceData),
58 iborFallbackConfig_(iborFallbackConfig), continueOnError_(continueOnError), engineData_(engineData),
59 portfolio_(portfolio), dryRun_(dryRun), useSingleThreadedEngine_(true) {}
62 const Size nThreads,
const Date&
asof,
const QuantLib::ext::shared_ptr<ore::data::Loader>& loader,
63 const QuantLib::ext::shared_ptr<ore::data::Portfolio>& portfolio,
const string& marketConfiguration,
64 const QuantLib::ext::shared_ptr<ore::data::EngineData>& engineData,
65 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters>& simMarketData,
66 const QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData>& sensitivityData,
const bool recalibrateModels,
67 const QuantLib::ext::shared_ptr<ore::data::CurveConfigurations>& curveConfigs,
68 const QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters>& todaysMarketParams,
69 const bool nonShiftedBaseCurrencyConversion,
const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceData,
70 const IborFallbackConfig& iborFallbackConfig,
const bool continueOnError,
bool dryRun,
const std::string& context)
71 : marketConfiguration_(marketConfiguration), asof_(
asof), simMarketData_(simMarketData),
72 sensitivityData_(sensitivityData), recalibrateModels_(recalibrateModels), curveConfigs_(
curveConfigs),
73 todaysMarketParams_(todaysMarketParams), overrideTenors_(false),
74 nonShiftedBaseCurrencyConversion_(nonShiftedBaseCurrencyConversion), referenceData_(referenceData),
75 iborFallbackConfig_(iborFallbackConfig), continueOnError_(continueOnError), engineData_(engineData),
76 portfolio_(portfolio), dryRun_(dryRun), useSingleThreadedEngine_(false), nThreads_(nThreads), loader_(loader),
80std::vector<std::pair<QuantLib::ext::shared_ptr<Portfolio>, QuantLib::ext::shared_ptr<SensitivityScenarioGenerator>>>
81splitPortfolioByScenarioGenerators(
82 const QuantLib::ext::shared_ptr<Portfolio>& portfolio, std::vector<std::string> ids,
83 const std::vector<QuantLib::ext::shared_ptr<SensitivityScenarioGenerator>>& scenarioGenerators) {
84 DLOG(
"Splitting portfolio by scenario generators for sensitivity run(s)");
85 std::vector<std::pair<QuantLib::ext::shared_ptr<Portfolio>, QuantLib::ext::shared_ptr<SensitivityScenarioGenerator>>> result;
86 for (
auto const& gen : scenarioGenerators) {
87 result.push_back(std::make_pair(QuantLib::ext::make_shared<Portfolio>(), gen));
89 for (
auto const& [
id, t] : portfolio->trades()) {
90 if (
auto f = std::find(ids.begin(), ids.end(), t->sensitivityTemplate()); f != ids.end()) {
91 result[std::distance(ids.begin(), f)].first->add(t);
92 TLOG(
"adding trade " << std::setw(35) << t->id() <<
" to sensi run for id " << std::setw(20)
93 << t->sensitivityTemplate() <<
", trade sensi-template: " << std::setw(20)
94 << t->sensitivityTemplate());
96 result.front().first->add(t);
97 TLOG(
"adding trade " << std::setw(35) << t->id() <<
" to sensi run for id " << std::setw(20) <<
"<default>"
98 <<
", trade sensi-template: " << std::setw(20) << t->sensitivityTemplate());
107 LOG(
"Sensitivity analysis started...");
110 "SensitivityAnalysis::generateSensitivities(): multi-threaded engine does not support non-shifted base "
111 "ccy conversion currently. This requires a small code extension. Contact Dev.");
119 std::set<std::string> sensiTemplateIdsFromPortfolio;
120 for (
auto const& [_, t] :
portfolio_->trades())
121 sensiTemplateIdsFromPortfolio.insert(t->sensitivityTemplate());
125 std::vector<std::string> sensiTemplateIds{std::string()};
126 std::set_intersection(sensiTemplateIdsFromSensiConfig.begin(), sensiTemplateIdsFromSensiConfig.end(),
127 sensiTemplateIdsFromPortfolio.begin(), sensiTemplateIdsFromPortfolio.end(),
128 std::back_inserter(sensiTemplateIds));
130 LOG(
"Need to process "
131 << sensiTemplateIds.size() <<
" sensi scenario sets resulting from " << sensiTemplateIdsFromSensiConfig.size()
132 <<
" sensi templates in sensi config (different from default config) and "
133 << sensiTemplateIdsFromPortfolio.size()
134 <<
" sensi templates in portfolio (including default config, if configured in pe config for a trade)");
140 LOG(
"SensitivitiyAnalysis::generateSensitivities(): use single-threaded engine to generate sensi cube. Using "
144 simMarket_ = QuantLib::ext::make_shared<ScenarioSimMarket>(
150 std::vector<QuantLib::ext::shared_ptr<SensitivityScenarioGenerator>> scenarioGenerators(sensiTemplateIds.size());
151 for (Size i = 0; i < sensiTemplateIds.size(); ++i) {
152 scenarioGenerators[i] = QuantLib::ext::make_shared<SensitivityScenarioGenerator>(
159 map<MarketContext, string> configurations;
161 auto ed = QuantLib::ext::make_shared<EngineData>(*
engineData_);
162 ed->globalParameters()[
"RunType"] =
163 std::string(
"Sensitivity") + (
sensitivityData_->computeGamma() ?
"DeltaGamma" :
"Delta");
165 QuantLib::ext::shared_ptr<DateGrid> dg = QuantLib::ext::make_shared<DateGrid>(
"1,0W", NullCalendar());
166 vector<QuantLib::ext::shared_ptr<ValuationCalculator>> calculators;
169 calculators.push_back(QuantLib::ext::make_shared<NPVCalculatorFXT0>(
simMarketData_->baseCcy(),
market_));
172 calculators.push_back(QuantLib::ext::make_shared<NPVCalculator>(
simMarketData_->baseCcy()));
175 for (
auto const& [pf, scenGen] :
176 splitPortfolioByScenarioGenerators(
portfolio_, sensiTemplateIds, scenarioGenerators)) {
177 if (pf->trades().empty())
179 LOG(
"Run Sensitivity Scenarios for " << pf->size() <<
" out of " <<
portfolio_->size() <<
" trades.");
180 QuantLib::ext::shared_ptr<NPVSensiCube> cube =
181 QuantLib::ext::make_shared<DoublePrecisionSensiCube>(pf->ids(),
asof_, scenGen->samples());
186 pf->build(factory,
"sensi analysis");
194 engine.
buildCube(pf, cube, calculators,
true,
nullptr,
nullptr, {},
dryRun_);
196 sensiCubes_.push_back(QuantLib::ext::make_shared<SensitivityCube>(cube, scenGen->scenarioDescriptions(),
198 scenGen->shiftSizes(), scenGen->shiftSchemes()));
204 LOG(
"SensitivitiyAnalysis::generateSensitivities(): use multi-threaded engine to generate sensi cube. Using "
212 simMarket_ = QuantLib::ext::make_shared<ScenarioSimMarket>(
218 std::vector<QuantLib::ext::shared_ptr<SensitivityScenarioGenerator>> scenarioGenerators(sensiTemplateIds.size());
219 for (Size i = 0; i < sensiTemplateIds.size(); ++i) {
220 scenarioGenerators[i] = QuantLib::ext::make_shared<SensitivityScenarioGenerator>(
227 auto ed = QuantLib::ext::make_shared<EngineData>(*
engineData_);
228 ed->globalParameters()[
"RunType"] =
229 std::string(
"Sensitivity") + (
sensitivityData_->computeGamma() ?
"DeltaGamma" :
"Delta");
232 for (
auto const& [pf, scenGen] :
233 splitPortfolioByScenarioGenerators(
portfolio_, sensiTemplateIds, scenarioGenerators)) {
234 if (pf->trades().empty())
238 nThreads_,
asof_, QuantLib::ext::make_shared<ore::analytics::DateGrid>(), scenGen->numScenarios(),
loader_,
243 [](
const QuantLib::Date&
asof,
const std::set<std::string>& ids,
const std::vector<QuantLib::Date>&,
244 const QuantLib::Size samples) {
245 return QuantLib::ext::make_shared<ore::analytics::DoublePrecisionSensiCube>(ids, asof, samples);
254 [&baseCcy]() -> std::vector<QuantLib::ext::shared_ptr<ValuationCalculator>> {
255 return {QuantLib::ext::make_shared<NPVCalculator>(baseCcy)};
258 std::vector<QuantLib::ext::shared_ptr<NPVSensiCube>> miniCubes;
260 miniCubes.push_back(QuantLib::ext::dynamic_pointer_cast<NPVSensiCube>(c));
262 miniCubes.back() !=
nullptr,
263 "SensitivityAnalysis::generateSensitivities(): internal error, could not cast to NPVSensiCube.");
265 auto cube = QuantLib::ext::make_shared<JointNPVSensiCube>(miniCubes, pf->ids());
267 sensiCubes_.push_back(QuantLib::ext::make_shared<SensitivityCube>(cube, scenGen->scenarioDescriptions(),
269 scenGen->shiftSizes(), scenGen->shiftSchemes()));
275 LOG(
"Sensitivity analysis completed");
279 const QuantLib::ext::shared_ptr<ScenarioSimMarket>& simMarket,
const string& marketConfiguration) {
281 Date
asof = simMarket->asofDate();
283 string keylabel = key.
name;
284 Real shiftSize = 0.0;
285 Real shiftMult = 1.0;
288 auto itr = sensiParams.
fxShiftData().find(keylabel);
289 QL_REQUIRE(itr != sensiParams.
fxShiftData().end(),
"shiftData not found for " << keylabel);
290 shiftSize = itr->second.shiftSize;
292 shiftMult = simMarket->fxRate(keylabel, marketConfiguration)->value();
297 QL_REQUIRE(itr != sensiParams.
equityShiftData().end(),
"shiftData not found for " << keylabel);
298 shiftSize = itr->second.shiftSize;
300 shiftMult = simMarket->equitySpot(keylabel, marketConfiguration)->value();
304 string ccy = keylabel;
307 shiftSize = itr->second->shiftSize;
309 Size keyIdx = key.
index;
310 Period p = itr->second->shiftTenors[keyIdx];
311 Handle<YieldTermStructure> yts = simMarket->discountCurve(ccy, marketConfiguration);
312 Time t = yts->dayCounter().yearFraction(
asof,
asof + p);
313 Real zeroRate = yts->zeroRate(t, Continuous);
314 shiftMult = zeroRate;
318 string idx = keylabel;
320 QL_REQUIRE(itr != sensiParams.
indexCurveShiftData().end(),
"shiftData not found for " << idx);
321 shiftSize = itr->second->shiftSize;
323 Size keyIdx = key.
index;
324 Period p = itr->second->shiftTenors[keyIdx];
325 Handle<YieldTermStructure> yts = simMarket->iborIndex(idx, marketConfiguration)->forwardingTermStructure();
326 Time t = yts->dayCounter().yearFraction(
asof,
asof + p);
327 Real zeroRate = yts->zeroRate(t, Continuous);
328 shiftMult = zeroRate;
332 string yc = keylabel;
334 QL_REQUIRE(itr != sensiParams.
yieldCurveShiftData().end(),
"shiftData not found for " << yc);
335 shiftSize = itr->second->shiftSize;
337 Size keyIdx = key.
index;
338 Period p = itr->second->shiftTenors[keyIdx];
339 Handle<YieldTermStructure> yts = simMarket->yieldCurve(yc, marketConfiguration);
340 Time t = yts->dayCounter().yearFraction(
asof,
asof + p);
341 Real zeroRate = yts->zeroRate(t, Continuous);
342 shiftMult = zeroRate;
346 string eq = keylabel;
349 shiftSize = itr->second->shiftSize;
352 Size keyIdx = key.
index;
353 Period p = itr->second->shiftTenors[keyIdx];
354 Handle<YieldTermStructure> ts = simMarket->equityDividendCurve(eq, marketConfiguration);
355 Time t = ts->dayCounter().yearFraction(
asof,
asof + p);
356 Real zeroRate = ts->zeroRate(t, Continuous);
357 shiftMult = zeroRate;
361 string pair = keylabel;
363 QL_REQUIRE(itr != sensiParams.
fxVolShiftData().end(),
"shiftData not found for " << pair);
364 shiftSize = itr->second.shiftSize;
369 Size keyIdx = key.
index;
370 Period p = itr->second.shiftExpiries[keyIdx];
371 Handle<BlackVolTermStructure> vts = simMarket->fxVol(pair, marketConfiguration);
372 Time t = vts->dayCounter().yearFraction(
asof,
asof + p);
373 Real atmVol = vts->blackVol(t, atmFwd);
378 string pair = keylabel;
380 QL_REQUIRE(itr != sensiParams.
equityVolShiftData().end(),
"shiftData not found for " << pair);
381 shiftSize = itr->second.shiftSize;
383 Size keyIdx = key.
index;
384 Period p = itr->second.shiftExpiries[keyIdx];
385 Handle<BlackVolTermStructure> vts = simMarket->equityVol(pair, marketConfiguration);
386 Time t = vts->dayCounter().yearFraction(
asof,
asof + p);
387 Real atmVol = vts->blackVol(t, Null<Real>());
393 QL_REQUIRE(itr != sensiParams.
swaptionVolShiftData().end(),
"shiftData not found for " << keylabel);
394 shiftSize = itr->second.shiftSize;
396 vector<Real>
strikes = itr->second.shiftStrikes;
397 vector<Period> tenors = itr->second.shiftTerms;
398 vector<Period> expiries = itr->second.shiftExpiries;
399 Size keyIdx = key.
index;
400 Size expIdx = keyIdx / (tenors.size() *
strikes.size());
401 Period p_exp = expiries[expIdx];
402 Size tenIdx = keyIdx % tenors.size();
403 Period p_ten = tenors[tenIdx];
404 Real strike = Null<Real>();
405 Handle<SwaptionVolatilityStructure> vts = simMarket->swaptionVol(keylabel, marketConfiguration);
406 Real vol = vts->volatility(p_exp, p_ten, strike);
411 string securityId = keylabel;
413 QL_REQUIRE(itr != sensiParams.
yieldVolShiftData().end(),
"shiftData not found for " << securityId);
414 shiftSize = itr->second.shiftSize;
416 vector<Real>
strikes = itr->second.shiftStrikes;
418 "shift strikes should be {0.0} for yield volatilities");
419 vector<Period> tenors = itr->second.shiftTerms;
420 vector<Period> expiries = itr->second.shiftExpiries;
421 Size keyIdx = key.
index;
422 Size expIdx = keyIdx / (tenors.size() *
strikes.size());
423 Period p_exp = expiries[expIdx];
424 Size tenIdx = keyIdx % tenors.size();
425 Period p_ten = tenors[tenIdx];
426 Real strike = Null<Real>();
427 Handle<SwaptionVolatilityStructure> vts = simMarket->yieldVol(securityId, marketConfiguration);
428 Real vol = vts->volatility(p_exp, p_ten, strike);
433 string ccy = keylabel;
436 shiftSize = itr->second->shiftSize;
438 vector<Real>
strikes = itr->second->shiftStrikes;
439 vector<Period> expiries = itr->second->shiftExpiries;
440 QL_REQUIRE(
strikes.size() > 0,
"Only strike capfloor vols supported");
441 shiftMult = simMarket->baseScenario()->get(
446 string name = keylabel;
448 QL_REQUIRE(itr != sensiParams.
cdsVolShiftData().end(),
"shiftData not found for " <<
name);
449 shiftSize = itr->second.shiftSize;
451 vector<Period> expiries = itr->second.shiftExpiries;
452 Size keyIdx = key.
index;
453 Size expIdx = keyIdx;
454 Period p_exp = expiries[expIdx];
455 Handle<CreditVolCurve> vts = simMarket->cdsVol(
name, marketConfiguration);
457 Real atmVol = vts->volatility(
asof + p_exp, 5.0, Null<Real>(), vts->type());
462 string name = keylabel;
465 shiftSize = itr->second->shiftSize;
467 Size keyIdx = key.
index;
468 Period p = itr->second->shiftTenors[keyIdx];
469 Handle<DefaultProbabilityTermStructure> ts = simMarket->defaultCurve(
name, marketConfiguration)->curve();
470 Time t = ts->dayCounter().yearFraction(
asof,
asof + p);
471 Real prob = ts->survivalProbability(t);
472 shiftMult = -std::log(prob) / t;
476 string name = keylabel;
479 shiftSize = itr->second.shiftSize;
481 vector<Real> lossLevels = itr->second.shiftLossLevels;
482 vector<Period> terms = itr->second.shiftTerms;
483 Size keyIdx = key.
index;
484 Size lossLevelIdx = keyIdx / terms.size();
485 Real lossLevel = lossLevels[lossLevelIdx];
486 Size termIdx = keyIdx % terms.size();
487 Period term = terms[termIdx];
488 Handle<QuantExt::BaseCorrelationTermStructure> ts = simMarket->baseCorrelation(
name, marketConfiguration);
489 Real bc = ts->correlation(
asof + term, lossLevel,
true);
494 string idx = keylabel;
497 shiftSize = itr->second->shiftSize;
499 Size keyIdx = key.
index;
500 Period p = itr->second->shiftTenors[keyIdx];
501 Handle<ZeroInflationTermStructure> yts =
502 simMarket->zeroInflationIndex(idx, marketConfiguration)->zeroInflationTermStructure();
503 Time t = yts->dayCounter().yearFraction(
asof,
asof + p);
504 Real zeroRate = yts->zeroRate(t);
505 shiftMult = zeroRate;
509 string idx = keylabel;
512 shiftSize = itr->second->shiftSize;
514 Size keyIdx = key.
index;
516 Handle<YoYInflationTermStructure> yts =
517 simMarket->yoyInflationIndex(idx, marketConfiguration)->yoyInflationTermStructure();
518 Time t = yts->dayCounter().yearFraction(
asof,
asof + p);
519 Real yoyRate = yts->yoyRate(t);
524 string name = keylabel;
527 shiftSize = itr->second->shiftSize;
529 vector<Real>
strikes = itr->second->shiftStrikes;
530 vector<Period> expiries = itr->second->shiftExpiries;
531 QL_REQUIRE(
strikes.size() > 0,
"Only strike yoy inflation capfloor vols supported");
532 Size keyIdx = key.
index;
533 Size expIdx = keyIdx /
strikes.size();
534 Period p_exp = expiries[expIdx];
535 Size strIdx = keyIdx %
strikes.size();
537 Handle<QuantExt::YoYOptionletVolatilitySurface> vts = simMarket->yoyCapFloorVol(
name, marketConfiguration);
538 Real vol = vts->volatility(p_exp, strike, vts->observationLag());
543 string name = keylabel;
546 shiftSize = itr->second->shiftSize;
548 vector<Real>
strikes = itr->second->shiftStrikes;
549 vector<Period> expiries = itr->second->shiftExpiries;
550 QL_REQUIRE(
strikes.size() > 0,
"Only strike zc inflation capfloor vols supported");
551 Size keyIdx = key.
index;
552 Size expIdx = keyIdx /
strikes.size();
553 Period p_exp = expiries[expIdx];
554 Size strIdx = keyIdx %
strikes.size();
556 Handle<CPIVolatilitySurface> vts =
557 simMarket->cpiInflationCapFloorVolatilitySurface(
name, marketConfiguration);
558 Real vol = vts->volatility(p_exp, strike, vts->observationLag());
565 shiftSize = it->second->shiftSize;
567 Period p = it->second->shiftTenors[key.
index];
568 Handle<PriceTermStructure> priceCurve = simMarket->commodityPriceCurve(keylabel, marketConfiguration);
569 Time t = priceCurve->dayCounter().yearFraction(
asof,
asof + p);
570 shiftMult = priceCurve->price(t);
577 shiftSize = it->second.shiftSize;
579 Size moneynessIndex = key.
index / it->second.shiftExpiries.size();
580 Size expiryIndex = key.
index % it->second.shiftExpiries.size();
581 Real moneyness = it->second.shiftStrikes[moneynessIndex];
582 Period expiry = it->second.shiftExpiries[expiryIndex];
583 Real spotValue = simMarket->commodityPriceCurve(keylabel, marketConfiguration)->price(0);
584 Handle<BlackVolTermStructure> vts = simMarket->commodityVolatility(keylabel, marketConfiguration);
585 Time t = vts->dayCounter().yearFraction(
asof,
asof + expiry);
586 Real vol = vts->blackVol(t, moneyness * spotValue);
592 QL_REQUIRE(itr != sensiParams.
securityShiftData().end(),
"shiftData not found for " << keylabel);
593 shiftSize = itr->second.shiftSize;
597 shiftMult = simMarket->securitySpread(keylabel, marketConfiguration)->value();
606 QL_FAIL(
"KeyType not supported yet - " << keytype);
608 Real realShift = shiftSize * shiftMult;
std::vector< QuantLib::ext::shared_ptr< ore::analytics::NPVCube > > outputCubes() const
void buildCube(const QuantLib::ext::shared_ptr< ore::data::Portfolio > &portfolio, const std::function< std::vector< QuantLib::ext::shared_ptr< ore::analytics::ValuationCalculator > >()> &calculators, const std::function< std::vector< QuantLib::ext::shared_ptr< ore::analytics::CounterpartyCalculator > >()> &cptyCalculators={}, bool mporStickyDate=true, bool dryRun=false)
Data types stored in the scenario class.
std::string name
Key name.
KeyType
Risk Factor types.
@ YoYInflationCapFloorVolatility
@ ZeroInflationCapFloorVolatility
QuantLib::ext::shared_ptr< ore::data::CurveConfigurations > curveConfigs_
Optional curve configurations. Used in building the scenario sim market.
QuantLib::ext::shared_ptr< SensitivityScenarioData > sensitivityData_
QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > todaysMarketParams_
Optional todays market parameters. Used in building the scenario sim market.
std::string marketConfiguration_
const QuantLib::Date asof() const
The ASOF date for the sensitivity analysis.
void generateSensitivities()
Generate the Sensitivities.
QuantLib::ext::shared_ptr< EngineData > engineData_
the engine data (provided as input, needed to construct the engine factory)
QuantLib::ext::shared_ptr< ScenarioSimMarket > simMarket_
std::vector< QuantLib::ext::shared_ptr< SensitivityCube > > sensiCubes_
sensitivityCube
QuantLib::ext::shared_ptr< Portfolio > portfolio_
the portfolio (provided as input)
SensitivityAnalysis(const QuantLib::ext::shared_ptr< ore::data::Portfolio > &portfolio, const QuantLib::ext::shared_ptr< ore::data::Market > &market, const string &marketConfiguration, const QuantLib::ext::shared_ptr< ore::data::EngineData > &engineData, const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &simMarketData, const QuantLib::ext::shared_ptr< SensitivityScenarioData > &sensitivityData, const bool recalibrateModels, const QuantLib::ext::shared_ptr< ore::data::CurveConfigurations > &curveConfigs=nullptr, const QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > &todaysMarketParams=nullptr, const bool nonShiftedBaseCurrencyConversion=false, const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceData=nullptr, const IborFallbackConfig &iborFallbackConfig=IborFallbackConfig::defaultConfig(), const bool continueOnError=false, bool dryRun=false)
Constructor using single-threaded engine.
std::set< std::pair< string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > modelBuilders_
model builders
QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > referenceData_
QuantLib::ext::shared_ptr< ore::data::Market > market_
QuantLib::ext::shared_ptr< SensitivityScenarioGenerator > scenarioGenerator_
QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > simMarketData_
IborFallbackConfig iborFallbackConfig_
bool useSingleThreadedEngine_
QuantLib::ext::shared_ptr< ore::data::Loader > loader_
bool nonShiftedBaseCurrencyConversion_
Description of sensitivity shift scenarios.
const map< string, QuantLib::ext::shared_ptr< CapFloorVolShiftData > > & yoyInflationCapFloorVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & indexCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CapFloorVolShiftData > > & capFloorVolShiftData() const
const map< string, SpotShiftData > & securityShiftData() const
const map< string, VolShiftData > & equityVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & discountCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & dividendYieldShiftData() const
const map< string, VolShiftData > & fxVolShiftData() const
const map< string, GenericYieldVolShiftData > & yieldVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & zeroInflationCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & creditCurveShiftData() const
const map< string, SpotShiftData > & fxShiftData() const
const map< string, GenericYieldVolShiftData > & swaptionVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & yoyInflationCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CapFloorVolShiftData > > & zeroInflationCapFloorVolShiftData() const
const map< string, BaseCorrelationShiftData > & baseCorrelationShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & yieldCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & commodityCurveShiftData() const
const map< string, VolShiftData > & commodityVolShiftData() const
const map< string, CdsVolShiftData > & cdsVolShiftData() const
const map< string, SpotShiftData > & equityShiftData() const
void buildCube(const QuantLib::ext::shared_ptr< data::Portfolio > &portfolio, QuantLib::ext::shared_ptr< analytics::NPVCube > outputCube, std::vector< QuantLib::ext::shared_ptr< ValuationCalculator > > calculators, bool mporStickyDate=true, QuantLib::ext::shared_ptr< analytics::NPVCube > outputCubeNettingSet=nullptr, QuantLib::ext::shared_ptr< analytics::NPVCube > outputCptyCube=nullptr, std::vector< QuantLib::ext::shared_ptr< CounterpartyCalculator > > cptyCalculators={}, bool dryRun=false)
Build NPV cube.
const std::set< QuantLib::ext::shared_ptr< ProgressIndicator > > & progressIndicators() const
void registerProgressIndicator(const QuantLib::ext::shared_ptr< ProgressIndicator > &indicator)
factory class for cloning a cached scenario
factory class for cloning a cached scenario
join n sensi cubes in terms of stored ids
multi-threaded valuation engine
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
Real getShiftSize(const RiskFactorKey &key, const SensitivityScenarioData &sensiParams, const QuantLib::ext::shared_ptr< ScenarioSimMarket > &simMarket, const string &marketConfiguration)
std::set< std::string > getShiftSpecKeys(const SensitivityScenarioData &d)
A cube implementation that stores the cube in memory.
Perform sensitivity analysis for a given portfolio.
vector< string > curveConfigs
The counterparty cube calculator interface.