Example #1
0
        /// <summary>
        /// Returns present value of the swap for a specified baseParty.
        /// </summary>
        /// <param name="capFloor">The cap floor.</param>
        /// <param name="baseParty">The party, from which point of view the valuations are computed.</param>
        /// <returns></returns>
        public static Money GetPresentValue(CapFloor capFloor, string baseParty)
        {
            var list = new List <Money>();
            InterestRateStream stream  = capFloor.capFloorStream;
            Money presentValueOfStream = CashflowsHelper.GetPresentValue(stream.cashflows);

            list.AddRange(GetValue(stream.payerPartyReference.href, stream.receiverPartyReference.href, baseParty, presentValueOfStream));
            Money presentValueOfAdditionalPayments = GetPresentValueOfAdditionalPayments(capFloor, baseParty);

            list.Add(presentValueOfAdditionalPayments);
            return(MoneyHelper.Sum(list));
        }
Example #2
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);
        }
Example #3
0
        public static Money GetReceivePresentValue(Swap swap, string baseParty)
        {
            var list = new List <Money>();

            foreach (InterestRateStream stream in swap.swapStream)
            {
                Money presentValueOfStream = CashflowsHelper.GetPresentValue(stream.cashflows);
                if (baseParty == stream.receiverPartyReference.href)
                {
                    list.Add(presentValueOfStream);
                }
            }
            Money receivePresentValueOfAdditionalPayments = GetReceivePresentValueOfAdditionalPayments(swap, baseParty);

            list.Add(receivePresentValueOfAdditionalPayments);
            return(MoneyHelper.Sum(list));
        }