Skip to content

Commit 6dded58

Browse files
author
sebastien.bouvard
committed
QPR-13776 Handle when there is not additionalFields
1 parent a994243 commit 6dded58

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

OREData/ored/portfolio/riskparticipationagreement.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ void RiskParticipationAgreement::buildWithSwapUnderlying(const QuantLib::ext::sh
192192
engineFactory->configuration(MarketContext::pricing))
193193
->value());
194194
}
195-
notional_ = envelope().additionalField("im_model") == "Schedule" ? notional_ * participationRate_ : notional_;
195+
for(auto const& af: envelope().additionalFields()){
196+
if(af.first == "im_model" && af.second =="Schedule")
197+
notional_ = notional_ * participationRate_;
198+
}
196199
legs_ = underlyingLegs;
197200
legCurrencies_ = underlyingCcys;
198201
legPayers_ = underlyingPayer;
@@ -238,7 +241,11 @@ void RiskParticipationAgreement::buildWithTlockUnderlying(const QuantLib::ext::s
238241
// set currency and notional
239242

240243
npvCurrency_ = notionalCurrency_ = tlockData_.bondData().currency();
241-
notional_ = envelope().additionalField("im_model") == "Schedule" ? tlockData_.bondData().bondNotional() * participationRate_ : tlockData_.bondData().bondNotional();
244+
notional_ = tlockData_.bondData().bondNotional();
245+
for(auto const& af: envelope().additionalFields()){
246+
if(af.first == "im_model" && af.second =="Schedule")
247+
notional_ = notional_ * participationRate_;
248+
}
242249

243250
// checks
244251

0 commit comments

Comments
 (0)