Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
SensitivityRecord Struct Reference

#include <orea/engine/sensitivityrecord.hpp>

+ Collaboration diagram for SensitivityRecord:

Public Member Functions

 SensitivityRecord ()
 
 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. More...
 
bool operator== (const SensitivityRecord &sr) const
 
bool operator!= (const SensitivityRecord &sr) const
 
bool operator< (const SensitivityRecord &sr) const
 
 operator bool () const
 
bool isCrossGamma () const
 True if a SensitivityRecord is a cross gamma, otherwise false. More...
 

Public Attributes

std::string tradeId
 
bool isPar
 
RiskFactorKey key_1
 
std::string desc_1
 
QuantLib::Real shift_1
 
RiskFactorKey key_2
 
std::string desc_2
 
QuantLib::Real shift_2
 
std::string currency
 
QuantLib::Real baseNpv
 
QuantLib::Real delta
 
QuantLib::Real gamma
 

Detailed Description

A container for holding sensitivity records.

  1. isPar is true for a par sensitivity, false for a zero sensitivity
  2. the currency member is the currency of the baseNpv, delta and gamma
  3. key_2 and desc_2 are empty except for cross gamma sensitivities
  4. for cross gamma, the sensitivity is in the gamma member

Definition at line 38 of file sensitivityrecord.hpp.

Constructor & Destructor Documentation

◆ SensitivityRecord() [1/2]

Default ctor to prevent uninitialised variables Could use in class initialisation and avoid ctor but may be confusing

Definition at line 56 of file sensitivityrecord.hpp.

◆ SensitivityRecord() [2/2]

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 
)

Member Function Documentation

◆ operator==()

bool operator== ( const SensitivityRecord sr) const

Comparison operators for SensitivityRecord

Definition at line 33 of file sensitivityrecord.cpp.

33 {
34 // Define in terms of operator<
35 return !(*this < sr) && !(sr < *this);
36}

◆ operator!=()

bool operator!= ( const SensitivityRecord sr) const

Definition at line 53 of file sensitivityrecord.cpp.

53 {
54 // Define in terms of operator==
55 return !(*this == sr);
56}

◆ operator<()

bool operator< ( const SensitivityRecord sr) const

Definition at line 38 of file sensitivityrecord.cpp.

38 {
39 // Verbose, would be nice to use std::tie but want to use close on the shifts
40
41 if (key_1 != sr.key_1)
42 return key_1 < sr.key_1;
43
44 if (key_2 != sr.key_2)
45 return key_2 < sr.key_2;
46
47 if (tradeId != sr.tradeId)
48 return tradeId < sr.tradeId;
49
50 return false;
51}

◆ operator bool()

operator bool ( ) const
explicit

This method will be used to denote the end of a stream of SensitivityRecord objects.

Definition at line 58 of file sensitivityrecord.cpp.

58 {
59 // A SensitivityRecord is false if it is default initialised
60 return *this != SensitivityRecord();
61}

◆ isCrossGamma()

bool isCrossGamma ( ) const

True if a SensitivityRecord is a cross gamma, otherwise false.

Definition at line 63 of file sensitivityrecord.cpp.

63{ return key_2 != RiskFactorKey(); }
+ Here is the caller graph for this function:

Member Data Documentation

◆ tradeId

std::string tradeId

Definition at line 40 of file sensitivityrecord.hpp.

◆ isPar

bool isPar

Definition at line 41 of file sensitivityrecord.hpp.

◆ key_1

Definition at line 42 of file sensitivityrecord.hpp.

◆ desc_1

std::string desc_1

Definition at line 43 of file sensitivityrecord.hpp.

◆ shift_1

QuantLib::Real shift_1

Definition at line 44 of file sensitivityrecord.hpp.

◆ key_2

Definition at line 45 of file sensitivityrecord.hpp.

◆ desc_2

std::string desc_2

Definition at line 46 of file sensitivityrecord.hpp.

◆ shift_2

QuantLib::Real shift_2

Definition at line 47 of file sensitivityrecord.hpp.

◆ currency

std::string currency

Definition at line 48 of file sensitivityrecord.hpp.

◆ baseNpv

QuantLib::Real baseNpv
mutable

Definition at line 49 of file sensitivityrecord.hpp.

◆ delta

QuantLib::Real delta
mutable

Definition at line 50 of file sensitivityrecord.hpp.

◆ gamma

QuantLib::Real gamma
mutable

Definition at line 51 of file sensitivityrecord.hpp.