6

I would like to get the cash flows and dates for the remaining coupons and principal repayment for a FinancialBond object. These must be calculated internally by the FinancialBond object for many of its possible return values but I can't see how to get the cashflows explicitly. Thanks

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
Peter
  • 61
  • 1

1 Answers1

5

Unless I'm mistaken, FinancialBond is a function that returns values given parameters. It isn't similar to those objects returned by the likes of NonlinearModelFit, that have internal data and methods.

Coupon dates can be found using, for instance, the following:

matDate = {2020, 12, 31};
faceValue = 1000;
couponRate = 0.07; 
cDates = 
 Rest@NestWhileList[
   FinancialBond[
     {"FaceValue" -> faceValue, "Coupon" -> couponRate, 
      "Maturity" -> matDate, "CouponInterval" -> 1/2}, 
     {"InterestRate" -> 0.06, "Settlement" -> #, "DayCountBasis" -> "Actual/360"}, 
     "NextCouponDate"
   ] &, 
   DateList[][[;; 3]], 
   DateDifference[#, matDate] > 0 &
]

{{2012, 12, 31}, {2013, 6, 30}, {2013, 12, 31}, {2014, 6, 30}, {2014, 12, 31}, {2015, 6, 30}, {2015, 12, 31}, {2016, 6, 30}, {2016, 12, 31}, {2017, 6, 30}, {2017, 12, 31}, {2018, 6, 30}, {2018, 12, 31}, {2019, 6, 30}, {2019, 12, 31}, {2020, 6, 30}, {2020, 12, 31}}

Cash flows are simply the product of "FaceValue" and "Coupon" terms on these days plus the "FaceValue" at maturity date, unless you use a rate function instead of a fixed rate.

cf = ConstantArray[faceValue couponRate, Length@cDates];
cf[[-1]] += faceValue;

You could make a CashFlow object from that:

cfo = Cashflow[{cDates, cf}\[Transpose]];

This could be used to calculate the time value of the cashflow:

TimeValue[cfo, 0.05, DateList[][[;; 3]]]

1655.630782

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
  • This solution doesn't allow one to "go back in time". If you run that same code today you will get the dates from {2015, 12, 31} to {2020, 12, 31}. There is a dependency on today's date apparently. Maybe there is something in "Financial Bond" that I have missed. – user1775372 Aug 24 '15 at 09:41
  • @user1775372 It doesn't "go back in time" because the OP was talking about "remaining coupons", i.e., coupons that will be active in the future. If you want to calculate this from a date in the past just replace the DateList[][[;; 3]], part of the code with the date of your interest. – Sjoerd C. de Vries Aug 24 '15 at 15:47