Logo
Reference manual - version orea_version
Classes | Public Types | Public Member Functions | List of all members
SensitivityCube Class Reference

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, RiskFactorKeycrossPair
 
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.
 
 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.
 

Inspectors

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.
 
const std::map< std::string, QuantLib::Size > & tradeIdx () const
 Return the map of up trade id's to index in cube.
 
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.
 
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.
 
const std::map< RiskFactorKey, SensitivityCube::FactorData > & upFactors () const
 Return the map of up risk factors to its factor data.
 
const std::map< RiskFactorKey, SensitivityCube::FactorData > & downFactors () const
 Return the map of down risk factors to its factor data.
 
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.
 
QuantLib::Real targetShiftSize (const RiskFactorKey &riskFactorKey) const
 Returns the absolute target shift size for given risk factor key.
 
QuantLib::Real actualShiftSize (const RiskFactorKey &riskFactorKey) const
 Returns the absolute actual shift size for given risk factor key.
 
ShiftScheme shiftScheme (const RiskFactorKey &riskFactorKey) const
 Returns the shift scheme for given risk factor key.
 
QuantLib::Real npv (const std::string &tradeId) const
 Get the base NPV for trade with ID tradeId.
 
QuantLib::Real npv (QuantLib::Size id) const
 Get the NPV for trade given the index of trade in the cube.
 
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.
 
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.
 
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.
 
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.
 
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.
 
std::set< RiskFactorKeyrelevantRiskFactors () const
 Get the relevant risk factors.
 

Detailed Description

SensitivityCube is a wrapper for an npvCube that gives easier access to the underlying cube elements.

Member Function Documentation

◆ upDownFactor()

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)

◆ crossFactor()

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)

◆ factorDescription()

std::string factorDescription ( const RiskFactorKey riskFactorKey) const

Get the description for the risk factor key riskFactorKey Returns the result of ShiftScenarioGenerator::ScenarioDescription::factor1()

◆ crossGamma() [1/2]

QuantLib::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

◆ crossGamma() [2/2]

QuantLib::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