Fixes bug when valuation run on only one trade in the portfolio

This commit is contained in:
Richard Green 2016-11-22 16:52:11 +00:00
parent 1c4dfbe6dc
commit a4771687aa

View File

@ -35,7 +35,7 @@ object BimmAnalysisUtils {
fun computeMargin(combinedRatesProvider: ImmutableRatesProvider?, normalizer: PortfolioNormalizer, calculatorTotal: RwamBimmNotProductClassesCalculator, fun computeMargin(combinedRatesProvider: ImmutableRatesProvider?, normalizer: PortfolioNormalizer, calculatorTotal: RwamBimmNotProductClassesCalculator,
first: CurrencyParameterSensitivities, second: MultiCurrencyAmount): Triple<Double, Double, Double> { first: CurrencyParameterSensitivities, second: MultiCurrencyAmount): Triple<Double, Double, Double> {
val amount = (second.amounts.map{ it -> it.amount}.fold(0.0,{ total, increment -> total + increment })) / 100.0 // Not to be used for financial purposes... val amount = second.amounts.map { it.amount }.sum()
return Triple<Double, Double, Double>(amount, 0.0, amount) return Triple<Double, Double, Double>(amount, 0.0, amount)
} }
} }