endOfMonth {RQuantLib} | R Documentation |
The endOfMonth
function evaluates the given dates in the context
of the given calendar, and returns a vector that corresponds to the end
of month.
endOfMonth(calendar="TARGET", dates=Sys.Date())
calendar |
A string identifying one of the supported QuantLib calendars, see Details for more |
dates |
A vector (or scalar) of Date types. |
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, each of which is the end of month date that corresponds to the input dates. The element names are the dates (formatted as text in yyyy-mm-dd format).
The interface might change in future release as QuantLib
stabilises its own API.
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) endOfMonth("UnitedStates", dates) endOfMonth("UnitedStates/Settlement", dates) ## same as previous endOfMonth("UnitedStates/NYSE", dates) ## stocks endOfMonth("UnitedStates/GovernmentBond", dates) ## bonds endOfMonth("UnitedStates/NERC", dates) ## energy