28#include <ql/shared_ptr.hpp>
29#include <ql/math/array.hpp>
30#include <ql/time/date.hpp>
31#include <ql/types.hpp>
33#include <boost/functional/hash.hpp>
35#include <unordered_map>
100 template <
class Archive>
void serialize(Archive& ar,
const unsigned int) {
107std::size_t
hash_value(
const RiskFactorKey& k);
123std::ostream&
operator<<(std::ostream& out,
const RiskFactorKey& key);
144 virtual const Date&
asof()
const = 0;
149 virtual const string&
label()
const = 0;
151 virtual void label(
const string&) = 0;
161 virtual const std::vector<RiskFactorKey>&
keys()
const = 0;
172 virtual const std::map<std::pair<RiskFactorKey::KeyType, std::string>, std::vector<std::vector<Real>>>&
176 virtual QuantLib::ext::shared_ptr<Scenario>
clone()
const = 0;
179 virtual bool isCloseEnough(
const QuantLib::ext::shared_ptr<Scenario>& s)
const;
186 template <
class Archive>
void serialize(Archive&,
const unsigned int) {}
195ShiftType parseShiftType(
const std::string& s);
202struct std::hash<
ore::analytics::RiskFactorKey> {
Data types stored in the scenario class.
RiskFactorKey(const KeyType &iKeytype, const string &iName, const Size &iIndex=0)
Constructor.
std::string name
Key name.
KeyType
Risk Factor types.
@ YoYInflationCapFloorVolatility
@ ZeroInflationCapFloorVolatility
RiskFactorKey()
Constructor.
friend class boost::serialization::access
void serialize(Archive &ar, const unsigned int)
virtual const string & label() const =0
Get the scenario label.
virtual const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > & coordinates() const =0
Get coordinates.
virtual bool isCloseEnough(const QuantLib::ext::shared_ptr< Scenario > &s) const
checks for equality up to numerical differences
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 void add(const RiskFactorKey &key, Real value)=0
Add an element to the scenario.
virtual Real get(const RiskFactorKey &key) const =0
Get an element from the scenario.
virtual bool has(const RiskFactorKey &key) const =0
Check whether this scenario provides the data for the given key.
virtual Real getNumeraire() const =0
Get Numeraire ratio n = N(t) / N(0) so that Price(0) = N(0) * E [Price(t) / N(t) ].
virtual void setAsof(const Date &d)=0
Set the asof date.
virtual bool isAbsolute() const =0
Is this an absolute or difference scenario?
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) ].
virtual void label(const string &)=0
Set the scenario label.
virtual ~Scenario()
Destructor.
virtual void setAbsolute(const bool b)=0
Set if this is an absolute scenario.
void serialize(Archive &, const unsigned int)
virtual QuantLib::ext::shared_ptr< Scenario > clone() const =0
clones a scenario and returns a pointer to the new object
friend class boost::serialization::access
virtual std::size_t keysHash() const
return fingerprint identifying the set of rf keys of the scenarios, or 0 if not provided by the imple...
bool operator<(const Dividend &d1, const Dividend &d2)
bool operator!=(const Filter &a, const Filter &b)
Filter operator>=(const RandomVariable &x, const RandomVariable &y)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
bool operator==(const Dividend &d1, const Dividend &d)
bool operator>(const Distributionpair &p1, const Distributionpair &p2)
Filter operator<=(const RandomVariable &x, const RandomVariable &y)
ShiftScheme parseShiftScheme(const std::string &s)
RiskFactorKey::KeyType parseRiskFactorKeyType(const string &str)
RiskFactorKey parseRiskFactorKey(const string &str)
std::size_t hash_value(const RiskFactorKey &k)
std::size_t operator()(const ore::analytics::RiskFactorKey &k) const