From 1c4dfbe6dc0a57e1d68984b5fd06f0c740460af1 Mon Sep 17 00:00:00 2001 From: Richard Green Date: Tue, 22 Nov 2016 16:41:30 +0000 Subject: [PATCH] Fixes bug when valuation run on only one trade in the portfolio --- .../src/main/kotlin/net/corda/vega/analytics/OGStub.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt index 106dbc2ee8..b84daf7b73 100644 --- a/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt +++ b/samples/simm-valuation-demo/src/main/kotlin/net/corda/vega/analytics/OGStub.kt @@ -34,7 +34,8 @@ class IsdaConfiguration { object BimmAnalysisUtils { fun computeMargin(combinedRatesProvider: ImmutableRatesProvider?, normalizer: PortfolioNormalizer, calculatorTotal: RwamBimmNotProductClassesCalculator, first: CurrencyParameterSensitivities, second: MultiCurrencyAmount): Triple { - val amount = (second.amounts.reduce { x, y -> x + y }.amount) / 100.0 // Not to be used for financial purposes... + + val amount = (second.amounts.map{ it -> it.amount}.fold(0.0,{ total, increment -> total + increment })) / 100.0 // Not to be used for financial purposes... return Triple(amount, 0.0, amount) } }