Dear all,
I have a question regarding the creditr package.
If I input spread at *2000* use spread_to_upfront then the
upfront_to_spread function, the output is a spread of *1962.592*, not a
spread of 2000 as initially inputted. Why is that the case?
Please see the code below.
x <- data.table(date = as.Date("2014-04-22"),
currency = "USD",
tenor = 6,
spread = *2000*,
coupon = 500,
recovery = 0.4,
stringsAsFactors = FALSE
)
a <- spread_to_upfront(x)
b <- data.table(date = as.Date("2014-04-22"),
currency = "USD",
tenor = 6,
ptsUpfront = a / 1e+07,
coupon = 500,
recovery = 0.4,
stringsAsFactors = FALSE
)
upfront_to_spread(b)
[1] *1962.592* #Does not equal the original spread of 2000