Problem in bond long coupon calculations...
Posted by Toyin Akin on
URL: http://quantlib.414.s1.nabble.com/BinomialEuropeanEngine-C-SWIG-tp4960p4962.html
Hi,
For regular bond calculations (using unadjusted dates, equal coupon periods,
same coupon amount paid for each period) where we have either a long first
or last coupon period, the yearFraction() method of the DayCounter classes
often produce the wrong values.
for example, if you have a long final coupon period of 6 month frequency and
the dates are
Penultimate coupon date = 40441 = 20/9/2010
Maturity date = 40623 = 21/3/2011
Penultimate coupon date + 6 months = 60622 = 20/3/2011
A typical DayCounter class will have as variable values
PeriodStart = 20/9/2010
PeriodEnd = 21/3/2011
refPeriodStart = 20/9/2010
refPeriodEnd = 20/3/2011
Bascially a long end period by one day.
For a bond (especially for most government bonds where adjusted dates are
not used), the usual way to compute the yearfraction for long periods would
be to count all 6 month periods (in our case) as 0.5, and whatever is left
we apply the yearFraction() function on this period.
ie
A = 20/9/2010 -> 20/3/2011 = 0.5
B = 20/3/2011 -> 21/3/2011 = yearFraction(20/3/2011, 21/3/2011, 20/3/2011,
20/3/2011 + 6M)
TotalYearFraction = A + B.
Currently, most of the DayCounter classes will return a value less than 0.5
for the same period.
I'm thinking maybe a neat solution around this would be to create a
templated class which would take a DayCounter as the template parameter and
derive from this. When a long period is detected, it will perform the
computation above, else delegate to normal operations. The nice thing about
this route is that the user can create the templated object and pass it to
the firstPeriodDayCount variable of the FixedRateCouponVector function().
It might be a good idea to use this same firstPeriodDayCount for a possible
long/short **LAST** coupon period and thus rename the firstPeriodDayCount
parameter to accuralPeriodDayCount.
Thoughts...
Toy out.