28 {
29 auto formulaData = QuantLib::ext::dynamic_pointer_cast<FormulaBasedLegData>(
data.concreteLegData());
30 QL_REQUIRE(formulaData, "Wrong LegType, expected Formula");
31 string formula = formulaData->formulaBasedIndex();
32 Calendar cal;
33 if (formulaData->fixingCalendar() != "")
35 std::map<std::string, QuantLib::ext::shared_ptr<QuantLib::InterestRateIndex>> indexMaps;
36 auto formulaIndex =
38 Leg result =
makeFormulaBasedLeg(data, formulaIndex, engineFactory, indexMaps, openEndDateReplacement);
39
40 for (auto const& m : indexMaps) {
41 for (auto const& c : result) {
42 auto f = QuantLib::ext::dynamic_pointer_cast<FloatingRateCoupon>(c);
43 QL_REQUIRE(f != nullptr, "expected FloatingRateCoupon in FormulaBasedLegBuilder");
44 requiredFixings.
addFixingDate(f->fixingDate(), m.first, f->date(),
false);
45 }
46 }
47 return result;
48}
void addFixingDate(const QuantLib::Date &fixingDate, const std::string &indexName, const QuantLib::Date &payDate=Date::maxDate(), const bool alwaysAddIfPaysOnSettlement=false, const bool mandatoryFixing=true)
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
QuantLib::ext::shared_ptr< QuantExt::FormulaBasedIndex > makeFormulaBasedIndex(const std::string &formula, const QuantLib::ext::shared_ptr< ore::data::Market > market, const std::string &configuration, std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > > &indexMaps, const Calendar &fixingCalendar)
Leg makeFormulaBasedLeg(const LegData &data, const QuantLib::ext::shared_ptr< QuantExt::FormulaBasedIndex > &formulaBasedIndex, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > > &indexMaps, const QuantLib::Date &openEndDateReplacement)