BloombergIRFuturePriceCurveInstrumentProvider implements FuturePriceCurveInstrumentProvider<Number> { @Override public ExternalId getInstrument(final Number futureNumber) { throw new OpenGammaRuntimeException("Provider needs a curve date to create interest rate future identifier from futureNumber"); } BloombergIRFuturePriceCurveInstrumentProvider(final String futurePrefix, final String postfix, final String dataFieldName, String tickerScheme);  BloombergIRFuturePriceCurveInstrumentProvider(final String futurePrefix, final String postfix, final String dataFieldName); @Override ExternalId getInstrument(final Number futureNumber); @Override /** * Provides ExternalID for Bloomberg ticker, eg EDZ3 Comdty, * given a reference date and an integer offset, the n'th subsequent future * The format is _futurePrefix + month + year + _postfix * <p> * Note that midcurve options are written on underlying futures that expire some number of quarters after the option's expiry. * The logic of this is based on the _futurePrefix. * <p> * @param futureNumber n'th future following curve date * @param curveDate date of curve validity; valuation date */ ExternalId getInstrument(final Number futureNumber, final LocalDate curveDate); String getFuturePrefix(); String getPostfix(); @Override String getTickerScheme(); @Override String getDataFieldName(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override ExchangeTradedInstrumentExpiryCalculator getExpiryRuleCalculator();  }
@Test(enabled = false) public void testEur() { String expected; for (int ithFuture = 1; ithFuture <= nFutures; ithFuture++) { expected = RESULTS_EUR[ithFuture - 1]; final ExternalId result = PROVIDER_EUR.getInstrument(ithFuture, SNAPSHOT_DATE); assertEquals(ExternalSchemes.BLOOMBERG_TICKER_WEAK, result.getScheme()); assertEquals(expected, result.getValue()); } }
@Test public void testERM() { final LocalDate today = LocalDate.now(OpenGammaClock.getInstance()); final LocalDate lastTradeDateOfERM1 = LocalDate.of(2011, 6, 13); final ExternalId actual = PROVIDER_EUR.getInstrument(5, SNAPSHOT_DATE); final String expected; if (today.isBefore(lastTradeDateOfERM1.plusMonths(11))) { expected = "ERM1 Comdty"; } else { expected = "ERM11 Comdty"; } assertEquals(expected, actual.getValue()); }