Skip to content

Commit 1a167b4

Browse files
mgronckijenkins
authored andcommitted
QPR-12148 bugfix
1 parent 412f63d commit 1a167b4

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

OREAnalytics/orea/engine/parsensitivityutilities.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <orea/engine/parsensitivityutilities.hpp>
20+
#include <ored/utilities/log.hpp>
2021
#include <ql/instruments/creditdefaultswap.hpp>
2122
#include <ql/instruments/forwardrateagreement.hpp>
2223
#include <ql/instruments/makecapfloor.hpp>
@@ -28,6 +29,7 @@
2829
#include <ql/pricingengine.hpp>
2930
#include <ql/pricingengines/capfloor/bacheliercapfloorengine.hpp>
3031
#include <ql/pricingengines/capfloor/blackcapfloorengine.hpp>
32+
#include <ql/quotes/simplequote.hpp>
3133
#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
3234
#include <qle/instruments/brlcdiswap.hpp>
3335
#include <qle/instruments/crossccybasismtmresetswap.hpp>
@@ -55,15 +57,16 @@ class ImpliedCapFloorVolHelper {
5557
public:
5658
ImpliedCapFloorVolHelper(
5759
const QuantLib::Instrument& cap,
58-
const std::function<QuantLib::ext::shared_ptr<PricingEngine>(const Handle<Quote>)> engineGenerator,
60+
const std::function<QuantLib::ext::shared_ptr<QuantLib::PricingEngine>(const QuantLib::Handle<Quote>)>
61+
engineGenerator,
5962
const Real targetValue);
6063
Real operator()(Volatility x) const;
6164
Real derivative(Volatility x) const;
6265

6366
private:
6467
Real targetValue_;
6568
QuantLib::ext::shared_ptr<PricingEngine> engine_;
66-
QuantLib::ext::shared_ptr<SimpleQuote> vol_;
69+
QuantLib::ext::shared_ptr<QuantLib::SimpleQuote> vol_;
6770
const Instrument::results* results_;
6871
};
6972

@@ -200,7 +203,7 @@ Volatility impliedVolatilityWrapper(const CapFloorType& cap, Real targetValue, c
200203
// 2. Try to get implied Vol with defaults
201204
TLOG("Getting impliedVolatility for cap (" << cap.maturityDate() << " strike " << strikeStr << ")");
202205
try {
203-
Volatility vol =
206+
double vol =
204207
impliedVolatilityImpl(cap, targetValue, d, guess, type, displacement, accuracy, maxEvaluations,
205208
minVolLognormal, maxVolLognormal, minVolNormal, maxVolNormal, index);
206209
TLOG("Got vol " << vol << " on first attempt");

OREAnalytics/orea/engine/parsensitivityutilities.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ double impliedVolatility(const QuantLib::CapFloor& cap, double targetValue,
4444
double impliedVolatility(const QuantLib::YoYInflationCapFloor& cap, double targetValue,
4545
const QuantLib::Handle<QuantLib::YieldTermStructure>& d, double guess,
4646
QuantLib::VolatilityType type, double displacement,
47-
const Handle<YoYInflationIndex>& index = {});
47+
const QuantLib::Handle<YoYInflationIndex>& index = {});
4848

4949
} // namespace analytics
5050
} // namespace ore

0 commit comments

Comments
 (0)