Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossassetmodelscenariogenerator.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 scenario/crossassetmodelscenariogenerator.hpp
20 \brief Scenario generation using cross asset model paths
21 \ingroup scenario
22*/
23
24#pragma once
25
32
45
46namespace ore {
47namespace analytics {
48using namespace data;
49using namespace QuantLib;
50using namespace QuantExt;
51
52//! Scenario Generator using cross asset model paths
53/*!
54 The generator expects
55 - a calibrated model,
56 - an associated multi path generator (i.e. providing paths for all factors
57 of the model ordered as described in the model),
58 - a scenario factory that provides building scenario class instances,
59 - the configuration of market curves to be simulated
60 - a simulation date grid that starts in the future, i.e. does not include today's date
61 - the associated time grid including t=0
62
63 \ingroup scenario
64 */
66public:
67 //! Constructor
68 CrossAssetModelScenarioGenerator(QuantLib::ext::shared_ptr<QuantExt::CrossAssetModel> model,
69 QuantLib::ext::shared_ptr<QuantExt::MultiPathGeneratorBase> multiPathGenerator,
70 QuantLib::ext::shared_ptr<ScenarioFactory> scenarioFactory,
71 QuantLib::ext::shared_ptr<ScenarioSimMarketParameters> simMarketConfig,
72 QuantLib::Date today, QuantLib::ext::shared_ptr<DateGrid> grid,
73 QuantLib::ext::shared_ptr<ore::data::Market> initMarket,
74 const std::string& configuration = Market::defaultConfiguration);
75 //! Default destructor
77 std::vector<QuantLib::ext::shared_ptr<Scenario>> nextPath() override;
78 void reset() override { pathGenerator_->reset(); }
79
80private:
81 QuantLib::ext::shared_ptr<QuantExt::CrossAssetModel> model_;
82 QuantLib::ext::shared_ptr<QuantExt::MultiPathGeneratorBase> pathGenerator_;
83 QuantLib::ext::shared_ptr<ScenarioFactory> scenarioFactory_;
84 QuantLib::ext::shared_ptr<ScenarioSimMarketParameters> simMarketConfig_;
85 QuantLib::ext::shared_ptr<ore::data::Market> initMarket_;
86 const std::string configuration_;
87 // generated data
90 std::vector<RiskFactorKey> fxKeys_, eqKeys_, cpiKeys_;
92 std::vector<QuantLib::ext::shared_ptr<QuantExt::CrossAssetModelImpliedFxVolTermStructure>> fxVols_;
93 std::vector<QuantLib::ext::shared_ptr<QuantExt::CrossAssetModelImpliedEqVolTermStructure>> eqVols_;
94 std::vector<std::vector<Period>> ten_dsc_, ten_idx_, ten_yc_, ten_efc_, ten_zinf_, ten_yinf_, ten_dfc_, ten_com_;
95 std::vector<bool> modelCcyRelevant_;
97
98 vector<QuantLib::ext::shared_ptr<QuantExt::ModelImpliedYieldTermStructure>> curves_, fwdCurves_, yieldCurves_;
99 vector<QuantLib::ext::shared_ptr<QuantExt::ModelImpliedPriceTermStructure>> comCurves_;
100 vector<QuantLib::ext::shared_ptr<IborIndex>> indices_;
101 vector<Currency> yieldCurveCurrency_;
103 vector<tuple<Size, Size, CrossAssetModel::ModelType, QuantLib::ext::shared_ptr<ZeroInflationModelTermStructure>>>
105 vector<tuple<Size, Size, CrossAssetModel::ModelType, QuantLib::ext::shared_ptr<YoYInflationModelTermStructure>>>
107 vector<QuantLib::ext::shared_ptr<QuantExt::LgmImpliedDefaultTermStructure>> lgmDefaultCurves_;
108 vector<QuantLib::ext::shared_ptr<QuantExt::CirppImpliedDefaultTermStructure>> cirppDefaultCurves_;
109 vector<QuantLib::ext::shared_ptr<QuantExt::CreditCurve>> survivalWeightsDefaultCurves_;
110};
111
112} // namespace analytics
113} // namespace ore
Scenario Generator using cross asset model paths.
QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > model_
std::vector< QuantLib::ext::shared_ptr< Scenario > > nextPath() override
QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > simMarketConfig_
vector< QuantLib::ext::shared_ptr< QuantExt::ModelImpliedYieldTermStructure > > yieldCurves_
vector< QuantLib::ext::shared_ptr< QuantExt::ModelImpliedYieldTermStructure > > fwdCurves_
vector< tuple< Size, Size, CrossAssetModel::ModelType, QuantLib::ext::shared_ptr< ZeroInflationModelTermStructure > > > zeroInfCurves_
vector< QuantLib::ext::shared_ptr< QuantExt::ModelImpliedPriceTermStructure > > comCurves_
vector< QuantLib::ext::shared_ptr< QuantExt::LgmImpliedDefaultTermStructure > > lgmDefaultCurves_
std::vector< QuantLib::ext::shared_ptr< QuantExt::CrossAssetModelImpliedEqVolTermStructure > > eqVols_
vector< tuple< Size, Size, CrossAssetModel::ModelType, QuantLib::ext::shared_ptr< YoYInflationModelTermStructure > > > yoyInfCurves_
QuantLib::ext::shared_ptr< QuantExt::MultiPathGeneratorBase > pathGenerator_
vector< QuantLib::ext::shared_ptr< QuantExt::ModelImpliedYieldTermStructure > > curves_
vector< QuantLib::ext::shared_ptr< QuantExt::CirppImpliedDefaultTermStructure > > cirppDefaultCurves_
vector< QuantLib::ext::shared_ptr< QuantExt::CreditCurve > > survivalWeightsDefaultCurves_
std::vector< QuantLib::ext::shared_ptr< QuantExt::CrossAssetModelImpliedFxVolTermStructure > > fxVols_
QuantLib::ext::shared_ptr< ore::data::Market > initMarket_
QuantLib::ext::shared_ptr< ScenarioFactory > scenarioFactory_
vector< QuantLib::ext::shared_ptr< IborIndex > > indices_
void reset() override
Reset the generator so calls to next() return the first scenario.
Scenario generator that generates an entire path.
static const string defaultConfiguration
data
factory classes for scenarios
Scenario generator base classes.
A Market class that can be updated by Scenarios.
A class to hold Scenario parameters for scenarioSimMarket.