Пример #1
0
        public static Money GetForecastValue(Cashflows cashflows)
        {
            List <Money> forecastValueList = new List <Money>();

            foreach (PaymentCalculationPeriod period in cashflows.paymentCalculationPeriod)
            {
                forecastValueList.Add(period.forecastPaymentAmount);
            }

            return(MoneyHelper.Sum(forecastValueList));
        }
Пример #2
0
        public static Money GetPresentValue(Cashflows cashflows)
        {
            List <Money> presentValueList = new List <Money>();

            foreach (PaymentCalculationPeriod period in cashflows.paymentCalculationPeriod)
            {
                presentValueList.Add(period.presentValueAmount);
            }

            return(MoneyHelper.Sum(presentValueList));
        }
Пример #3
0
        public static Money GetPresentValueOfAdditionalPayments(CapFloor capFloor, string baseParty)
        {
            List <Money> list = new List <Money>();

            if (null != capFloor.additionalPayment)
            {
                foreach (Payment payment in capFloor.additionalPayment)
                {
                    list.AddRange(GetValue(payment.payerPartyReference.href, payment.receiverPartyReference.href, baseParty, payment.presentValueAmount));
                }
            }

            return(MoneyHelper.Sum(list));
        }
Пример #4
0
        public static Money GetPresentValueOfAdditionalPayments(Swap swap, string baseParty, Currency currencyToAdd)
        {
            List <Money> list = new List <Money>();

            if (null != swap.additionalPayment)
            {
                foreach (Payment payment in swap.additionalPayment)
                {
                    list.AddRange(GetValue(payment.payerPartyReference.href, payment.receiverPartyReference.href, baseParty, payment.presentValueAmount));
                }
            }

            return(MoneyHelper.Sum(list, currencyToAdd));
        }
Пример #5
0
        public static Money GetFutureValue(CapFloor capFloor, string baseParty)
        {
            List <Money> list = new List <Money>();

            InterestRateStream stream = capFloor.capFloorStream;
            Money futureValueOfStream = CashflowsHelper.GetForecastValue(stream.cashflows);

            list.AddRange(GetValue(stream.payerPartyReference.href, stream.receiverPartyReference.href, baseParty, futureValueOfStream));

            Money futureValueOfAdditionalPayments = GetValueOfAdditionalPayments(capFloor, baseParty);

            list.Add(futureValueOfAdditionalPayments);

            return(MoneyHelper.Sum(list));
        }
Пример #6
0
        public static Money GetPayPresentValueOfAdditionalPayments(CapFloor capFloor, string baseParty)
        {
            List <Money> valueList = new List <Money>();

            if (null != capFloor.additionalPayment)
            {
                foreach (Payment payment in capFloor.additionalPayment)
                {
                    if (baseParty == payment.payerPartyReference.href)
                    {
                        valueList.Add(payment.presentValueAmount);
                    }
                }
            }

            return(MoneyHelper.Sum(valueList));
        }
Пример #7
0
        public static Money GetReceivePresentValueOfAdditionalPayments(Swap swap, string baseParty)
        {
            List <Money> valueList = new List <Money>();

            if (null != swap.additionalPayment)
            {
                foreach (Payment payment in swap.additionalPayment)
                {
                    if (baseParty == payment.receiverPartyReference.href)
                    {
                        valueList.Add(payment.presentValueAmount);
                    }
                }
            }

            return(MoneyHelper.Sum(valueList));
        }
Пример #8
0
        public static Money GetFutureValue(Swap swap, string baseParty)
        {
            List <Money> list = new List <Money>();

            foreach (InterestRateStream stream in swap.swapStream)
            {
                Money futureValueOfStream = CashflowsHelper.GetForecastValue(stream.cashflows);

                list.AddRange(GetValue(stream.payerPartyReference.href, stream.receiverPartyReference.href, baseParty, futureValueOfStream));
            }

            Money futureValueOfAdditionalPayments = GetValueOfAdditionalPayments(swap, baseParty);

            list.Add(futureValueOfAdditionalPayments);

            return(MoneyHelper.Sum(list));
        }
Пример #9
0
        public static Money GetPayFutureValue(CapFloor capFloor, string baseParty)
        {
            List <Money> list = new List <Money>();

            InterestRateStream stream = capFloor.capFloorStream;
            {
                Money presentValueOfStream = CashflowsHelper.GetForecastValue(stream.cashflows);

                if (baseParty == stream.payerPartyReference.href)
                {
                    list.Add(presentValueOfStream);
                }
            }

            Money payFutureValueOfAdditionalPayments = GetPayFutureValueOfAdditionalPayments(capFloor, baseParty);

            list.Add(payFutureValueOfAdditionalPayments);

            return(MoneyHelper.Sum(list));
        }
Пример #10
0
        public static Money GetPayFutureValue(Swap swap, string baseParty)
        {
            List <Money> list = new List <Money>();

            foreach (InterestRateStream stream in swap.swapStream)
            {
                Money presentValueOfStream = CashflowsHelper.GetForecastValue(stream.cashflows);

                if (baseParty == stream.payerPartyReference.href)
                {
                    list.Add(presentValueOfStream);
                }
            }

            Money payFutureValueOfAdditionalPayments = GetPayFutureValueOfAdditionalPayments(swap, baseParty);

            list.Add(payFutureValueOfAdditionalPayments);

            return(MoneyHelper.Sum(list));
        }
Пример #11
0
        /// <summary>
        /// Returns present value of the swap for a specified baseParty.
        /// </summary>
        /// <param name="swap"></param>
        /// <param name="baseParty">The party, from which point of view the valuations are computed.</param>
        /// <returns></returns>
        public static Money GetPresentValue(Swap swap, string baseParty)
        {
            var list = new List <Money>();

            foreach (InterestRateStream stream in swap.swapStream)
            {
                Money presentValueOfStream = CashflowsHelper.GetPresentValue(stream.cashflows);

                list.AddRange(GetValue(stream.payerPartyReference.href, stream.receiverPartyReference.href, baseParty, presentValueOfStream));
            }

            Money sumPVs = MoneyHelper.Sum(list);

            //only add a pv in the same currency.
            Money presentValueOfAdditionalPayments = GetPresentValueOfAdditionalPayments(swap, baseParty, sumPVs.currency);

            sumPVs = MoneyHelper.Add(sumPVs, presentValueOfAdditionalPayments);

            return(sumPVs);
        }