Пример #1
0
        internal static void AddOtherPartyPayments(ValuationReport valuationReport, List <OtherPartyPaymentRangeItem> otherPartyPaymentList)
        {
            var otherPartyPayments = new List <Payment>();

            //  other party payments
            //
            if (null != otherPartyPaymentList)
            {
                foreach (OtherPartyPaymentRangeItem item in otherPartyPaymentList)
                {
                    var otherPartyPayment = new Payment
                    {
                        payerPartyReference =
                            PartyReferenceFactory.Create(item.Payer),
                        receiverPartyReference =
                            PartyReferenceFactory.Create(item.Receiver),
                        paymentAmount = MoneyHelper.GetNonNegativeAmount(item.Amount),
                        paymentDate   = AdjustableOrAdjustedDateHelper.CreateAdjustedDate(item.PaymentDate),
                        paymentType   = PaymentTypeHelper.Create(item.PaymentType)
                    };
                    otherPartyPayments.Add(otherPartyPayment);
                }
            }
            TradeValuationItem valuationItem = valuationReport.tradeValuationItem[0];

            Trade[] tradeArray = XsdClassesFieldResolver.TradeValuationItemGetTradeArray(valuationItem);
            Trade   trade      = tradeArray[0];

            trade.otherPartyPayment = otherPartyPayments.ToArray();
        }
