Description Usage Arguments Value Examples
View source: R/Step1_YieldCurveGeneration.R
Bootstrap discount factors from a yield curve.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | buildCurve(
swapRates,
tenors,
fixFreq = 6,
fixDCC = "Thirty360",
fltFreq = 6,
fltDCC = "Thirty360",
calendar = "General",
bdc = c("Actual", "Preceding", "Following", "Modified_Prec", "Modified_Foll"),
curveDate,
numSetDay,
yieldCurveDCC = "Thirty360",
holidays = NULL
)
|
swapRates |
A vector of doubles of swap rates. |
tenors |
A vector of integers of corresponding tenors. |
fixFreq |
An integer of fixed leg frequency of payment in months. Default is 6, semi-annual payments. |
fixDCC |
A string of fixed leg day count convention from four options: "Thirty360", "ACT360", "ACT365", or "ACTACT". Default is "Thirty360". |
fltFreq |
An integer of floating leg frequency of payment in months. Default is 6, semi-annual payments. |
fltDCC |
A string of floating leg day count convention from four options: "Thirty360", "ACT360", "ACT365", or "ACTACT". Default is "Thirty360". |
calendar |
A string of the desired calendar convention from two options:
|
bdc |
A string of business day convention from five options:
Default is "Actual". |
curveDate |
A string in the format of "YYYY-MM-DD" of yield curve date. |
numSetDay |
An integer of settlement days from yield curve date. |
yieldCurveDCC |
A string of yield curve day count convention from four options: "Thirty360", "ACT360", "ACT365", or "ACTACT". Default is "Thirty360". |
holidays |
An optional vector dates of user-defined holidays. If provided, within the given holidays range, the calendar provided in the parameter "calendar" will not be applied; If the date is not in the given holidays range, it will follow the calendar provided in the "calendar" parameter |
Outputs a data frame of strings of discount dates and doubles of discount factors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | rate <- c(0.69, 0.77, 0.88, 1.01, 1.14, 1.38, 1.66, 2.15) * 0.01
tenor <- c(1, 2, 3, 4, 5, 7, 10, 30)
fixFreq <- 6
fixDCC <- "Thirty360"
fltFreq <- 6
fltDCC <- "ACT360"
calendar <- "NY"
bdc <- "Modified_Foll"
curveDate <- "2016-02-08"
numSetDay <- 2
yieldCurveDCC <- "Thirty360"
holidays <- NULL
buildCurve(rate, tenor, fixFreq, fixDCC, fltFreq, fltDCC, calendar, bdc,
curveDate, numSetDay, yieldCurveDCC, holidays)
|
obsDate discountFac zeroRate forwardCurve dayCount
1 2016-02-08 1.0000000 0.000000000 0.006912035 0.000000
2 2017-02-10 0.9930975 0.006888125 0.008520036 1.005556
3 2018-02-10 0.9847078 0.007683825 0.011060713 2.005556
4 2019-02-10 0.9739354 0.008787170 0.014146403 3.005556
5 2020-02-10 0.9603499 0.010100373 0.016846310 4.005556
6 2021-02-10 0.9444396 0.011420029 0.020451281 5.005556
7 2023-02-10 0.9073275 0.013882093 0.024514485 7.005556
8 2026-02-10 0.8451708 0.016812319 0.032098279 10.005556
9 2046-02-10 0.5147311 0.022132923 0.032098279 30.005556
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.