I was wondering why if you want the dirtyPriceFromCleanPrice, or the accruedInterest, or the dirtyPriceFromYield at the endDate of the PeriodicSchedule, you get :
Exception in thread “main” java.lang.IllegalArgumentException: Date outside range of bond
at com.opengamma.strata.pricer.bond.DiscountingFixedCouponBondProductPricer.lambda$accruedYearFraction$0(DiscountingFixedCouponBondProductPricer.java:527)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at com.opengamma.strata.pricer.bond.DiscountingFixedCouponBondProductPricer.accruedYearFraction(DiscountingFixedCouponBondProductPricer.java:527)
at com.opengamma.strata.pricer.bond.DiscountingFixedCouponBondProductPricer.accruedInterest(DiscountingFixedCouponBondProductPricer.java:512)
at com.opengamma.strata.pricer.bond.DiscountingFixedCouponBondProductPricer.dirtyPriceFromCleanPrice(DiscountingFixedCouponBondProductPricer.java:274)
It think this is not correct. For example, the dirtyPriceFromYield should return 100% (accrued is 0).
Something should be done in ResolvedFixedCouponBond.findPeriod to accept the endDate as a valid date.