forwardrate() creates a ForwardRate object.
forwardrate(x, ...)
# S3 method for class 'numeric'
forwardrate(
x,
terms,
compounding,
daycount,
calendar,
.copyfrom = NULL,
refdate = NULL,
...
)
# S3 method for class 'SpotRateCurve'
forwardrate(x, t1 = NULL, t2 = NULL, ...)a numeric or a SpotRateCurve object.
additional arguments.
a numeric vector with positive values representing terms of the forward rates.
a character with the compouning name.
a character representing the daycount.
a calendar object.
a SpotRate object that is used as reference to build the SpotRateCurve object.
the curve reference date.
initial term
final term
A ForwardRate object.
The arguments t1 and t2 define initial and final term used to
extract a ForwardRate from a SpotRateCurve.
forwardrate(c(0.1, 0.11, 0.12), term(c(21, 21, 21), "days"),
compounding("discrete"), daycount("business/252"), "Brazil/ANBIMA")
#> ForwardRate
#> 21 days 0.10
#> 21 days 0.11
#> 21 days 0.12
#> discrete business/252 Brazil/ANBIMA
terms <- c(1, 11, 26, 27, 28)
rates <- c(0.0719, 0.056, 0.0674, 0.0687, 0.07)
curve <- spotratecurve(rates, terms, "discrete", "actual/365", "actual",
refdate = as.Date("2022-02-23")
)
# forward rates between consecutive curve terms
forwardrate(curve)
#> ForwardRate
#> 1 day 0.07190000
#> 10 days 0.05442303
#> 15 days 0.07583814
#> 1 day 0.10306142
#> 1 day 0.10570410
#> discrete actual/365 actual
# forward rate between terms 11 and 26
forwardrate(curve, 11, 26)
#> ForwardRate
#> 15 days 0.07583814
#> discrete actual/365 actual