Esempio n. 1
0
        public static List <Money> GetValue(string payer, string receiver, string baseParty, Money amount)
        {
            var result = new List <Money>();

            if (baseParty == payer)
            {
                result.Add(MoneyHelper.Neg(amount));
            }
            if (baseParty == receiver)
            {
                result.Add(amount);
            }
            return(result);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public static Money GetPayFutureValue(Swap swap, string baseParty)
        {
            var 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));
        }
Esempio n. 4
0
        public static Money GetPayFutureValue(CapFloor capFloor, string baseParty)
        {
            var 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));
        }
Esempio n. 5
0
        public static Swaption Create(Swap swap, decimal premiumAmount, DateTime expirationDate)
        {
            var swaption = new Swaption {
                swap = swap, premium = new[] { new Payment() }
            };

            swaption.premium[0].paymentAmount = MoneyHelper.GetNonNegativeAmount(premiumAmount);
            var europeanExercise = new EuropeanExercise
            {
                expirationDate = new AdjustableOrRelativeDate()
            };
            var adjustableDate = new AdjustableDate
            {
                unadjustedDate = new IdentifiedDate
                {
                    Value = expirationDate
                }
            };

            europeanExercise.expirationDate.Item = adjustableDate;
            XsdClassesFieldResolver.SwaptionSetEuropeanExercise(swaption, europeanExercise);
            return(swaption);
        }
Esempio n. 6
0
        public static Money GetPresentValue(Cashflows cashflows)
        {
            var presentValueList = cashflows.paymentCalculationPeriod.Select(period => period.presentValueAmount).ToList();

            return(MoneyHelper.Sum(presentValueList));
        }
Esempio n. 7
0
        public static Money GetForecastValue(Cashflows cashflows)
        {
            var forecastValueList = cashflows.paymentCalculationPeriod.Select(period => period.forecastPaymentAmount).ToList();

            return(MoneyHelper.Sum(forecastValueList));
        }