Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
AdjustedInMemoryLoader Class Reference

An Adjusted In Memory Loader,. More...

#include <ored/marketdata/adjustedinmemoryloader.hpp>

+ Inheritance diagram for AdjustedInMemoryLoader:
+ Collaboration diagram for AdjustedInMemoryLoader:

Public Member Functions

 AdjustedInMemoryLoader (const ore::data::AdjustmentFactors &factors)
 
virtual void add (QuantLib::Date date, const std::string &name, QuantLib::Real value) override
 
virtual void addFixing (QuantLib::Date date, const std::string &name, QuantLib::Real value) override
 
ore::data::AdjustmentFactors adjustmentFactors () const
 
- Public Member Functions inherited from InMemoryLoader
 InMemoryLoader ()
 
std::vector< QuantLib::ext::shared_ptr< MarketDatum > > loadQuotes (const QuantLib::Date &d) const override
 get all quotes, TODO change the return value to std::set More...
 
QuantLib::ext::shared_ptr< MarketDatumget (const string &name, const QuantLib::Date &d) const override
 get quote by its unique name, throws if not existent, override in derived classes for performance More...
 
std::set< QuantLib::ext::shared_ptr< MarketDatum > > get (const std::set< std::string > &names, const QuantLib::Date &asof) const override
 get quotes matching a set of names, this should be overridden in derived classes for performance More...
 
std::set< QuantLib::ext::shared_ptr< MarketDatum > > get (const Wildcard &wildcard, const QuantLib::Date &asof) const override
 get quotes matching a wildcard, this should be overriden in derived classes for performance More...
 
std::set< FixingloadFixings () const override
 
std::set< QuantExt::DividendloadDividends () const override
 Optional load dividends method. More...
 
bool hasQuotes (const QuantLib::Date &d) const override
 check if there are quotes for a date More...
 
virtual void add (QuantLib::Date date, const string &name, QuantLib::Real value)
 
virtual void addFixing (QuantLib::Date date, const string &name, QuantLib::Real value)
 
virtual void addDividend (const QuantExt::Dividend &dividend)
 
void reset ()
 
- Public Member Functions inherited from Loader
virtual ~Loader ()
 
virtual bool has (const std::string &name, const QuantLib::Date &d) const
 Default implementation, returns false if get throws or returns a null pointer. More...
 
virtual QuantLib::ext::shared_ptr< MarketDatumget (const std::pair< std::string, bool > &name, const QuantLib::Date &d) const
 
virtual bool hasFixing (const string &name, const QuantLib::Date &d) const
 
virtual Fixing getFixing (const string &name, const QuantLib::Date &d) const
 Default implementation for getFixing. More...
 
void setActualDate (const QuantLib::Date &d)
 
const Date & actualDate () const
 
std::pair< bool, string > checkFxDuplicate (const ext::shared_ptr< MarketDatum >, const QuantLib::Date &)
 

Private Attributes

ore::data::AdjustmentFactors factors_
 

Additional Inherited Members

- Protected Attributes inherited from InMemoryLoader
std::map< QuantLib::Date, std::set< QuantLib::ext::shared_ptr< MarketDatum >, SharedPtrMarketDatumComparator > > data_
 
std::set< Fixingfixings_
 
std::set< QuantExt::Dividenddividends_
 
- Protected Attributes inherited from Loader
Date actualDate_ = Date()
 

Detailed Description

An Adjusted In Memory Loader,.

Definition at line 29 of file adjustedinmemoryloader.hpp.

Constructor & Destructor Documentation

◆ AdjustedInMemoryLoader()

Definition at line 31 of file adjustedinmemoryloader.hpp.

31: factors_(factors){};
ore::data::AdjustmentFactors factors_

Member Function Documentation

◆ add()

void add ( QuantLib::Date  date,
const std::string &  name,
QuantLib::Real  value 
)
overridevirtual

Reimplemented from InMemoryLoader.

Definition at line 24 of file adjustedinmemoryloader.cpp.

24 {
25 Real factor = 1.0;
26 try {
27 auto datum = parseMarketDatum(date, name, Null<Real>());
28 if (auto eqDatum = QuantLib::ext::dynamic_pointer_cast<EquitySpotQuote>(datum))
29 factor = factors_.getFactor(eqDatum->eqName(), date);
30 else if (auto eqDatum = QuantLib::ext::dynamic_pointer_cast<EquityForwardQuote>(datum))
31 factor = factors_.getFactor(eqDatum->eqName(), date);
32 } catch (const std::exception& e) {
33 DLOG("AdjustedInMemoryLoader failure on " << name << ": " << e.what());
34 }
35 InMemoryLoader::add(date, name, value * factor);
36}
QuantLib::Real getFactor(const std::string &name, const QuantLib::Date &d) const
Returns the adjustment factor for a name on a given date.
virtual void add(QuantLib::Date date, const string &name, QuantLib::Real value)
SafeStack< ValueType > value
QuantLib::ext::shared_ptr< MarketDatum > parseMarketDatum(const Date &asof, const string &datumName, const Real &value)
Function to parse a market datum.
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
string name
+ Here is the call graph for this function:

◆ addFixing()

void addFixing ( QuantLib::Date  date,
const std::string &  name,
QuantLib::Real  value 
)
overridevirtual

Reimplemented from InMemoryLoader.

Definition at line 38 of file adjustedinmemoryloader.cpp.

38 {
39 Real factor = 1.0;
40 try {
41 auto ind = parseEquityIndex(name);
42 factor = factors_.getFactor(ind->name(), date);
43 } catch (...) {
44 }
45 InMemoryLoader::addFixing(date, name, value * factor);
46}
virtual void addFixing(QuantLib::Date date, const string &name, QuantLib::Real value)
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > parseEquityIndex(const string &s)
Convert std::string (e.g SP5) to QuantExt::EquityIndex.
+ Here is the call graph for this function:

◆ adjustmentFactors()

ore::data::AdjustmentFactors adjustmentFactors ( ) const

Definition at line 39 of file adjustedinmemoryloader.hpp.

39{ return factors_; }

Member Data Documentation

◆ factors_

ore::data::AdjustmentFactors factors_
private

Definition at line 42 of file adjustedinmemoryloader.hpp.