BloombergCommodityFutureOptionVolatilitySurfaceInstrumentProvider extends BloombergFutureOptionVolatilitySurfaceInstrumentProvider { @Override public ExternalId getInstrument(final Number futureOptionNumber, final Double strike, final LocalDate surfaceDate) { ArgumentChecker.notNull(futureOptionNumber, "futureOptionNumber"); ArgumentChecker.notNull(strike, "strike"); ArgumentChecker.notNull(surfaceDate, "surface date"); final String prefix = getFutureOptionPrefix(); final StringBuffer ticker = new StringBuffer(); ticker.append(prefix); final ExchangeTradedInstrumentExpiryCalculator expiryRule = getExpiryRuleCalculator(); final LocalDate expiryDate = expiryRule.getExpiryMonth(futureOptionNumber.intValue(), surfaceDate); final String expiryCode = BloombergFutureUtils.getShortExpiryCode(expiryDate); ticker.append(expiryCode); ticker.append(strike > useCallAboveStrike() ? "C" : "P"); ticker.append(" "); ticker.append(strike); ticker.append(" "); ticker.append(getPostfix()); return ExternalId.of(getScheme(), ticker.toString()); } BloombergCommodityFutureOptionVolatilitySurfaceInstrumentProvider(final String futureOptionPrefix, final String postfix, final String dataFieldName, final Double useCallAboveStrike,
      final String exchangeIdName);  BloombergCommodityFutureOptionVolatilitySurfaceInstrumentProvider(final String futureOptionPrefix, final String postfix, final String dataFieldName, final Double useCallAboveStrike,
      final String exchangeIdName, final String schemeName); @Override ExternalId getInstrument(final Number futureOptionNumber, final Double strike, final LocalDate surfaceDate); static Map<String, ExchangeTradedInstrumentExpiryCalculator> getExpiryRules(); @Override ExchangeTradedInstrumentExpiryCalculator getExpiryRuleCalculator();  }
@Test public void testSurfaceInstrumentProvider() { for (int i = 0; i < EXPIRY_OFFSETS.length; i++) { for (int j = 0; j < STRIKES.length; j++) { final String expected = RESULTS[i][j]; final ExternalId actual = PROVIDER.getInstrument(EXPIRY_OFFSETS[i], STRIKES[j], DATE); assertEquals(ExternalSchemes.BLOOMBERG_TICKER_WEAK, actual.getScheme()); assertEquals(expected, actual.getValue()); } } }