calc_risk: Calculate the Risks of a Bond

Description Usage Arguments Value See Also Examples

Description

Given a bond or the necessary parameters to construct one, this will calculate the DV01 and other risks of the bond for the worst workout date. The workout dates used are the based on the cfs object's last cashflow dates in the bond. This function uses discount_cfs_single to do the actual calculations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
calc_risk(x, ...)

## Default S3 method:
calc_risk(maturity, settle, coupon, price_yield,
  input_type = "Y", returnCFs = FALSE, conv = "30/360", freq = 2)

## S3 method for class 'bond'
calc_risk(b, settle, price_yield, input_type = "Y",
  returnCFs = FALSE)

calc_dv01(x, ...)

## Default S3 method:
calc_dv01(maturity, settle, coupon, price_yield,
  input_type = "Y", conv = "30/360", freq = 2)

## S3 method for class 'bond'
calc_dv01(b, settle, price_yield, input_type = "Y")

Arguments

maturity

Maturity/Workout date

settle

Settlement Date

coupon

Annnual coupon amount

price_yield

The clean price of the bond or the yield to worst

input_type

"Y" for Yield to Worst (default) or "P" for clean price

returnCFs

Boolean flag indicating whether or not to return the calculated set of cashflows and risk metrics

conv

Daycount convention (one of "30/360", "Act/Act", or "Act/365")

freq

Coupon frequency (number of periods per year)

b

A bond object

Value

Numeric value of the DV01 and other risks and corresponding worst workout date and workout type if there are multiple sets of cashflows in the bond or a full set of calculated cashflows and risk metrics as a tbl_df

See Also

Other pricing functions: acc_int; calc_clean_px, calc_clean_px.bond, calc_clean_px.default; calc_dirty_px, calc_dirty_px.bond, calc_dirty_px.default; calc_yield, calc_yield.bond, calc_yield.default; calc_ytm; discount_cfs_single; risk_cfs_single; yield_cfs_single

Examples

1
2
3
4
calc_risk("2045-02-15", "2015-02-15", 4, 101, "P", TRUE, "Act/Act", 2)
b <- bond("2045-02-15", 2.5, "2015-02-17", "Act/Act", 2, 100, id = "ABCD")
calc_risk(b, "2015-05-15", 101, "P", TRUE)
calc_dv01(b, "2015-05-15", 3, "Y")

Tsunamical28/mdpr documentation built on May 9, 2019, 5:15 p.m.