25#include <ql/cashflows/fixedratecoupon.hpp>
26#include <ql/cashflows/simplecashflow.hpp>
27#include <ql/time/calendars/weekendsonly.hpp>
28#include <ql/time/daycounters/one.hpp>
41 const QuantLib::Date& openEndDateReplacement,
const bool useXbsCurves)
const {
42 auto eqMarginData = QuantLib::ext::dynamic_pointer_cast<EquityMarginLegData>(
data.concreteLegData());
43 QL_REQUIRE(eqMarginData,
"Wrong LegType, expected EquityMargin");
45 QuantLib::ext::shared_ptr<EquityLegData> eqData = eqMarginData->equityLegData();
47 string eqName = eqData->eqName();
48 auto eqCurve = *engineFactory->market()->equityCurve(eqName, configuration);
51 Currency eqCurrency = eqCurve->currency();
53 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex =
nullptr;
55 if (dataCurrency != eqCurrency) {
56 QL_REQUIRE(eqData->fxIndex() !=
"",
57 "No FxIndex - if equity currency differs from leg currency an FxIndex must be provided");
58 fxIndex =
buildFxIndex(eqData->fxIndex(),
data.currency(), eqCurrency.code(), engineFactory->market(),
63 addToRequiredFixings(result, QuantLib::ext::make_shared<ore::data::FixingDateGetter>(requiredFixings));
QuantLib::Leg buildLeg(const ore::data::LegData &data, const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &engineFactory, ore::data::RequiredFixings &requiredFixings, const std::string &configuration, const QuantLib::Date &openEndDateReplacement=QuantLib::Null< QuantLib::Date >(), const bool useXbsCurves=false) const override
Serializable object holding leg data.
Equity & FX leg builders.
leg data for equityfx leg types
Logic for calculating required fixing dates on legs.
Currency parseCurrencyWithMinors(const string &s)
Convert text to QuantLib::Currency.
Classes and functions for log message handling.
market data related utilties
void addToRequiredFixings(const QuantLib::Leg &leg, const QuantLib::ext::shared_ptr< FixingDateGetter > &fixingDateGetter)
QuantExt::Leg makeEquityMarginLeg(const LegData &data, const QuantLib::ext::shared_ptr< EquityIndex2 > &equityCurve, const QuantLib::ext::shared_ptr< QuantExt::FxIndex > &fxIndex, const QuantLib::Date &openEndDateReplacement)
QuantLib::ext::shared_ptr< QuantExt::FxIndex > buildFxIndex(const string &fxIndex, const string &domestic, const string &foreign, const QuantLib::ext::shared_ptr< Market > &market, const string &configuration, bool useXbsCurves)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.