scheduleGenerator

First introduced in version: 3.00.6

Syntax

scheduleGenerator(start, end, frequency, calendar, [businessDayConvention='Following'], [endOfMonth=false], [stubPolicy='Initial'], [brokenPeriodType='Long'], [method='AbsoluteNormal'])

Details

Generates a sequence of dates according to specified rules. The function takes a start date, an end date, and a frequency, and optionally incorporates a business calendar and business day adjustment rules to generate key dates such as coupon dates, observation dates, and cash flow dates.

This function applies to financial calculation scenarios such as bond coupon dates, interest rate reset dates, and payment dates. It supports the following rule combinations:

  • Generates a date sequence based on the specified frequency.
  • Adjusts non-business days according to the specified business calendar.
  • Supports end-of-month rule handling.
  • Supports initial stub or final stub handling.
  • Supports long stub or short stub handling.
  • Supports two date list generation methods: AbsoluteNormal and AbsoluteRecursive.

Note: When the total period between start and end cannot be evenly divided by frequency, an incomplete period (stub) is generated. Its handling is jointly determined by stubPolicy and brokenPeriodType.

Parameters

start is a DATE scalar specifying the start date.

end is a DATE scalar specifying the end date.

frequency is a STRING scalar specifying the date generation frequency. Supported values include:

  • "Once": generate only once
  • "Annual": once per year
  • "Semiannual": twice per year
  • "EveryFourthMonth": once every four months
  • "Quarterly": once every three months
  • "BiMonthly": once every two months
  • "Monthly": once per month
  • "EveryFourthWeek": once every four weeks
  • "BiWeekly": once every two weeks
  • "Weekly": once per week
  • "Daily": once per day

calendar is a STRING scalar specifying the business calendar.

businessDayConvention (optional) is a STRING scalar specifying the business day convention used to adjust dates that fall on non-business days. The default value is "Following". Supported values include:

  • "Following": the following business day.
  • "ModifiedFollowing": the following business day. If that day is in a different month, the preceding business day is adopted instead.
  • "Preceding": the preceding business day.
  • "ModifiedPreceding": the preceding business day. If that day is in a different month, the following business day is adopted instead.
  • "Unadjusted": unadjusted.
  • "HalfMonthModifiedFollowing": the following business day. If that day crosses the mid-month (15th) or the end of the month, the preceding business day is adopted instead.
  • "Nearest": the nearest business day. If both the preceding and following business days are equally far away, default to the following business day.

endOfMonth (optional) is a Boolean scalar specifying whether to enable the end-of-month rule. If the start date is the last business day of a month, all subsequent dates in the generated schedule will also be the last business day of a month. The default value is false.

stubPolicy (optional) is a STRING scalar specifying the stub policy. The default value is "Initial". Supported values include:

  • "Initial": place the incomplete period at the beginning
  • "Final": place the incomplete period at the end

brokenPeriodType (optional) is a STRING scalar specifying the type of incomplete period. The default value is "Long". Supported values include:

  • "Long": treat the incomplete period as a long period
  • "Short": treat the incomplete period as a short period

method (optional) is a STRING scalar specifying the schedule generation method. The default value is "AbsoluteNormal". Supported values include:

  • "AbsoluteNormal": first generate the full date sequence at once based on the start date and frequency, and then apply business day adjustments to all dates.
  • "AbsoluteRecursive": starting from the initial date, generate each date sequentially; after each date is generated, immediately apply business day adjustment, and use the adjusted date as the basis for generating the next date.

Returns

A DATE vector.

Examples

Example 1: Generate a sequence of dates with the given frequency.

// Generate only once
scheduleGenerator(start=2023.01.01, end=2025.01.01, frequency="Once", calendar="XSHG")
// output: [2023.01.03,2025.01.02]

// Generate a quarterly schedule using the default business day adjustment rule.
scheduleGenerator(start=2023.01.01, end=2025.01.01, frequency="Quarterly", calendar="XSHG")
// output: [2023.01.03,2023.04.03,2023.07.03,2023.10.09,2024.01.02,2024.04.01,2024.07.01,2024.10.08,2025.01.02]

// Generate once per month
scheduleGenerator(start=2023.01.01, end=2025.01.01, frequency="Monthly", calendar="XSHG")
// output: [2023.01.03,2023.02.01,2023.03.01,2023.04.03,2023.05.04,2023.06.01,2023.07.03,2023.08.01,2023.09.01,2023.10.09,2023.11.01,2023.12.01,2024.01.02,2024.02.01,2024.03.01,2024.04.01,2024.05.06,2024.06.03,2024.07.01,2024.08.01,2024.09.02,2024.10.08,2024.11.01,2024.12.02,2025.01.02]

Example 2: Generate a schedule with a final short stub using "AbsoluteNormal".

scheduleGenerator(start=2023.01.01, end=2024.12.01, frequency="Quarterly", calendar="XSHG", businessDayConvention="Following", endOfMonth=false, stubPolicy="Final", brokenPeriodType="Short", method="AbsoluteNormal")
// output: [2023.01.03,2023.04.03,2023.07.03,2023.10.09,2024.01.02,2024.04.01,2024.07.01,2024.10.08,2024.12.02]

Example 3: Generate a schedule with an initial short stub using "AbsoluteRecursive".

scheduleGenerator(start=2023.01.01, end=2024.12.01, frequency="Quarterly", calendar="XSHG", businessDayConvention="Following", endOfMonth=false, stubPolicy="Initial", brokenPeriodType="Short", method="AbsoluteRecursive")
// output: [2023.01.03,2023.03.06,2023.06.05,2023.09.04,2023.12.04,2024.03.04,2024.06.03,2024.09.02,2024.12.02]

Example 4: Generate a weekly schedule.

scheduleGenerator(start=2023.09.25, end=2023.10.30, frequency="Weekly", calendar="XSHG", businessDayConvention="Following", endOfMonth=false, stubPolicy="Final", brokenPeriodType="Short", method="AbsoluteNormal")
// output: [2023.09.25,2023.10.09,2023.10.16,2023.10.23,2023.10.30]

// Specify businessDayConvention="Unadjusted"
scheduleGenerator(start=2023.09.25, end=2023.10.30, frequency="Weekly", calendar="XSHG", businessDayConvention="Unadjusted", endOfMonth=false, stubPolicy="Final", brokenPeriodType="Short", method="AbsoluteNormal")
// output: [2023.09.25,2023.10.02,2023.10.09,2023.10.16,2023.10.23,2023.10.30]

Example 5: Generate a schedule with a final long stub using "AbsoluteRecursive".

scheduleGenerator(start=2023.01.01, end=2024.12.01, frequency="Quarterly", calendar="XSHG", businessDayConvention="Following", endOfMonth=false, stubPolicy="Final", brokenPeriodType="Long", method="AbsoluteRecursive")
// output: [2023.01.03,2023.04.03,2023.07.03,2023.10.09,2024.01.09,2024.04.09,2024.07.09,2024.12.02]

Related functions: dateGenerator, yearFrac