Learn R Programming

RTL (version 0.1.5)

swapIRS: swapIRS

Description

Commodity swap pricing from exchange settlement

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"
)

Arguments

trade.date

Date object. Defaults to today().

eff.date

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

mat.date

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

notional

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

PayRec

"Pay" or "Rec" fixed.

fixed.rate

Numeric fixed interest rate. Defaults to 0.05.

float.curve

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

reset.freq

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

disc.curve

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

convention

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

bus.calendar

Banking day calendar. Not implemented.

output

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

Value

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

Examples

Run this code
# NOT RUN {
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