Package com.opengamma.bbg.loader.hts

Examples of com.opengamma.bbg.loader.hts.BloombergHistoricalTimeSeriesLoader


    final Set<ExternalId> externalIds = newHashSet();
    for (final UnorderedCurrencyPair pair : ccys) {
      final List<ExternalId> tickers = getFXRateFor(pair);
      externalIds.addAll(tickers);
    }
    final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
      getToolContext().getHistoricalTimeSeriesMaster(),
      getToolContext().getHistoricalTimeSeriesProvider(),
      new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
    loader.loadTimeSeries(externalIds, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
  }
View Full Code Here


  private ReferenceDataProvider _referenceDataProvider;

  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
    BloombergHistoricalTimeSeriesLoader htsLoader = new BloombergHistoricalTimeSeriesLoader(
        getHistoricalTimeSeriesMaster(), getHistoricalTimeSeriesProvider(), new BloombergIdentifierProvider(getReferenceDataProvider()));
   
    ComponentInfo info = new ComponentInfo(HistoricalTimeSeriesLoader.class, getClassifier());
    repo.registerComponent(info, htsLoader);
  }
View Full Code Here

  }

  private void loadHistoricalData() {
    final Log log = new Log("Loading historical reference data");
    try {
      final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
          getToolContext().getHistoricalTimeSeriesMaster(),
          getToolContext().getHistoricalTimeSeriesProvider(),
          new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
      for (final SecurityDocument doc : readEquitySecurities()) {
        final Security security = doc.getSecurity();
        loader.loadTimeSeries(ImmutableSet.of(security.getExternalIdBundle().getExternalId(ExternalSchemes.BLOOMBERG_TICKER)), "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
      }
      loader.loadTimeSeries(_historicalDataToLoad, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
      _historicalDataToLoad.clear();
      log.done();
    } catch (final RuntimeException t) {
      log.fail(t);
    }
View Full Code Here

  }

  private void loadTimeSeries(final List<ExternalId> curveNodeIDs) {
    final Set<ExternalId> externalIds = newHashSet(curveNodeIDs);
    final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
        getToolContext().getHistoricalTimeSeriesMaster(),
        getToolContext().getHistoricalTimeSeriesProvider(),
        new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
    loader.loadTimeSeries(externalIds, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
  }
View Full Code Here

    for (final Triple<Currency, LocalDate, Tenor> swapArgs : swapsArgs) {
      final ExternalId swapRateForMaturityIdentifier = getSwapRateFor(configSource, swapArgs.getFirst(), swapArgs.getSecond(), swapArgs.getThird());
      externalIds.add(swapRateForMaturityIdentifier);
    }

    final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
      getToolContext().getHistoricalTimeSeriesMaster(),
      getToolContext().getHistoricalTimeSeriesProvider(),
      new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
    loader.loadTimeSeries(externalIds, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
  }
View Full Code Here

    ArgumentChecker.notNull(portfolioWriter, "portfolioWriter");
    ArgumentChecker.notNull(portfolioReader, "portfolioReader");
   
    // Get bbg hts loader
    BloombergIdentifierProvider bbgIdentifierProvider = new BloombergIdentifierProvider(_bbgRefDataProvider);
    BloombergHistoricalTimeSeriesLoader bbgLoader = new BloombergHistoricalTimeSeriesLoader(_htsMaster, _htsProvider, bbgIdentifierProvider);
   
    ObjectsPair<ManageablePosition, ManageableSecurity[]> next;

    // Read in next row, checking for EOF
    while ((next = portfolioReader.readNext()) != null) {
View Full Code Here

    }
    return externalIds;
  }

  private void loadHistoricalData(final boolean write, final String[] dataFields, final String dataProvider, final Set<ExternalId>... externalIdSets) {
    final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
        getToolContext().getHistoricalTimeSeriesMaster(),
        getToolContext().getHistoricalTimeSeriesProvider(),
        new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));

    for (final Set<ExternalId> externalIds : externalIdSets) {
      if (externalIds.size() > 0) {
        for (final String dataField : dataFields) {
          s_logger.info("Loading time series (field: " + dataField + ", provider: " + dataProvider + ") with external IDs " + externalIds);
          if (write) {
            loader.loadTimeSeries(externalIds, dataProvider, dataField, LocalDate.now().minusYears(1), null);
          }
        }
      }
    }
  }
View Full Code Here

    String replaceWithProvider = getCommandLineOption(commandLine, REPLACE_WITH_PROVIDER_OPTION);
   
    HistoricalTimeSeriesMaster htsMaster = getToolContext().getHistoricalTimeSeriesMaster();
    HistoricalTimeSeriesProvider htsProvider = getToolContext().getHistoricalTimeSeriesProvider();
   
    BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(htsMaster, htsProvider,
        new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
   
    for (HistoricalTimeSeriesInfoDocument infoDoc : HistoricalTimeSeriesInfoSearchIterator.iterable(htsMaster, getHistoricalSearchRequest(findProvider))) {
      ExternalIdBundle bundle = infoDoc.getInfo().getExternalIdBundle().toBundle();
      ExternalId buid = bundle.getExternalId(ExternalSchemes.BLOOMBERG_BUID);
      ExternalId ticker = bundle.getExternalId(ExternalSchemes.BLOOMBERG_TICKER);
      String dataField = infoDoc.getInfo().getDataField();
      if (buid != null) {
        s_logger.info("replacing {} {}", buid, ticker);
        try {
          LocalDateDoubleTimeSeries hts = htsProvider.getHistoricalTimeSeries(ExternalIdBundle.of(buid),
              BLOOMBERG_DATA_SOURCE_NAME, replaceWithProvider, dataField);
          if (hts != null) {
            Map<ExternalId, UniqueId> addedTS = loader.loadTimeSeries(Sets.newHashSet(buid), replaceWithProvider, dataField, null, null);
            if (addedTS.get(buid) != null) {
              htsMaster.remove(infoDoc.getUniqueId());
              s_logger.info("removed TS with buid={}, ticker={}, dataProvider={}, dataField={}", new Object[] {buid, ticker, findProvider, dataField});
            }
          }
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  protected HistoricalTimeSeriesLoader createHistoricalTimeSeriesLoader(ComponentRepository repo) {
    ExternalIdResolver idProvider = new BloombergIdentifierProvider(getReferenceDataProvider());
    return new BloombergHistoricalTimeSeriesLoader(getHistoricalTimeSeriesMaster(), getHistoricalTimeSeriesProvider(), idProvider);
  }
View Full Code Here

    final Set<ExternalId> externalIds = newHashSet();
    for (final UnorderedCurrencyPair pair : ccys) {
      final List<ExternalId> tickers = getFXRateFor(pair);
      externalIds.addAll(tickers);
    }
    final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
      getToolContext().getHistoricalTimeSeriesMaster(),
      getToolContext().getHistoricalTimeSeriesProvider(),
      new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
    loader.loadTimeSeries(externalIds, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.bbg.loader.hts.BloombergHistoricalTimeSeriesLoader

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.