rates | R Documentation |
DynamicYieldCurve
objectA 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.
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, ...)
object |
An object of class |
from |
(optional) Date(s) t1. Should be a |
to |
(optional, character) The date(s) t2. Should have the same format as |
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 |
ad |
(optional) The analysis date |
Additional |
parameters:
|
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
.
numeric
The interest rates for the defined tenor(s)
discountFactors
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.