Class ScheduleGenerator

java.lang.Object
net.finmath.time.ScheduleGenerator

public class ScheduleGenerator extends Object
Generates a schedule based on some meta data (frequency, maturity, date roll convention, etc.). A schedule is just a collection of Periods.
Version:
1.0
Author:
Christian Fries
Date:
02.03.2014
  • Method Details

    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, LocalDate startDate, LocalDate maturityDate, ScheduleGenerator.Frequency frequency, ScheduleGenerator.DaycountConvention daycountConvention, ScheduleGenerator.ShortPeriodConvention shortPeriodConvention, BusinessdayCalendar.DateRollConvention dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays, boolean isUseEndOfMonth)
      ScheduleFromPeriods generation for given {referenceDate,startDate,maturityDate}. Generates a schedule based on some meta data.
      • The schedule generation considers short stub periods at beginning or at the end.
      • Date rolling is performed using the provided businessdayCalendar.
      The reference date is used internally to represent all dates as doubles, i.e. t = 0 corresponds to the reference date.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startDate - The start date of the first period (unadjusted - adjustments take place during schedule generation).
      maturityDate - The end date of the last period (unadjusted - adjustments take place during schedule generation).
      frequency - The frequency.
      daycountConvention - The daycount convention.
      shortPeriodConvention - If short period exists, have it first or last.
      dateRollConvention - Adjustment to be applied to the all dates.
      businessdayCalendar - Businessday calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      isUseEndOfMonth - If ShortPeriodConvention is LAST and startDate is an end of month date, all period will be adjusted to EOM. If ShortPeriodConvention is FIRST and maturityDate is an end of month date, all period will be adjusted to EOM.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, LocalDate startDate, LocalDate maturityDate, ScheduleGenerator.Frequency frequency, ScheduleGenerator.DaycountConvention daycountConvention, ScheduleGenerator.ShortPeriodConvention shortPeriodConvention, BusinessdayCalendar.DateRollConvention dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      ScheduleFromPeriods generation for given {referenceDate,startDate,maturityDate}. Generates a schedule based on some meta data.
      • The schedule generation considers short stub periods at beginning or at the end.
      • Date rolling is performed using the provided businessdayCalendar.
      The reference date is used internally to represent all dates as doubles, i.e. t = 0 corresponds to the reference date.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startDate - The start date of the first period (unadjusted - adjustments take place during schedule generation).
      maturityDate - The end date of the last period (unadjusted - adjustments take place during schedule generation).
      frequency - The frequency.
      daycountConvention - The daycount convention.
      shortPeriodConvention - If short period exists, have it first or last.
      dateRollConvention - Adjustment to be applied to the all dates.
      businessdayCalendar - Businessday calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, LocalDate startDate, LocalDate maturityDate, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      ScheduleFromPeriods generation for given {referenceDate,startDate,maturityDate}. Generates a schedule based on some meta data.
      • The schedule generation considers short stub periods at beginning or at the end.
      • Date rolling is performed using the provided businessdayCalendar.
      The reference date is used internally to represent all dates as doubles.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startDate - The start date of the first period (unadjusted - adjustments take place during schedule generation).
      maturityDate - The end date of the last period (unadjusted - adjustments take place during schedule generation).
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Businessday calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(Date referenceDate, Date startDate, Date maturityDate, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      ScheduleFromPeriods generation for given {referenceDate,startDate,maturityDate}. Method using Date instead of LocalDate for backward compatibility. Generates a schedule based on some meta data.
      • The schedule generation considers short stub periods at beginning or at the end.
      • Date rolling is performed using the provided businessdayCalendar.
      The reference date is used internally to represent all dates as doubles.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startDate - The start date of the first period (unadjusted - adjustments take place during schedule generation).
      maturityDate - The end date of the last period (unadjusted - adjustments take place during schedule generation).
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Businessday calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, LocalDate tradeDate, int spotOffsetDays, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      Simple schedule generation where startDate and maturityDate are calculated based on tradeDate, spotOffsetDays, startOffsetString and maturityString. The schedule generation considers short periods. Date rolling is ignored.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      tradeDate - Base date for the schedule generation (used to build spot date).
      spotOffsetDays - Number of business days to be added to the trade date to obtain the spot date.
      startOffsetString - The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      maturityString - The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Business day calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, int spotOffsetDays, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays, boolean isUseEndOfMonth)
      Simple schedule generation where startDate and maturityDate are calculated based on referenceDate, spotOffsetDays, startOffsetString and maturityString. The schedule generation considers short periods. Date rolling is ignored.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      spotOffsetDays - Number of business days to be added to the reference date to obtain the spot date.
      startOffsetString - The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      maturityString - The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Business day calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      isUseEndOfMonth - If ShortPeriodConvention is LAST and startDate is an end of month date, all period will be adjusted to EOM. If ShortPeriodConvention is FIRST and maturityDate is an end of month date, all period will be adjusted to EOM.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, int spotOffsetDays, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      Simple schedule generation where startDate and maturityDate are calculated based on referenceDate, spotOffsetDays, startOffsetString and maturityString. The schedule generation considers short periods. Date rolling is ignored.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      spotOffsetDays - Number of business days to be added to the trade date to obtain the spot date.
      startOffsetString - The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      maturityString - The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Business day calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      Simple schedule generation where startDate and maturityDate are calculated based on referenceDate, startOffsetString and maturityString. The schedule generation considers short periods. Date rolling is ignored.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startOffsetString - The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      maturityString - The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Business day calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      public static Schedule createScheduleFromConventions(LocalDate referenceDate, String futureCode, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      ScheduleFromPeriods generation with futureCodes (in the format DEC17). Futures are assumed to expire on the third wednesday in the respective month.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      futureCode - Future code in the format DEC17
      startOffsetString - The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      maturityString - The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc.
      frequency - The frequency (as String).
      daycountConvention - The daycount convention (as String).
      shortPeriodConvention - If short period exists, have it first or last (as String).
      dateRollConvention - Adjustment to be applied to the all dates (as String).
      businessdayCalendar - Business day calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      @Deprecated public static Schedule createScheduleFromConventions(LocalDate referenceDate, LocalDate startDate, String frequency, double maturity, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays)
      Deprecated.
      Will be removed in version 2.3
      Generates a schedule based on some meta data. The schedule generation considers short periods.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startDate - The start date of the first period.
      frequency - The frequency.
      maturity - The end date of the last period.
      daycountConvention - The daycount convention.
      shortPeriodConvention - If short period exists, have it first or last.
      dateRollConvention - Adjustment to be applied to the all dates.
      businessdayCalendar - Businessday calendar (holiday calendar) to be used for date roll adjustment.
      fixingOffsetDays - Number of business days to be added to period start to get the fixing date.
      paymentOffsetDays - Number of business days to be added to period end to get the payment date.
      Returns:
      The corresponding schedule
    • createScheduleFromConventions

      @Deprecated public static Schedule createScheduleFromConventions(LocalDate referenceDate, LocalDate startDate, String frequency, double maturity, String daycountConvention, String shortPeriodConvention)
      Deprecated.
      Will be removed in version 2.3
      Generates a schedule based on some meta data. The schedule generation considers short periods. Date rolling is ignored.
      Parameters:
      referenceDate - The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
      startDate - The start date of the first period.
      frequency - The frequency.
      maturity - The end date of the last period.
      daycountConvention - The daycount convention.
      shortPeriodConvention - If short period exists, have it first or last.
      Returns:
      The corresponding schedule