Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableLeaseAsset"/> class.
 /// </summary>
 /// <param name="baseDate">The base date.</param>
 /// <param name="paymentCalendar">The payment Calendar.</param>
 /// <param name="marketQuote">The market quote.</param>
 /// <param name="lease">The lease.</param>
 public PriceableLeaseAsset(DateTime baseDate, FpML.V5r3.Reporting.Lease lease, IBusinessCalendar paymentCalendar,
                            BasicQuotation marketQuote)
 {
     PaymentCalendar = paymentCalendar;
     Multiplier      = 1.0m;
     YearFractions   = new[] { 0.25m };
     ModelIdentifier = "LeaseAsset";
     StartAmount     = lease.startGrossPrice.amount;
     MaturityDate    = lease.leaseExpiryDate.Value;
     Frequency       = lease.paymentFrequency;
     LeaseRate       = lease.reviewChange;
     Currency        = lease.currency;
     BaseDate        = baseDate;
     SettlementDate  = baseDate;
     PaymentBusinessDayAdjustments = lease.businessDayAdjustments;
     FirstPaymentDate = lease.startDate.Value;
     ReviewFrequency  = lease.reviewFrequency;
     NextReviewDate   = lease.nextReviewDate.Value;
     if (MaturityDate > BaseDate)
     {
         var rollConvention =
             RollConventionEnumHelper.Parse(MaturityDate.Day.ToString(CultureInfo.InvariantCulture));
         UnAdjustedPeriodDates = DateScheduler.GetUnadjustedCouponDatesFromMaturityDate(SettlementDate,
                                                                                        MaturityDate,
                                                                                        Frequency,
                                                                                        rollConvention,
                                                                                        out _,
                                                                                        out var nextCouponDate);
         LastPaymentDate     = UnAdjustedPeriodDates[0];
         AdjustedPeriodDates =
             AdjustedDateScheduler.GetAdjustedDateSchedule(UnAdjustedPeriodDates,
                                                           PaymentBusinessDayAdjustments.businessDayConvention,
                                                           paymentCalendar).ToArray();
         AdjustedPeriodDates[0] = SettlementDate;
         NextPaymentDate        = nextCouponDate;
     }
     RiskMaturityDate = AdjustedPeriodDates[AdjustedPeriodDates.Length - 1];
     Weightings       =
         CreateWeightings(CDefaultWeightingValue, AdjustedPeriodDates.Length - 1);//, LeaseRate,
     //TODO Need to add a credit spread to this.
     LeaseDiscountCurveName = CurveNameHelpers.GetDiscountCurveName(Currency.Value, true);
 }
Пример #2
0
        ///<summary>
        ///</summary>
        public override FpML.V5r3.Reporting.Lease GetLease()
        {
            var lease = new FpML.V5r3.Reporting.Lease
            {
                currency = new IdentifiedCurrency {
                    Value = Currency.Value, id = "Currency"
                },
                definition       = null,
                description      = Description,
                id               = Id,
                leaseTenor       = LeaseTenor,
                leaseExpiryDate  = IdentifiedDateHelper.Create("MaturityDate", MaturityDate),
                paymentFrequency = Frequency,
            };

            if (InstrumentIds != null)
            {
                lease.instrumentId = InstrumentIds.ToArray();
            }
            return(lease);
        }