[R-SIG-Finance] functions for quarterly settlement dates

Gabor Grothendieck ggrothendieck at gmail.com
Sat Feb 23 17:33:15 CET 2008


On Sat, Feb 23, 2008 at 10:24 AM, tom soyer <tom.soyer at gmail.com> wrote:
> Are there built-in R functions that return both the nearest and the next
> nearest quarterly settlement dates for options and futures?

You can do it yourself using some functions in fCalendar
(see ?timeSpecialDate).

Another possibility is using as.yearqtr, as.yearmon
in zoo together with the nextfri() function defined in
vignette("zoo-quickref").  If d is a Date then
d1 <- as.Date(as.yearmon(as.yearqtr(d)) + 2/12)
would be the first day in the last month of the quarter and
nextfri(d1)+14
would be 3rd Fri that month.

This requires the zoo package for as.yearmon and as.yearqtr
but does not require a zoo object and d can be a vector of dates.



More information about the R-SIG-Finance mailing list