prepare_interpolation-FlatForwardCOPOM-SpotRateCurve-method: Create the interpolation function

prepare_interpolation,FlatForwardCOPOM,SpotRateCurve-methodR Documentation

Create the interpolation function

Description

Creates the interpolation function to a SpotRateCurve object.

Usage

## S4 method for signature 'FlatForwardCOPOM,SpotRateCurve'
prepare_interpolation(object, x, ...)

Arguments

object

a Interpolation object.

x

a SpotRateCurve object.

...

additional arguments. Currently unused.

This method is used internally when the interpolation is set to a curve. It uses the current state of the curve to build the interpolation function. This is similar to call 'approxfun' and 'splinefun' to create functions that perform interpolation of the given data points.

This method shouldn't be directly called, it is for internal use only.

Value

A 'FlatForwardCOPOM' object.

Examples

library(fixedincome)
library(bizdays)
copom_dates <- as.Date(
  c("2022-03-17", "2022-05-05", "2022-06-17", "2022-08-04")
)
terms <- c(1, 3, 25, 44, 66, 87, 108, 131, 152, 172, 192, 214, 236, 277)
rates <- c(
  0.1065, 0.1064, 0.111, 0.1138, 0.1168, 0.1189, 0.1207, 0.1219,
  0.1227, 0.1235, 0.1234, 0.1236, 0.1235, 0.1235
)
curve <- spotratecurve(
  rates, terms, "discrete", "business/252", "Brazil/ANBIMA",
  refdate = as.Date("2022-02-23")
)
prepare_interpolation(
  interp_flatforwardcopom(copom_dates, "second"),
  curve
)

wilsonfreitas/copom documentation built on June 11, 2025, 10:20 p.m.