Skip to content

Commit 217c3dc

Browse files
committed
Merge branch 'master' into 'master'
update from master Closes QPR-12189 See merge request qs/quantlib-github!2
2 parents e239f95 + 0fd143c commit 217c3dc

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

ql/pricingengines/swaption/blackswaptionengine.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ namespace QuantLib {
229229
// the part of the swap preceding exerciseDate should be truncated
230230
// to avoid taking into account unwanted cashflows
231231
// for the moment we add a check avoiding this situation
232-
auto swap = arguments_.swap;
233-
auto swapOis = arguments_.swapOis;
232+
// Furthermore, we take a copy of the underlying swap. This avoids notifying the swaption
233+
// when we set a pricing engine on the swap below.
234+
auto swap = arguments_.swap ? boost::make_shared<VanillaSwap>(*arguments_.swap) : nullptr;
235+
auto swapOis = arguments_.swapOis ?
236+
boost::make_shared<OvernightIndexedSwap>(*arguments_.swapOis) :
237+
nullptr;
234238
QL_REQUIRE(swap || swapOis,
235239
"BlackStyleSwaptionEngine: internal error, expected swap or swapOis to be set");
236240
const Leg& fixedLeg = swap ? swap->fixedLeg() : swapOis->fixedLeg();

0 commit comments

Comments
 (0)