/// <summary> /// Aggregates the coupon metric. /// </summary> /// <param name="metric">The metric.</param> /// <returns></returns> protected virtual Decimal AggregateCouponMetric(InstrumentMetrics metric) { string[] metrics = { metric.ToString() }; var childValuations = GetChildValuations(GetChildren().ToArray(), new List <string>(metrics), ModelData); decimal result = Aggregator.SumDecimals(childValuations.Select(valuation => Aggregator.SumDecimals(GetMetricResults(valuation, metric))).ToArray()); return(result); }
/// <summary> /// Aggregates the coupon metric. /// </summary> /// <param name="metric">The metric.</param> /// <returns></returns> protected virtual Decimal AggregatePaymentMetric(InstrumentMetrics metric) { string[] metrics = { metric.ToString() }; var childValuations = GetChildValuations(GetPaymentControllers().ToArray(), new List <string>(metrics), ModelData); var results = new List <decimal>(); if (childValuations != null) { results.AddRange(childValuations.Select(valuation => Aggregator.SumDecimals(GetMetricResults(valuation, metric)))); } decimal result = Aggregator.SumDecimals(results.ToArray()); return(result); }