The DiscountFactor
class is designed to represent discount factors. Checks
whether: d1
is less than d2
, elementwise, and that both are Date
vectors; and value
is greater than zero and is a numeric vector. An error
is thrown if any of these are not true. The elements of each argument are
recycled such that each resulting vectors have equivalent lengths.
DiscountFactor(value, d1, d2)
value | a numeric vector containing discount factor values. Must be greater than zero |
---|---|
d1 | a |
d2 | a |
a (vectorised) DiscountFactor
object
library("lubridate") df <- DiscountFactor(c(0.95, 0.94, 0.93), ymd(20130101), ymd(20140101, 20150101)) as_InterestRate(df, 2, "act/365")#> <InterestRate> 5.195670%, SEMI-ANNUAL, ACT/365 #> <InterestRate> 3.117823%, SEMI-ANNUAL, ACT/365 #> <InterestRate> 7.390339%, SEMI-ANNUAL, ACT/365