Creates the interpolation function to a SpotRateCurve object.

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 Interpolation object with the slot func properly defined. This slot is set with a function (closure) that executes the interpolation method.

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")
prepare_interpolation(interp_flatforward(), curve)
#> <Interpolation: flatforward >