Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FixedLegBuilder Class Reference

#include <ored/portfolio/legbuilders.hpp>

+ Inheritance diagram for FixedLegBuilder:
+ Collaboration diagram for FixedLegBuilder:

Public Member Functions

 FixedLegBuilder ()
 
Leg buildLeg (const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, RequiredFixings &requiredFixings, const string &configuration, const QuantLib::Date &openEndDateReplacement=Null< Date >(), const bool useXbsCurves=false) const override
 
- Public Member Functions inherited from LegBuilder
 LegBuilder (const string &legType)
 
virtual ~LegBuilder ()
 
virtual Leg buildLeg (const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &, RequiredFixings &requiredFixings, const string &configuration, const QuantLib::Date &openEndDateReplacement=Null< Date >(), const bool useXbsCurves=false) const =0
 
const string & legType () const
 

Detailed Description

Definition at line 34 of file legbuilders.hpp.

Constructor & Destructor Documentation

◆ FixedLegBuilder()

Definition at line 36 of file legbuilders.hpp.

36: LegBuilder("Fixed") {}
LegBuilder(const string &legType)

Member Function Documentation

◆ buildLeg()

Leg buildLeg ( const LegData data,
const QuantLib::ext::shared_ptr< EngineFactory > &  engineFactory,
RequiredFixings requiredFixings,
const string &  configuration,
const QuantLib::Date &  openEndDateReplacement = Null<Date>(),
const bool  useXbsCurves = false 
) const
overridevirtual

Implements LegBuilder.

Definition at line 33 of file legbuilders.cpp.

35 {
36 Leg leg = makeFixedLeg(data, openEndDateReplacement);
37 applyIndexing(leg, data, engineFactory, requiredFixings, openEndDateReplacement, useXbsCurves);
38 addToRequiredFixings(leg, QuantLib::ext::make_shared<FixingDateGetter>(requiredFixings));
39 if (data.legType() == "Fixed" && !data.isNotResetXCCY()) {
40
41 QL_REQUIRE(!data.fxIndex().empty(), "FixedLegBuilder: need fx index for fx resetting leg");
42 auto fxIndex = buildFxIndex(data.fxIndex(), data.currency(), data.foreignCurrency(), engineFactory->market(),
43 configuration, true);
44
45 // If no initial notional is given, all coupons including the first period will be FX linked (i.e resettable)
46 Size j = 0;
47 if (data.notionals().size() == 0) {
48 DLOG("Building FX Resettable with unspecified domestic notional");
49 } else {
50 // given an initial amount (not a resettable period)
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 // Add the FX fixing to the required fixings
64 requiredFixings.addFixingDate(fixingDate, data.fxIndex(), fxLinkedCoupon->date());
65 }
66 }
67 return leg;
68}
@ data
Definition: log.hpp:77
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
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)
Definition: legdata.cpp:2633
void addToRequiredFixings(const QuantLib::Leg &leg, const QuantLib::ext::shared_ptr< FixingDateGetter > &fixingDateGetter)
Leg makeFixedLeg(const LegData &data, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:950
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)
Definition: marketdata.cpp:137
+ Here is the call graph for this function:
+ Here is the caller graph for this function: