as_InterestRate: Coerce to InterestRate

Description Usage Arguments Value Examples

Description

You can coerce objects to the InterestRate class using this method.

Usage

1
2
3
4
5
6
7
8
as_InterestRate(x, ...)

## S3 method for class 'DiscountFactor'
as_InterestRate(x, compounding, day_basis, ...)

## S3 method for class 'InterestRate'
as_InterestRate(x, compounding = NULL,
  day_basis = NULL, ...)

Arguments

x

object to coerce

...

other parameters passed to methods

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

an InterestRate object

Examples

1
2
3
4
5
library("lubridate")
as_InterestRate(DiscountFactor(0.95, ymd(20130101), ymd(20140101)),
  compounding = 2, day_basis = "act/365")
as_InterestRate(InterestRate(c(0.04, 0.05), c(2, 4), 'act/365'),
  compounding = 4, day_basis = 'act/365')

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