public static bool IsLocalCurrencyType(InstrumentMetrics metric)
        {
            switch (metric)
            {
            case InstrumentMetrics.LocalCurrencyAnalyticalDelta:
            case InstrumentMetrics.LocalCurrencyDelta1:
            case InstrumentMetrics.LocalCurrencyDelta0:
            case InstrumentMetrics.LocalCurrencyDeltaR:
            case InstrumentMetrics.LocalCurrencyFloatingNPV:
            case InstrumentMetrics.LocalCurrencyAccrualFactor:
            case InstrumentMetrics.LocalCurrencyHistoricalAccrualFactor:
            case InstrumentMetrics.LocalCurrencyExpectedValue:
            case InstrumentMetrics.LocalCurrencyCalculatedValue:
            case InstrumentMetrics.LocalCurrencyHistoricalValue:
            case InstrumentMetrics.LocalCurrencyNFV:
            case InstrumentMetrics.LocalCurrencyNPV:
            case InstrumentMetrics.LocalCurrencySimpleCVA:
            case InstrumentMetrics.LocalCurrencyBucketedDelta1:
            case InstrumentMetrics.LocalCurrencyBucketedDeltaVector:
            case InstrumentMetrics.LocalCurrencyBucketedDeltaVector2:
            case InstrumentMetrics.LocalCurrencyHistoricalDelta1:
            case InstrumentMetrics.LocalCurrencyDelta1PDH:
            case InstrumentMetrics.LocalCurrencyDelta0PDH:
            case InstrumentMetrics.LocalCurrencyAnalyticalGamma:
            case InstrumentMetrics.LocalCurrencyGamma1:
            case InstrumentMetrics.LocalCurrencyGamma0:
            case InstrumentMetrics.LocalCurrencyDelta0Delta1:
                return(true);

            default:
                return(false);
            }
        }
        /// <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>
        /// <param name="childValuations"> </param>
        /// <returns></returns>
        protected Decimal AggregateMetric(InstrumentMetrics metric, List <AssetValuation> childValuations)
        {
            var result = 0.0m;

            if (childValuations != null && childValuations.Count > 0)
            {
                result = Aggregator.SumDecimals(childValuations.Select(valuation => Aggregator.SumDecimals(GetMetricResults(valuation, metric))).ToArray());
            }
            return(result);
        }
Exemple #4
0
        /// <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);
        }
        /// <summary>
        /// Aggregates the exchange metric.
        /// </summary>
        /// <param name="childValuations"> </param>
        /// <param name="metric">The metric.</param>
        /// <returns></returns>
        protected virtual Decimal AggregatePaymentMetric(List <AssetValuation> childValuations, InstrumentMetrics metric)
        {
            var result = 0.0m;

            if (Payments != null && Payments.Count > 0)
            {
                //var childValuations = GetChildValuations(Payments.ToArray(), new List<string>(metrics), ModelData);
                result = Aggregator.SumDecimals(childValuations.Select(valuation => Aggregator.SumDecimals(GetMetricResults(valuation, metric))).ToArray());
            }
            return(result);
        }