bondsimple: Simple Bond Functions

bondsimpleR Documentation

Simple Bond Functions

Description

Basic yield, pricing, duration and convexity calculations. These functions perform simple present value calculations assuming that all periods between payments are the same length. Unlike bond functions in Excel, for example, settlement and maturity dates are not used. By default, duration is Macaulay duration.

Usage

bondpv(coupon, mat, yield, principal, freq)
bondyield(price, coupon, mat, principal, freq)
duration(price, coupon, mat, principal, freq, modified)
convexity(price, coupon, mat, principal, freq)

Arguments

coupon

annual coupon

mat

maturity in years

yield

annual yield to maturity. If freq > 1, the yield is freq times the per period yield.

principal

maturity payment of the bond, in addition to the final coupon. Default value is $1,000. If the instrument is an annuity, set principal to zero.

freq

number of payments per year.

price

price of the bond

modified

If true, compute modified duration, otherwise compute Macaulay duration. FALSE by default.

Value

Return price, yield, or duration/convexity.

Examples

coupon <- 6; mat <- 20; freq <- 2; principal <- 100; yield <- 0.045;

price <- bondpv(coupon, mat, yield, principal, freq) # 119.7263
bondyield(coupon, mat, price=price, principal, freq) # 0.045
duration(price, coupon, mat, principal, freq, modified=FALSE) # 12.5043
duration(price, coupon, mat, principal, freq, modified=TRUE) # 12.3928
convexity(price, coupon, mat, principal, freq) # 205.3245


derivmkts documentation built on April 11, 2022, 5:10 p.m.