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 boost::shared_ptr< NPVSensiCube > &cube, const std::vector< ShiftScenarioDescription > &scenarioDescriptions, const std::map< RiskFactorKey, QuantLib::Real > &shiftSizes, const std::set< RiskFactorKey::KeyType > &twoSidedDeltas={})
 Constructor using a vector of scenario descriptions.
 
 SensitivityCube (const boost::shared_ptr< NPVSensiCube > &cube, const std::vector< std::string > &scenarioDescriptions, const std::map< RiskFactorKey, QuantLib::Real > &shiftSizes, const std::set< RiskFactorKey::KeyType > &twoSidedDeltas={})
 Constructor using a vector of scenario description strings.
 

Inspectors

const boost::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 upFactor (const Size upIndex) const
 
RiskFactorKey downFactor (const Size downIndex) 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 shiftSize (const RiskFactorKey &riskFactorKey) const
 Returns the absolute shift size 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 (const std::string &tradeId, const ShiftScenarioDescription &scenarioDescription) const
 Get the NPV with scenario description scenarioDescription 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 npv (QuantLib::Size id, QuantLib::Size scenarioIdx) const
 Get the NPV for trade given the index of trade and scenario in the cube.
 
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 delta (QuantLib::Size id, QuantLib::Size scenarioIdx) const
 Get the trade delta for trade given the index of trade and risk factors in the cube.
 
QuantLib::Real delta (QuantLib::Size id, QuantLib::Size upIdx, QuantLib::Size downIdx) const
 Get the two sided trade delta for trade given the index of trade and risk factors in the cube.
 
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 gamma (QuantLib::Size id, QuantLib::Size upScenarioIdx, QuantLib::Size downScenarioIdx) const
 Get the trade gamma for trade given the index of trade and risk factors in the cube.
 
QuantLib::Real crossGamma (const std::string &tradeId, const crossPair &riskFactorKeyPair) const
 
std::set< RiskFactorKeyrelevantRiskFactors ()
 Get the relevant risk factors.
 
QuantLib::Real crossGamma (QuantLib::Size id, QuantLib::Size upIdx_1, QuantLib::Size upIdx_2, QuantLib::Size crossIdx) const
 Get the trade cross gamma for trade given the index of trade and risk factors in the cube.
 
bool twoSidedDelta (const RiskFactorKey::KeyType &keyType) const
 Check if a two sided delta has been configured for the given risk factor key type, keyType.
 

Detailed Description

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

Member Function Documentation

◆ upFactor()

RiskFactorKey upFactor ( const Size  upIndex) const

Return factor for given up scenario index or None if given index is not an up scenario (to be reviewed)

◆ downFactor()

RiskFactorKey downFactor ( const Size  downIndex) const

Return factor for given down scenario index or None if given index is not an 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()

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