Learn R Programming

RTL (version 1.3.7)

swapIRS: Interest Rate Swap

Description

Computes the mark to market of an IRS

Usage

swapIRS(
  trade.date = lubridate::today(),
  eff.date = lubridate::today() + 2,
  mat.date = lubridate::today() + 2 + lubridate::years(2),
  notional = 1e+06,
  PayRec = "Rec",
  fixed.rate = 0.05,
  float.curve = usSwapCurves,
  reset.freq = 3,
  disc.curve = usSwapCurves,
  convention = c("act", 360),
  bus.calendar = "NY",
  output = "price"
)

Value

List of swap price, cash flow data frame, duration. list

Arguments

trade.date

Date object. Defaults to today(). Date

eff.date

Date object. Defaults to today() + 2 days. Date

mat.date

Date object. Defaults to today() + 2 years. Date

notional

Numeric value of notional. Defaults to 1,000,000. numeric

PayRec

"Pay" or "Rec" fixed. character

fixed.rate

Numeric fixed interest rate. Defaults to 0.05. Date

float.curve

List of interest rate curves. Defaults to data("usSwapCurves"). list

reset.freq

Numeric where 1 = "monthly", 3 = quarterly, 6 = Semi annual 12 = yearly. character

disc.curve

List of interest rate curves. Defaults to data("usSwapCurves"). list

convention

Vector of convention e.g. c("act",360) c(30,360),... character

bus.calendar

Banking day calendar. Not implemented.

output

"price" for swap price or "all" for price, cash flow data frame, duration. character

Author

Philippe Cote

Examples

Run this code
data("usSwapCurves")
swapIRS(
  trade.date = as.Date("2020-01-04"), eff.date = as.Date("2020-01-06"),
  mat.date = as.Date("2022-01-06"), notional = 1000000,
  PayRec = "Rec", fixed.rate = 0.05, float.curve = usSwapCurves, reset.freq = 3,
  disc.curve = usSwapCurves, convention = c("act", 360),
  bus.calendar = "NY", output = "all"
)

Run the code above in your browser using DataLab