InterestRate: InterestRate class

Description Usage Arguments Value Examples

Description

The InterestRate class is designed to represent interest rates. Checks whether: the day_basis is valid; and the compounding is valid. 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.

Usage

1
InterestRate(value, compounding, day_basis)

Arguments

value

a numeric vector containing interest rate values (as decimals).

compounding

a numeric vector representing the compounding frequency.

day_basis

a character vector representing the day basis associated with the interest rate (see fmdates::year_frac())

Value

a vectorised InterestRate object

Examples

1
2
3
4
5
library("lubridate")
InterestRate(c(0.04, 0.05), c(2, 4), 'act/365')
rate <- InterestRate(0.04, 2, 'act/365')
as_DiscountFactor(rate, ymd(20140101), ymd(20150101))
as_InterestRate(rate, compounding = 4, day_basis = 'act/365')

fmbasics documentation built on May 2, 2019, 6:22 a.m.