I need to do bond valuations (lots of them across lots of data) using FinancialBond.
Context & Background
I have daily interest rate data on 30 year US Treasury bonds from 1977 through the present. Each data element looks like this:
{{1977, 2, 15, 0, 0, 0.},0.077}
A DateList and interest rate.
Given a starting date (e.g., {1977, 2, 15, 0, 0, 0.}) I assume a 30 year maturity from the starting date.
At a future date, but prior to the assumed maturity date, I (1) find the interest rate associated with that future date and (2) calculate the "Settlement" value (essentially a proportion of the projected maturity date) like this...
maturityDate = DatePlus[{1977, 2, 15, 0, 0, 0.}, {30, "Years"}];
settlement = 30 - DateDifference[{1979, 2, 20, 0, 0, 0.}, maturityDate,"Years"]
2.0137
Then things begin to get odd...
Can anyone provide an explanation of the following?
The 3rd function takes over 36 seconds to run. The 4th crashes the kernel.
Code so anyone can replicate the problem.
Timing[FinancialBond[{"FaceValue" -> 1000, "Coupon" -> 0.077,
"Maturity" -> 30,"CouponInterval" -> 1/2}, {"InterestRate" -> 0.0902,
"Settlement" -> 2}]]
Timing[FinancialBond[{"FaceValue" -> 1000, "Coupon" -> 0.077,
"Maturity" -> 30,"CouponInterval" -> 1/2}, {"InterestRate" -> 0.0902,
"Settlement" -> 2.25}]]
Timing[FinancialBond[{"FaceValue" -> 1000, "Coupon" -> 0.077,
"Maturity" -> 30,"CouponInterval" -> 1/2}, {"InterestRate" -> 0.0902,
"Settlement" -> 2.0137}]]
Timing[FinancialBond[{"FaceValue" -> 1000, "Coupon" -> 0.077,
"Maturity" -> 30,"CouponInterval" -> 1/2}, {"InterestRate" -> 0.0902,
"Settlement" -> 2.01}]]
It appears that FinancialBond doesn't like certain fractions of a year (e.g., 2.0137 or 2.01).
Thoughts appreciated.
