Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
zerotoparcube.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/engine/zerotoparcube.hpp
20 \brief Class for converting zero sensitivities to par sensitivities
21*/
22
23#pragma once
24
25#include <map>
26#include <string>
27
30
31namespace ore {
32namespace analytics {
33
34//! ZeroToParCube class
35/*! Takes a cube of zero sensitivities, a par sensitivity converter and can return the
36 par deltas for a given trade ID from the cube.
37 */
39public:
40 //! Constructor
41 ZeroToParCube(const QuantLib::ext::shared_ptr<ore::analytics::SensitivityCube>& zeroCube,
42 const QuantLib::ext::shared_ptr<ParSensitivityConverter>& parConverter,
43 const std::set<ore::analytics::RiskFactorKey::KeyType>& typesDisabled = {},
44 const bool continueOnError = false);
45 //! Another Constructor!
46 ZeroToParCube(const std::vector<QuantLib::ext::shared_ptr<ore::analytics::SensitivityCube>>& zeroCubes,
47 const QuantLib::ext::shared_ptr<ParSensitivityConverter>& parConverter,
48 const std::set<ore::analytics::RiskFactorKey::KeyType>& typesDisabled = {},
49 const bool continueOnError = false);
50
51 //! Inspectors
52 //@{
53 //! Underlying zero sensitivity cubes
54 const std::vector<QuantLib::ext::shared_ptr<ore::analytics::SensitivityCube>>& zeroCubes() const { return zeroCubes_; }
55 //! Par converter object
56 const QuantLib::ext::shared_ptr<ParSensitivityConverter>& parConverter() const { return parConverter_; }
57 //! The par risk factor types that are disabled for this instance of ZeroToParCube.
58 const std::set<ore::analytics::RiskFactorKey::KeyType>& typesDisabled() const { return typesDisabled_; }
59 //@}
60
61 //! Return the non-zero par deltas for the given \p tradeId
62 std::map<ore::analytics::RiskFactorKey, QuantLib::Real> parDeltas(const std::string& tradeId) const;
63
64 //! Return the non-zero par deltas for the given cube and trade index
65 std::map<ore::analytics::RiskFactorKey, QuantLib::Real> parDeltas(QuantLib::Size cubeIdx,
66 QuantLib::Size tradeIdx) const;
67
68private:
69 std::vector<QuantLib::ext::shared_ptr<ore::analytics::SensitivityCube>> zeroCubes_;
70 QuantLib::ext::shared_ptr<ParSensitivityConverter> parConverter_;
71 std::map<ore::analytics::RiskFactorKey, Size> factorToIndex_;
72
73 //! Set of risk factor types available for par conversion but that are disabled for this instance of ZeroToParCube.
74 std::set<ore::analytics::RiskFactorKey::KeyType> typesDisabled_;
75 const bool continueOnError_;
76};
77
78} // namespace analytics
79} // namespace ore
const std::vector< QuantLib::ext::shared_ptr< ore::analytics::SensitivityCube > > & zeroCubes() const
Inspectors.
ZeroToParCube(const std::vector< QuantLib::ext::shared_ptr< ore::analytics::SensitivityCube > > &zeroCubes, const QuantLib::ext::shared_ptr< ParSensitivityConverter > &parConverter, const std::set< ore::analytics::RiskFactorKey::KeyType > &typesDisabled={}, const bool continueOnError=false)
Another Constructor!
std::map< ore::analytics::RiskFactorKey, Size > factorToIndex_
std::set< ore::analytics::RiskFactorKey::KeyType > typesDisabled_
Set of risk factor types available for par conversion but that are disabled for this instance of Zero...
ZeroToParCube(const QuantLib::ext::shared_ptr< ore::analytics::SensitivityCube > &zeroCube, const QuantLib::ext::shared_ptr< ParSensitivityConverter > &parConverter, const std::set< ore::analytics::RiskFactorKey::KeyType > &typesDisabled={}, const bool continueOnError=false)
Constructor.
std::map< ore::analytics::RiskFactorKey, QuantLib::Real > parDeltas(const std::string &tradeId) const
Return the non-zero par deltas for the given tradeId.
std::vector< QuantLib::ext::shared_ptr< ore::analytics::SensitivityCube > > zeroCubes_
const QuantLib::ext::shared_ptr< ParSensitivityConverter > & parConverter() const
Par converter object.
QuantLib::ext::shared_ptr< ParSensitivityConverter > parConverter_
const std::set< ore::analytics::RiskFactorKey::KeyType > & typesDisabled() const
The par risk factor types that are disabled for this instance of ZeroToParCube.
Perfrom sensitivity analysis for a given portfolio.
holds a grid of NPVs for a list of trades under various scenarios