File tree Expand file tree Collapse file tree
ql/pricingengines/swaption Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments