23#ifndef quantext_divdendmanager_hpp
24#define quantext_divdendmanager_hpp
26#include <ql/patterns/singleton.hpp>
27#include <ql/timeseries.hpp>
28#include <ql/utilities/observablevalue.hpp>
34 QuantLib::Date
exDate = QuantLib::Date();
36 std::string
name = std::string();
38 QuantLib::Real
rate = QuantLib::Null<QuantLib::Real>();
40 QuantLib::Date
payDate = QuantLib::Date();
44 Dividend(
const QuantLib::Date& ed,
const std::string& s,
const QuantLib::Real r,
const QuantLib::Date& pd)
47 return name.empty() &&
exDate == QuantLib::Date() &&
rate == QuantLib::Null<QuantLib::Real>() &&
53bool operator==(
const Dividend& d1,
const Dividend& d);
54bool operator<(
const Dividend& d1,
const Dividend& d2);
55std::ostream&
operator<<(std::ostream&, Dividend);
70 bool hasHistory(
const std::string& name)
const;
72 const std::set<Dividend>&
getHistory(
const std::string& name);
74 void setHistory(
const std::string& name,
const std::set<Dividend>&);
76 QuantLib::ext::shared_ptr<QuantLib::Observable>
notifier(
const std::string& name);
81 typedef std::map<std::string, QuantLib::ObservableValue<std::set<Dividend>>>
history_map;
global repository for past dividends
DividendManager()=default
void setHistory(const std::string &name, const std::set< Dividend > &)
stores the historical fixings of the index
const std::set< Dividend > & getHistory(const std::string &name)
returns the (possibly empty) history of the index fixings
QuantLib::ext::shared_ptr< QuantLib::Observable > notifier(const std::string &name)
observer notifying of changes in the index fixings
std::map< std::string, QuantLib::ObservableValue< std::set< Dividend > > > history_map
void clearHistory(const std::string &name)
bool hasHistory(const std::string &name) const
returns whether historical fixings were stored for the index
bool operator<(const Dividend &d1, const Dividend &d2)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
bool operator==(const Dividend &d1, const Dividend &d2)
Compare dividends.
void applyDividends(const set< Dividend > ÷nds)
Utility to write a set of dividends in the dividend manager's history.
Dividend(const QuantLib::Date &ed, const std::string &s, const QuantLib::Real r, const QuantLib::Date &pd)
QuantLib::Real rate
Dividend rate.
std::string name
Index name.
QuantLib::Date payDate
Dividend Payment date.
QuantLib::Date exDate
Ex dividend date.