Learn R Programming

RTL (version 1.3.7)

bond: Bond pricing

Description

Compute bond price, cash flow table or duration

Usage

bond(ytm = 0.05, C = 0.05, T2M = 1, m = 2, output = "price")

Value

Returns price numeric, cash flows tibble, or duration numeric

Arguments

ytm

Yield to Maturity. numeric

C

Coupon rate per annum. numeric

T2M

Time to maturity in years. numeric

m

Periods per year for coupon payments e.g semi-annual = 2. numeric

output

"price", "df" or "duration". character

Author

Philippe Cote

Examples

Run this code
bond(ytm = 0.05, C = 0.05, T2M = 1, m = 2, output = "price")
bond(ytm = 0.05, C = 0.05, T2M = 1, m = 2, output = "df")
bond(ytm = 0.05, C = 0.05, T2M = 1, m = 2, output = "duration")

Run the code above in your browser using DataLab