Skip to content

Commit 95f85e3

Browse files
NathanielVolfangojenkins
authored andcommitted
QPR-11462 -- Remove handling of multiple SIMM result/calc ccys to handle PnL conversion more easily, and since we do not use this in SIMM BT at the moment (and it is incomplete anyway, so is meaningless for the BT).
1 parent 4cdc4d0 commit 95f85e3

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

OREAnalytics/orea/engine/marketriskbacktest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void MarketRiskBacktest::reset(const QuantLib::ext::shared_ptr<MarketRiskGroup>&
370370

371371
void MarketRiskBacktest::addPnlRow(const QuantLib::ext::shared_ptr<BacktestReports>& reports, Size scenarioIdx,
372372
bool isCall, const RiskFactorKey& key_1, Real shift_1, Real delta, Real gamma, Real deltaPnl, Real gammaPnl,
373-
const RiskFactorKey& key_2, Real shift_2, const string& tradeId) {
373+
const RiskFactorKey& key_2, Real shift_2, const string& tradeId, const string& currency, Real fxSpot) {
374374

375375
// Do we have a report to write to?
376376
// Is this too slow to do on every call to addPnlRow? Need to find the report each time in any case.
@@ -401,9 +401,9 @@ void MarketRiskBacktest::addPnlRow(const QuantLib::ext::shared_ptr<BacktestRepor
401401
.add(gamma)
402402
.add(shift_1)
403403
.add(shift_2)
404-
.add(deltaPnl)
405-
.add(gammaPnl)
406-
.add(calculationCurrency_);
404+
.add(currency.empty() || currency == calculationCurrency_ ? deltaPnl : deltaPnl / fxSpot)
405+
.add(currency.empty() || currency == calculationCurrency_ ? gammaPnl : gammaPnl / fxSpot)
406+
.add(currency.empty() ? calculationCurrency_ : currency);
407407
}
408408

409409
void BacktestPNLCalculator::writePNL(Size scenarioIdx, bool isCall, const RiskFactorKey& key_1, Real shift_1,

OREAnalytics/orea/engine/marketriskbacktest.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ class MarketRiskBacktest : public ore::analytics::MarketRiskReport {
142142

143143
//! Add a row to the P&L contribution report
144144
virtual void addPnlRow(const QuantLib::ext::shared_ptr<BacktestReports>& reports, QuantLib::Size scenarioIdx,
145-
bool isCall,
146-
const ore::analytics::RiskFactorKey& key_1, QuantLib::Real shift_1, QuantLib::Real delta, QuantLib::Real gamma,
147-
QuantLib::Real deltaPnl, QuantLib::Real gammaPnl, const ore::analytics::RiskFactorKey& key_2 = ore::analytics::RiskFactorKey(),
148-
QuantLib::Real shift_2 = 0.0, const std::string& tradeId = "");
145+
bool isCall, const ore::analytics::RiskFactorKey& key_1, QuantLib::Real shift_1,
146+
QuantLib::Real delta, QuantLib::Real gamma, QuantLib::Real deltaPnl, QuantLib::Real gammaPnl,
147+
const ore::analytics::RiskFactorKey& key_2 = ore::analytics::RiskFactorKey(),
148+
QuantLib::Real shift_2 = 0.0, const std::string& tradeId = "",
149+
const std::string& currency = "", QuantLib::Real fxSpot = 1.0);
149150

150151
protected:
151152
std::unique_ptr<BacktestArgs> btArgs_;

0 commit comments

Comments
 (0)