Skip to content

Commit ebb19ae

Browse files
author
Damien Barker
committed
QPR-13085 Catch tradeGroup/portfolio with no trades for backtesting
1 parent 632bd16 commit ebb19ae

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

OREAnalytics/orea/engine/marketriskreport.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <ored/marketdata/todaysmarket.hpp>
2020
#include <ored/portfolio/trade.hpp>
2121
#include <ored/utilities/to_string.hpp>
22+
#include <orea/app/structuredanalyticserror.hpp>
2223
#include <orea/cube/cubewriter.hpp>
2324
#include <orea/cube/inmemorycube.hpp>
2425
#include <orea/cube/npvcube.hpp>
@@ -316,6 +317,14 @@ void MarketRiskReport::calculate(const ext::shared_ptr<MarketRiskReport::Reports
316317

317318
writePnl_ = tradeGroup->allLevel() && riskGroup->allLevel();
318319
tradeIdIdxPairs_ = tradeIdGroups_.at(tradeGroupKey(tradeGroup));
320+
if (tradeIdIdxPairs_.size() == 0) {
321+
StructuredAnalyticsErrorMessage(
322+
"Market Risk Backtest", "No trades for tradeGroup",
323+
"No trades to process for RiskGroup: " + riskGroup->to_string() + ", TradeGroup: "
324+
+ tradeGroup->to_string())
325+
.log();
326+
continue;
327+
}
319328

320329
// populate the tradeIds
321330
transform(tradeIdIdxPairs_.begin(), tradeIdIdxPairs_.end(), back_inserter(tradeIds_),

0 commit comments

Comments
 (0)