"Creditr" package: spread to upfront conversions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

"Creditr" package: spread to upfront conversions

Monica Phang
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]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.