Learn R Programming

Trading (version 3.2)

Curve-class: Curve Class

Description

Creates a Curve Object containing pairs of Tenors with relevant rates and the interpolation function. Also, methods for populating the object via a .csv file and the generation of the interpolation function via cubic splines are included.

Value

An object of type Curve

Arguments

Tenors

The Tenors of the curve

Rates

The rates on the corresponding tenors

interp_function

(Optional) The interpolation function of the curve. Can be populated via the 'CalcInterpPoints' method

Author

Tasos Grivas <tasos@openriskcalculator.com>

Examples

Run this code

## generating a curve either directly or through a csv - 
## the spot_rates.csv file can be found on the extdata folder in the installation library path
funding_curve =  Curve(Tenors=c(1,2,3,4,5,6,10),Rates=c(4,17,43,47,76,90,110))
spot_rates = Curve()
spot_rates$PopulateViaCSV('spot_rates.csv')
time_points = seq(0,5,0.01)
spot_curve     = spot_rates$CalcInterpPoints(time_points)

Run the code above in your browser using DataLab