FittedBondCurve: Returns the discount curve (with zero rates and forwards)...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/bond.R

Description

FittedBondCurve fits a term structure to a set of bonds using three different fitting methodologies. For more detail, see QuantLib/Example/FittedBondCurve.

Usage

1
FittedBondCurve(curveparams, lengths, coupons, marketQuotes, dateparams)

Arguments

curveparams

curve parameters

method a string, fitting methods: "ExponentialSplinesFitting",
"SimplePolynomialFitting", "NelsonSiegelFitting"
origDate a Date, starting date of the curve
lengths

an numeric vector, length of the bonds in year

coupons

a numeric vector, coupon rate of the bonds

marketQuotes

a numeric vector, market price of the bonds

dateparams

(Optional) a named list, QuantLib's date parameters of the bond.

settlementDays (Optional) a double, settlement days.
Default value is 1.
dayCounter (Optional) a number or string,
day counter convention.
See Enum. Default value is 'Thirty360'
period (Optional) a number or string,
interest compounding interval. See Enum.
Default value is 'Semiannual'.
businessDayConvention (Optional) a number or string,
business day convention.
See Enum. Default value is 'Following'.

See example below.

Details

Please see any decent Finance textbook for background reading, and the QuantLib documentation for details on the QuantLib implementation.

Value

table, a three columns "date - zeroRate - discount" data frame

Author(s)

Khanh Nguyen knguyen@cs.umb.edu for the inplementation; Dirk Eddelbuettel edd@debian.org for the R interface; the QuantLib Group for QuantLib

References

http://quantlib.org/ for details on QuantLib.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
lengths <- c(2,4,6,8,10,12,14,16,18,20,22,24,26,28,30)
coupons <- c( 0.0200, 0.0225, 0.0250, 0.0275, 0.0300,
              0.0325, 0.0350, 0.0375, 0.0400, 0.0425,
              0.0450, 0.0475, 0.0500, 0.0525, 0.0550 )
marketQuotes <- rep(100, length(lengths))
dateparams <- list(settlementDays=0, period="Annual", 
                   dayCounter="ActualActual", 
                  businessDayConvention ="Unadjusted")
curveparams <- list(method="ExponentialSplinesFitting", 
                    origDate = Sys.Date())
curve <- FittedBondCurve(curveparams, lengths, coupons, marketQuotes, dateparams)
library(zoo)
z <- zoo(curve$table$zeroRates, order.by=curve$table$date)
plot(z)

RQuantLib documentation built on May 2, 2019, 4:48 p.m.