Accrued Interest Calculation For Bonds before first coupon payment


Hi All,

We are trying to calculate accrued interest for bond before the first coupon date.
Consider a scenario , suppose 1st coupon payment date for bond is 2nd February 2017 and frequency type is 3 months.
Now if i am calculating value for accrued on 24th Dec’16 , it should be a non - zero value.
How to achieve this in Strata, i have the required inputs i.e. fixed rate , settle date and first coupon date.

We are using the following for getting this value-

ResolvedFixedCouponBond resolvedBond = bond.resolve(ReferenceData.standard());
double accruedInterest = DiscountingFixedCouponBondProductPricer.DEFAULT.accruedInterest(resolvedBond, input.SettlementDate);

And creating periodic schedule by setting the start date as first coupon date.

var pScheduleBuilder = PeriodicSchedule.builder();
pScheduleBuilder.startDate(input.Startdate); ///FIRST COUPON DATE////
if (input.Enddate != null)
pScheduleBuilder.endDate(java.time.LocalDate.of(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));

the above logic gives ZERO value for accrued calculation done for settlementDate < First coupon date.