Skip to content

Commit 0ac33a6

Browse files
author
jenkins
committed
git subrepo pull (merge) ore
subrepo: subdir: "ore" merged: "684e540572" upstream: origin: "git@gitlab.acadiasoft.net:qs/ore.git" branch: "master" commit: "127314a796" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "73a0129"
2 parents 4432853 + 127314a commit 0ac33a6

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

OREData/ored/portfolio/legdata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ Leg makeCPILeg(const LegData& data, const boost::shared_ptr<ZeroInflationIndex>&
16491649
CPI::InterpolationType interpolationMethod;
16501650
if (cpiLegData->interpolation().empty()) {
16511651
QL_REQUIRE(cpiSwapConvention,
1652-
"observationLag is not specified in legData and couldn't find convention for "
1652+
"Interpolation is not specified in legData and couldn't find convention for "
16531653
<< cpiLegData->index() << ". Please add field to trade xml or add convention");
16541654
DLOG("Build CPI Leg and use observation lag from standard inflationswap convention");
16551655
interpolationMethod = cpiSwapConvention->interpolated() ? CPI::Linear : CPI::Flat;

QuantExt/qle/pricingengines/numericalintegrationindexcdsoptionengine.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,19 @@ void NumericalIntegrationIndexCdsOptionEngine::doCalc() const {
223223
};
224224

225225
Real fepAdjustedForwardSpread;
226-
Brent brent;
227-
brent.setLowerBound(1.0E-8);
228-
try {
229-
fepAdjustedForwardSpread = brent.solve(target, 1.0E-7, arguments_.swap->fairSpreadClean(), 0.0001);
230-
} catch (const std::exception& e) {
231-
QL_FAIL(
232-
"NumericalIntegrationIndexCdsOptionEngine::doCalc(): failed to calibrate forward spread: " << e.what());
226+
if (target(0.0) > 0.0) {
227+
// the target function might not have a zero, because of the continuous annuity approximation
228+
// in some extreme situations (e.g. survival prob = 1 everywhere)
229+
fepAdjustedForwardSpread = 0.0;
230+
} else {
231+
Brent brent;
232+
brent.setLowerBound(0.0);
233+
try {
234+
fepAdjustedForwardSpread = brent.solve(target, 1.0E-7, arguments_.swap->fairSpreadClean(), 0.0001);
235+
} catch (const std::exception& e) {
236+
QL_FAIL("NumericalIntegrationIndexCdsOptionEngine::doCalc(): failed to calibrate forward spread: "
237+
<< e.what());
238+
}
233239
}
234240
results_.additionalResults["fepAdjustedForwardSpread"] = fepAdjustedForwardSpread;
235241
results_.additionalResults["forwardSpread"] = arguments_.swap->fairSpreadClean();

0 commit comments

Comments
 (0)