35 {
37 applyIndexing(leg, data, engineFactory, requiredFixings, openEndDateReplacement, useXbsCurves);
39 if (
data.legType() ==
"Fixed" && !
data.isNotResetXCCY()) {
40
41 QL_REQUIRE(!
data.fxIndex().empty(),
"FixedLegBuilder: need fx index for fx resetting leg");
43 configuration, true);
44
45
46 Size j = 0;
47 if (
data.notionals().size() == 0) {
48 DLOG(
"Building FX Resettable with unspecified domestic notional");
49 } else {
50
51 LOG(
"Building FX Resettable with first domestic notional specified explicitly");
52 j = 1;
53 }
54
55 for (; j < leg.size(); ++j) {
56 QuantLib::ext::shared_ptr<FixedRateCoupon> coupon = QuantLib::ext::dynamic_pointer_cast<FixedRateCoupon>(leg[j]);
57 Date
fixingDate = fxIndex->fixingCalendar().advance(coupon->accrualStartDate(),
58 -static_cast<Integer>(fxIndex->fixingDays()), Days);
59 QuantLib::ext::shared_ptr<FixedRateFXLinkedNotionalCoupon> fxLinkedCoupon =
60 QuantLib::ext::make_shared<FixedRateFXLinkedNotionalCoupon>(fixingDate,
data.foreignAmount(), fxIndex, coupon);
61 leg[j] = fxLinkedCoupon;
62
63
64 requiredFixings.addFixingDate(fixingDate,
data.fxIndex(), fxLinkedCoupon->date());
65 }
66 }
67 return leg;
68}
#define LOG(text)
Logging Macro (Level = Notice)
#define DLOG(text)
Logging Macro (Level = Debug)
QuantLib::Date fixingDate(const QuantLib::Date &d, const QuantLib::Period obsLag, const QuantLib::Frequency freq, bool interpolated)
void applyIndexing(Leg &leg, const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, RequiredFixings &requiredFixings, const QuantLib::Date &openEndDateReplacement, const bool useXbsCurves)
void addToRequiredFixings(const QuantLib::Leg &leg, const QuantLib::ext::shared_ptr< FixingDateGetter > &fixingDateGetter)
Leg makeFixedLeg(const LegData &data, 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)