0

I have a Problem and would be very grateful if you could help me.

starting Situation:

  • Bonds: "026351AZ9" "026351BC9"
  • First Coupon Date of These Bonds: "2029-02-15" "2010-09-11" (class date)
  • Count of the years where the bonds pay coupons: 3 years and 1 years
  • each years has also a Coupon frequency: 2 and 4, that means that during the next year there will be 2 payments (4 payments)

First case: 3 years and each year 2 times Coupon payment -> so every 6 month Coupon payment for the next 3 years. Same with 1 year and 4 times coupn payment.

Result: It should be look like this:

datesBond1 = "2029-02-15" "2029-08-15" "2030-02-15" "2030-08-15" "2031-02-15" "2031-08-15"

datesBond2 = "2010-09-11" "2010-12-11" "2010-03-11" "2010-06-11"

This is just a sample. In my case I have a lot more ISINS, Dates, and various years and Coupon frequencies.

Thank you

Silence Dogood
  • 3,587
  • 1
  • 13
  • 17
I.AH
  • 27
  • 1
  • 7

1 Answers1

0

You can use the months function to contruct future coupon payments dates and wrap the calculation in a custom function that could be accessed for individual bonds.

There is typo in your expected output for bond 2 where last two values should correspond to year 2011.

fn_cpnPayDates = function(cpnStartDt = as.Date("2029-02-15"),numYears = 3, freq = 6) {

# number of coupon payments per year
numPayPerYear = 12 / freq

#total payments
numPayments = numYears * numPayPerYear

cpnDatesAll = rep(cpnStartDt, numPayments)

for(i in 1:numPayments) cpnDatesAll[i] = cpnDatesAll[i] + months((i-1)* freq)


return(cpnDatesAll)

}

datesBond1 = fn_cpnPayDates(cpnStartDt = as.Date("2029-02-15"),numYears = 3, freq = 6)
datesBond1
#[1] "2029-02-15" "2029-08-15" "2030-02-15" "2030-08-15" "2031-02-15" "2031-08-15"

datesBond2 = fn_cpnPayDates(cpnStartDt = as.Date("2010-09-11"),numYears = 1, freq = 3)
datesBond2
#[1] "2010-09-11" "2010-12-11" "2011-03-11" "2011-06-11"
Silence Dogood
  • 3,587
  • 1
  • 13
  • 17
  • yeah the last two should be 2011. Thank you very much. This solution is nice. I so much easier to work with a function. And to put all in one vector I can do: c(datesBond1, datesBond2) – I.AH Jul 07 '17 at 12:27