@@ -82,8 +82,10 @@ void IndexCreditDefaultSwapOption::build(const QuantLib::ext::shared_ptr<EngineF
8282 asof = Settings::instance ().evaluationDate ();
8383 }
8484
85+ bool defaultTradeDateIsUsed = false ;
8586 if (tradeDate_ == Date ()) {
8687 tradeDate_ = asof;
88+ defaultTradeDateIsUsed = true ;
8789 } else {
8890 QL_REQUIRE (tradeDate_ <= asof, " Trade date (" << io::iso_date (tradeDate_) << " ) should be on or "
8991 << " before the valuation date (" << io::iso_date (asof) << " )" );
@@ -182,12 +184,25 @@ void IndexCreditDefaultSwapOption::build(const QuantLib::ext::shared_ptr<EngineF
182184
183185 // Populate the constituents and determine the various notional amounts.
184186 constituents_.clear ();
187+ defaultHasOccured_ = false ;
185188 if (swap_.basket ().constituents ().size () > 1 ) {
186189 fromBasket (asof, constituents_);
187190 } else {
188191 fromReferenceData (asof, constituents_, engineFactory->referenceData ());
189192 }
190193
194+ // Check if a default trade date might lead to an inaccurate valuation
195+ if (defaultTradeDateIsUsed && defaultHasOccured_) {
196+ StructuredTradeWarningMessage (id (), tradeType (), " Results might be inaccurate, because no trade date is given." ,
197+ " No trade date is given and there were defaults in the underlying index. This "
198+ " might lead to wrong notional and realized fep amounts. The trade date is "
199+ " assumed to be the valuation date (" +
200+ ore::data::to_string (tradeDate_) +
201+ " ). If this is not correct, consider "
202+ " populating the trade date." )
203+ .log ();
204+ }
205+
191206 // Transfer to vectors for ctors below
192207 vector<string> constituentIds;
193208 constituentIds.reserve (constituents_.size ());
@@ -510,6 +525,8 @@ void IndexCreditDefaultSwapOption::fromBasket(const Date& asof, map<string, Real
510525 notionals_.realisedFep += fepAmount;
511526 }
512527
528+ defaultHasOccured_ = true ;
529+
513530 } else if (ntl > 0.0 ) {
514531
515532 // Entity is still in the index.
@@ -620,6 +637,8 @@ void IndexCreditDefaultSwapOption::fromReferenceData(const Date& asof, map<strin
620637 notionals_.realisedFep += fepAmount;
621638 }
622639
640+ defaultHasOccured_ = true ;
641+
623642 } else if (weight > 0.0 ) {
624643
625644 // Entity is still in the index.
0 commit comments