Package com.opengamma.util.time

Examples of com.opengamma.util.time.LocalDateRange


   * @param request  the request to fix, not null
   * @param earliestStartDate  the earliest start date to set to, not null
   * @return the adjusted date range, not null
   */
  protected LocalDateRange fixRequestDateRange(HistoricalTimeSeriesProviderGetRequest request, LocalDate earliestStartDate) {
    LocalDateRange dateRange = request.getDateRange();
    if (dateRange.getStartDateInclusive().isBefore(earliestStartDate)) {
      dateRange = dateRange.withStartDate(earliestStartDate);
    }
    request.setDateRange(dateRange);
    return dateRange;
  }
View Full Code Here


      ExternalIdBundle identifiers, String dataSource, String dataProvider, String dataField,
      LocalDate start, boolean includeStart, LocalDate end, boolean includeEnd) {
    if (!includeStart && start != null) {
      start = start.plusDays(1);
    }
    LocalDateRange dateRange = LocalDateRange.ofNullUnbounded(start, end, includeEnd);
    return doGetHistoricalTimeSeries(identifiers, dataSource, dataProvider, dataField, dateRange, null);
  }
View Full Code Here

      ExternalIdBundle identifiers, String dataSource, String dataProvider, String dataField,
      LocalDate start, boolean includeStart, LocalDate end, boolean includeEnd, int maxPoints) {
    if (!includeStart && start != null) {
      start = start.plusDays(1);
    }
    LocalDateRange dateRange = LocalDateRange.ofNullUnbounded(start, end, includeEnd);
    Integer maxPointsVal = (maxPoints == 0 ? null : maxPoints);
    return doGetHistoricalTimeSeries(identifiers, dataSource, dataProvider, dataField, dateRange, maxPointsVal);
  }
View Full Code Here

      Set<ExternalIdBundle> externalIdBundles, String dataSource, String dataProvider, String dataField, LocalDate start, boolean includeStart, LocalDate end, boolean includeEnd) {

    if (!includeStart && start != null) {
      start = start.plusDays(1);
    }
    LocalDateRange dateRange = LocalDateRange.ofNullUnbounded(start, end, includeEnd);
    s_logger.info("Getting HistoricalTimeSeries for securities {}", externalIdBundles);

    Map<ExternalIdBundle, LocalDateDoubleTimeSeries> map = _provider.getHistoricalTimeSeries(externalIdBundles, dataSource, dataProvider, dataField, dateRange);
    Map<ExternalIdBundle, HistoricalTimeSeries> result = Maps.newHashMap();
    for (ExternalIdBundle bundle : map.keySet()) {
View Full Code Here

   * @return the map of results, not null
   */
  protected Map<ExternalIdBundle, LocalDateDoubleTimeSeries> provideTimeSeries(
      Set<ExternalIdBundle> externalIds, String dataField, String dataProvider, LocalDate startDate, LocalDate endDate) {
    s_logger.debug("Loading time series {} ({}-{}) {}: {}", new Object[] {dataField, startDate, endDate, dataProvider, externalIds});
    LocalDateRange dateRange = LocalDateRange.of(startDate, endDate, true);
    return _underlyingHtsProvider.getHistoricalTimeSeries(
        externalIds, BloombergConstants.BLOOMBERG_DATA_SOURCE_NAME, dataProvider, dataField, dateRange);
  }
View Full Code Here

  //-------------------------------------------------------------------------
  private Map<ExternalIdBundle, LocalDateDoubleTimeSeries> getTimeSeries(
      final String dataField, final LocalDate startDate, final LocalDate endDate, String bbgDataProvider, Set<ExternalIdBundle> identifierSet) {
    s_logger.debug("Loading time series {} ({}-{}) {}: {}", new Object[] {dataField, startDate, endDate, bbgDataProvider, identifierSet});
    LocalDateRange dateRange = LocalDateRange.of(startDate, endDate, true);
    return _historicalTimeSeriesProvider.getHistoricalTimeSeries(
        identifierSet, BloombergConstants.BLOOMBERG_DATA_SOURCE_NAME, bbgDataProvider, dataField, dateRange);
  }
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_getHistoricalTimeSeries_single_wrongDataSource() {
    LocalDateRange range = LocalDateRange.of(LocalDate.of(2009, 11, 4), LocalDate.of(2009, 11, 4), true);
    _provider.getHistoricalTimeSeries(SIMPLE_BUNDLE, "RUBBISH", DEFAULT_DATA_PROVIDER, PX_LAST, range);
  }
View Full Code Here

    _provider.getHistoricalTimeSeries(SIMPLE_BUNDLE, "RUBBISH", DEFAULT_DATA_PROVIDER, PX_LAST, range);
  }

  @Test
  public void test_getHistoricalTimeSeries_single_sameDate() {
    LocalDateRange range = LocalDateRange.of(LocalDate.of(2009, 11, 4), LocalDate.of(2009, 11, 4), true);
    LocalDateDoubleTimeSeries test = _provider.getHistoricalTimeSeries(SIMPLE_BUNDLE, BBG_DATA_SOURCE, DEFAULT_DATA_PROVIDER, PX_LAST, range);
    assertNotNull(test);
    assertEquals(1, test.size());
  }
View Full Code Here

  @Test
  public void getHistoricalTimeSeriesWithZeroMaxPoints() throws Exception {   
    LocalDate endDate = LocalDate.of(2012, 03, 07);
    LocalDate startDate = endDate.minusMonths(1);
   
    LocalDateRange dateRange = LocalDateRange.of(startDate, endDate, true);
    HistoricalTimeSeriesProviderGetRequest realRequest = HistoricalTimeSeriesProviderGetRequest.createGet(SIMPLE_BUNDLE, BBG_DATA_SOURCE, DEFAULT_DATA_PROVIDER, PX_LAST, dateRange);
    realRequest.setMaxPoints(0);
    LocalDateDoubleTimeSeries realHts = _provider.getHistoricalTimeSeries(realRequest).getResultMap().get(SIMPLE_BUNDLE);
   
    assertNotNull(realHts);
View Full Code Here

  @Test
  public void getHistoricalTimeSeriesWithAllMaxPoints() throws Exception {   
    LocalDate endDate = LocalDate.of(2012, 03, 07);
    LocalDate startDate = endDate.minusMonths(1);
   
    LocalDateRange dateRange = LocalDateRange.of(startDate, endDate, true);
    HistoricalTimeSeriesProviderGetRequest referenceRequest = HistoricalTimeSeriesProviderGetRequest.createGet(SIMPLE_BUNDLE, BBG_DATA_SOURCE, DEFAULT_DATA_PROVIDER, PX_LAST, dateRange);
    LocalDateDoubleTimeSeries reference = _provider.getHistoricalTimeSeries(referenceRequest).getResultMap().get(SIMPLE_BUNDLE);
    HistoricalTimeSeriesProviderGetRequest realRequest = HistoricalTimeSeriesProviderGetRequest.createGet(SIMPLE_BUNDLE, BBG_DATA_SOURCE, DEFAULT_DATA_PROVIDER, PX_LAST, dateRange);
    realRequest.setMaxPoints(-9999);
    LocalDateDoubleTimeSeries realHts = _provider.getHistoricalTimeSeries(realRequest).getResultMap().get(SIMPLE_BUNDLE);
View Full Code Here

TOP

Related Classes of com.opengamma.util.time.LocalDateRange

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.