Пример #2
0
 protected PriceableCashflow()
 {
     Multiplier                    = 1.0m;
     PaymentAmount                 = MoneyHelper.GetAmount(0.0m);
     ForecastAmount                = MoneyHelper.GetAmount(0.0m);
     PaymentType                   = PaymentTypeHelper.Create("Certain");
     ModelIdentifier               = "DiscountedCashflow";
     PaymentDateIncluded           = false;
     PricingStructureEvolutionType = PricingStructureEvolutionType.ForwardToSpot;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceablePrincipalExchange"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="payerIsBaseParty">A flag determining if the sign on the mamount is relative to the base party.</param>
 /// <param name="amount">The amount.</param>
 /// <param name="currency">The currency.</param>
 /// <param name="adjustedPaymentDate">The adjusted payment date.</param>
 /// <param name="paymentCalendar">Type paymentCalendar.</param>
 public PriceablePrincipalExchange
 (
     string id
     , bool payerIsBaseParty
     , Decimal amount
     , string currency
     , DateTime adjustedPaymentDate
     , IBusinessCalendar paymentCalendar) :
     base(id, "DiscountedCashflow", payerIsBaseParty, MoneyHelper.GetAmount(amount, currency), DateTypesHelper.ToAdjustableOrAdjustedDate(adjustedPaymentDate),
          PaymentTypeHelper.Create("Certain"), CashflowTypeHelper.Create(CashflowTypeEnum.PrincipalExchange.ToString()), false, paymentCalendar)
 {
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceablePrincipalExchange"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="payerIsBase">The payerIsBase flag.</param>
 /// <param name="amount">The amount.</param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="paymentCalendar">The paymentCalendar.</param>
 public BulletPaymentPricer
 (
     string id
     , bool payerIsBase
     , Money amount
     , AdjustableOrAdjustedDate paymentDate
     , IBusinessCalendar paymentCalendar) :
     base(id, "DiscountedCashflow", payerIsBase, amount, paymentDate,
          PaymentTypeHelper.Create("Certain"), CashflowTypeHelper.Create(CashflowTypeEnum.PrincipalExchange.ToString()),
          false, paymentCalendar)
 {
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceablePayment"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="payerPartyReference">The payer.</param>
 /// <param name="receiverPartyReference">The receiver.</param>
 /// <param name="payerIsBase">The payer is base flag.</param>
 /// <param name="amount">The amount.</param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="paymentCalendar">Type paymentCalendar.</param>
 public PriceablePayment
 (
     string id
     , string payerPartyReference
     , string receiverPartyReference
     , bool payerIsBase
     , Money amount
     , AdjustableOrAdjustedDate paymentDate
     , IBusinessCalendar paymentCalendar) :
     base(id, "DiscountedCashflow", payerIsBase, amount, paymentDate, PaymentTypeHelper.Create("Certain"),
          CashflowTypeHelper.Create(CashflowTypeEnum.PrincipalExchange.ToString()), false, paymentCalendar)
 {
     PayerPartyReference    = PartyReferenceFactory.Create(payerPartyReference);
     ReceiverPartyReference = PartyReferenceFactory.Create(receiverPartyReference);
     OrderedPartyNames.Add(PayerPartyReference.href);
     OrderedPartyNames.Add(ReceiverPartyReference.href);
 }
Пример #6
0
        /// <summary>
        /// Builds this instance.
        /// </summary>
        /// <returns></returns>
        public BulletPayment Build()
        {
            var px = new BulletPayment
            {
                payment =
                    new Payment
                {
                    paymentAmount =
                        MoneyHelper.GetNonNegativeAmount(PaymentAmount.amount,
                                                         PaymentAmount.currency.Value)
                },
                Items            = new object[] { ProductTypeHelper.Create(ProductTypeSimpleEnum.BulletPayment.ToString()) },
                ItemsElementName = new[] { ItemsChoiceType2.productType }
            };

            //Setting the items array which contains product type and product is information.
            //payment type information
            px.payment.paymentType = PaymentTypeHelper.Create("Payment");
            //Set the party information
            px.payment.payerPartyReference = new PartyReference {
                href = "Party2"
            };
            px.payment.receiverPartyReference = new PartyReference {
                href = "Party1"
            };
            if (PayerIsBaseParty)
            {
                px.payment.payerPartyReference = new PartyReference {
                    href = "Party1"
                };
                px.payment.receiverPartyReference = new PartyReference {
                    href = "Party2"
                };
            }
            //The payment date
            px.payment.paymentDate = AdjustableOrAdjustedDateHelper.Create(null, PaymentDate, PaymentDateAdjustments);
            if (CalculationPerformedIndicator)
            {
                px.payment.discountFactor          = PaymentDiscountFactor;
                px.payment.discountFactorSpecified = true;
                px.payment.presentValueAmount      = MoneyHelper.GetAmount(CalculationResults.NPV, PaymentAmount.currency.Value);
            }
            return(px);
        }
Пример #7
0
        /// <summary>
        /// Builds a bullet payment.
        /// </summary>
        /// <param name="productType"></param>
        /// <param name="payerIsBaseParty"></param>
        /// <param name="paymentDate"></param>
        /// <param name="businessDayCalendar"></param>
        /// <param name="businessDayAdjustments"> </param>
        /// <param name="currency"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public static BulletPayment Parse(string productType, Boolean payerIsBaseParty,
                                          DateTime paymentDate, string businessDayCalendar,
                                          string businessDayAdjustments, string currency, decimal amount)
        {
            var px = new BulletPayment
            {
                payment =
                    new Payment
                {
                    paymentAmount =
                        MoneyHelper.GetNonNegativeAmount(amount, currency)
                },
                Items            = new object[] { ProductTypeHelper.Create("BulletPayment") },
                ItemsElementName = new[] { ItemsChoiceType2.productType }
            };
            var tempDate = DateTypesHelper.ToAdjustableDate(paymentDate, businessDayAdjustments,
                                                            businessDayCalendar);

            px.payment.paymentDate = AdjustableOrAdjustedDateHelper.Create(tempDate.unadjustedDate.Value, null, tempDate.dateAdjustments);//TODO
            //Setting the items array which contains product type and product is information.
            //payment type information
            px.payment.paymentType = PaymentTypeHelper.Create("Payment");
            //Set the party information
            px.payment.payerPartyReference = new PartyReference {
                href = "Party2"
            };
            px.payment.receiverPartyReference = new PartyReference {
                href = "Party1"
            };
            if (payerIsBaseParty)
            {
                px.payment.payerPartyReference = new PartyReference {
                    href = "Party1"
                };
                px.payment.receiverPartyReference = new PartyReference {
                    href = "Party2"
                };
            }
            return(px);
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PriceableFxOptionPremium"/> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="receiverPartyReference">The receiver.</param>
        /// <param name="payerIsBase">The flag determining if the payer is the base party.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="settlementDate">The adjusted payment date.</param>
        /// <param name="payerPartyReference">The payer.</param>
        /// <param name="premiumQuote">The premium quote </param>
        /// <param name="settlementInformation">The settlement information. </param>
        /// <param name="paymentCalendar">Type paymentCalendar.</param>
        public PriceableFxOptionPremium
        (
            string id
            , string payerPartyReference
            , string receiverPartyReference
            , bool payerIsBase
            , Money amount
            , DateTime settlementDate
            , PremiumQuote premiumQuote
            , SettlementInformation settlementInformation
            , IBusinessCalendar paymentCalendar) :
            base(id, "DiscountedCashflow", payerIsBase, amount,
                 AdjustableOrAdjustedDateHelper.CreateAdjustedDate(settlementDate),
                 PaymentTypeHelper.Create("Certain"), CashflowTypeHelper.Create(CashflowTypeEnum.Premium.ToString()), false, paymentCalendar)
        {
            PayerPartyReference    = PartyReferenceFactory.Create(payerPartyReference);
            ReceiverPartyReference = PartyReferenceFactory.Create(receiverPartyReference);
            OrderedPartyNames.Add(PayerPartyReference.href);
            OrderedPartyNames.Add(ReceiverPartyReference.href);
            if (premiumQuote != null)
            {
                PremiumQuote = new PremiumQuote
                {
                    quoteBasis          = premiumQuote.quoteBasis,
                    quoteBasisSpecified = true,
                    value          = premiumQuote.value,
                    valueSpecified = true
                };
            }
            if (settlementInformation == null)
            {
                return;
            }
            SettlementInformation = new SettlementInformation();
            var item = BinarySerializerHelper.Clone(settlementInformation.Item);

            SettlementInformation.Item = item;
        }