Пример #1
0
            private static Amount CalculateCorrelatedSumWeights(Currency calculationCurrency, List <MarginWeighting> weightingMargins)
            {
                Amount sum = Amount.OfZero(calculationCurrency);

                foreach (MarginWeighting marginWeighting1 in weightingMargins)
                {
                    foreach (MarginWeighting marginWeighting2 in weightingMargins)
                    {
                        Sensitivity sensitivity1 = marginWeighting1.Sensitivity;
                        Sensitivity sensitivity2 = marginWeighting2.Sensitivity;

                        if (sensitivity1 != sensitivity2)
                        {
                            Decimal correlation = ModelParameters.GetCorrelationBase(sensitivity1, sensitivity2);
                            sum += marginWeighting1.Value * marginWeighting2.Value * correlation;
                        }
                    }
                }

                return(sum);
            }