Beispiel #1
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public static CapFloor Create(InterestRateStream stream)
        {
            CapFloor result = new CapFloor();

            result.capFloorStream = stream;

            return(result);
        }
        public static InterestRateStream GetReceiverStream(CapFloor capFloor, string baseParty)
        {
            if (capFloor.capFloorStream.receiverPartyReference.href == baseParty)
            {
                return(capFloor.capFloorStream);
            }

            throw new Exception(String.Format("No receiver stream was found for the specified receiver : '{0}'", baseParty));
        }
        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));
        }
        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));
        }
        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));
        }
        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));
        }