Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
scenarioshiftcalculator.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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/scenario/scenarioshiftcalculator.hpp
20 \brief Class for calculating the shift multiple between two scenarios for a given key
21*/
22
23#pragma once
24
29
30namespace ore {
31namespace analytics {
32
33/*! Class for calculating the shift multiple between two scenarios for a given risk factor key.
34
35 The shift value returned is a value that is consistent with the SensitivityScenarioData
36 and ScenarioSimMarketParameters passed in during construction. In other words, multiplying
37 the result of the shift method with sensitivities generated using the SensitivityScenarioData
38 configuration will give a valid estimate of the P&L move associated with moving from one
39 scenario to another.
40*/
42public:
43 /*! Constructor
44 \param sensitivityConfig sensitivity configuration that will determine the result
45 returned by the shift method
46 \param simMarketConfig simulation market configuration for the scenarios that will
47 be fed to the shift method
48 \param simMarket simulation market that will be used if provided
49 */
50 ScenarioShiftCalculator(const QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData>& sensitivityConfig,
51 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters>& simMarketConfig,
52 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarket>& simMarket =
53 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarket>());
54 /*! Calculate the shift in the risk factor \p key implied by going from scenario \p s_1 to
55 scenario \p s_2.
56 */
57 QuantLib::Real shift(const ore::analytics::RiskFactorKey& key, const ore::analytics::Scenario& s_1,
58 const ore::analytics::Scenario& s_2) const;
59
60private:
61 QuantLib::ext::shared_ptr<ore::analytics::SensitivityScenarioData> sensitivityConfig_;
62 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters> simMarketConfig_;
63 QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarket> simMarket_;
64
65 /*! For some risk factors, the sensitivty is understood to be to a transform
66 of the quantity that appears in the scenario and this transform can generally
67 require the time to expiry of the factor.
68
69 For example, the SensitivityScenarioData expresses shifts for IR in terms of
70 zero rates and the scenarios hold discount factors so to convert the scenario
71 value from \f$df_t\f$ to \f$z_t\f$, you need to know the year fraction until
72 maturity i.e. \f$\tau(0, t)\f$ and then the transformed value is:
73 \f[
74 z_t = - \frac{\ln(df_t)}{\tau(0, t)}
75 \f]
76 */
77 QuantLib::Real transform(const ore::analytics::RiskFactorKey& key, QuantLib::Real value,
78 const QuantLib::Date& asof) const;
79};
80
81} // namespace analytics
82} // namespace ore
Data types stored in the scenario class.
Definition: scenario.hpp:48
Scenario Base Class.
Definition: scenario.hpp:138
QuantLib::Real shift(const ore::analytics::RiskFactorKey &key, const ore::analytics::Scenario &s_1, const ore::analytics::Scenario &s_2) const
QuantLib::Real transform(const ore::analytics::RiskFactorKey &key, QuantLib::Real value, const QuantLib::Date &asof) const
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > simMarketConfig_
QuantLib::ext::shared_ptr< ore::analytics::SensitivityScenarioData > sensitivityConfig_
QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarket > simMarket_
Scenario class.
A Market class that can be updated by Scenarios.
A class to hold Scenario parameters for scenarioSimMarket.
A class to hold the parametrisation for building sensitivity scenarios.
Date asof(14, Jun, 2018)