final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 3, 7);
final ZonedDateTime[] dateFixing = new ZonedDateTime[] {DateUtils.getUTCDate(2012, 3, 1), DateUtils.getUTCDate(2012, 3, 2), DateUtils.getUTCDate(2012, 3, 5), DateUtils.getUTCDate(2012, 3, 6),
DateUtils.getUTCDate(2012, 3, 7)};
final double[] rateFixing = new double[] {0.0010, 0.0011, 0.0012, 0.0013, 0.0014};
final DoubleTimeSeries<ZonedDateTime> fixingTS = ImmutableZonedDateTimeDoubleTimeSeries.ofUTC(dateFixing, rateFixing);
final FederalFundsFutureSecurity futureSecurity = FUTURE_SECURITY_DEFINITION.toDerivative(referenceDate, fixingTS, CURVE_NAMES);
double interest = futureSecurity.getAccruedInterest();
final YieldAndDiscountCurve oisCurve = CURVES.getCurve(CURVE_NAMES[0]);
final double[] ratePeriod = new double[futureSecurity.getFixingPeriodAccrualFactor().length];
for (int loopfix = 0; loopfix < futureSecurity.getFixingPeriodAccrualFactor().length; loopfix++) {
ratePeriod[loopfix] = (oisCurve.getDiscountFactor(futureSecurity.getFixingPeriodTime()[loopfix]) / oisCurve.getDiscountFactor(futureSecurity.getFixingPeriodTime()[loopfix + 1]) - 1.0)
/ futureSecurity.getFixingPeriodAccrualFactor()[loopfix];
interest += (oisCurve.getDiscountFactor(futureSecurity.getFixingPeriodTime()[loopfix]) / oisCurve.getDiscountFactor(futureSecurity.getFixingPeriodTime()[loopfix + 1]) - 1.0);
}
final double rate = interest / FUTURE_SECURITY_DEFINITION.getFixingTotalAccrualFactor();
final double priceExpected = 1.0 - rate;
final double priceComputed = METHOD_SECURITY.price(futureSecurity, CURVES);
assertEquals("Federal Funds Future Security: price", priceExpected, priceComputed, TOLERANCE_PRICE);