@@ -1491,7 +1491,7 @@ void ReportWriter::writeCube(ore::data::Report& report, const boost::shared_ptr<
14911491}
14921492
14931493// Ease notation again
1494- typedef SimmConfiguration ::ProductClass ProductClass;
1494+ typedef CrifRecord ::ProductClass ProductClass;
14951495typedef SimmConfiguration::RiskClass RiskClass;
14961496typedef SimmConfiguration::MarginType MarginType;
14971497typedef SimmConfiguration::SimmSide SimmSide;
@@ -1660,7 +1660,7 @@ void ReportWriter::writeSIMMReport(
16601660 }
16611661}
16621662
1663- void ReportWriter::writeSIMMData (const SimmNetSensitivities & simmData, const boost::shared_ptr<Report>& dataReport,
1663+ void ReportWriter::writeSIMMData (const ore::analytics::Crif & simmData, const boost::shared_ptr<Report>& dataReport,
16641664 const bool hasNettingSetDetails) {
16651665
16661666 LOG (" Writing SIMM data report." );
@@ -1708,7 +1708,7 @@ void ReportWriter::writeSIMMData(const SimmNetSensitivities& simmData, const boo
17081708 // Same check as above, but for backwards compatibility, if im_model is not used
17091709 // but Risk::Type is PV or Notional
17101710 if (cr.imModel .empty () &&
1711- (cr.riskType == SimmConfiguration ::RiskType::Notional || cr.riskType == SimmConfiguration ::RiskType::PV))
1711+ (cr.riskType == CrifRecord ::RiskType::Notional || cr.riskType == CrifRecord ::RiskType::PV))
17121712 continue ;
17131713
17141714 // Write current netted CRIF record
@@ -1743,13 +1743,13 @@ void ReportWriter::writeSIMMData(const SimmNetSensitivities& simmData, const boo
17431743 LOG (" SIMM data report written." );
17441744}
17451745
1746- void ReportWriter::writeCrifReport (const boost::shared_ptr<Report>& report, const SimmNetSensitivities& crifRecords ) {
1746+ void ReportWriter::writeCrifReport (const boost::shared_ptr<Report>& report, const Crif& crif ) {
17471747
17481748 // If we have SIMM parameters, check if at least one of them uses netting set details optional field/s
17491749 // It is easier to check here than to pass the flag from other places, since otherwise we'd have to handle certain edge cases
17501750 // e.g. SIMM parameters use optional NSDs, but trades don't. So SIMM report should not display NSDs, but CRIF report still should.
17511751 bool hasNettingSetDetails = false ;
1752- for (const CrifRecord & cr : crifRecords ) {
1752+ for (const auto & cr : crif ) {
17531753 if (!cr.nettingSetDetails .emptyOptionalFields ())
17541754 hasNettingSetDetails = true ;
17551755 }
@@ -1758,7 +1758,7 @@ void ReportWriter::writeCrifReport(const boost::shared_ptr<Report>& report, cons
17581758 bool hasCollectRegulations = false ;
17591759 bool hasPostRegulations = false ;
17601760 bool hasScheduleTrades = false ;
1761- for (const auto & cr : crifRecords ) {
1761+ for (const auto & cr : crif ) {
17621762 // Check which additional fields are being used/populated
17631763 for (const auto & af : cr.additionalFields ) {
17641764 if (std::find (addFields.begin (), addFields.end (), af.first ) == addFields.end ()) {
@@ -1803,9 +1803,18 @@ void ReportWriter::writeCrifReport(const boost::shared_ptr<Report>& report, cons
18031803 .addColumn (" IMModel" , string ())
18041804 .addColumn (" TradeType" , string ());
18051805
1806- if (hasScheduleTrades)
1806+ if (hasScheduleTrades || crif. type () == Crif::CrifType::Frtb )
18071807 report->addColumn (" end_date" , string ());
18081808
1809+ if (crif.type () == Crif::CrifType::Frtb) {
1810+ report->addColumn (" Label3" , string ())
1811+ .addColumn (" CreditQuality" , string ())
1812+ .addColumn (" LongShortInd" , string ())
1813+ .addColumn (" CoveredBondInd" , string ())
1814+ .addColumn (" TrancheThickness" , string ())
1815+ .addColumn (" BB_RW" , string ());
1816+ }
1817+
18091818 if (hasCollectRegulations)
18101819 report->addColumn (" collect_regulations" , string ());
18111820
@@ -1818,7 +1827,7 @@ void ReportWriter::writeCrifReport(const boost::shared_ptr<Report>& report, cons
18181827 }
18191828
18201829 // Write individual CRIF records
1821- for (const auto & cr : crifRecords ) {
1830+ for (const auto & cr : crif ) {
18221831
18231832 report->next ().add (cr.tradeId ).add (cr.portfolioId );
18241833
@@ -1840,9 +1849,18 @@ void ReportWriter::writeCrifReport(const boost::shared_ptr<Report>& report, cons
18401849 .add (cr.imModel )
18411850 .add (cr.tradeType );
18421851
1843- if (hasScheduleTrades)
1852+ if (hasScheduleTrades || crif. type () == Crif::CrifType::Frtb )
18441853 report->add (cr.endDate );
18451854
1855+ if (crif.type () == Crif::CrifType::Frtb) {
1856+ report->add (cr.label3 )
1857+ .add (cr.creditQuality )
1858+ .add (cr.longShortInd )
1859+ .add (cr.coveredBondInd )
1860+ .add (cr.trancheThickness )
1861+ .add (cr.bb_rw );
1862+ }
1863+
18461864 if (hasCollectRegulations) {
18471865 string regString = escapeCommaSeparatedList (cr.collectRegulations , ' \0 ' );
18481866 report->add (regString);
@@ -1857,7 +1875,7 @@ void ReportWriter::writeCrifReport(const boost::shared_ptr<Report>& report, cons
18571875 if (cr.additionalFields .find (af) == cr.additionalFields .end ())
18581876 report->add (" " );
18591877 else
1860- report->add (cr.additionalFields . at (af));
1878+ report->add (cr.getAdditionalFieldAsStr (af));
18611879 }
18621880 }
18631881
0 commit comments