NPVSensiCube class stores NPVs resulting from risk factor shifts on an as of date. More...
#include <orea/cube/npvsensicube.hpp>
Public Member Functions | |
QuantLib::Size | numDates () const override |
Number of dates in the NPVSensiCube is exactly one i.e. the as of date. More... | |
QuantLib::Size | depth () const override |
The depth in the NPVSensiCube is exactly one. More... | |
Real | get (QuantLib::Size id, QuantLib::Size sample) const |
Convenience method to get a value from the cube using id and sample only. More... | |
Real | get (const std::string &id, QuantLib::Size sample) const |
Convenience method to get a value from the cube using id and sample only. More... | |
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. More... | |
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. More... | |
Size | getTradeIndex (const std::string &tradeId) const |
Return the index of the trade in the cube. More... | |
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. More... | |
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. More... | |
virtual void | set (Real value, Size id, Size date, Size sample, Size depth=0)=0 |
Set a value in the cube using index. More... | |
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. More... | |
Public Member Functions inherited from NPVCube | |
NPVCube () | |
default ctor More... | |
NPVCube (NPVCube &)=delete | |
Do not allow cube copying. More... | |
NPVCube & | operator= (NPVCube const &)=delete |
virtual | ~NPVCube () |
dtor More... | |
virtual Size | numIds () const =0 |
Return the length of each dimension. More... | |
virtual Size | numDates () const =0 |
virtual Size | samples () const =0 |
virtual Size | depth () const =0 |
virtual const std::map< std::string, Size > & | idsAndIndexes () const =0 |
Get a map of id and their index position in this cube. More... | |
const std::set< std::string > | ids () const |
Get a set of all ids in the cube. More... | |
virtual const std::vector< QuantLib::Date > & | dates () const =0 |
Get the vector of dates for this cube. More... | |
virtual QuantLib::Date | asof () const =0 |
Return the asof date (T0 date) More... | |
virtual Real | getT0 (Size id, Size depth=0) const =0 |
Get a T0 value from the cube using index. More... | |
virtual Real | getT0 (const std::string &id, Size depth=0) const |
Get a T0 value from the cube using trade id. More... | |
virtual void | setT0 (Real value, Size id, Size depth=0)=0 |
Set a value in the cube using index. More... | |
virtual void | setT0 (Real value, const std::string &id, Size depth=0) |
Set a value in the cube using trade id. More... | |
virtual Real | get (Size id, Size date, Size sample, Size depth=0) const =0 |
Get a value from the cube using index. More... | |
virtual void | set (Real value, Size id, Size date, Size sample, Size depth=0)=0 |
Set a value in the cube using index. More... | |
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. More... | |
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. More... | |
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 |
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
Definition at line 40 of file npvsensicube.hpp.
|
overridevirtual |
Number of dates in the NPVSensiCube is exactly one i.e. the as of date.
Implements NPVCube.
Definition at line 46 of file npvsensicube.hpp.
|
overridevirtual |
The depth in the NPVSensiCube is exactly one.
Implements NPVCube.
Definition at line 49 of file npvsensicube.hpp.
Real get | ( | QuantLib::Size | id, |
QuantLib::Size | sample | ||
) | const |
Convenience method to get a value from the cube using id
and sample
only.
Definition at line 52 of file npvsensicube.hpp.
Real get | ( | const std::string & | id, |
QuantLib::Size | sample | ||
) | const |
Convenience method to get a value from the cube using id
and sample
only.
Definition at line 55 of file npvsensicube.hpp.
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.
Definition at line 58 of file npvsensicube.hpp.
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.
Definition at line 61 of file npvsensicube.hpp.
Size getTradeIndex | ( | const std::string & | tradeId | ) | const |
Return the index of the trade in the cube.
Definition at line 66 of file npvsensicube.hpp.
|
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.
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
Definition at line 76 of file npvsensicube.hpp.
|
pure virtual |
Return the set of scenario indices with non-zero result
Implemented in JointNPVSensiCube, and SensiCube< T >.
|
virtual |
Get a value from the cube using index.
Implements NPVCube.
|
virtual |
Get a value from the cube using trade id and date.
Reimplemented from NPVCube.
Definition at line 103 of file npvcube.hpp.
|
virtual |
Set a value in the cube using index.
Implements NPVCube.
|
virtual |