Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
sensitivityrecord.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/sensitivityrecord.hpp
20 \brief Struct for holding a sensitivity record
21*/
22
23#pragma once
24
26
27#include <string>
28
29namespace ore {
30namespace analytics {
31
32/*! A container for holding sensitivity records.
33 -# isPar is <code>true</code> for a par sensitivity, <code>false</code> for a zero sensitivity
34 -# the currency member is the currency of the baseNpv, delta and gamma
35 -# key_2 and desc_2 are empty except for cross gamma sensitivities
36 -# for cross gamma, the sensitivity is in the gamma member
37*/
39 // Public members
40 std::string tradeId;
41 bool isPar;
43 std::string desc_1;
44 QuantLib::Real shift_1;
46 std::string desc_2;
47 QuantLib::Real shift_2;
48 std::string currency;
49 mutable QuantLib::Real baseNpv;
50 mutable QuantLib::Real delta;
51 mutable QuantLib::Real gamma;
52
53 /*! Default ctor to prevent uninitialised variables
54 Could use in class initialisation and avoid ctor but may be confusing
55 */
56 SensitivityRecord() : isPar(false), shift_1(0.0), shift_2(0.0), baseNpv(0.0), delta(0.0), gamma(0.0) {}
57
58 //! Full ctor to allow braced initialisation
59 SensitivityRecord(const std::string& tradeId, bool isPar, const RiskFactorKey& key_1, const std::string& desc_1,
60 QuantLib::Real shift_1, const RiskFactorKey& key_2, const std::string& desc_2,
61 QuantLib::Real shift_2, const std::string& currency, QuantLib::Real baseNpv, QuantLib::Real delta,
62 QuantLib::Real gamma)
65
66 /*! Comparison operators for SensitivityRecord
67 */
68 bool operator==(const SensitivityRecord& sr) const;
69 bool operator!=(const SensitivityRecord& sr) const;
70 bool operator<(const SensitivityRecord& sr) const;
71
72 /*! This method will be used to denote the end of a stream of SensitivityRecord objects.
73 */
74 explicit operator bool() const;
75
76 //! True if a SensitivityRecord is a cross gamma, otherwise false
77 bool isCrossGamma() const;
78};
79
80//! Enable writing of a SensitivityRecord
81std::ostream& operator<<(std::ostream& out, const SensitivityRecord& sr);
82
83} // namespace analytics
84} // namespace ore
Data types stored in the scenario class.
Definition: scenario.hpp:48
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
Scenario class.
bool operator==(const SensitivityRecord &sr) const
SensitivityRecord(const std::string &tradeId, bool isPar, const RiskFactorKey &key_1, const std::string &desc_1, QuantLib::Real shift_1, const RiskFactorKey &key_2, const std::string &desc_2, QuantLib::Real shift_2, const std::string &currency, QuantLib::Real baseNpv, QuantLib::Real delta, QuantLib::Real gamma)
Full ctor to allow braced initialisation.
bool operator!=(const SensitivityRecord &sr) const
bool operator<(const SensitivityRecord &sr) const
bool isCrossGamma() const
True if a SensitivityRecord is a cross gamma, otherwise false.