Accrued Interest Calculation For Bonds before first coupon payment


#1

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.businessDayAdjustment(businessDayAdjustment.build());
pScheduleBuilder.frequency(input.FrequencyValue);
pScheduleBuilder.startDate(input.Startdate); ///FIRST COUPON DATE////
if (input.Enddate != null)
pScheduleBuilder.endDate(input.Enddate);
else
pScheduleBuilder.endDate(java.time.LocalDate.of(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));
pScheduleBuilder.stubConvention(StubConvention.LONG_FINAL);

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

Thanks
Dev