fmbasics makes it easy to work with interest rates and discount factors. You can convert interest rates to discount factors and vice-versa.

Interest rates

Let’s make an interest rate object:

You can convert this rate to another rate with a different compounding/day basis:

You can perform arithmetic on interest rates. Rates are implicitly converted to equivalent day basis and compounding before the operation is performed on the rates’ values.

You can also convert interest rates into discount factors:

library("lubridate")
df <- as_DiscountFactor(rate, ymd(20140101), ymd(20140401))

The InterestRate class is vectorised.

Discount factors

Let’s make a discount factor object:

You can convert discount factors to interest rates.

as_InterestRate(df, compounding = 2, day_basis = 'act/365')
#> <InterestRate> 10.81851%, SEMI-ANNUAL, ACT/365

The DiscountFactor class is vectorised.