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
-
1$\begingroup$ Welcome to Mathematica.SE! Please consider registering your account so that any upvotes you get on this question are added to those you might get on future questions and answers. That way, over time you will be able to do more on the site (post graphics, edit things, etc). $\endgroup$– Sjoerd C. de VriesNov 28, 2012 at 10:25
1 Answer
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
-
$\begingroup$ 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. $\endgroup$ Aug 24, 2015 at 9:41
-
$\begingroup$ @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. $\endgroup$ Aug 24, 2015 at 15:47