Initialise the manager with these flows and indices from the given portfolio.
Initialise the manager-.
66 {
67
68
69 for (auto const& [tradeId,t] : portfolio->trades()) {
70 auto r = t->requiredFixings();
71 r.unsetPayDates();
72 for (auto const& [name, fixingDates] : r.fixingDatesIndices(QuantLib::Date::maxDate())) {
73 std::set<Date> dates;
74 for (const auto& [d, _] : fixingDates) {
75 dates.insert(d);
76 }
77 try {
79 if (auto index = QuantLib::ext::dynamic_pointer_cast<EquityIndex2>(rawIndex)) {
80
81 fixingMap_[*market->equityCurve(index->familyName(), configuration)].insert(dates.begin(),
82 dates.end());
83 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<BondIndex>(rawIndex)) {
84 QL_FAIL("BondIndex not handled");
85 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<CommodityIndex>(rawIndex)) {
86
87 Date safeExpiryDate = index->expiryDate();
88 if (safeExpiryDate != Date() && !index->keepDays()) {
89 safeExpiryDate = Date::endOfMonth(safeExpiryDate);
90 }
92 market->commodityPriceCurve(index->underlyingName(), configuration))]
93 .insert(dates.begin(), dates.end());
94 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<FxIndex>(rawIndex)) {
95 fixingMap_[*market->fxIndex(index->oreName(), configuration)].insert(dates.begin(), dates.end());
96 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<GenericIndex>(rawIndex)) {
97 QL_FAIL("GenericIndex not handled");
98 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<ConstantMaturityBondIndex>(rawIndex)) {
99 QL_FAIL("ConstantMaturityBondIndex not handled");
100 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<IborIndex>(rawIndex)) {
101 fixingMap_[*market->iborIndex(name, configuration)].insert(dates.begin(), dates.end());
102 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<SwapIndex>(rawIndex)) {
103 fixingMap_[*market->swapIndex(name, configuration)].insert(dates.begin(), dates.end());
104 } else if (auto index = QuantLib::ext::dynamic_pointer_cast<ZeroInflationIndex>(rawIndex)) {
105 fixingMap_[*market->zeroInflationIndex(name, configuration)].insert(dates.begin(), dates.end());
106 }
107 } catch (const std::exception& e) {
108 ALOG(
"FixingManager: error " << e.what() <<
" - no fixings are added for '" << name <<
"'");
109 }
110 TLOG(
"Added " << dates.size() <<
" fixing dates for '" << name <<
"'");
111 }
112 }
113
114
116 fixingCache_[m.first] = IndexManager::instance().getHistory(m.first->name());
117 }
118}
QuantLib::ext::shared_ptr< Index > parseIndex(const string &s)