We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

mutuelinvestor • 6 years ago

Can this handle a plan vanilla amortizing swap.

kar120c • 6 years ago

So I get an error message: " Error in seq.default(from = 0, to = (lubridate::year(maturity.date) - :
'by' must be of length 1 ". I've replaced the SwapCashflowYFCalculation function with the CashFlowPricing one, changed the old CalculateAccural function to the new one, and changed the reference to the SwapCashflowYFCalculation function in the SwapPricing section as well (here's the new one, "# Put everything together
SwapPricing <- function(today, swap, df.table) {
CashFlowPricing(today, swap$start.date, swap$maturity.date, swap$type,
swap$time.unit, swap$dcc, swap$calendar) %>%
SwapCalculations(swap$notional, swap$strike, swap$direction, df.table)
}"

Somehow the maturity date can't be read. Any ideas Davide?
Thanks!

Davide Magno • 6 years ago

Are you using the swap.25 defined in the post? I have no problem running the CashFlowPricing function with that swap.

One important change on this specifically: let's keep the type attribute as a list(pay = "floating", receive = "fixed") when you define a swap as list...more to come in this space.

kar120c • 6 years ago

Yeah, I'm using the same swap. Let me check few things out first as I rushed through this one and will let you know. I'm sure it's on my end.