# bondsimple: Simple Bond Functions In derivmkts: Functions and R Code to Accompany Derivatives Markets

## 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

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

 ```1 2 3 4 5 6 7``` ```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 June 6, 2019, 5:03 p.m.