spotratecurve-helpers: SpotRateCurve helpers

spotratecurve-helpersR Documentation

SpotRateCurve helpers

Description

Helpers methods that return parts of a SpotRateCurve object according to a given term.

Usage

first(x, t)

last(x, t)

closest(x, t)

Arguments

x

a SpotRateCurve object.

t

a Term object.

first filters the first elements of the SpotRateCurve according to the given term.

last filters the last elements of the SpotRateCurve according to the given term.

closest selects the element of the SpotRateCurve that is the closest to the given term.

Value

A SpotRateCurve object that is a subset of the given curve. The elements returned are select according to the operation executed.

Examples

terms <- c(1, 11, 26, 27, 28)
rates <- c(0.0719, 0.056, 0.0674, 0.0687, 0.07)
curve <- spotratecurve(rates, terms, "discrete", "actual/365", "actual")
first(curve, "10 days")
last(curve, "10 days")
closest(curve, "10 days")

wilsonfreitas/R-fixedincome documentation built on June 30, 2023, 7:46 a.m.