Package com.opengamma.master.historicaltimeseries

Examples of com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesInfoSearchResult


  @Test
  public void test_search_name_wildcard() {
    HistoricalTimeSeriesInfoSearchRequest request = new HistoricalTimeSeriesInfoSearchRequest();
    request.setName("N1*");
    HistoricalTimeSeriesInfoSearchResult test = _htsMaster.search(request);
   
    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
View Full Code Here


  @Test
  public void test_search_name_wildcardCase() {
    HistoricalTimeSeriesInfoSearchRequest request = new HistoricalTimeSeriesInfoSearchRequest();
    request.setName("n1*");
    HistoricalTimeSeriesInfoSearchResult test = _htsMaster.search(request);
   
    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Test
  public void test_search_versionAsOf_below() {
    HistoricalTimeSeriesInfoSearchRequest request = new HistoricalTimeSeriesInfoSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.minusSeconds(5)));
    HistoricalTimeSeriesInfoSearchResult test = _htsMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_versionAsOf_mid() {
    HistoricalTimeSeriesInfoSearchRequest request = new HistoricalTimeSeriesInfoSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.plusSeconds(5)));
    HistoricalTimeSeriesInfoSearchResult test = _htsMaster.search(request);
   
    assertEquals(_totalHistoricalTimeSeries, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert201(test.getDocuments().get(2))// old version
  }
View Full Code Here

  @Test
  public void test_search_versionAsOf_above() {
    HistoricalTimeSeriesInfoSearchRequest request = new HistoricalTimeSeriesInfoSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version2Instant.plusSeconds(5)));
    HistoricalTimeSeriesInfoSearchResult test = _htsMaster.search(request);
   
    assertEquals(_totalHistoricalTimeSeries, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert203(test.getDocuments().get(2))// new version
  }
View Full Code Here

  private HistoricalTimeSeriesInfoDocument getOrLoadTimeSeries(final ExternalId ticker, final ExternalIdBundle idBundle) {

    final ExternalIdBundle searchBundle = idBundle.withoutScheme(ExternalSchemes.ISIN); //For things which move country, e.g. ISIN(VALE5 BZ Equity) == ISIN(RIODF US Equity)
    final HistoricalTimeSeriesInfoSearchRequest htsRequest = new HistoricalTimeSeriesInfoSearchRequest(searchBundle);
    htsRequest.setDataField("PX_LAST");
    final HistoricalTimeSeriesInfoSearchResult htsSearch = getToolContext().getHistoricalTimeSeriesMaster().search(htsRequest);
    switch (htsSearch.getDocuments().size()) {
      case 0:
        return loadTimeSeries(idBundle);
      case 1:
        break;
      default:
        throw new OpenGammaRuntimeException("Multiple time series match " + htsSearch);
    }
    final HistoricalTimeSeriesInfoDocument timeSeriesInfo = htsSearch.getDocuments().get(0);
    s_logger.debug("Loaded time series info {} for underlying {}", timeSeriesInfo, ticker);
    return timeSeriesInfo;
  }
View Full Code Here

    _destinationMaster = destinationMaster;
  }
 
  public void copy(boolean fastCopy, boolean deleteDestinationSeriesNotInSource, boolean verbose, boolean noAdditions) {
    HistoricalTimeSeriesInfoSearchRequest infoSearchRequest = new HistoricalTimeSeriesInfoSearchRequest();
    HistoricalTimeSeriesInfoSearchResult sourceSearchResult = _sourceMaster.search(infoSearchRequest);
    List<ManageableHistoricalTimeSeriesInfo> sourceInfoList = sourceSearchResult.getInfoList();
    HistoricalTimeSeriesInfoSearchResult destSearchResult = _destinationMaster.search(infoSearchRequest);
    List<ManageableHistoricalTimeSeriesInfo> destInfoList = destSearchResult.getInfoList();
    Set<ManageableHistoricalTimeSeriesInfo> bothInfoSetSource = new TreeSet<ManageableHistoricalTimeSeriesInfo>(new ManageableHistoricalTimeSeriesInfoComparator());
    bothInfoSetSource.addAll(sourceInfoList);
    bothInfoSetSource.retainAll(destInfoList);
    Set<ManageableHistoricalTimeSeriesInfo> bothInfoSetDestination = new TreeSet<ManageableHistoricalTimeSeriesInfo>(new ManageableHistoricalTimeSeriesInfoComparator());
    bothInfoSetDestination.addAll(destInfoList);
View Full Code Here

      searchRequest.setExternalIdSearch(new ExternalIdSearch(htsId));
      searchRequest.setDataField(dataField);
      searchRequest.setDataProvider(dataProvider);
      searchRequest.setDataSource(dataSource);
      searchRequest.setObservationTime(observationTime);
      HistoricalTimeSeriesInfoSearchResult searchResult = _htsMaster.search(searchRequest);
      oId = searchResult.getFirstDocument() == null ? null : searchResult.getFirstDocument().getObjectId();

      // if this is a new hts, create it
      if (oId == null) {
        ManageableHistoricalTimeSeriesInfo info = new ManageableHistoricalTimeSeriesInfo();
        info.setDataField(dataField);
View Full Code Here

    final int pages = (total / PAGE_SIZE) + 1;
    for (int page = 1; page <= pages; page++) {
      request.setPagingRequest(PagingRequest.ofPage(page, PAGE_SIZE));
      System.out.println("Checking exchange master, page " + request.getPagingRequest());
      try {
        final HistoricalTimeSeriesInfoSearchResult result = getHistoricalTimeSeriesMaster().search(request);
        for (final HistoricalTimeSeriesInfoDocument doc : result.getDocuments()) {
          assertNotNull(doc);
          assertNotNull(doc.getUniqueId());
          assertNotNull(doc.getInfo());
        }
      } catch (final RuntimeException ex) {
View Full Code Here

  private boolean haveTimeSeries(final ExternalId identifier, final String dataProvider, final String dataField) {
    HistoricalTimeSeriesInfoSearchRequest searchRequest = new HistoricalTimeSeriesInfoSearchRequest(identifier);
    searchRequest.setDataField(dataField);
    searchRequest.setDataProvider(BloombergDataUtils.resolveDataProvider(dataProvider));
    searchRequest.setDataSource(RANDOM_DATA_SOURCE_NAME);
    HistoricalTimeSeriesInfoSearchResult searchTimeSeries = _htsMaster.search(searchRequest);
    List<HistoricalTimeSeriesInfoDocument> documents = searchTimeSeries.getDocuments();
    return !documents.isEmpty();
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesInfoSearchResult

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.