dfs-methods: Generic method to retrieve discount factors for specific...

discountFactorsR Documentation

Generic method to retrieve discount factors for specific tenor(s) from a YieldCurve or DynamicYieldCurve object.

Description

Discount factors for specified tenors are extracted from a YieldCurve or DynamicYieldCurve object according to the compounding method specified.

Usage

discountFactors(object, to, from, method = "continuous", 
period = "Y", refdate = NULL, ...)

## S4 method for signature 'YieldCurve'
discountFactors(object, ...)

## S4 method for signature 'numeric'
discountFactors(object, to, from, ...)

## S4 method for signature 'DynamicYieldCurve'
discountFactors(
  object,
  to,
  from,
  by,
  method = "continuous",
  period = "Y",
  ad = NULL,
  refdate,
  ...
)

Arguments

object

An object of class YieldCurve or DynamicYieldCurve from which to extract the discount factors.

...

Additional parameters to be passed.

  • "isDateEnd" (deprecated)logical indicating whether 'end' is of date (TRUE) or term (FALSE) format. Date format is 'YYYY-MM-DD'. Default is isDateEnd = FALSE.

to

character reflecting the discounting period end date. Can be a single value or a vector of tenors.

from

(optional) a character defining the discounting period start date. If it is a single value combined with a vector for 'end', then 'start' remains the same for all dates defined in 'end'.

by

(optional)

method
period
ad
refdate

Value

numeric vector of discount factors for the defined periods.

See Also

rates

Examples

tenors <- c("1W", "1M", "6M", "1Y", "2Y", "5Y")
rates <- c(0.001, 0.0015, 0.002, 0.01, 0.02, 0.03)
yc <- DynamicYieldCurve(label = "YC_Prim",
                        ReferenceDate = "2015-01-01",
                        Tenors = tenors,
                        Rates = rates)

discountFactors(yc, by="1Y")
discountFactors(yc, to="2016-01-01", isDateEnd = TRUE)
discountFactors(yc, by="1Y", from="2015-07-01")


wbreymann/FEMS documentation built on Dec. 8, 2022, 9:43 a.m.