Term-class {fixedincome}R Documentation

Term class

Description

It is the time interval used in calculations with interest rates. The Term class represents the period used to discount or compound a spot rate.

Details

The Term object is defined by its numeric value and its unit, that can be "days", "months" or "years". For example:

term(6, "months")
#> [1] "6 months"

It represents a period of 6 months. The Term object can also be created from a string representation of a Term.

as.term("6 months")
#> [1] "6 months"

Since the Term object inherits from a numeric, it inherits all numeric operations. Numeric values can be summed or subtracted from a Term object numeric part.

term(1, "days") + 1
#> [1] "2 days"

Arithmetic and comparison operations between Term object are not implemented, so these operations raise an error.

try(term(1, "days") + term(2 , "days"))
#> Error in term(1, "days") + term(2, "days") : Not implemented

DateRangeTerm objects

The DateRangeTerm class inherits Term and defines start and end dates and a calendar to count the amount of working days between these two dates. This is a Term between two dates.

term(Sys.Date() - 5, Sys.Date(), "Brazil/ANBIMA")
#> [1] "3 days"

In financial markets it is fairly usual to evaluate interest rates between two dates.


[Package fixedincome version 0.0.5 Index]