/** * Calculates the accrued interest of the fixed coupon bond with the specified settlement date. * * @param bond the product * @param settlementDate the settlement date * @return the accrued interest of the product */ public double accruedInterest(ResolvedFixedCouponBond bond, LocalDate settlementDate) { double notional = bond.getNotional(); return accruedYearFraction(bond, settlementDate) * bond.getFixedRate() * notional; }
private double factorToNextCoupon(ResolvedFixedCouponBond bond, LocalDate settlementDate) { if (bond.getPeriodicPayments().get(0).getStartDate().isAfter(settlementDate)) { return 0d; } int couponIndex = couponIndex(bond.getPeriodicPayments(), settlementDate); double factorSpot = accruedYearFraction(bond, settlementDate); double factorPeriod = bond.getPeriodicPayments().get(couponIndex).getYearFraction(); return (factorPeriod - factorSpot) / factorPeriod; }