private static CalculationPeriod Create(DateTime periodStartDate, DateTime periodEndDate
                                                , CalculationPeriodFrequency frequency, BusinessDayAdjustments dateAdjustments
                                                , IBusinessCalendar paymentCalendar, bool isFirstPeriodCreated)
        {
            var calculationPeriod = new CalculationPeriod();
            //  Apply ROLL CONVENTION (NOT A BUSINESS DAY CONVENTION!) to unadjusted period start and end dates.
            //
            DateTime rollConventionPeriodStartDate = periodStartDate;
            DateTime rollConventionPeriodEndDate   = periodEndDate;
            var      frequencyPeriod = EnumHelper.Parse <PeriodEnum>(frequency.period, true);

            if (frequencyPeriod != PeriodEnum.D)//adjust if the frequency is NOT expressed in days
            {
                rollConventionPeriodStartDate = RollConventionEnumHelper.AdjustDate(frequency.rollConvention, periodStartDate);
                rollConventionPeriodEndDate   = RollConventionEnumHelper.AdjustDate(frequency.rollConvention, periodEndDate);
            }
            CalculationPeriodHelper.SetUnadjustedDates(calculationPeriod, rollConventionPeriodStartDate, rollConventionPeriodEndDate);
            //  Set adjusted period dates
            //
            DateTime adjustedPeriodStartDate = AdjustedDateHelper.ToAdjustedDate(paymentCalendar, rollConventionPeriodStartDate, dateAdjustments);
            DateTime adjustedPeriodEndDate   = AdjustedDateHelper.ToAdjustedDate(paymentCalendar, rollConventionPeriodEndDate, dateAdjustments);

            if (isFirstPeriodCreated)
            {
                adjustedPeriodEndDate = periodEndDate;
            }
            CalculationPeriodHelper.SetAdjustedDates(calculationPeriod, adjustedPeriodStartDate, adjustedPeriodEndDate);
            return(calculationPeriod);
        }
        private static void GeneratePeriodsBackward(DateTime firstRollDate, CalculationPeriodFrequency frequency,
                                                    BusinessDayAdjustments calculationPeriodDatesAdjustments,
                                                    CalculationPeriodsPrincipalExchangesAndStubs result,
                                                    DateTime adjustedEffectiveDate, StubPeriodTypeEnum?initialStubType
                                                    , IBusinessCalendar paymentCalendar)
        {
            DateTime periodEndDate               = firstRollDate;
            DateTime periodStartDate             = AddPeriod(periodEndDate, IntervalHelper.FromFrequency(frequency), -1);
            bool     encounteredShortInitialStub = false;

            //if (paymentCalendar == null)
            //{
            //    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, calculationPeriodDatesAdjustments.businessCenters);
            //}
            do
            {
                var calculationPeriod = new CalculationPeriod();
                //  Apply ROLL CONVENTION (NOT A BUSINESS DAY CONVENTION!) to unadjusted period start and end dates.
                //
                DateTime rollConventionAdjustedPeriodStartDate = periodStartDate;
                DateTime rollConventionAdjustedPeriodEndDate   = periodEndDate;
                var      frequencyPeriod = EnumHelper.Parse <PeriodEnum>(frequency.period, true);
                if (frequencyPeriod != PeriodEnum.D)//adjust if the frequency is NOT expressed in days
                {
                    rollConventionAdjustedPeriodStartDate = RollConventionEnumHelper.AdjustDate(frequency.rollConvention, periodStartDate);
                    rollConventionAdjustedPeriodEndDate   = RollConventionEnumHelper.AdjustDate(frequency.rollConvention, periodEndDate);
                }
                CalculationPeriodHelper.SetUnadjustedDates(calculationPeriod, rollConventionAdjustedPeriodStartDate, rollConventionAdjustedPeriodEndDate);
                //  Set adjusted period dates
                //
                DateTime adjustedPeriodStartDate = AdjustedDateHelper.ToAdjustedDate(paymentCalendar, rollConventionAdjustedPeriodStartDate, calculationPeriodDatesAdjustments);
                DateTime adjustedPeriodEndDate   = AdjustedDateHelper.ToAdjustedDate(paymentCalendar, rollConventionAdjustedPeriodEndDate, calculationPeriodDatesAdjustments);
                CalculationPeriodHelper.SetAdjustedDates(calculationPeriod, adjustedPeriodStartDate, adjustedPeriodEndDate);
                //if (calculationPeriod.unadjustedStartDate > adjustedEffectiveDate)
                if (calculationPeriod.adjustedStartDate > adjustedEffectiveDate)
                {
                    result.InsertFirst(calculationPeriod);
                    periodEndDate   = periodStartDate;
                    periodStartDate = AddPeriod(periodEndDate, IntervalHelper.FromFrequency(frequency), -1);
                }
                //else if (calculationPeriod.unadjustedStartDate == adjustedEffectiveDate)//first period - not stub
                else if (calculationPeriod.adjustedStartDate == adjustedEffectiveDate)//first period - not stub
                {
                    result.InsertFirst(calculationPeriod);
                    break;
                }
                else//first period - short stub (merge with next period if a long stub specified)
                {
                    encounteredShortInitialStub = true;
                    //calculationPeriod.unadjustedStartDate = adjustedEffectiveDate;
                    calculationPeriod.adjustedStartDate = adjustedEffectiveDate;
                    result.InitialStubCalculationPeriod = calculationPeriod;
                    break;
                }
            } while (true);
            if (encounteredShortInitialStub && initialStubType == StubPeriodTypeEnum.LongInitial)
            {
                result.CreateLongInitialStub();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parses the specified interval as string.
        /// </summary>
        /// <param name="intervalAsString"><example>3M,3m,14d,6Y</example></param>
        /// <param name="rollConventionAsString">The roll convention.</param>
        /// <returns></returns>
        public static CalculationPeriodFrequency Parse(string intervalAsString, string rollConventionAsString)
        {
            var    result   = new CalculationPeriodFrequency();
            Period interval = PeriodHelper.Parse(intervalAsString);

            result.periodMultiplier = interval.periodMultiplier;
            result.period           = interval.period.ToString();
            result.rollConvention   = RollConventionEnumHelper.Parse(rollConventionAsString);
            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Calculations the period frequency to interval.
        /// </summary>
        /// <param name="calculationPeriodFrequency">The calculation period frequency.</param>
        /// <returns></returns>
        static public Period CalculationPeriodFrequencyToInterval(CalculationPeriodFrequency calculationPeriodFrequency)
        {
            var periodInterval = new Period
            {
                period           = EnumHelper.Parse <PeriodEnum>(calculationPeriodFrequency.period, true),
                periodMultiplier = calculationPeriodFrequency.periodMultiplier
            };

            return(periodInterval);
        }
Ejemplo n.º 5
0
        public List <DateTime> BuildDates(ILogger logger, ICoreCache cache, String nameSpace, BillSwapPricerDatesRange billSwapPricerDatesRange, IBusinessCalendar paymentCalendar)
        {
            CalculationPeriodFrequency frequency   = CalculationPeriodFrequencyHelper.Parse(billSwapPricerDatesRange.RollFrequency, billSwapPricerDatesRange.RollConvention);
            StubPeriodTypeEnum?        initialStub = null;

            if (!String.IsNullOrEmpty(billSwapPricerDatesRange.InitialStubPeriod))
            {
                initialStub = EnumHelper.Parse <StubPeriodTypeEnum>(billSwapPricerDatesRange.InitialStubPeriod);
            }
            StubPeriodTypeEnum?finalStub = null;

            if (!String.IsNullOrEmpty(billSwapPricerDatesRange.FinalStubPeriod))
            {
                finalStub = EnumHelper.Parse <StubPeriodTypeEnum>(billSwapPricerDatesRange.FinalStubPeriod);
            }
            //BusinessDayAdjustments adjustments = BusinessDayAdjustmentsHelper.Create(BusinessDayConventionEnum.NONE, "");
            //if (paymentCalendar == null)
            //{
            //    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, adjustments.businessCenters);//Make sure this builds a valid calendar!
            //}
            BusinessDayAdjustments calculationPeriodDayAdjustments = BusinessDayAdjustmentsHelper.Create(billSwapPricerDatesRange.BusinessDayConvention, billSwapPricerDatesRange.Calendar);

            if (paymentCalendar == null)
            {
                paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, calculationPeriodDayAdjustments.businessCenters, nameSpace);
            }
            CalculationPeriodsPrincipalExchangesAndStubs result = CalculationPeriodGenerator.GenerateAdjustedCalculationPeriods(
                billSwapPricerDatesRange.StartDate,
                billSwapPricerDatesRange.EndDate,
                billSwapPricerDatesRange.FirstRegularPeriodStartDate,
                frequency,
                calculationPeriodDayAdjustments,
                initialStub,
                finalStub,
                paymentCalendar
                );

            foreach (CalculationPeriod regularCalculationPeriod in result.GetRegularAndStubPeriods())
            {
                // Adjust both startDate & endDate of period
                //
                CalculationPeriodHelper.SetAdjustedDates(regularCalculationPeriod,
                                                         AdjustedDateHelper.ToAdjustedDate(paymentCalendar, regularCalculationPeriod.unadjustedStartDate, calculationPeriodDayAdjustments),
                                                         AdjustedDateHelper.ToAdjustedDate(paymentCalendar, regularCalculationPeriod.unadjustedEndDate, calculationPeriodDayAdjustments));
            }
            var listResult = result.GetRegularAndStubPeriods().Select(regularCalculationPeriod => regularCalculationPeriod.adjustedStartDate).ToList();

            listResult.Add(result.GetRegularAndStubPeriods()[result.GetRegularAndStubPeriods().Count - 1].adjustedEndDate);
            return(listResult);
        }
Ejemplo n.º 6
0
        public void LongFinalStubSpecifiedButNoStub()
        {
            DateTime                   startDate       = new DateTime(2007, 01, 5);
            DateTime                   endDate         = new DateTime(2012, 01, 5);
            RollConventionEnum         rollConvention  = RollConventionEnum.Item5;
            CalculationPeriodFrequency periodFrequency = CalculationPeriodFrequencyHelper.Parse("3M", rollConvention.ToString());
            CalculationPeriodSchedule  cps             = new CalculationPeriodSchedule();
            Period periodInterval = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(periodFrequency);
            List <CalculationPeriod> unadjustedCalcPeriods = cps.GetUnadjustedCalculationDateSchedule(startDate, endDate, periodInterval, rollConvention, StubPeriodTypeEnum.LongFinal);

            Assert.AreEqual(unadjustedCalcPeriods.Count, 20);
            Assert.IsFalse(cps.HasFinalStub);
            Assert.IsFalse(cps.HasInitialStub);
        }
Ejemplo n.º 7
0
        public void LongInitialStubSpecified()
        {
            DateTime                   startDate              = new DateTime(2007, 01, 5);
            DateTime                   endDate                = new DateTime(2012, 01, 5);
            RollConventionEnum         rollConvention         = RollConventionEnum.Item26;
            CalculationPeriodFrequency periodFrequency        = CalculationPeriodFrequencyHelper.Parse("3M", rollConvention.ToString());
            DateTime                   firstRegularPeriodDate = new DateTime(2007, 4, 26);
            CalculationPeriodSchedule  cps = new CalculationPeriodSchedule();
            List <CalculationPeriod>   unadjustedCalcPeriods = cps.GetUnadjustedCalculationDateSchedule(startDate, endDate, firstRegularPeriodDate, periodFrequency, StubPeriodTypeEnum.LongInitial);

            Assert.AreEqual(unadjustedCalcPeriods.Count, 20);
            Assert.IsTrue(cps.HasFinalStub);
            Assert.IsTrue(cps.HasInitialStub);
            Assert.IsTrue(CalculationPeriodHelper.IsLongStub(unadjustedCalcPeriods[0], cps.PeriodInterval));
        }
Ejemplo n.º 8
0
        public void ShortFinalStubSpecifiedFromTermination()
        {
            DateTime                   startDate       = new DateTime(2007, 01, 5);
            DateTime                   endDate         = new DateTime(2010, 01, 5);
            RollConventionEnum         rollConvention  = RollConventionEnum.Item12;
            CalculationPeriodFrequency periodFrequency = CalculationPeriodFrequencyHelper.Parse("3M", rollConvention.ToString());
            Period periodInterval             = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(periodFrequency);
            CalculationPeriodSchedule cps     = new CalculationPeriodSchedule();
            DateTime lastRegularPeriodEndDate = new DateTime(2009, 8, 12);
            List <CalculationPeriod> unadjustedCalcPeriods = cps.GetUnadjustedCalculationDateScheduleFromTermDate(startDate, endDate, periodInterval, lastRegularPeriodEndDate, rollConvention, StubPeriodTypeEnum.ShortFinal);

            Assert.AreEqual(unadjustedCalcPeriods.Count, 13);
            Assert.IsTrue(cps.HasFinalStub);
            Assert.IsTrue(cps.HasInitialStub);
            Assert.IsTrue(CalculationPeriodHelper.IsShortStub(unadjustedCalcPeriods[unadjustedCalcPeriods.Count - 1], cps.PeriodInterval));
        }
Ejemplo n.º 9
0
        public void RegularPeriodFrequencyUnadjustedDates()
        {
            // 5 year 3 month cash flow
            DateTime startDate = new DateTime(2007, 01, 5);

            RollConventionEnum rollConvention = RollConventionEnum.Item26;

            CalculationPeriodFrequency frequencyToMaturity = CalculationPeriodFrequencyHelper.Parse("5Y", rollConvention.ToString());
            CalculationPeriodFrequency periodFrequency     = CalculationPeriodFrequencyHelper.Parse("3M", rollConvention.ToString());
            CalculationPeriodSchedule  cps = new CalculationPeriodSchedule();
            List <CalculationPeriod>   unadjustedCalcPeriods = cps.GetUnadjustedCalculationDateSchedule(startDate, frequencyToMaturity, periodFrequency);
            List <DateTime>            dates = CalculationPeriodHelper.GetCalculationPeriodsProperty <DateTime>(unadjustedCalcPeriods, "unadjustedStartDate");

            Assert.AreEqual(unadjustedCalcPeriods.Count, 20);
            Assert.IsFalse(cps.HasInitialStub);
            Assert.IsFalse(cps.HasFinalStub);
        }
        public static CalculationPeriodsPrincipalExchangesAndStubs GenerateAdjustedCalculationPeriods(
            DateTime unadjustedEffectiveDate,
            DateTime unadjustedTerminationDate,
            DateTime unadjustedFirstRollDate, //this one is still UN adjusted
            CalculationPeriodFrequency frequency,
            BusinessDayAdjustments calculationPeriodDatesAdjustments,
            StubPeriodTypeEnum?initialStubType,
            StubPeriodTypeEnum?finalStubType,
            IBusinessCalendar paymentCalendar)
        {
            #region Param check

            if (initialStubType.HasValue)
            {
                if ((initialStubType != StubPeriodTypeEnum.LongInitial) && (initialStubType != StubPeriodTypeEnum.ShortInitial))
                {
                    throw new ArgumentOutOfRangeException(nameof(initialStubType), initialStubType, "Wrong stub type.");
                }
            }
            if (finalStubType.HasValue)
            {
                if ((finalStubType == StubPeriodTypeEnum.LongFinal) && (initialStubType == StubPeriodTypeEnum.ShortFinal))
                {
                    throw new ArgumentOutOfRangeException(nameof(finalStubType), finalStubType, "Wrong stub type.");
                }
            }
//            if (!RollConventionEnumHelper.IsAdjusted(frequency.rollConvention, unadjustedFirstRollDate))
//            {
//                string message = String.Format("First roll date {0}, should be pre-adjusted according to RollConvention {1}", unadjustedFirstRollDate, frequency.rollConvention);
//                throw new Exception(message);
//            }

            #endregion

            var result = new CalculationPeriodsPrincipalExchangesAndStubs();
            //  Start calculations from 'first roll date' and generate dates backwards and forwards
            //
            //  Generate periods backwards (toward the unadjustedEffectiveDate)
            //
            GeneratePeriodsBackward(unadjustedFirstRollDate, frequency, calculationPeriodDatesAdjustments, result, unadjustedEffectiveDate, initialStubType, paymentCalendar);
            //  Generate periods forwards (toward the unadjustedTerminationDate)
            //
            GeneratePeriodsForward(unadjustedFirstRollDate, frequency, calculationPeriodDatesAdjustments, result, unadjustedTerminationDate, finalStubType, paymentCalendar);
            return(result);
        }
        //public static CalculationPeriodsPrincipalExchangesAndStubs GenerateUnadjustedCalculationPeriods(
        //                                                    IBusinessCalendar paymentCalendar,
        //                                                    DateTime unadjustedStartDate,
        //                                                    DateTime unadjustedEndDate,
        //                                                    CalculationPeriodFrequency frequency,
        //                                                    StubPeriodTypeEnum? initialStubType,
        //                                                    StubPeriodTypeEnum? finalStubType
        //                                                )
        //{
        //    // If first roll date not specified - calculate it from the start date.
        //    //
        //    DateTime unadjustedFirstRollDate = AddPeriod(unadjustedStartDate, frequency, 1);
        //    return GenerateUnadjustedCalculationPeriods(unadjustedStartDate, unadjustedEndDate, unadjustedFirstRollDate, frequency, initialStubType, finalStubType);
        //}

        public static CalculationPeriodsPrincipalExchangesAndStubs GenerateAdjustedCalculationPeriods(

            DateTime unadjustedStartDate,
            DateTime unadjustedTerminationDate,
            DateTime?firstUnadjustedRegularPeriodStartDate,
            DateTime?lastUnadjustedRegularPeriodEndDate,
            CalculationPeriodFrequency frequency,
            BusinessDayAdjustments calculationPeriodDatesAdjustments,
            IBusinessCalendar paymentCalendar)
        {
            var result = new CalculationPeriodsPrincipalExchangesAndStubs();

            //  Generate periods backwards (toward the unadjustedEffectiveDate)
            //
            GeneratePeriods(unadjustedStartDate, unadjustedTerminationDate, firstUnadjustedRegularPeriodStartDate,
                            lastUnadjustedRegularPeriodEndDate, frequency, calculationPeriodDatesAdjustments, result, paymentCalendar);
            result.CalculationPeriods.Sort((calculationPeriod1, calculationPeriod2) =>
                                           calculationPeriod1.adjustedEndDate.CompareTo(calculationPeriod2.adjustedEndDate));
            return(result);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Gets the backward regular periods.
 /// </summary>
 /// <param name="startDate">The start date.</param>
 /// <param name="endDate">The end date.</param>
 /// <param name="calculationPeriodFrequency">The calculation period frequency.</param>
 /// <param name="hasIrregularPeriod">if set to <c>true</c> [has irregular period].</param>
 /// <returns></returns>
 static public List <CalculationPeriod> GetBackwardRegularPeriods(DateTime startDate, DateTime endDate, CalculationPeriodFrequency calculationPeriodFrequency, out Boolean hasIrregularPeriod)
 {
     return(GetBackwardRegularPeriods(startDate, endDate, CalculationPeriodFrequencyToInterval(calculationPeriodFrequency), calculationPeriodFrequency.rollConvention, out hasIrregularPeriod));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets the last regular period end date.
        /// </summary>
        /// <param name="frequencyToLastRegularPeriodEndDate">The frequency to last regular period end date.</param>
        /// <param name="endDate">The end date.</param>
        /// <returns></returns>
        public static DateTime GetLastRegularPeriodEndDate(CalculationPeriodFrequency frequencyToLastRegularPeriodEndDate, DateTime endDate)
        {
            Period periodInterval = CalculationPeriodFrequencyToInterval(frequencyToLastRegularPeriodEndDate);

            return(GetLastRegularPeriodEndDate(periodInterval, frequencyToLastRegularPeriodEndDate.rollConvention, endDate));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Gets the first regular period start date.
        /// </summary>
        /// <param name="calculationPeriodFrequency">The calculation period frequency.</param>
        /// <param name="startDate">The start date.</param>
        /// <returns></returns>
        public static DateTime GetFirstRegularPeriodStartDate(CalculationPeriodFrequency calculationPeriodFrequency, DateTime startDate)
        {
            Period periodInterval = CalculationPeriodFrequencyToInterval(calculationPeriodFrequency);

            return(GetFirstRegularPeriodStartDate(periodInterval, calculationPeriodFrequency.rollConvention, startDate));
        }
        public static void GeneratePeriods(DateTime unadjustedStartDate,
                                           DateTime unadjustedTerminationDate,
                                           DateTime?firstUnadjustedRegularPeriodStartDate,
                                           DateTime?lastUnadjustedRegularPeriodEndDate,
                                           //StubPeriodTypeEnum? initialStubType,
                                           //StubPeriodTypeEnum? finalStubType,
                                           CalculationPeriodFrequency frequency,
                                           BusinessDayAdjustments calculationPeriodDatesAdjustments,
                                           CalculationPeriodsPrincipalExchangesAndStubs result,
                                           IBusinessCalendar paymentCalendar)
        {
            DateTime periodEndDate = unadjustedTerminationDate;
            DateTime periodStartDate;
            bool     isInitialStub = firstUnadjustedRegularPeriodStartDate != null;
            var      startDate     = unadjustedStartDate;

            if (isInitialStub)
            {
                startDate = (DateTime)firstUnadjustedRegularPeriodStartDate;
            }
            var isFinalStub = lastUnadjustedRegularPeriodEndDate != null;

            if (isFinalStub)
            {
                periodStartDate = (DateTime)lastUnadjustedRegularPeriodEndDate;
            }
            else
            {
                periodStartDate = AddPeriod(periodEndDate, IntervalHelper.FromFrequency(frequency), -1);
            }
            var isFirstPeriod = true;

            do
            {
                var calculationPeriod = Create(periodStartDate, periodEndDate, frequency,
                                               calculationPeriodDatesAdjustments, paymentCalendar, isFirstPeriod);
                isFirstPeriod = false;
                //adjust for roll convention.
                periodStartDate = calculationPeriod.unadjustedStartDate;
                periodEndDate   = calculationPeriod.unadjustedEndDate;
                if (isFinalStub)//Always at least one period.
                {
                    result.FinalStubCalculationPeriod = calculationPeriod;
                    periodEndDate   = periodStartDate;
                    periodStartDate = AddPeriod(periodEndDate, IntervalHelper.FromFrequency(frequency), -1);
                    isFinalStub     = false;
                }
                else if (calculationPeriod.unadjustedStartDate.Date >= startDate.Date)
                {
                    result.Add(calculationPeriod);
                    periodEndDate   = periodStartDate;
                    periodStartDate = AddPeriod(periodEndDate, IntervalHelper.FromFrequency(frequency), -1);
                }
                else if (calculationPeriod.unadjustedStartDate.Date == startDate.Date)//first period - not stub
                {
                    result.Add(calculationPeriod);
                    break;
                }
                else if (calculationPeriod.unadjustedStartDate.Date < startDate.Date)//first period - not stub
                {
                    var number = result.CalculationPeriods.Count;
                    result.CalculationPeriods[number - 1].unadjustedStartDate = startDate.Date;
                    result.CalculationPeriods[number - 1].adjustedStartDate   = startDate.Date;
                    break;
                }
                if (calculationPeriod.unadjustedEndDate.Date <= startDate.Date)//first period - not stub
                {
                    break;
                }
            } while (true);
            if (isInitialStub)//TODO -Fix the unadjustedstartdate which is affected by the roll convention.
            {
                var calculationPeriod = CreateStub(unadjustedStartDate, startDate.Date,
                                                   calculationPeriodDatesAdjustments, paymentCalendar);
                result.InitialStubCalculationPeriod = calculationPeriod;
            }
        }
 /// <summary>
 /// Gets the unadjusted calculation date schedule.
 /// </summary>
 /// <param name="effectiveDate">The effective date.</param>
 /// <param name="terminationDate">The termination date.</param>
 /// <param name="regularPeriodStartDate">The regular period start date.</param>
 /// <param name="periodFrequency">The period frequency.</param>
 /// <param name="stubPeriodType">Type of the stub period.</param>
 /// <returns></returns>
 public List <CalculationPeriod> GetUnadjustedCalculationDateSchedule(DateTime effectiveDate, DateTime terminationDate, DateTime regularPeriodStartDate, CalculationPeriodFrequency periodFrequency, StubPeriodTypeEnum?stubPeriodType)
 {
     CalculationPeriodDates = null;
     PeriodInterval         = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(periodFrequency);
     _effectiveDate         = effectiveDate;
     _termDate      = terminationDate;
     RollConvention = periodFrequency.rollConvention;
     _unadjustedDateScheduleList = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, terminationDate, regularPeriodStartDate, periodFrequency, stubPeriodType);
     return(_unadjustedDateScheduleList);
 }
 /// <summary>
 /// Gets the unadjusted calculation date schedule.
 /// </summary>
 /// <param name="effectiveDate">The effective date.</param>
 /// <param name="periodToTerminationDate">The period to termination date.</param>
 /// <param name="periodFrequency">The period frequency.</param>
 /// <returns></returns>
 public List <CalculationPeriod> GetUnadjustedCalculationDateSchedule(DateTime effectiveDate, CalculationPeriodFrequency periodToTerminationDate, CalculationPeriodFrequency periodFrequency)
 {
     CalculationPeriodDates = null;
     PeriodInterval         = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(periodFrequency);
     _effectiveDate         = effectiveDate;
     _termDate      = PeriodInterval.Add(effectiveDate);
     RollConvention = periodFrequency.rollConvention;
     _unadjustedDateScheduleList = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, periodToTerminationDate, periodFrequency);
     return(_unadjustedDateScheduleList);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Generates the unadjusted calculation dates.
        /// </summary>
        /// <param name="effectiveDate">The effective date.</param>
        /// <param name="periodToTerminationDate">The period to termination date.</param>
        /// <param name="periodFrequecy">The period frequecy.</param>
        /// <returns></returns>
        static public List <CalculationPeriod> GenerateUnadjustedCalculationDates(DateTime effectiveDate, CalculationPeriodFrequency periodToTerminationDate, CalculationPeriodFrequency periodFrequecy)
        {
            Period intervalToTerminationDate = CalculationPeriodFrequencyToInterval(periodToTerminationDate);
            Period periodInterval            = CalculationPeriodFrequencyToInterval(periodFrequecy);

            return(GenerateUnadjustedCalculationDates(effectiveDate, intervalToTerminationDate, periodInterval, periodFrequecy.rollConvention));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Generates the unadjusted calculation dates.
        /// </summary>
        /// <param name="effectiveDate">The effective date.</param>
        /// <param name="terminationDate">The termination date.</param>
        /// <param name="regularPeriodStartDate">The regular period start date.</param>
        /// <param name="calculationPeriodFrequency">The calculation period frequency.</param>
        /// <param name="stubPeriodType">Type of the stub period.</param>
        /// <returns></returns>
        static public List <CalculationPeriod> GenerateUnadjustedCalculationDates(DateTime effectiveDate, DateTime terminationDate, DateTime regularPeriodStartDate, CalculationPeriodFrequency calculationPeriodFrequency, StubPeriodTypeEnum?stubPeriodType)
        {
            Period periodInterval = CalculationPeriodFrequencyToInterval(calculationPeriodFrequency);

            return(GenerateUnadjustedCalculationDates(effectiveDate, terminationDate, regularPeriodStartDate, periodInterval, calculationPeriodFrequency.rollConvention, stubPeriodType));
        }