| yc_bond_duration | R Documentation |
Compute Macaulay duration, modified duration, and convexity for a coupon-bearing bond.
yc_bond_duration(
face = 100,
coupon_rate,
maturity,
yield,
frequency = 2,
compounding = c("semi_annual", "annual", "continuous")
)
face |
Numeric. Face (par) value of the bond. Default is 100. |
coupon_rate |
Numeric. Annual coupon rate as a decimal (e.g., 0.05 for 5 percent). |
maturity |
Numeric. Time to maturity in years. |
yield |
Numeric. Yield to maturity as a decimal. |
frequency |
Integer. Coupon frequency per year: 1 for annual or 2 for semi-annual (default). |
compounding |
Character. Compounding convention: |
A list with components macaulay_duration, modified_duration,
convexity, and price.
# 2-year 5% bond at 4% yield, semi-annual coupons
yc_bond_duration(face = 100, coupon_rate = 0.05, maturity = 2,
yield = 0.04, frequency = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.