Learn R Programming

fmdates (version 0.1.4)

generate_schedule: Generate a date schedule

Description

Generate a date schedule from effective_date to termination_date. This code was derived from the Quantlib method Schedule::Schedule. This can be used to generate the cash flow, fixing and projection dates of an interest rate swap according to certain conventions.

Usage

generate_schedule(effective_date, termination_date, tenor,
  calendar = EmptyCalendar(), bdc = "u", stub = "short_front",
  eom_rule = FALSE, first_date = effective_date,
  last_date = termination_date)

Arguments

effective_date

the date at which the schedule begins. For example, the effective date of a swap. This should be POSIXct.

termination_date

the date at which the schedule ends. For example, the termination date of a swap. This should be POSIXct.

tenor

the frequency of the events for which dates are generated. For example, month(3) reflects events that occur quarterly. Should be an atomic Period-class of length one

calendar
bdc

a string representing one of the following business day conventions: "u", "f", "mf", "p", "mp", "ms" (unadjusted, following, modified following, preceding, modified preceding and modified succeeding, resp.)

stub

a string representing one of the following stub types: "short_front", "short_back", "long_front", "long_back".

eom_rule

a logical value defining whether the end-to-end convention applies.

first_date

date of first payment for example. This defaults to effective_date as is usually the case

last_date

date of last payment for example. This defaults to termination_date as is usually the case

Value

an Interval vector

See Also

Other calendar methods: adjust, is_good, is_valid_bdc, is, locale, shift, tz

Examples

Run this code
# NOT RUN {
library (lubridate)
effective_date <- ymd('20120103')
termination_date <- ymd('20121203')
tenor <- months(3)
stub <- 'short_front'
bdc <- 'mf'
calendar <- AUSYCalendar()
eom_rule <- FALSE
generate_schedule(effective_date, termination_date, tenor, calendar,
 bdc, stub, eom_rule)
# }

Run the code above in your browser using DataLab