Package org.threeten.bp

Examples of org.threeten.bp.LocalDate.plusDays()


    final int n = dates.length;
    final LocalDate[] result = new LocalDate[n];
    for (int i = 0; i < n; i++) {
      LocalDate date = businessDayConvention.adjustDate(calendar, dates[i].plusDays(1));
      for (int j = 0; j < settlementDays; j++) {
        date = businessDayConvention.adjustDate(calendar, date.plusDays(1));
      }
      result[i] = date;
    }
    return result;
  }
View Full Code Here


    }
    final List<LocalDate> dates = new ArrayList<>();
    LocalDate date = startDate;
    while (!date.isAfter(endDate)) {
      dates.add(date);
      date = date.plusDays(1);
    }
    return dates.toArray(EMPTY_LOCAL_DATE_ARRAY);
  }

  @Override
View Full Code Here

  private SwapSecurity getTenorSwap(final InterpolatedYieldCurveSpecification spec, final FixedIncomeStripWithIdentifier strip, final SnapshotDataBundle marketValues) {
    final ExternalId swapIdentifier = strip.getSecurity();
    final Double rate = marketValues.getDataPoint(swapIdentifier);
    final LocalDate curveDate = spec.getCurveDate();
    final ZonedDateTime tradeDate = curveDate.atTime(11, 00).atZone(ZoneOffset.UTC);
    final ZonedDateTime effectiveDate = DateUtils.previousWeekDay(curveDate.plusDays(3)).atTime(11, 00).atZone(ZoneOffset.UTC);
    final ZonedDateTime maturityDate = curveDate.plus(strip.getMaturity().getPeriod()).atTime(11, 00).atZone(ZoneOffset.UTC);
    final ConventionBundle convention = _conventionBundleSource.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, spec.getCurrency().getCode() + "_TENOR_SWAP"));
    final String counterparty = "";
    final ConventionBundle payLegFloatRateConvention = _conventionBundleSource.getConventionBundle(convention.getBasisSwapPayFloatingLegInitialRate());
    final ConventionBundle receiveLegFloatRateConvention = _conventionBundleSource.getConventionBundle(convention.getBasisSwapReceiveFloatingLegInitialRate());
View Full Code Here

    private LocalDateDoubleTimeSeries makeRandomTimeSeries(LocalDate start, LocalDate end) {
      LocalDateDoubleTimeSeriesBuilder tsMap = ImmutableLocalDateDoubleTimeSeries.builder();
      LocalDate current = start;
      tsMap.put(current, Math.random());
      while (current.isBefore(end)) {
        current = current.plusDays(1);
        if (isWeekday(current)) {
          tsMap.put(current, Math.random());
        }
      }
      return tsMap.build();
View Full Code Here

      if (!sourceTimeSeries.getTimeSeries().equals(destTimeSeries.getTimeSeries())) {
        HistoricalTimeSeriesGetFilter filter = new HistoricalTimeSeriesGetFilter();
        LocalDate lastSourceDate = sourceTimeSeries.getTimeSeries().getLatestTime();
        LocalDate lastDestinationDate = destTimeSeries.getTimeSeries().getLatestTime();
        if (lastSourceDate.isAfter(lastDestinationDate)) {
          filter.setEarliestDate(lastDestinationDate.plusDays(1));
          filter.setLatestDate(lastSourceDate);
          sourceTimeSeries = _sourceMaster.getTimeSeries(sourceId, filter);
          // get JUST the new days
          _destinationMaster.updateTimeSeriesDataPoints(destinationId, sourceTimeSeries.getTimeSeries());
          if (verbose) {
View Full Code Here

    LocalDateDoubleTimeSeriesBuilder bld = ImmutableLocalDateDoubleTimeSeries.builder();
    LocalDate start = LocalDate.of(2000, 1, 2);
    LocalDate end = start.plusYears(10);
    LocalDate current = start;
    while (current.isBefore(end)) {
      current = current.plusDays(1);
      if (isWeekday(current)) {
        bld.put(current, Math.random());
      }
    }
    return bld.build();
View Full Code Here

    for (int i = 0; i < numDaysHistory; i++) {
      writeOneSimulationSeriesDate(simulationSource, simulationSeriesDate, 5);
      simulationSeriesDate = simulationSeriesDate.minusDays(1);
    }
   
    simulationSeriesDate = simulationSeriesDate.plusDays(1);
    simulationSource.setCurrentSimulationExecutionDate(simulationSeriesDate);
    hts = simulationSource.getHistoricalTimeSeries(generateId(3), null, false, null, false);
    assertNotNull(hts);

    simulationSource.clearExecutionDate(simulationSeriesDate);
View Full Code Here

    simulationSource.clearExecutionDate(simulationSeriesDate);
    hts = simulationSource.getHistoricalTimeSeries(generateId(3), null, false, null, false);
    assertNull(hts);

    simulationSource.setCurrentSimulationExecutionDate(simulationSeriesDate.plusDays(1));
    hts = simulationSource.getHistoricalTimeSeries(generateId(3), null, false, null, false);
    assertNotNull(hts);
  }
 
  @Test(enabled=false)
View Full Code Here

  private HistoricalTimeSeries createSampleHts() {
    UniqueId id = UniqueId.of("HTS", UUID.randomUUID().toString());
    LocalDateDoubleTimeSeriesBuilder builder = ImmutableLocalDateDoubleTimeSeries.builder();
    LocalDate start = LocalDate.now();
    for (int i = 0; i < 50000; i++) {
      builder.put(start.plusDays(i), Math.random());
    }
    return new SimpleHistoricalTimeSeries(id, builder.build());
  }
 
}
View Full Code Here

  private LocalDateObjectTimeSeries<?> localDateObjectTimeSeries(final int length) {
    final LocalDate[] d = new LocalDate[length];
    final Object[] v = new Object[length];
    final LocalDate start = LocalDate.of(2013, 1, 1);
    for (int i = 0; i < length; i++) {
      d[i] = start.plusDays(i);
      v[i] = Integer.toString(i);
    }
    return ImmutableLocalDateObjectTimeSeries.of(d, v);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.