Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
Scenario Class Referenceabstract

Scenario Base Class. More...

#include <orea/scenario/scenario.hpp>

+ Inheritance diagram for Scenario:
+ Collaboration diagram for Scenario:

Public Member Functions

virtual ~Scenario ()
 Destructor. More...
 
virtual const Date & asof () const =0
 Return the scenario asof date. More...
 
virtual void setAsof (const Date &d)=0
 Set the asof date. More...
 
virtual const string & label () const =0
 Get the scenario label. More...
 
virtual void label (const string &)=0
 Set the scenario label. More...
 
virtual Real getNumeraire () const =0
 Get Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ]. More...
 
virtual void setNumeraire (Real n)=0
 Set the Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ]. More...
 
virtual bool has (const RiskFactorKey &key) const =0
 Check whether this scenario provides the data for the given key. More...
 
virtual const std::vector< RiskFactorKey > & keys () const =0
 Risk factor keys for which this scenario provides data. More...
 
virtual void add (const RiskFactorKey &key, Real value)=0
 Add an element to the scenario. More...
 
virtual Real get (const RiskFactorKey &key) const =0
 Get an element from the scenario. More...
 
virtual bool isAbsolute () const =0
 Is this an absolute or difference scenario? More...
 
virtual void setAbsolute (const bool b)=0
 Set if this is an absolute scenario. More...
 
virtual const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > & coordinates () const =0
 Get coordinates. More...
 
virtual QuantLib::ext::shared_ptr< Scenarioclone () const =0
 clones a scenario and returns a pointer to the new object More...
 
virtual bool isCloseEnough (const QuantLib::ext::shared_ptr< Scenario > &s) const
 checks for equality up to numerical differences More...
 
virtual std::size_t keysHash () const
 return fingerprint identifying the set of rf keys of the scenarios, or 0 if not provided by the implementation More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &, const unsigned int)
 

Friends

class boost::serialization::access
 

Detailed Description

Scenario Base Class.

A scenario contains a single cross asset model sample in terms of yield curves by currency, FX rates, etc.

This base class provides the interface to add and retrieve data to and from a scenario. Concrete simple and memory optimized "compact" scenario classes are derived from this.

Definition at line 138 of file scenario.hpp.

Constructor & Destructor Documentation

◆ ~Scenario()

virtual ~Scenario ( )
virtual

Destructor.

Definition at line 141 of file scenario.hpp.

141{}

Member Function Documentation

◆ asof()

virtual const Date & asof ( ) const
pure virtual

Return the scenario asof date.

Implemented in DeltaScenario, and SimpleScenario.

+ Here is the caller graph for this function:

◆ setAsof()

virtual void setAsof ( const Date &  d)
pure virtual

Set the asof date.

Implemented in DeltaScenario, and SimpleScenario.

◆ label() [1/2]

virtual const string & label ( ) const
pure virtual

Get the scenario label.

Implemented in DeltaScenario, and SimpleScenario.

+ Here is the caller graph for this function:

◆ label() [2/2]

virtual void label ( const string &  )
pure virtual

Set the scenario label.

Implemented in DeltaScenario, and SimpleScenario.

◆ getNumeraire()

virtual Real getNumeraire ( ) const
pure virtual

Get Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ].

Implemented in DeltaScenario, and SimpleScenario.

+ Here is the caller graph for this function:

◆ setNumeraire()

virtual void setNumeraire ( Real  n)
pure virtual

Set the Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ].

Implemented in DeltaScenario, and SimpleScenario.

◆ has()

virtual bool has ( const RiskFactorKey key) const
pure virtual

Check whether this scenario provides the data for the given key.

Implemented in DeltaScenario, and SimpleScenario.

◆ keys()

virtual const std::vector< RiskFactorKey > & keys ( ) const
pure virtual

Risk factor keys for which this scenario provides data.

Implemented in DeltaScenario, and SimpleScenario.

+ Here is the caller graph for this function:

◆ add()

virtual void add ( const RiskFactorKey key,
Real  value 
)
pure virtual

Add an element to the scenario.

Implemented in DeltaScenario, and SimpleScenario.

◆ get()

virtual Real get ( const RiskFactorKey key) const
pure virtual

Get an element from the scenario.

Implemented in DeltaScenario, and SimpleScenario.

+ Here is the caller graph for this function:

◆ isAbsolute()

virtual bool isAbsolute ( ) const
pure virtual

Is this an absolute or difference scenario?

Implemented in DeltaScenario, and SimpleScenario.

◆ setAbsolute()

virtual void setAbsolute ( const bool  b)
pure virtual

Set if this is an absolute scenario.

Implemented in DeltaScenario, and SimpleScenario.

◆ coordinates()

virtual const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > & coordinates ( ) const
pure virtual

Get coordinates.

Implemented in DeltaScenario, and SimpleScenario.

◆ clone()

virtual QuantLib::ext::shared_ptr< Scenario > clone ( ) const
pure virtual

clones a scenario and returns a pointer to the new object

Implemented in DeltaScenario, and SimpleScenario.

◆ isCloseEnough()

bool isCloseEnough ( const QuantLib::ext::shared_ptr< Scenario > &  s) const
virtual

checks for equality up to numerical differences

Reimplemented in DeltaScenario.

Definition at line 38 of file scenario.cpp.

38 {
39 return asof() == s->asof() && label() == s->label() && QuantLib::close_enough(getNumeraire(), s->getNumeraire()) &&
40 keys() == s->keys() && std::all_of(keys().begin(), keys().end(), [this, s](const RiskFactorKey& k) {
41 return QuantLib::close_enough(this->get(k), s->get(k));
42 });
43}
virtual const string & label() const =0
Get the scenario label.
virtual const std::vector< RiskFactorKey > & keys() const =0
Risk factor keys for which this scenario provides data.
virtual const Date & asof() const =0
Return the scenario asof date.
virtual Real get(const RiskFactorKey &key) const =0
Get an element from the scenario.
virtual Real getNumeraire() const =0
Get Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ].
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keysHash()

virtual std::size_t keysHash ( ) const
virtual

return fingerprint identifying the set of rf keys of the scenarios, or 0 if not provided by the implementation

Reimplemented in SimpleScenario.

Definition at line 182 of file scenario.hpp.

182{ return 0; }

◆ serialize()

void serialize ( Archive &  ,
const unsigned int   
)
private

Definition at line 186 of file scenario.hpp.

186{}

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 185 of file scenario.hpp.