[R-SIG-Finance] "Creditr" package: spread to upfront conversions

Monica Phang monicaphang.mp at gmail.com
Fri May 12 04:57:22 CEST 2017


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

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list