rts-methods: Generic method to retrieve the rate(s) for (a) specific...

ratesR Documentation

Generic method to retrieve the rate(s) for (a) specific tenor(s) from a DynamicYieldCurve object

Description

A yield curve (or more precisely spot rate curve) describes the term structure of interest rates. The interest rates are calculated with respect to a given (analysis) adte ad for money that is borrowed or lend at t1>=ad until time t2>t1. The term or tenor is t2-t1. Cf. below for details.

Usage

rates(object, from, to, by, ad, refdate, ...)

## S4 method for signature 'YieldCurve'
rates(object, from, to, by, ad, refdate, ...)

## S4 method for signature 'DynamicYieldCurve'
rates(object, from, to, by, ad, refdate, ...)

Arguments

object

An object of class DynamicYieldCurve for which to return the yield for a given tenor

from

(optional) Date(s) t1. Should be a character variable with format 'YYYY-MM-DD'. Is set to ad if missing.

to

(optional, character) The date(s) t2. Should have the same format as from.

by

(optional) The tenor(s). Should be for form 'nX' where 'n' is an integer and 'X'=("D"|"W"|"M"|"Q"|"H"|"Y") for days, weeks, months, quarters, half-years and years, respectively. Either to or by must be defined.

ad

(optional) The analysis date ad with respect to which the interest rates are calculated. Should have the same format as from. If missing or ad=to, spot rates are calculated. If ad<to, forward rates are calculated.

Additional

parameters:

  • "isDateEnd"(deprecated) logical indicating whether to is of date (TRUE) or term (FALSE) format. Date format is 'YYYY-MM-DDTXX' with 'XX'=00 for beginning of day, or 24 for end of day, and term format is 'IP' with 'I' an integer and 'P' indicating the period (D=days, W=weeks, M=months, Q=quarters, H=halfyears, Y=years). Default is isDateEnd=FALSE.

  • "refdate" (deprecated) an alternative name for ad

Details

The DynamicYieldCurve object contains tenors with associated spot interest rates. Rates can be retrieved for any tenor by inter-/extrapolation.

For the forward rate at ad between times t1 and t2, to refers to t2 and from refers to t1. Is a single value. If combined with a vector for to, then from remains the same for all t2 defined in to.

Value

numeric The interest rates for the defined tenor(s)

See Also

discountFactors

Examples

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

rates(yc, by="1Y")  # 1-year spot rate
rates(yc, to="2016-01-01T00") # again, 1-year spot rate
rates(yc, by="1Y", from="2015-07-01T00")  # 1-year forward rate at 2015-07-01T00


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