Skip to content

Commit c2d2897

Browse files
alexchow-acadiajenkins
authored andcommitted
Fix a bug where capfloor fails to build when there are more than one quotes with same currency, same quote type, same strike, same tenor but different index
1 parent 48e20d8 commit c2d2897

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

OREData/ored/marketdata/capfloorvolcurve.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,10 @@ CapFloorVolCurve::capSurface(const Date& asof, CapFloorVolatilityCurveConfig& co
619619
vector<Period> configTenors = parseVectorOfValues<Period>(config.tenors(), &parsePeriod);
620620

621621
std::ostringstream ss;
622-
ss << MarketDatum::InstrumentType::CAPFLOOR << "/" << config.quoteType() << "/" << currency << "/*";
622+
ss << MarketDatum::InstrumentType::CAPFLOOR << "/" << config.quoteType() << "/" << currency << "/";
623+
if (config.quoteIncludesIndexName())
624+
ss << config.index() << "/";
625+
ss << "*";
623626
Wildcard w(ss.str());
624627
for (const auto& md : loader.get(w, asof)) {
625628
QL_REQUIRE(md->asofDate() == asof, "MarketDatum asofDate '" << md->asofDate() << "' <> asof '" << asof << "'");
@@ -650,8 +653,12 @@ CapFloorVolCurve::capSurface(const Date& asof, CapFloorVolatilityCurveConfig& co
650653
}
651654
auto key = make_pair(cfq->term(), cfq->strike());
652655
auto r = volQuotes.insert(make_pair(key, cfq->quote()->value()));
653-
QL_REQUIRE(r.second, "Duplicate cap floor quote in config " << config.curveID() << ", with underlying tenor " << tenor <<
654-
" and currency " << currency << ", for tenor " << key.first << " and strike " << key.second);
656+
if (config.quoteIncludesIndexName())
657+
QL_REQUIRE(r.second, "Duplicate cap floor quote in config " << config.curveID() << ", with underlying tenor " << tenor <<
658+
" ,currency " << currency << " and index " << config.index() << ", for tenor " << key.first << " and strike " << key.second);
659+
else
660+
QL_REQUIRE(r.second, "Duplicate cap floor quote in config " << config.curveID() << ", with underlying tenor " << tenor <<
661+
" and currency " << currency << ", for tenor " << key.first << " and strike " << key.second);
655662
}
656663
}
657664
}

0 commit comments

Comments
 (0)