SensitivityCube is a wrapper for an npvCube that gives easier access to the underlying cube elements. More...
#include <orea/cube/sensitivitycube.hpp>
Classes | |
struct | FactorData |
Public Types | |
typedef std::pair< RiskFactorKey, RiskFactorKey > | crossPair |
typedef ShiftScenarioGenerator::ScenarioDescription | ShiftScenarioDescription |
Public Member Functions | |
SensitivityCube (const QuantLib::ext::shared_ptr< NPVSensiCube > &cube, const std::vector< ShiftScenarioDescription > &scenarioDescriptions, const std::map< RiskFactorKey, QuantLib::Real > &targetShiftSizes, const std::map< RiskFactorKey, QuantLib::Real > &actualShiftSizes, const std::map< RiskFactorKey, ShiftScheme > &shiftSchemes) | |
Constructor using a vector of scenario descriptions. More... | |
SensitivityCube (const QuantLib::ext::shared_ptr< NPVSensiCube > &cube, const std::vector< std::string > &scenarioDescriptions, const std::map< RiskFactorKey, QuantLib::Real > &targetShiftSizes, const std::map< RiskFactorKey, QuantLib::Real > &actualshiftSizes, const std::map< RiskFactorKey, ShiftScheme > &shiftSchemes) | |
Constructor using a vector of scenario description strings. More... | |
Inspectors | |
QuantLib::ext::shared_ptr< NPVSensiCube > | cube_ |
std::vector< ShiftScenarioDescription > | scenarioDescriptions_ |
std::map< RiskFactorKey, QuantLib::Real > | targetShiftSizes_ |
std::map< RiskFactorKey, QuantLib::Real > | actualShiftSizes_ |
std::map< RiskFactorKey, ShiftScheme > | shiftSchemes_ |
std::set< RiskFactorKey > | factors_ |
std::map< std::string, QuantLib::Size > | tradeIdx_ |
std::map< ShiftScenarioDescription, QuantLib::Size > | scenarioIdx_ |
std::map< RiskFactorKey, FactorData > | upFactors_ |
std::map< RiskFactorKey, FactorData > | downFactors_ |
std::map< crossPair, std::tuple< FactorData, FactorData, QuantLib::Size > > | crossFactors_ |
std::map< QuantLib::Size, RiskFactorKey > | upIndexToKey_ |
std::map< QuantLib::Size, RiskFactorKey > | downIndexToKey_ |
std::map< QuantLib::Size, crossPair > | crossIndexToKey_ |
const QuantLib::ext::shared_ptr< NPVSensiCube > & | npvCube () const |
const std::vector< ShiftScenarioDescription > & | scenarioDescriptions () const |
bool | hasTrade (const std::string &tradeId) const |
Check if the cube has scenario NPVs for trade with ID tradeId . More... | |
const std::map< std::string, QuantLib::Size > & | tradeIdx () const |
Return the map of up trade id's to index in cube. More... | |
RiskFactorKey | upDownFactor (const Size index) const |
crossPair | crossFactor (const Size crossIndex) const |
bool | hasScenario (const ShiftScenarioDescription &scenarioDescription) const |
Check if the cube has scenario NPVs for scenario with description scenarioDescription . More... | |
std::string | factorDescription (const RiskFactorKey &riskFactorKey) const |
const std::set< RiskFactorKey > & | factors () const |
Returns the set of risk factor keys for which a delta and gamma can be calculated. More... | |
const std::map< RiskFactorKey, SensitivityCube::FactorData > & | upFactors () const |
Return the map of up risk factors to its factor data. More... | |
const std::map< RiskFactorKey, SensitivityCube::FactorData > & | downFactors () const |
Return the map of down risk factors to its factor data. More... | |
const std::map< crossPair, std::tuple< SensitivityCube::FactorData, SensitivityCube::FactorData, QuantLib::Size > > & | crossFactors () const |
Returns the set of pairs of risk factor keys for which a cross gamma is available. More... | |
QuantLib::Real | targetShiftSize (const RiskFactorKey &riskFactorKey) const |
Returns the absolute target shift size for given risk factor key . More... | |
QuantLib::Real | actualShiftSize (const RiskFactorKey &riskFactorKey) const |
Returns the absolute actual shift size for given risk factor key . More... | |
ShiftScheme | shiftScheme (const RiskFactorKey &riskFactorKey) const |
Returns the shift scheme for given risk factor key . More... | |
QuantLib::Real | npv (const std::string &tradeId) const |
Get the base NPV for trade with ID tradeId . More... | |
QuantLib::Real | npv (QuantLib::Size id) const |
Get the NPV for trade given the index of trade in the cube. More... | |
QuantLib::Real | delta (const Size tradeIdx, const RiskFactorKey &riskFactorKey) const |
Get the trade delta for trade with index tradeIdx and for the given risk factor key riskFactorKey . More... | |
QuantLib::Real | delta (const std::string &tradeId, const RiskFactorKey &riskFactorKey) const |
Get the trade delta for trade with ID tradeId and for the given risk factor key riskFactorKey . More... | |
QuantLib::Real | gamma (const Size tradeIdx, const RiskFactorKey &riskFactorKey) const |
Get the trade gamma for trade with index tradeIdx and for the given risk factor key riskFactorKey . More... | |
QuantLib::Real | gamma (const std::string &tradeId, const RiskFactorKey &riskFactorKey) const |
Get the trade gamma for trade with ID tradeId and for the given risk factor key riskFactorKey . More... | |
QuantLib::Real | crossGamma (const Size tradeIdx, const crossPair &riskFactorKeyPair) const |
QuantLib::Real | crossGamma (const std::string &tradeId, const crossPair &riskFactorKeyPair) const |
QuantLib::Real | crossGamma (QuantLib::Size tradeIdx, QuantLib::Size upIdx_1, QuantLib::Size upIdx_2, QuantLib::Size crossId, QuantLib::Real scaling1, QuantLib::Real scaling2) const |
Get the trade cross gamma for trade given the index of trade and risk factors in the cube. More... | |
std::set< RiskFactorKey > | relevantRiskFactors () const |
Get the relevant risk factors. More... | |
void | initialise () |
Initialise method used by the constructors. More... | |
SensitivityCube is a wrapper for an npvCube that gives easier access to the underlying cube elements.
Definition at line 42 of file sensitivitycube.hpp.
typedef std::pair<RiskFactorKey, RiskFactorKey> crossPair |
Definition at line 45 of file sensitivitycube.hpp.
Definition at line 46 of file sensitivitycube.hpp.
SensitivityCube | ( | const QuantLib::ext::shared_ptr< NPVSensiCube > & | cube, |
const std::vector< ShiftScenarioDescription > & | scenarioDescriptions, | ||
const std::map< RiskFactorKey, QuantLib::Real > & | targetShiftSizes, | ||
const std::map< RiskFactorKey, QuantLib::Real > & | actualShiftSizes, | ||
const std::map< RiskFactorKey, ShiftScheme > & | shiftSchemes | ||
) |
Constructor using a vector of scenario descriptions.
Definition at line 59 of file sensitivitycube.cpp.
SensitivityCube | ( | const QuantLib::ext::shared_ptr< NPVSensiCube > & | cube, |
const std::vector< std::string > & | scenarioDescriptions, | ||
const std::map< RiskFactorKey, QuantLib::Real > & | targetShiftSizes, | ||
const std::map< RiskFactorKey, QuantLib::Real > & | actualshiftSizes, | ||
const std::map< RiskFactorKey, ShiftScheme > & | shiftSchemes | ||
) |
Constructor using a vector of scenario description strings.
Definition at line 69 of file sensitivitycube.cpp.
const QuantLib::ext::shared_ptr< NPVSensiCube > & npvCube | ( | ) | const |
Definition at line 72 of file sensitivitycube.hpp.
const std::vector< ShiftScenarioDescription > & scenarioDescriptions | ( | ) | const |
bool hasTrade | ( | const std::string & | tradeId | ) | const |
Check if the cube has scenario NPVs for trade with ID tradeId
.
Definition at line 147 of file sensitivitycube.cpp.
const std::map< std::string, QuantLib::Size > & tradeIdx | ( | ) | const |
Return the map of up trade id's to index in cube.
Definition at line 80 of file sensitivitycube.hpp.
RiskFactorKey upDownFactor | ( | const Size | index | ) | const |
Return factor for given up or down scenario index or None if given index is not an up or down scenario (to be reviewed)
Definition at line 149 of file sensitivitycube.cpp.
SensitivityCube::crossPair crossFactor | ( | const Size | crossIndex | ) | const |
Return factor for given cross scenario index or None if given index is not a cross scenario (to be reviewed)
Definition at line 159 of file sensitivitycube.cpp.
bool hasScenario | ( | const ShiftScenarioDescription & | scenarioDescription | ) | const |
Check if the cube has scenario NPVs for scenario with description scenarioDescription
.
Definition at line 167 of file sensitivitycube.cpp.
std::string factorDescription | ( | const RiskFactorKey & | riskFactorKey | ) | const |
Get the description for the risk factor key riskFactorKey
Returns the result of ShiftScenarioGenerator::ScenarioDescription::factor1()
Definition at line 171 of file sensitivitycube.cpp.
const set< RiskFactorKey > & factors | ( | ) | const |
Returns the set of risk factor keys for which a delta and gamma can be calculated.
Definition at line 176 of file sensitivitycube.cpp.
const std::map< RiskFactorKey, SensitivityCube::FactorData > & upFactors | ( | ) | const |
Return the map of up risk factors to its factor data.
Definition at line 99 of file sensitivitycube.hpp.
const std::map< RiskFactorKey, SensitivityCube::FactorData > & downFactors | ( | ) | const |
Return the map of down risk factors to its factor data.
Definition at line 102 of file sensitivitycube.hpp.
const std::map< SensitivityCube::crossPair, tuple< SensitivityCube::FactorData, SensitivityCube::FactorData, Size > > & crossFactors | ( | ) | const |
Returns the set of pairs of risk factor keys for which a cross gamma is available.
Definition at line 179 of file sensitivitycube.cpp.
Real targetShiftSize | ( | const RiskFactorKey & | riskFactorKey | ) | const |
Returns the absolute target shift size for given risk factor key
.
Definition at line 183 of file sensitivitycube.cpp.
Real actualShiftSize | ( | const RiskFactorKey & | riskFactorKey | ) | const |
Returns the absolute actual shift size for given risk factor key
.
Definition at line 190 of file sensitivitycube.cpp.
ShiftScheme shiftScheme | ( | const RiskFactorKey & | riskFactorKey | ) | const |
Returns the shift scheme for given risk factor key
.
Definition at line 197 of file sensitivitycube.cpp.
Real npv | ( | const std::string & | tradeId | ) | const |
QuantLib::Real npv | ( | QuantLib::Size | id | ) | const |
Get the NPV for trade given the index of trade in the cube.
Real delta | ( | const Size | tradeIdx, |
const RiskFactorKey & | riskFactorKey | ||
) | const |
Get the trade delta for trade with index tradeIdx
and for the given risk factor key riskFactorKey
.
Definition at line 219 of file sensitivitycube.cpp.
Real delta | ( | const std::string & | tradeId, |
const RiskFactorKey & | riskFactorKey | ||
) | const |
Get the trade delta for trade with ID tradeId
and for the given risk factor key riskFactorKey
.
Definition at line 239 of file sensitivitycube.cpp.
Real gamma | ( | const Size | tradeIdx, |
const RiskFactorKey & | riskFactorKey | ||
) | const |
Get the trade gamma for trade with index tradeIdx
and for the given risk factor key riskFactorKey
.
Definition at line 243 of file sensitivitycube.cpp.
Real gamma | ( | const std::string & | tradeId, |
const RiskFactorKey & | riskFactorKey | ||
) | const |
Get the trade gamma for trade with ID tradeId
and for the given risk factor key riskFactorKey
.
Definition at line 252 of file sensitivitycube.cpp.
Real crossGamma | ( | const Size | tradeIdx, |
const crossPair & | riskFactorKeyPair | ||
) | const |
Get the trade cross gamma for trade with ID tradeId
and for the given risk factor key pair riskFactorKeyPair
Definition at line 269 of file sensitivitycube.cpp.
Real crossGamma | ( | const std::string & | tradeId, |
const crossPair & | riskFactorKeyPair | ||
) | const |
Get the trade cross gamma for trade with ID tradeId
and for the given risk factor key pair riskFactorKeyPair
Definition at line 276 of file sensitivitycube.cpp.
QuantLib::Real crossGamma | ( | QuantLib::Size | tradeIdx, |
QuantLib::Size | upIdx_1, | ||
QuantLib::Size | upIdx_2, | ||
QuantLib::Size | crossId, | ||
QuantLib::Real | scaling1, | ||
QuantLib::Real | scaling2 | ||
) | const |
Get the trade cross gamma for trade given the index of trade and risk factors in the cube.
Definition at line 256 of file sensitivitycube.cpp.
std::set< RiskFactorKey > relevantRiskFactors | ( | ) | const |
Get the relevant risk factors.
Definition at line 280 of file sensitivitycube.cpp.
|
private |
Initialise method used by the constructors.
Definition at line 86 of file sensitivitycube.cpp.
|
private |
Definition at line 154 of file sensitivitycube.hpp.
|
private |
Definition at line 155 of file sensitivitycube.hpp.
|
private |
Definition at line 156 of file sensitivitycube.hpp.
|
private |
Definition at line 157 of file sensitivitycube.hpp.
|
private |
Definition at line 158 of file sensitivitycube.hpp.
|
private |
Definition at line 162 of file sensitivitycube.hpp.
|
private |
Definition at line 166 of file sensitivitycube.hpp.
|
private |
Definition at line 167 of file sensitivitycube.hpp.
|
private |
Definition at line 169 of file sensitivitycube.hpp.
|
private |
Definition at line 169 of file sensitivitycube.hpp.
|
private |
Definition at line 172 of file sensitivitycube.hpp.
|
private |
Definition at line 175 of file sensitivitycube.hpp.
|
private |
Definition at line 176 of file sensitivitycube.hpp.
|
private |
Definition at line 177 of file sensitivitycube.hpp.