advance {RQuantLib} | R Documentation |
The advance
function evaluates the given dates in the context
of the given calendar, and returns a vector that advances the given
dates of the given number of business days and returns the result. See
note for usage below for usage.
calendar |
A string identifying one of the supported QuantLib calendars, see Details for more |
dates |
A vector (or scalar) of Date types. |
n |
an int |
timeUnit |
a value of 0,1,2,3 that corresponds to Days, Weeks, Months, and Year. For more detail, see QuantLib doc http://quantlib.org/reference/group__datetime.html |
period |
See Enum |
bdc |
business day convention. By default, this value is 0 and correspond to Following convention |
emr |
End Of Month rule. Default = false |
The calendars are coming from QuantLib, and the QuantLib documentation should be consulted for details.
Currently, the following strings are recognised: TARGET (a default calendar), Canada and Canada/Settlement, Canada/TSX, Germany and Germany/FrankfurtStockExchange, Germany/Settlement, Germany/Xetra, Germany/Eurex, Italy and Italy/Settlement, Italy/Exchange, Japan, UnitedKingdom and UnitedKingdom/Settlement, UnitedKingdom/Exchange, UnitedKingdom/Metals, UnitedStates and UnitedStates/Settlement, UnitedStates/NYSE, UnitedStates/GovernmentBond, UnitedStates/NERC.
(In case of multiples entries per country, the country default is listed right after the country itself. Using the shorter form is equivalent.)
An named vector of dates. The element names are the dates (formatted as text in yyyy-mm-dd format).
The function can be called in two ways.
advance(calendar="TARGET", dates=Sys.Date(),n, timeUnit, bdc = 0, emr =0)
advance(calendar="TARGET", dates=Sys.Date(), period, bdc = 0, emr =0)
Dirk Eddelbuettel edd@debian.org for the R interface;
Khanh Nguyen nguyen.h.khanh@gmail.com for the implementation;
the QuantLib Group for QuantLib
http://quantlib.org for details on QuantLib
.
dates <- seq(from=as.Date("2009-04-07"), to=as.Date("2009-04-14"), by=1) advance("UnitedStates", dates, 10, 0) advance("UnitedStates/Settlement", dates, 10, 1) ## same as previous advance("UnitedStates/NYSE", dates, 10, 2) ## stocks advance("UnitedStates/GovernmentBond", dates, 10, 3) ## bonds advance("UnitedStates/NERC", dates, period = 3) ## energy