FederalFundsFutureSecurityDefinition extends FuturesSecurityDefinition<FederalFundsFutureSecurity> implements InstrumentDefinitionWithData<FederalFundsFutureSecurity, DoubleTimeSeries<ZonedDateTime>> { public static FederalFundsFutureSecurityDefinition from(final ZonedDateTime monthDate, final IndexON index, final double notional, final double paymentAccrualFactor, final String name, final Calendar calendar) { ArgumentChecker.notNull(monthDate, "Reference date"); ArgumentChecker.notNull(index, "Index overnight"); final ZonedDateTime periodFirstDate = BUSINESS_DAY_FOLLOWING.adjustDate(calendar, monthDate.withDayOfMonth(1)); final ZonedDateTime periodLastDate = BUSINESS_DAY_FOLLOWING.adjustDate(calendar, monthDate.withDayOfMonth(1).plusMonths(1)); final ZonedDateTime last = BUSINESS_DAY_PRECEDING.adjustDate(calendar, periodLastDate.minusDays(1)); final List<ZonedDateTime> fixingList = new ArrayList<>(); ZonedDateTime date = periodFirstDate; while (!date.isAfter(periodLastDate)) { fixingList.add(date); date = BUSINESS_DAY_FOLLOWING.adjustDate(calendar, date.plusDays(1)); } final ZonedDateTime[] fixingDate = fixingList.toArray(new ZonedDateTime[fixingList.size()]); final double[] fixingAccrualFactor = new double[fixingDate.length - 1]; for (int loopfix = 0; loopfix < fixingDate.length - 1; loopfix++) { fixingAccrualFactor[loopfix] = index.getDayCount().getDayCountFraction(fixingDate[loopfix], fixingDate[loopfix + 1], calendar); } return new FederalFundsFutureSecurityDefinition(last, index, fixingDate, fixingAccrualFactor, notional, paymentAccrualFactor, name); } FederalFundsFutureSecurityDefinition(final ZonedDateTime lastTradingDate, final IndexON index, final ZonedDateTime[] fixingPeriodDate,
      final double[] fixingPeriodAccrualFactor, final double notional, final double paymentAccrualFactor, final String name); static FederalFundsFutureSecurityDefinition from(final ZonedDateTime monthDate, final IndexON index, final double notional, final double paymentAccrualFactor,
      final String name, final Calendar calendar); static FederalFundsFutureSecurityDefinition fromFedFund(final ZonedDateTime monthDate, final IndexON index, final Calendar calendar); IndexON getIndex(); ZonedDateTime[] getFixingPeriodDate(); double[] getFixingPeriodAccrualFactor(); double getFixingTotalAccrualFactor(); double getNotional(); double getMarginAccrualFactor(); String getName(); Currency getCurrency(); @Override String toString(); @Override FederalFundsFutureSecurity toDerivative(final ZonedDateTime date); @Override FederalFundsFutureSecurity toDerivative(final ZonedDateTime valZdt, final DoubleTimeSeries<ZonedDateTime> indexFixingTimeSeries); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void from() { final FederalFundsFutureSecurityDefinition from = FederalFundsFutureSecurityDefinition.from(MARCH_1, INDEX_FEDFUND, NOTIONAL, PAYMENT_ACCURAL_FACTOR, NAME, NYC); assertEquals("Fed fund future security definition: builder", FUTURE_FEDFUND_DEFINITION, from); }