Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
xvaenginecg.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file orea/engine/xvaenginecg.hpp
20 \brief xva engine using cg infrastructure
21 \ingroup engine
22*/
23
24#pragma once
25
30
37
39
40#include <ql/types.hpp>
41
42namespace ore {
43namespace analytics {
44
45using namespace QuantLib;
46using namespace ore::data;
47
49public:
50 XvaEngineCG(const Size nThreads, const Date& asof, const QuantLib::ext::shared_ptr<ore::data::Loader>& loader,
51 const QuantLib::ext::shared_ptr<ore::data::CurveConfigurations>& curveConfigs,
52 const QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters>& todaysMarketParams,
53 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters>& simMarketData,
54 const QuantLib::ext::shared_ptr<ore::data::EngineData>& engineData,
55 const QuantLib::ext::shared_ptr<ore::analytics::CrossAssetModelData>& crossAssetModelData,
56 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioGeneratorData>& scenarioGeneratorData,
57 const QuantLib::ext::shared_ptr<ore::data::Portfolio>& portfolio,
58 const string& marketConfiguration = Market::defaultConfiguration,
59 const string& marketConfigurationInCcy = Market::inCcyConfiguration,
60 const QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData>& sensitivityData = nullptr,
61 const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceData = nullptr,
62 const IborFallbackConfig& iborFallbackConfig = IborFallbackConfig::defaultConfig(),
63 const bool bumpCvaSensis = false,
64 const bool continueOnCalibrationError = true, const bool continueOnError = true,
65 const std::string& context = "xva engine cg");
66
67 QuantLib::ext::shared_ptr<InMemoryReport> exposureReport() { return epeReport_; }
68 QuantLib::ext::shared_ptr<InMemoryReport> sensiReport() { return sensiReport_; }
69
70private:
71 void populateRandomVariates(std::vector<RandomVariable>& values) const;
72 void populateConstants(std::vector<RandomVariable>& values) const;
73 void populateModelParameters(std::vector<RandomVariable>& values,
74 const std::vector<std::pair<std::size_t, double>>& modelParameters) const;
75
76 // input parameters
77 Date asof_;
78 QuantLib::ext::shared_ptr<ore::data::Loader> loader_;
79 QuantLib::ext::shared_ptr<ore::data::CurveConfigurations> curveConfigs_;
80 QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters> todaysMarketParams_;
81 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters> simMarketData_;
82 QuantLib::ext::shared_ptr<ore::data::EngineData> engineData_;
83 QuantLib::ext::shared_ptr<ore::analytics::CrossAssetModelData> crossAssetModelData_;
84 QuantLib::ext::shared_ptr<ore::analytics::ScenarioGeneratorData> scenarioGeneratorData_;
85 QuantLib::ext::shared_ptr<ore::data::Portfolio> portfolio_;
88 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData> sensitivityData_;
89 QuantLib::ext::shared_ptr<ReferenceDataManager> referenceData_;
94 std::string context_;
95
96 std::vector<bool> nodesA_;
97 std::vector<bool> nodesB_;
98 std::vector<bool> nodesC_;
99 std::vector<bool> nodesD_;
100
101 // artefacts produced during run
102 QuantLib::ext::shared_ptr<ore::data::Market> initMarket_;
103 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarket> simMarket_;
104 QuantLib::ext::shared_ptr<SensitivityScenarioGenerator> sensiScenarioGenerator_;
105 QuantLib::ext::shared_ptr<CrossAssetModelBuilder> camBuilder_;
106 QuantLib::ext::shared_ptr<GaussianCamCG> model_;
107 std::vector<std::pair<std::size_t, double>> baseModelParams_;
108 std::vector<RandomVariableOpNodeRequirements> opNodeRequirements_;
109 std::vector<RandomVariableOp> ops_;
110 std::vector<RandomVariableGrad> grads_;
111
112 QuantLib::ext::shared_ptr<InMemoryReport> epeReport_, sensiReport_;
113};
114
115} // namespace analytics
116} // namespace ore
QuantLib::ext::shared_ptr< ore::data::CurveConfigurations > curveConfigs_
Definition: xvaenginecg.hpp:79
std::vector< bool > nodesD_
Definition: xvaenginecg.hpp:99
std::vector< bool > nodesB_
Definition: xvaenginecg.hpp:97
QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > todaysMarketParams_
Definition: xvaenginecg.hpp:80
std::vector< bool > nodesA_
Definition: xvaenginecg.hpp:96
void populateModelParameters(std::vector< RandomVariable > &values, const std::vector< std::pair< std::size_t, double > > &modelParameters) const
QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > sensitivityData_
Definition: xvaenginecg.hpp:88
QuantLib::ext::shared_ptr< SensitivityScenarioGenerator > sensiScenarioGenerator_
QuantLib::ext::shared_ptr< InMemoryReport > sensiReport_
QuantLib::ext::shared_ptr< ore::analytics::CrossAssetModelData > crossAssetModelData_
Definition: xvaenginecg.hpp:83
QuantLib::ext::shared_ptr< InMemoryReport > sensiReport()
Definition: xvaenginecg.hpp:68
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > simMarketData_
Definition: xvaenginecg.hpp:81
std::vector< std::pair< std::size_t, double > > baseModelParams_
std::vector< RandomVariableOpNodeRequirements > opNodeRequirements_
QuantLib::ext::shared_ptr< CrossAssetModelBuilder > camBuilder_
std::vector< RandomVariableOp > ops_
QuantLib::ext::shared_ptr< ore::data::Portfolio > portfolio_
Definition: xvaenginecg.hpp:85
QuantLib::ext::shared_ptr< InMemoryReport > exposureReport()
Definition: xvaenginecg.hpp:67
QuantLib::ext::shared_ptr< InMemoryReport > epeReport_
std::vector< bool > nodesC_
Definition: xvaenginecg.hpp:98
void populateConstants(std::vector< RandomVariable > &values) const
std::string marketConfigurationInCcy_
Definition: xvaenginecg.hpp:87
IborFallbackConfig iborFallbackConfig_
Definition: xvaenginecg.hpp:90
std::vector< RandomVariableGrad > grads_
QuantLib::ext::shared_ptr< ore::analytics::ScenarioGeneratorData > scenarioGeneratorData_
Definition: xvaenginecg.hpp:84
QuantLib::ext::shared_ptr< ore::data::Market > initMarket_
QuantLib::ext::shared_ptr< ReferenceDataManager > referenceData_
Definition: xvaenginecg.hpp:89
QuantLib::ext::shared_ptr< GaussianCamCG > model_
QuantLib::ext::shared_ptr< ore::data::Loader > loader_
Definition: xvaenginecg.hpp:78
void populateRandomVariates(std::vector< RandomVariable > &values) const
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > simMarket_
QuantLib::ext::shared_ptr< ore::data::EngineData > engineData_
Definition: xvaenginecg.hpp:82
static IborFallbackConfig defaultConfig()
static const string inCcyConfiguration
static const string defaultConfiguration
Scenario generator configuration.
A class to hold Scenario parameters for scenarioSimMarket.
A class to hold the parametrisation for building sensitivity scenarios.
Sensitivity scenario generation.
vector< string > curveConfigs
Date asof(14, Jun, 2018)