Skip to content

Commit ad7692b

Browse files
author
sebastien.bouvard
committed
QPR-13626 Duplicate workaround for risk factor pnl report
1 parent aba2011 commit ad7692b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

OREAnalytics/orea/engine/historicalsimulationvar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void HistoricalSimulationVarReport::writeAdditionalReports(
127127
if (riskFactorBreakdown_) {
128128
// The PnL breakdown on risk factors per scenario
129129
QuantLib::ext::shared_ptr<Report> report2 = reports->reports().at(2);
130-
if (s < riskFactorPnls_.size()) {
130+
if (s < riskFactorPnls_.size() && countRF_ < 1) {
131131
for (const auto& r : riskFactorPnls_[s]) {
132132
report2->next();
133133
const auto& key = r.first;
@@ -140,6 +140,7 @@ void HistoricalSimulationVarReport::writeAdditionalReports(
140140
}
141141
}
142142
}
143+
countRF_++;
143144
}
144145

145146
void HistoricalSimulationVarReport::writeHeader(const ext::shared_ptr<Report>& report) const {

OREAnalytics/orea/engine/historicalsimulationvar.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class HistoricalSimulationVarReport : public VarReport {
104104
bool includeExpectedShortfall_ = false;
105105
bool tradePnl_ = false;
106106
bool riskFactorBreakdown_ = false;
107+
int countRF_ = 0;
107108
};
108109

109110
} // namespace analytics

0 commit comments

Comments
 (0)