//! accrued interest used internally, where includeToday = false
/*! same as Bond::accruedAmount() but with enable early
* payments true. Forces accrued to be calculated in a
* consistent way for future put/ call dates, which can be
* problematic in lattice engines when option dates are also
* coupon dates.
*/
private double accrued(Date settlement)
{
if (settlement == null)
{
settlement = settlementDate();
}
bool IncludeToday = false;
for (int i = 0; i < cashflows_.Count; ++i)
{
// the first coupon paying after d is the one we're after
if (!cashflows_[i].hasOccurred(settlement, IncludeToday))
{
Coupon coupon = cashflows_[i] as Coupon;
if (coupon != null)
{
// !!!
return(coupon.accruedAmount(settlement) /
notional(settlement) * 100.0);
}
else
{
return(0.0);
}
}
}
return(0.0);
}