Package com.opengamma.bbg.referencedata

Examples of com.opengamma.bbg.referencedata.ReferenceDataProvider


    System.exit(success ? 0 : 1);
  }

  //-------------------------------------------------------------------------
  protected ManageablePortfolio generatePortfolio(final String portfolioName) {
    final ReferenceDataProvider referenceDataProvider = getToolContext().getBloombergReferenceDataProvider();

    final ManageablePortfolio portfolio = new ManageablePortfolio(portfolioName);

    //Is this a hack?
    final ManageablePortfolioNode rootNode = portfolio.getRootNode();
    portfolio.setRootNode(rootNode);

    //    String indexTickerSuffix = " Index";

    final Set<String> memberEquities = new HashSet<String>();

    for (final Entry<String, String> entry : INDEXES_TO_EXCHANGE.entrySet()) {

      final String indexTickerSuffix = " Index";

      final String underlying = entry.getKey();
      final String ticker = underlying + indexTickerSuffix;

      //don't add index (delete at some point)
      //      addNodes(rootNode, ticker, false, INDEX_OPTION_PERIODS);

      final Set<String> indexMembers = BloombergDataUtils.getIndexMembers(referenceDataProvider, ticker);
      for (final String member : indexMembers) {
        final String symbol = getBloombergEquitySymbol(entry.getValue(), member);
        //time series errors for Walmart
        //Todo: investegate & fix
        if ("WMT US Equity".equals(symbol)) {
          continue;
        }
        memberEquities.add(symbol);
      }
    }

    // Sort the symbols for the current index by market cap (highest to lowest), skipping any in the list of EXCLUDED_SECTORS
    final TreeMap<Double, String> equityByMarketCap = new TreeMap<Double, String>();
    final Map<String, FudgeMsg> refDataMap = referenceDataProvider.getReferenceData(memberEquities,
        Sets.newHashSet(BloombergFields.CURRENT_MARKET_CAP_FIELD, BloombergConstants.FIELD_GICS_SUB_INDUSTRY));
    for (final String equity : memberEquities) {
      final FudgeMsg fieldData = refDataMap.get(equity);
      if (fieldData == null) {
        throw new OpenGammaRuntimeException("Information not found for equity: " + equity);
View Full Code Here


  private Set<ExternalId> getOptionChain(final ExternalId ticker) {
    if (ticker.getScheme() != ExternalSchemes.BLOOMBERG_TICKER) {
      throw new OpenGammaRuntimeException("Not a bloomberg ticker " + ticker);
    }
    final ReferenceDataProvider referenceDataProvider = getToolContext().getBloombergReferenceDataProvider();

    final Set<ExternalId> optionChain = BloombergDataUtils.getOptionChain(referenceDataProvider, ticker.getValue()); //TODO [BBG-88] this query shouldn't get cached permanently
    if (optionChain == null) {
      throw new OpenGammaRuntimeException("Failed to get option chain for " + ticker);
    }
View Full Code Here

    s_logger.debug("Loaded time series info {} for underlying {}", timeSeriesInfo, ticker);
    return timeSeriesInfo;
  }

  private HistoricalTimeSeriesInfoDocument loadTimeSeries(ExternalIdBundle idBundle) {
    final ReferenceDataProvider referenceDataProvider = getToolContext().getBloombergReferenceDataProvider();
    if (idBundle.getExternalId(ExternalSchemes.BLOOMBERG_BUID) == null && idBundle.getExternalId(ExternalSchemes.BLOOMBERG_TICKER) != null) {
      //For some reason loading some series by TICKER fails, but BUID works
      final BiMap<String, ExternalIdBundle> map = BloombergDataUtils.convertToBloombergBuidKeys(Collections.singleton(idBundle), referenceDataProvider);
      if (map.size() != 1) {
        throw new OpenGammaRuntimeException("Failed to get buid");
      }
      for (final String key : map.keySet()) {
        final String buid = referenceDataProvider.getReferenceDataValue(key, BloombergConstants.FIELD_ID_BBG_UNIQUE);
        idBundle = idBundle.withExternalId(ExternalSchemes.bloombergBuidSecurityId(buid));
      }
    }
    final ExternalIdBundle searchBundle = idBundle.withoutScheme(ExternalSchemes.ISIN); // For things which move country, e.g. ISIN(VALE5 BZ Equity) == ISIN(RIODF US Equity)
    final Map<ExternalId, UniqueId> timeSeries = getToolContext().getHistoricalTimeSeriesLoader()
View Full Code Here

    }
    return bloombergKeys;
  }
 
  private void doSnapshot(Map<String, String> ticker2Buid) {
    ReferenceDataProvider refDataProvider = _refDataProvider;
    Map<String, FudgeMsg> refDataValues = refDataProvider.getReferenceDataIgnoreCache(ticker2Buid.keySet(), BloombergDataUtils.STANDARD_FIELDS_SET);
   
    for (String bloombergKey : ticker2Buid.keySet()) {
      FudgeMsg result = refDataValues.get(bloombergKey);
      if (result == null) {
        throw new OpenGammaRuntimeException("Result for " + bloombergKey + " was not found");
View Full Code Here

  @PropertyDefinition(validate = "notNull")
  private ReferenceDataProvider _referenceDataProvider;

  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    ReferenceDataProvider wrappedRefData = new PatchableReferenceDataProvider(getReferenceDataProvider());
    ComponentInfo info = new ComponentInfo(ReferenceDataProvider.class, "bloomberg");
    repo.registerComponent(info, wrappedRefData);
  }
View Full Code Here

   * @param dryRun set to true to not write to the database
   */
  private void createSurfaces(String name, boolean dryRun) {
    ConfigMaster configMaster = getToolContext().getConfigMaster();
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    ReferenceDataProvider bbgRefData = getToolContext().getBloombergReferenceDataProvider();

    SecuritySearchRequest securityRequest = new SecuritySearchRequest();
    securityRequest.setName(name);
    securityRequest.setSortOrder(SecuritySearchSortOrder.NAME_ASC);

View Full Code Here

    ExternalId underlyingId = ExternalId.parse(args[0]);
   
    PlatformConfigUtils.configureSystemProperties();
    ConfigurableApplicationContext appcontext = getApplicationContext();
   
    ReferenceDataProvider bbgRefDataProvider = appcontext.getBean("sharedReferenceDataProvider", ReferenceDataProvider.class);
    String bloombergKey = BloombergDomainIdentifierResolver.toBloombergKey(underlyingId);
    SecurityProvider secProvider = appcontext.getBean("bloombergSecurityProvider", SecurityProvider.class);
    DbSecurityMaster secMaster = appcontext.getBean("dbSecurityMaster", DbSecurityMaster.class);
    DefaultSecurityLoader loader = new DefaultSecurityLoader(secMaster, secProvider);
   
View Full Code Here

   * @param dryRun set to true to not write to the database
   */
  private void createSurfaces(String name, boolean dryRun) {
    ConfigMaster configMaster = getToolContext().getConfigMaster();
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    ReferenceDataProvider bbgRefData = getToolContext().getBloombergReferenceDataProvider();

    SecuritySearchRequest securityRequest = new SecuritySearchRequest();
    securityRequest.setName(name);
    securityRequest.setSortOrder(SecuritySearchSortOrder.NAME_ASC);

View Full Code Here

    HistoricalTimeSeriesProvider historicalTimeSeriesProvider = getToolContext().getHistoricalTimeSeriesProvider();
    if (historicalTimeSeriesProvider == null) {
      s_logger.warn("Historical timeseries provider is missing in toolContext");
      return;
    }
    ReferenceDataProvider bloombergReferenceDataProvider = getToolContext().getBloombergReferenceDataProvider();
    if (bloombergReferenceDataProvider == null) {
      s_logger.warn("Bloomberg reference data provider is missing in toolContext");
      return;
    }
   
View Full Code Here

      set.add(entry.getKey());
    }
   
    Set<String> buids = specsBySecurityId.keySet();

    ReferenceDataProvider refDataProvider = server.getReferenceDataProvider();
   
    if (buids.size() > 0) {
      Map<String, String> values = refDataProvider.getReferenceDataValues(buids, BloombergConstants.FIELD_SECURITY_TYP);
      for (String buid : buids) {
        String type = values.get(buid);
        if (type != null && _toFake.contains(type)) {
          fakes.addAll(specsBySecurityId.get(buid));
        } else {
View Full Code Here

TOP

Related Classes of com.opengamma.bbg.referencedata.ReferenceDataProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.