yearFraction {RQuantLib}R Documentation

DayCounter functions from QuantLib

Description

The yearFraction function returns year fraction between two dates given a day counter Enum

Usage

yearFraction(startDates, endDates, dayCounters)

Arguments

startDates A vector of Date type.
endDates A vector of Date type.
dayCounters A vector of numeric type. See Enum

Details

The day counters are coming from QuantLib, and the QuantLib documentation should be consulted for details. See Enum and http://quantlib.org/reference/class_quant_lib_1_1_day_counter.html

Value

A numeric vector contains year fractions between two dates from the input.

Note

The interface might change in future release as QuantLib stabilises its own API.

Author(s)

Dirk Eddelbuettel edd@debian.org for the R interface; Khanh Nguyen nguyen.h.khanh@gmail.com for the implementation; the QuantLib Group for QuantLib

References

http://quantlib.org for details on QuantLib.

Examples

  startDates <- seq(from=as.Date("2009-04-07"), to=as.Date("2009-04-14"),
by=1)
endDates <- seq(from=as.Date("2009-11-07"), to=as.Date("2009-11-14"), by=1)
dayCounters <- c(0,1,2,3,4,5,6,1)
yearFraction(startDates, endDates, dayCounters)

[Package RQuantLib version 0.3.2 Index]