A collection of methods that shift dates according to index conventions.

to_reset(dates, index)

to_value(dates, index)

to_maturity(dates, index)

# S3 method for default
to_reset(dates, index)

# S3 method for default
to_value(dates, index)

# S3 method for default
to_maturity(dates, index)

Arguments

dates

a vector of dates to shift

index

an instance of an object that inherits from the Index class.

Value

a vector of shifted dates

Details

The following describes the default methods. to_reset() treats the input dates as value dates and shifts these to the corresponding reset or fixing dates using the index's spot lag; to_value() treats the input dates as reset or fixing dates and shifts them to the corresponding value dates using the index's spot lag; and to_maturity() treats the input dates as value dates and shifts these to the index's corresponding maturity date using the index's tenor.

Examples

library(lubridate) to_reset(ymd(20170101) + days(0:30), AUDBBSW(months(3)))
#> [1] "2017-01-03" "2017-01-03" "2017-01-03" "2017-01-04" "2017-01-05" #> [6] "2017-01-06" "2017-01-09" "2017-01-09" "2017-01-09" "2017-01-10" #> [11] "2017-01-11" "2017-01-12" "2017-01-13" "2017-01-13" "2017-01-13" #> [16] "2017-01-16" "2017-01-17" "2017-01-18" "2017-01-19" "2017-01-20" #> [21] "2017-01-23" "2017-01-23" "2017-01-23" "2017-01-24" "2017-01-25" #> [26] "2017-01-27" "2017-01-27" "2017-01-30" "2017-01-30" "2017-01-30" #> [31] "2017-01-31"
to_value(ymd(20170101) + days(0:30), AUDBBSW(months(3)))
#> [1] "2017-01-03" "2017-01-03" "2017-01-03" "2017-01-04" "2017-01-05" #> [6] "2017-01-06" "2017-01-09" "2017-01-09" "2017-01-09" "2017-01-10" #> [11] "2017-01-11" "2017-01-12" "2017-01-13" "2017-01-13" "2017-01-13" #> [16] "2017-01-16" "2017-01-17" "2017-01-18" "2017-01-19" "2017-01-20" #> [21] "2017-01-23" "2017-01-23" "2017-01-23" "2017-01-24" "2017-01-25" #> [26] "2017-01-27" "2017-01-27" "2017-01-30" "2017-01-30" "2017-01-30" #> [31] "2017-01-31"
to_maturity(ymd(20170101) + days(0:30), AUDBBSW(months(3)))
#> [1] "2017-04-03" "2017-04-03" "2017-04-03" "2017-04-04" "2017-04-05" #> [6] "2017-04-06" "2017-04-07" "2017-04-10" "2017-04-10" "2017-04-10" #> [11] "2017-04-11" "2017-04-12" "2017-04-13" "2017-04-13" "2017-04-13" #> [16] "2017-04-18" "2017-04-18" "2017-04-18" "2017-04-19" "2017-04-20" #> [21] "2017-04-21" "2017-04-24" "2017-04-24" "2017-04-24" "2017-04-26" #> [26] "2017-04-26" "2017-04-27" "2017-04-28" "2017-04-28" "2017-04-28" #> [31] "2017-04-28"