Logo
Reference manual - version orea_version
Public Member Functions | List of all members
NPVSensiCube Class Referenceabstract

NPVSensiCube class stores NPVs resulting from risk factor shifts on an as of date. More...

#include <orea/cube/npvsensicube.hpp>

+ Inheritance diagram for NPVSensiCube:

Public Member Functions

QuantLib::Size numDates () const override
 Number of dates in the NPVSensiCube is exactly one i.e. the as of date.
 
QuantLib::Size depth () const override
 The depth in the NPVSensiCube is exactly one.
 
Real get (QuantLib::Size id, QuantLib::Size sample) const
 Convenience method to get a value from the cube using id and sample only.
 
Real get (const std::string &id, QuantLib::Size sample) const
 Convenience method to get a value from the cube using id and sample only.
 
void set (QuantLib::Real value, QuantLib::Size id, QuantLib::Size sample)
 Convenience method to set a value in the cube using id and sample only.
 
void set (QuantLib::Real value, const std::string &id, QuantLib::Size sample)
 Convenience method to set a value in the cube using id and sample only.
 
Size getTradeIndex (const std::string &tradeId) const
 Return the index of the trade in the cube.
 
virtual std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (Size tradeIdx) const =0
 
std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (const std::string &tradeId) const
 
virtual std::set< QuantLib::Size > relevantScenarios () const =0
 
virtual Real get (Size id, Size date, Size sample, Size depth=0) const=0
 Get a value from the cube using index.
 
virtual Real get (const std::string &id, const QuantLib::Date &date, Size sample, Size depth=0) const
 Get a value from the cube using trade id and date.
 
virtual void set (Real value, Size id, Size date, Size sample, Size depth=0)=0
 Set a value in the cube using index.
 
virtual void set (Real value, const std::string &id, const QuantLib::Date &date, Size sample, Size depth=0)
 Set a value in the cube using trade id and date.
 
- Public Member Functions inherited from NPVCube
 NPVCube ()
 default ctor
 
 NPVCube (NPVCube &)=delete
 Do not allow cube copying.
 
NPVCubeoperator= (NPVCube const &)=delete
 
virtual ~NPVCube ()
 dtor
 
virtual Size numIds () const =0
 Return the length of each dimension.
 
virtual Size samples () const =0
 
virtual const std::map< std::string, Size > & idsAndIndexes () const =0
 Get a map of id and their index position in this cube.
 
const std::set< std::string > ids () const
 Get a set of all ids in the cube.
 
virtual const std::vector< QuantLib::Date > & dates () const =0
 Get the vector of dates for this cube.
 
virtual QuantLib::Date asof () const =0
 Return the asof date (T0 date)
 
virtual Real getT0 (Size id, Size depth=0) const =0
 Get a T0 value from the cube using index.
 
virtual Real getT0 (const std::string &id, Size depth=0) const
 Get a T0 value from the cube using trade id.
 
virtual void setT0 (Real value, Size id, Size depth=0)=0
 Set a value in the cube using index.
 
virtual void setT0 (Real value, const std::string &id, Size depth=0)
 Set a value in the cube using trade id.
 
virtual Real get (Size id, Size date, Size sample, Size depth=0) const =0
 Get a value from the cube using index.
 
virtual void set (Real value, Size id, Size date, Size sample, Size depth=0)=0
 Set a value in the cube using index.
 
virtual Real get (const std::string &id, const QuantLib::Date &date, Size sample, Size depth=0) const
 Get a value from the cube using trade id and date.
 
virtual void set (Real value, const std::string &id, const QuantLib::Date &date, Size sample, Size depth=0)
 Set a value in the cube using trade id and date.
 
virtual void remove (Size id)
 
virtual void remove (Size id, Size sample)
 
Size getTradeIndex (const std::string &id) const
 

Additional Inherited Members

- Protected Member Functions inherited from NPVCube
virtual Size index (const std::string &id) const
 
virtual Size index (const QuantLib::Date &date) const
 

Detailed Description

NPVSensiCube class stores NPVs resulting from risk factor shifts on an as of date.

This class is a restriction of the NPVCube to a grid of values where the ids are trade IDs and the samples are risk factor shifts

Member Function Documentation

◆ getTradeNPVs() [1/2]

virtual std::map<QuantLib::Size, QuantLib::Real> getTradeNPVs ( Size  tradeIdx) const
pure virtual

Return a map for the trade ID at index tradeIdx where the map key is the index of the risk factor shift and the map value is the NPV under that shift

Implemented in JointNPVSensiCube.

◆ getTradeNPVs() [2/2]

std::map<QuantLib::Size, QuantLib::Real> getTradeNPVs ( const std::string &  tradeId) const

Return a map for the tradeId where the map key is the index of the risk factor shift and the map value is the NPV under that shift

◆ relevantScenarios()

virtual std::set<QuantLib::Size> relevantScenarios ( ) const
pure virtual

Return the set of scenario indices with non-zero result

Implemented in SensiCube< T >, and JointNPVSensiCube.