Skip to content

Commit 4b75f5c

Browse files
pcaspersjenkins
authored andcommitted
QPR-11772 code simplification, we now use the index name translator
1 parent fab6c98 commit 4b75f5c

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

OREData/ored/portfolio/capfloor.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void CapFloor::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
6363

6464
legs_.clear();
6565
boost::shared_ptr<EngineBuilder> builder;
66-
std::string underlyingIndex, qlIndexName;
66+
std::string underlyingIndex;
6767
boost::shared_ptr<QuantLib::Instrument> qlInstrument;
6868

6969
// Account for long / short multiplier. In the following we expect the qlInstrument to be set up
@@ -82,7 +82,6 @@ void CapFloor::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
8282
engineFactory->market()->iborIndex(underlyingIndex, engineFactory->configuration(MarketContext::pricing));
8383
QL_REQUIRE(!hIndex.empty(), "Could not find ibor index " << underlyingIndex << " in market.");
8484
boost::shared_ptr<IborIndex> index = hIndex.currentLink();
85-
qlIndexName = index->name();
8685

8786
QL_REQUIRE(floatData->caps().empty() && floatData->floors().empty(),
8887
"CapFloor build error, Floating leg section must not have caps and floors");
@@ -169,7 +168,6 @@ void CapFloor::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
169168
QL_REQUIRE(!hIndex.empty(), "Could not find swap index " << underlyingIndex << " in market.");
170169

171170
boost::shared_ptr<SwapIndex> index = hIndex.currentLink();
172-
qlIndexName = index->name();
173171

174172
LegData tmpLegData = legData_;
175173
boost::shared_ptr<CMSLegData> tmpFloatData = boost::make_shared<CMSLegData>(*cmsData);
@@ -239,7 +237,6 @@ void CapFloor::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
239237
underlyingIndex = cpiData->index();
240238
Handle<ZeroInflationIndex> zeroIndex = engineFactory->market()->zeroInflationIndex(
241239
underlyingIndex, builder->configuration(MarketContext::pricing));
242-
qlIndexName = zeroIndex->name();
243240

244241
// the cpi leg uses the first schedule date as the start date, which only makes sense if there are at least
245242
// two dates in the schedule, otherwise the only date in the schedule is the pay date of the cf and a a separate
@@ -371,7 +368,6 @@ void CapFloor::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
371368
// look for yoy inflation index
372369
yoyIndex =
373370
engineFactory->market()->yoyInflationIndex(underlyingIndex, builder->configuration(MarketContext::pricing));
374-
qlIndexName = yoyIndex->name();
375371

376372
// we must have either an yoy or a zero inflation index in the market, if no yoy curve, get the zero
377373
// and create a yoy index from it
@@ -449,12 +445,10 @@ void CapFloor::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
449445
instrument_ =
450446
boost::make_shared<VanillaInstrument>(qlInstrument, multiplier, additionalInstruments, additionalMultipliers);
451447

452-
// add required fixings
453-
if (!qlIndexName.empty() && !underlyingIndex.empty()) {
454-
auto fdg = boost::make_shared<FixingDateGetter>(requiredFixings_);
455-
for (auto const& l : legs_)
456-
addToRequiredFixings(l, fdg);
457-
}
448+
// axdd required fixings
449+
auto fdg = boost::make_shared<FixingDateGetter>(requiredFixings_);
450+
for (auto const& l : legs_)
451+
xaddToRequiredFixings(l, fdg);
458452

459453
Date startDate = Date::maxDate();
460454
for (auto const& l : legs_) {

0 commit comments

Comments
 (0)