/// <summary>
        /// Gets the adjusted calculation period start dates.
        /// </summary>
        /// <param name="effectiveDate">The effective date.</param>
        /// <param name="terminationDate">The termination date.</param>
        /// <param name="periodInterval">The period interval.</param>
        /// <param name="rollConvention">The roll convention.</param>
        /// <param name="firstRegularPeriodDate">The first regular period date.</param>
        /// <param name="stubPeriodType">Type of the stub period.</param>
        /// <param name="businessCalendar">The businessCalendar.</param>
        /// <param name="businessDayConvention">The business day convention.</param>
        /// <returns>A vertical range of dates.</returns>
        public static DateTime[] GetAdjustedCalculationPeriodDates(DateTime effectiveDate, DateTime terminationDate,
                                                                   string periodInterval, string rollConvention, DateTime firstRegularPeriodDate, string stubPeriodType,
                                                                   IBusinessCalendar businessCalendar, string businessDayConvention)
        {
            const string       dateToReturn = "unadjustedStartDate";
            StubPeriodTypeEnum?stubType     = null;

            if (!string.IsNullOrEmpty(stubPeriodType))
            {
                stubType = (StubPeriodTypeEnum)Enum.Parse(typeof(StubPeriodTypeEnum), stubPeriodType, true);
            }
            var periods  = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, terminationDate, firstRegularPeriodDate, PeriodHelper.Parse(periodInterval), RollConventionEnumHelper.Parse(rollConvention), stubType);
            var dates    = CalculationPeriodHelper.GetCalculationPeriodsProperty <DateTime>(periods, dateToReturn);
            var newDates = new DateTime[dates.Count];
            var index    = 0;

            foreach (var date in dates)
            {
                var newDate = BusinessCalendarHelper.Advance(businessCalendar, date, "Calendar", "0D", businessDayConvention);
                newDates[index] = newDate;
                index++;
            }
            var result = newDates;

            return(result);
        }
 /// <summary>
 /// Gets the unadjusted calculation date schedule.
 /// </summary>
 /// <param name="effectiveDate">The effective date.</param>
 /// <param name="terminationDate">The termination date.</param>
 /// <param name="periodInterval">The period interval.</param>
 /// <param name="rollConvention">The roll convention.</param>
 /// <param name="stubPeriodType">Type of the stub period.</param>
 /// <returns></returns>
 public List <CalculationPeriod> GetUnadjustedCalculationDateSchedule(DateTime effectiveDate, DateTime terminationDate, Period periodInterval, RollConventionEnum rollConvention, StubPeriodTypeEnum?stubPeriodType)
 {
     CalculationPeriodDates = null;
     PeriodInterval         = periodInterval;
     _effectiveDate         = effectiveDate;
     _termDate      = terminationDate;
     RollConvention = rollConvention;
     _unadjustedDateScheduleList = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, terminationDate, periodInterval, rollConvention, stubPeriodType);
     return(_unadjustedDateScheduleList);
 }
 /// <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="intervalToTerminationDate">The interval to termination date.</param>
 /// <param name="periodInterval">The period interval.</param>
 /// <returns></returns>
 public List <CalculationPeriod> GetUnadjustedCalculationDateSchedule(DateTime effectiveDate, Period intervalToTerminationDate, Period periodInterval)
 {
     CalculationPeriodDates = null;
     PeriodInterval         = periodInterval;
     _effectiveDate         = effectiveDate;
     _termDate      = intervalToTerminationDate.Add(effectiveDate);
     RollConvention = RollConventionEnum.NONE;
     _unadjustedDateScheduleList = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, intervalToTerminationDate, periodInterval);
     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);
 }
 /// <summary>
 /// Gets the unadjusted calculation date schedule.
 /// </summary>
 /// <param name="calculationPeriodDates">The calculation period dates.</param>
 /// <returns></returns>
 public List <CalculationPeriod> GetUnadjustedCalculationDateSchedule(CalculationPeriodDates calculationPeriodDates)
 {
     CalculationPeriodDates = calculationPeriodDates;
     PeriodInterval         = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(calculationPeriodDates.calculationPeriodFrequency);
     _effectiveDate         = XsdClassesFieldResolver.CalculationPeriodDatesGetEffectiveDate(calculationPeriodDates).unadjustedDate.Value;
     _termDate      = XsdClassesFieldResolver.CalculationPeriodDatesGetTerminationDate(calculationPeriodDates).unadjustedDate.Value;
     RollConvention = calculationPeriodDates.calculationPeriodFrequency.rollConvention;
     _unadjustedDateScheduleList = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(_effectiveDate, _termDate, calculationPeriodDates);
     return(_unadjustedDateScheduleList);
 }
예제 #7
0
        /// <summary>
        /// Returns the unadjusted the calculation dates
        /// </summary>
        /// <param name="effectiveDate">The effective date.</param>
        /// <param name="terminationDate">The termination date.</param>
        /// <param name="intervalToFirstRegularPeriodStart">The interval to first regular period start.</param>
        /// <param name="periodInterval">The period interval.</param>
        /// <param name="rollConvention">The roll convention.</param>
        /// <param name="stubPeriodType">Type of the stub period.</param>
        /// <returns></returns>
        public static DateTime[] UnadjustedCalculationDatesFromFirstRegularInterval(DateTime effectiveDate, DateTime terminationDate, string intervalToFirstRegularPeriodStart, string periodInterval, string rollConvention, string stubPeriodType)
        {
            const string       dateToReturn = "unadjustedStartDate";
            StubPeriodTypeEnum?stubType     = null;

            if (!string.IsNullOrEmpty(stubPeriodType))
            {
                stubType = (StubPeriodTypeEnum)Enum.Parse(typeof(StubPeriodTypeEnum), stubPeriodType, true);
            }
            var periods = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, terminationDate, PeriodHelper.Parse(periodInterval), PeriodHelper.Parse(intervalToFirstRegularPeriodStart), RollConventionEnumHelper.Parse(rollConvention), stubType);
            var dates   = CalculationPeriodHelper.GetCalculationPeriodsProperty <DateTime>(periods, dateToReturn);
            var result  = dates.ToArray();

            return(result);
        }