#include <orea/scenario/simplescenario.hpp>
Classes | |
struct | SharedData |
Public Member Functions | |
SimpleScenario () | |
SimpleScenario (Date asof, const std::string &label=std::string(), Real numeraire=0, const boost::shared_ptr< SharedData > &sharedData=nullptr) | |
if sharedData is not provided, the instance will create its own shared data block More... | |
const Date & | asof () const override |
Return the scenario asof date. More... | |
void | setAsof (const Date &d) override |
Set the asof date. More... | |
const std::string & | label () const override |
Get the scenario label. More... | |
void | label (const string &s) override |
Set the scenario label. More... | |
Real | getNumeraire () const override |
Get Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ]. More... | |
void | setNumeraire (Real n) override |
Set the Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ]. More... | |
bool | isAbsolute () const override |
Is this an absolute or difference scenario? More... | |
const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > & | coordinates () const override |
Get coordinates. More... | |
std::size_t | keysHash () const override |
return fingerprint identifying the set of rf keys of the scenarios, or 0 if not provided by the implementation More... | |
bool | has (const RiskFactorKey &key) const override |
Check whether this scenario provides the data for the given key. More... | |
const std::vector< RiskFactorKey > & | keys () const override |
Risk factor keys for which this scenario provides data. More... | |
void | add (const RiskFactorKey &key, Real value) override |
Add an element to the scenario. More... | |
Real | get (const RiskFactorKey &key) const override |
Get an element from the scenario. More... | |
QuantLib::ext::shared_ptr< Scenario > | clone () const override |
This does not close the shared data. More... | |
void | setAbsolute (const bool isAbsolute) override |
Set if this is an absolute scenario. More... | |
void | setCoordinates (const RiskFactorKey::KeyType type, const std::string &name, const std::vector< std::vector< Real > > &coordinates) |
const boost::shared_ptr< SharedData > & | sharedData () const |
get shared data block (for construction of sister scenarios) More... | |
const std::vector< Real > & | data () const |
get data, order is the same as in keys() More... | |
Public Member Functions inherited from Scenario | |
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< Scenario > | clone () 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 Attributes | |
QuantLib::ext::shared_ptr< SharedData > | sharedData_ |
bool | isAbsolute_ = true |
Date | asof_ |
std::string | label_ |
Real | numeraire_ = 0.0 |
std::vector< Real > | data_ |
Simple Scenario class
Definition at line 34 of file simplescenario.hpp.
SimpleScenario | ( | ) |
Definition at line 43 of file simplescenario.hpp.
SimpleScenario | ( | Date | asof, |
const std::string & | label = std::string() , |
||
Real | numeraire = 0 , |
||
const boost::shared_ptr< SharedData > & | sharedData = nullptr |
||
) |
if sharedData is not provided, the instance will create its own shared data block
Definition at line 30 of file simplescenario.cpp.
|
overridevirtual |
Return the scenario asof date.
Implements Scenario.
Definition at line 48 of file simplescenario.hpp.
|
overridevirtual |
Set the asof date.
Implements Scenario.
Definition at line 49 of file simplescenario.hpp.
|
overridevirtual |
|
overridevirtual |
Set the scenario label.
Implements Scenario.
Definition at line 52 of file simplescenario.hpp.
|
overridevirtual |
Get Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ].
Implements Scenario.
Definition at line 54 of file simplescenario.hpp.
|
overridevirtual |
Set the Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ].
Implements Scenario.
Definition at line 55 of file simplescenario.hpp.
|
overridevirtual |
Is this an absolute or difference scenario?
Implements Scenario.
Definition at line 57 of file simplescenario.hpp.
|
overridevirtual |
Get coordinates.
Implements Scenario.
Definition at line 59 of file simplescenario.hpp.
|
overridevirtual |
return fingerprint identifying the set of rf keys of the scenarios, or 0 if not provided by the implementation
Reimplemented from Scenario.
Definition at line 63 of file simplescenario.hpp.
|
overridevirtual |
Check whether this scenario provides the data for the given key.
Implements Scenario.
Definition at line 35 of file simplescenario.cpp.
|
overridevirtual |
Risk factor keys for which this scenario provides data.
Implements Scenario.
Definition at line 66 of file simplescenario.hpp.
|
overridevirtual |
Add an element to the scenario.
Implements Scenario.
Definition at line 39 of file simplescenario.cpp.
|
overridevirtual |
Get an element from the scenario.
Implements Scenario.
Definition at line 55 of file simplescenario.cpp.
|
overridevirtual |
This does not close the shared data.
Implements Scenario.
Definition at line 61 of file simplescenario.cpp.
|
overridevirtual |
Set if this is an absolute scenario.
Implements Scenario.
Definition at line 65 of file simplescenario.cpp.
void setCoordinates | ( | const RiskFactorKey::KeyType | type, |
const std::string & | name, | ||
const std::vector< std::vector< Real > > & | coordinates | ||
) |
Definition at line 67 of file simplescenario.cpp.
const boost::shared_ptr< SharedData > & sharedData | ( | ) | const |
get shared data block (for construction of sister scenarios)
Definition at line 78 of file simplescenario.hpp.
const std::vector< Real > & data | ( | ) | const |
|
private |
Definition at line 84 of file simplescenario.hpp.
|
private |
Definition at line 85 of file simplescenario.hpp.
|
private |
Definition at line 86 of file simplescenario.hpp.
|
private |
Definition at line 87 of file simplescenario.hpp.
|
private |
Definition at line 88 of file simplescenario.hpp.
|
private |
Definition at line 89 of file simplescenario.hpp.