BloombergDataUtils { public static Set<ExternalId> identifierLoader(final Reader reader) { ArgumentChecker.notNull(reader, "reader"); final Set<ExternalId> result = Sets.newHashSet(); final BufferedReader inputReader = new BufferedReader(reader); try { String line; while ((line = inputReader.readLine()) != null) { if (StringUtils.isBlank(line) || line.charAt(0) == '#') { continue; } result.add(ExternalId.parse(line)); } } catch (final IOException ex) { throw new OpenGammaRuntimeException("cannot read from reader", ex); } finally { try { inputReader.close(); } catch (final IOException ex) { s_logger.warn("cannot close reader ", ex); } } return result; } private  BloombergDataUtils(); static Collection<NormalizationRuleSet> getDefaultNormalizationRules(final ReferenceDataProvider referenceDataProvider, final CacheManager cacheManager, ExternalScheme bbgScheme); static HistoricalTimeSeriesFieldAdjustmentMap createFieldAdjustmentMap(final ReferenceDataProvider referenceDataProvider, final CacheManager cacheManager); static MarketDataAvailabilityFilter createAvailabilityFilter(); static FudgeMsg parseElement(final Element element); static Object parseValue(final Element valueElement); static String getSingleBUID(final ReferenceDataProvider refDataProvider, final String securityDes); static Map<String, String> getBUID(final ReferenceDataProvider refDataProvider, final Set<String> bloombergKeys); static Set<String> getIndexMembers(final ReferenceDataProvider refDataProvider, final String indexTicker); static Set<ExternalId> getOptionChain(final ReferenceDataProvider refDataProvider, final String securityID); static Set<ExternalId> getFuturechain(final ReferenceDataProvider refDataProvider, final String securityID); static boolean isValidField(final String name); static ExternalIdBundleWithDates parseIdentifiers(final FudgeMsg fieldData, final String firstTradeDateField, final String lastTradeDateField); static ExternalIdBundleWithDates addTwoDigitYearCode(final ExternalIdBundleWithDates bundleWithDates); static Set<ExternalIdBundle> getCurrentIdentifiers(final PositionMaster positionMaster); static String removeDuplicateWhiteSpace(final String field, final String replacement); static Set<ExternalId> identifierLoader(final Reader reader); static BiMap<String, ExternalIdBundle> convertToBloombergBuidKeys(final Collection<ExternalIdBundle> identifiers, final ReferenceDataProvider refDataProvider); static Pair<String, String> splitTickerAtMarketSector(final String ticker); static boolean isValidBloombergTicker(final String ticker); static ExternalId generateEquityOptionTicker(final String underlyingTicker, final Expiry expiry, final OptionType optionType, final double strike); static String dateToBbgCode(final LocalDate date); static ExternalId ricToBbgFuture(final String ric); static ExternalId ricToBbgFutureOption(final String ric, final boolean isCall, final double strike, final LocalDate expiry); static ExternalId futureBundleToGenericFutureTicker(ExternalIdBundle bundle, ZonedDateTime now, OffsetTime futureExpiryTime, ZoneId futureExpiryTimeZone); static String resolveDataProvider(final String dataProvider); static String resolveObservationTime(String dataProvider); static String toBloombergDate(LocalDate localDate); static String futureMonthCode(final Month month); static final List<String> STANDARD_FIELDS_LIST; static final Set<String> STANDARD_FIELDS_SET; }
@Test public void identifierLoader() throws Exception { Set<ExternalId> identifiers = BloombergDataUtils.identifierLoader(new StringReader(multiStringLine(IDENTIFIERS))); assertNotNull(identifiers); assertEquals(6, identifiers.size()); assertTrue(identifiers.contains(ExternalId.of("ISIN", "ISIN 1234"))); assertTrue(identifiers.contains(ExternalId.of("BLOOMBERG_BUID", "BUID 1234"))); assertTrue(identifiers.contains(ExternalId.of("BLOOMBERG_TICKER", "TICKER 1234"))); assertTrue(identifiers.contains(ExternalId.of("CUSIP", "CUSIP 1234"))); assertTrue(identifiers.contains(ExternalId.of("SEDOL1", "SEDOL1 1234"))); assertTrue(identifiers.contains(ExternalId.of("BLOOMBERG_TCM", "BLOOMBERG_TCM 1234"))); }