Learn R Programming

termstrc (version 1.3.7)

bond_prices: Bond Price Calculation

Description

Function for the calculation of bond prices according to the chosen approach (Diebold/Li, Nelson/Siegel, Svensson) based on the cashflows and maturities matrix of the bonds.

Usage

bond_prices(method = "ns", beta, m, cf, lambda)

Arguments

method
defines the desired method: "ns" for the Nelson/Siegel,"dl" for Diebold/Li, "sv" for the Svensson approach.
beta
parameter vector, is linked to the chosen approach.
m
maturities matrix, consists of the maturity dates which are appended to the cashflows of the bonds.
cf
cashflows matrix.
lambda
additional parameter for the "dl" spot rate function

Value

Returns a list with:
spot_rates
spot rates matrix
discount_factors
discount factors matrix
bond_prices
bond prices vector

See Also

spotrates

Examples

Run this code
data(govbonds)
cf <- create_cashflows_matrix(govbonds[[1]])
m <- create_maturities_matrix(govbonds[[1]])
beta <- c(0.0511,-0.0124,-0.0303,2.5429)
bond_prices(method="ns",beta,m,cf)$bond_prices

Run the code above in your browser using DataLab