bond_prices: Bond Price Calculation

Description Usage Arguments Value See Also Examples

View source: R/bondpricing.R

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

1
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

1
2
3
4
5
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

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
DE0001141414 DE0001137131 DE0001141422 DE0001137149 DE0001135093 DE0001135077 
    104.2482     102.9952     102.9923     103.2357     104.1084     104.7333 
DE0001137156 DE0001141430 DE0001137164 DE0001135101 DE0001137172 DE0001141448 
    103.4763     103.4735     103.7172     103.7149     107.4580     106.4547 
DE0001137180 DE0001135127 DE0001135119 DE0001137198 DE0001141455 DE0001137206 
    108.9483     108.9460     107.9464     107.9393     106.9369     107.9301 
DE0001135135 DE0001141463 DE0001135150 DE0001141471 DE0001135168 DE0001141489 
    110.6762     109.6686     115.6565     107.4006     115.6357     113.8787 
DE0001135184 DE0001141497 DE0001135192 DE0001141505 DE0001135200 DE0001141513 
    119.8646     113.8568     119.8419     119.8329     124.8181     121.0583 
DE0001135218 DE0001135234 DE0001135242 DE0001135259 DE0001135267 DE0001135283 
    122.2958     122.2752     125.2458     129.4687     125.9457     125.6734 
DE0001135291 DE0001134468 DE0001135309 DE0001134492 DE0001135317 DE0001135333 
    127.6418     153.5775     135.6049     150.1911     133.3280     142.0375 
DE0001135341 DE0001134922 DE0001135044 DE0001135069 DE0001135085 DE0001135143 
    139.5079     198.9473     228.5707     211.0932     198.3733     235.8135 
DE0001135176 DE0001135226 DE0001135275 DE0001135325 
    224.7862     226.2541     213.8654     233.5375 

termstrc documentation built on May 29, 2017, 1:05 p.m.