21#include <ql/time/calendars/nullcalendar.hpp>
22#include <boost/algorithm/string/case_conv.hpp>
25using namespace::QuantLib;
26using boost::algorithm::to_upper_copy;
31 map<string, QuantLib::ext::shared_ptr<EquityIndex2>> cache;
32 QuantLib::ext::shared_ptr<EquityIndex2> index;
33 std::string lastIndexName;
34 for (
auto& d: dividends) {
36 if (lastIndexName != d.name) {
37 index = QuantLib::ext::make_shared<EquityIndex2>(d.name, NullCalendar(), Currency());
38 lastIndexName = d.name;
40 index->addDividend(d,
true);
56 return out << dividend.
name <<
"," << dividend.
exDate;
62 return data_[to_upper_copy(name)].value();
66 data_[to_upper_copy(name)] = history;
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
void clearHistory(const std::string &name)
bool hasHistory(const std::string &name) const
returns whether historical fixings were stored for the index
equity index class for holding equity fixing histories and forwarding.
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.
std::string name
Index name.
QuantLib::Date exDate
Ex dividend date.