Problem in FixedCouponBond/FloatingRateBond causing Yield() to fail.

Posted by Toyin Akin on
URL: http://quantlib.414.s1.nabble.com/C-wrapper-tp4263p4264.html

Hi,

Basically if one were to construct a bond where the maturity date lands on a
holiday (or weekend), and the date is to be adjusted to a non-holiday
(BusinessDayConvention = Following), then the date passed to the redemption
object will be the unadjusted date (via the Bond constructor).

However the  schedule object will compute the coupons with the last coupon
having an adjusted end date which is different from that of the redemption.

If this happens, it causes the yield() calculation to fail as line #96 of
the Bond.cpp class will try to obtain a discountfactor() with the dates
(lastCouponDate, redemptionDate). However the lastCouponDate is greater than
the redemptionDate.

Also, there is a bug within the mcbarriarengine class (cpp file). I think it
should return the rebate amount instead of 0.0 (lines #140 and #213). (In
fact the rebate amount is set by the constructor, but never used within the
class.)

Toy out.