final double factorSpot = getDayCount().getAccruedInterest(couponDefinition.getNthPayment(0).getAccrualStartDate(), settlementDate, couponDefinition.getNthPayment(0).getAccrualEndDate(), 1.0,
_couponPerYear);
final double factorPeriod = getDayCount().getAccruedInterest(couponDefinition.getNthPayment(0).getAccrualStartDate(), couponDefinition.getNthPayment(0).getAccrualEndDate(),
couponDefinition.getNthPayment(0).getAccrualEndDate(), 1.0, _couponPerYear);
final double factorToNextCoupon = (factorPeriod - factorSpot) / factorPeriod;
final PaymentFixedDefinition nominalLast = getNominal().getNthPayment(getNominal().getNumberOfPayments() - 1);
final ZonedDateTime settlementDate2 = settlementDate.isBefore(date) ? date : settlementDate;
final double notional = settlementDate.isBefore(date) ? 0.0 : 1.0;
final PaymentFixedDefinition settlementDefinition = new PaymentFixedDefinition(nominalLast.getCurrency(), settlementDate2, notional);
final PaymentFixed settlement = settlementDefinition.toDerivative(date);
return new BondInterestIndexedSecurity<>(nominalStandard, couponStandard, settlementTime, accruedInterest, factorToNextCoupon, _yieldConvention, _couponPerYear, settlement, getIssuer(),
_priceIndex);
}