Logo
Reference manual - version orea_version
Public Member Functions | List of all members
JointNPVSensiCube Class Reference
+ Inheritance diagram for JointNPVSensiCube:

Public Member Functions

 JointNPVSensiCube (const boost::shared_ptr< NPVSensiCube > &cube1, const boost::shared_ptr< NPVSensiCube > &cube2, const std::set< std::string > &ids={})
 
 JointNPVSensiCube (const std::vector< boost::shared_ptr< NPVSensiCube >> &cubes, const std::set< std::string > &ids={})
 
Size numIds () const override
 Return the length of each dimension.
 
Size numDates () const override
 
Size samples () const override
 
Size depth () const override
 
const std::map< std::string, Size > & idsAndIndexes () const override
 Get a map of id and their index position in this cube.
 
const std::vector< QuantLib::Date > & dates () const override
 Get the vector of dates for this cube.
 
QuantLib::Date asof () const override
 Return the asof date (T0 date)
 
Real getT0 (Size id, Size depth=0) const override
 Get a T0 value from the cube using index.
 
void setT0 (Real value, Size id, Size depth=0) override
 Set a value in the cube using index.
 
Real get (Size id, Size date, Size sample, Size depth=0) const override
 Get a value from the cube using index.
 
void set (Real value, Size id, Size date, Size sample, Size depth=0) override
 Set a value in the cube using index.
 
std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (Size tradeIdx) const override
 
std::set< QuantLib::Size > relevantScenarios () const override
 
void remove (Size id) override
 
void remove (Size id, Size sample) override
 
- Public Member Functions inherited from NPVSensiCube
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.
 
std::map< QuantLib::Size, QuantLib::Real > getTradeNPVs (const std::string &tradeId) const
 
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
 
const std::set< std::string > ids () const
 Get a set of all ids in the cube.
 
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, const std::string &id, Size depth=0)
 Set a value in the cube using trade id.
 
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.
 
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
 

Constructor & Destructor Documentation

◆ JointNPVSensiCube() [1/2]

JointNPVSensiCube ( const boost::shared_ptr< NPVSensiCube > &  cube1,
const boost::shared_ptr< NPVSensiCube > &  cube2,
const std::set< std::string > &  ids = {} 
)

ctor for two input cubes

◆ JointNPVSensiCube() [2/2]

JointNPVSensiCube ( const std::vector< boost::shared_ptr< NPVSensiCube >> &  cubes,
const std::set< std::string > &  ids = {} 
)

ctor for n input cubes If no ids are given, the ids in the input cubes define theids in the resulting cube, the ids must be unique in this case. If ids are given they define the ids in the output cube.

Member Function Documentation

◆ getTradeNPVs()

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

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

Implements NPVSensiCube.

◆ relevantScenarios()

std::set<QuantLib::Size> relevantScenarios ( ) const
overridevirtual

Return the set of scenario indices with non-zero result

Implements NPVSensiCube.

◆ remove() [1/2]

void remove ( Size  id)
overridevirtual

remove all values for a given id, i.e. change the state as if setT0() and set() has never been called for the id the default implementation has generelly to be overriden in derived classes depending on how values are stored

Reimplemented from NPVCube.

◆ remove() [2/2]

void remove ( Size  id,
Size  sample 
)
overridevirtual

simliar as above, but remove all values for a given id and scenario and keep T0 values

Reimplemented from NPVCube.