@@ -325,13 +325,16 @@ void CreditDefaultSwapOption::buildDefaulted(const boost::shared_ptr<EngineFacto
325325 amount *= -1.0 ;
326326 }
327327
328+ Position::Type positionType = parsePositionType (option_.longShort ());
329+ Real indicatorLongShort = positionType == Position::Long ? 1.0 : -1.0 ;
330+
328331 // Use the add premiums method to add the payment.
329332 string marketConfig = Market::defaultConfiguration;
330333 auto ccy = parseCurrency (notionalCurrency_);
331334 vector<boost::shared_ptr<Instrument>> additionalInstruments;
332335 vector<Real> additionalMultipliers;
333336 Date premiumPayDate =
334- addPremiums (additionalInstruments, additionalMultipliers, 1.0 ,
337+ addPremiums (additionalInstruments, additionalMultipliers, indicatorLongShort ,
335338 PremiumData (amount, notionalCurrency_, paymentDate), 1.0 , ccy, engineFactory, marketConfig);
336339 DLOG (" FEP payment (date = " << paymentDate << " , amount = " << amount << " ) added for CDS option " << id () << " ." );
337340
@@ -346,8 +349,6 @@ void CreditDefaultSwapOption::buildDefaulted(const boost::shared_ptr<EngineFacto
346349 addPremium (engineFactory, ccy, marketConfig, additionalInstruments, additionalMultipliers);
347350
348351 // Instrument wrapper.
349- Position::Type positionType = parsePositionType (option_.longShort ());
350- Real indicatorLongShort = positionType == Position::Long ? 1.0 : -1.0 ;
351352 instrument_ = boost::make_shared<VanillaInstrument>(qlInst, indicatorLongShort,
352353 additionalInstruments, additionalMultipliers);
353354}
@@ -361,8 +362,8 @@ Date CreditDefaultSwapOption::addPremium(const boost::shared_ptr<EngineFactory>&
361362 // pay the premium if long the option and receive the premium if short the option.
362363 Position::Type positionType = parsePositionType (option_.longShort ());
363364 Real indicatorLongShort = positionType == Position::Long ? 1.0 : -1.0 ;
364- return addPremiums (additionalInstruments, additionalMultipliers, 1.0 , option_.premiumData (), indicatorLongShort ,
365- tradeCurrency, ef, marketConfig);
365+ return addPremiums (additionalInstruments, additionalMultipliers, indicatorLongShort , option_.premiumData (),
366+ indicatorLongShort, tradeCurrency, ef, marketConfig);
366367}
367368
368369}
0 commit comments