Learn R Programming

QuantBondCurves (version 0.3.1)

price.dirty2clean: From one price to another

Description

Converts bond prices from dirty to clean and viceversa.

Usage

price.dirty2clean(
  maturity,
  analysis.date = Sys.Date(),
  price,
  dirty = 1,
  coupon.rate,
  principal = 1,
  asset.type = "TES",
  freq = NULL,
  daycount = "NL/365"
)

Value

The dirty price or clean price of a bond.

Arguments

maturity

Last day of the contract: YYYY-MM-DD. Alternatively, it can be a numeric value that represents the duration of the contract in years.

analysis.date

Date in which the asset is valued. By default, the current date.

price

Numeric value. Price of the bond to convert.

dirty

Numeric value. Determines if the input price corresponds to the dirty price or the clean price. For dirty price, set dirty = 1. Otherwise, dirty = 0

coupon.rate

Coupon rate of the asset. Can be an unique numeric value or a vector corresponding to each coupon payment date.

principal

Notional amount for the asset.

asset.type

String that determines the asset type to value. See also 'Details'.

freq

Frequency of payments of a given asset in a year. For LIBOR and IBR the default frequency is four (quarterly payments). TES has a default frequency of one (annual payments).

daycount

Day count convention. See also 'Details'.

Details

asset.type makes reference to the following type of assets:

  • "TES" for Colombian Treasury Bonds (default).

  • "FixedIncome" for assets that are indexed to a fixed income with different frequency of payments.

  • "IBR" for bonds and assets indexed to 3M IBR rate.

  • "LIBOR" for bonds and assets indexed to 3M LIBOR.

daycount convention accepts the following values:

  • 30/360.

  • ACT/365.

  • ACT/360 (Default).

  • ACT/365L.

  • NL/365.

  • ACT/ACT-ISDA

  • ACT/ACT-AFB

Examples

Run this code
price.dirty2clean(maturity = "2026-01-03", analysis.date = "2023-01-02",
                  price = 1, dirty = 1, coupon.rate = 0.04, principal = 1)
price.dirty2clean(maturity = "2026-01-03", analysis.date = "2023-01-02",
                  price = 0.9601096, dirty = 0, coupon.rate = 0.04, principal = 1)

Run the code above in your browser using DataLab