BloombergIRFutureOptionVolatilitySurfaceInstrumentProvider 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 StringBuilder ticker = new StringBuilder(getFutureOptionPrefix()); ticker.append(BloombergFutureUtils.getExpiryCodeForIRFutureOptions(getFutureOptionPrefix(), futureOptionNumber.intValue(), surfaceDate)); ticker.append(strike > useCallAboveStrike() ? "C " : "P "); ticker.append(FORMATTER.format(strike)); ticker.append(" "); ticker.append(getPostfix()); return ExternalId.of(getScheme(), ticker.toString()); } BloombergIRFutureOptionVolatilitySurfaceInstrumentProvider(final String futureOptionPrefix, final String postfix, final String dataFieldName, final Double useCallAboveStrike,
      final String exchangeIdName);  BloombergIRFutureOptionVolatilitySurfaceInstrumentProvider(final String futureOptionPrefix, final String postfix, final String dataFieldName, final Double useCallAboveStrike,
      final String exchangeIdName, final String schemeName); @Override /** * {@inheritDoc} * Provides ExternalID for Bloomberg ticker, e.g. EDZ3C 99.250 Comdty, * given a reference date and an integer offset, the n'th subsequent option * The format is futurePrefix + month + year + callPutFlag + strike + postfix * * @param futureNumber n'th future following curve date, not null * @param strike option's strike, expressed as price in %, e.g. 98.750, not null * @param surfaceDate date of curve validity; valuation date, not null */ ExternalId getInstrument(final Number futureOptionNumber, final Double strike, final LocalDate surfaceDate); @Override ExchangeTradedInstrumentExpiryCalculator getExpiryRuleCalculator();  }
@Test public void test() { for (int i = 0; i < NUMBERS.length; i++) { assertEquals(EXPIRY_DATES[i], UTILS.getQuarterlyExpiry(NUMBERS[i], DATE)); for (int j = 0; j < STRIKES.length; j++) { final String expected = RESULTS[i][j]; final ExternalId actual = PROVIDER.getInstrument(NUMBERS[i], STRIKES[j], DATE); assertEquals(ExternalSchemes.BLOOMBERG_TICKER_WEAK, actual.getScheme()); assertEquals(expected, actual.getValue()); } } }