Package org.threeten.bp

Examples of org.threeten.bp.LocalDate


    return new DependencyGraphTraceProviderResource(_provider, _fudgeContext, properties);
  }

  @Path("marketDataHistorical/{localDate}/{timeSeriesResolverKey}")
  public DependencyGraphTraceProviderResource setMarketDataHistorical(@PathParam("localDate") final String localDateStr, @PathParam("timeSeriesResolverKey") final String timeSeriesResolverKey) {
    LocalDate localDate = LocalDate.parse(localDateStr);
    MarketDataSpecification marketData = MarketData.historical(localDate, timeSeriesResolverKey);
    DependencyGraphTraceBuilderProperties properties = _properties.addMarketData(marketData);
    return new DependencyGraphTraceProviderResource(_provider, _fudgeContext, properties);
  }
View Full Code Here


    return message;
  }

  @Override
  public InterpolatedYieldCurveSpecification buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
    final LocalDate curveDate = deserializer.fieldValueToObject(LocalDate.class, message.getByName(CURVE_DATE_FIELD));
    final String name = message.getString(NAME_FIELD);
    final Currency currency = deserializer.fieldValueToObject(Currency.class, message.getByName(CURRENCY_FIELD));
    final ExternalId region = deserializer.fieldValueToObject(ExternalId.class, message.getByName(REGION_FIELD));
    final Interpolator1D interpolator = deserializer.fieldValueToObject(Interpolator1D.class, message.getByName(INTERPOLATOR_FIELD));
    final List<FudgeField> resolvedStripFields = message.getAllByName(RESOLVED_STRIPS_FIELD);
View Full Code Here

  @Deprecated
  @Override
  public InterestRateFutureTransaction toDerivative(final ZonedDateTime dateTime, final Double lastMarginPrice, final String... yieldCurveNames) {
    ArgumentChecker.notNull(dateTime, "date");
    ArgumentChecker.notNull(yieldCurveNames, "yield curve names");
    final LocalDate date = dateTime.toLocalDate();
    ArgumentChecker.isTrue(yieldCurveNames.length > 1, "at least two curves required");
    final LocalDate transactionDateLocal = _transactionDate.toLocalDate();
    final LocalDate lastMarginDateLocal = getFixingPeriodStartDate().toLocalDate();
    if (date.isAfter(lastMarginDateLocal)) {
      throw new ExpiredException("Valuation date, " + date + ", is after last margin date, " + lastMarginDateLocal);
    }
    double referencePrice;
    if (transactionDateLocal.isBefore(date)) { // Transaction was before last margining.
View Full Code Here

   * @param lastMarginPrice The price on which the last margining was done.
   */
  @Override
  public InterestRateFutureTransaction toDerivative(final ZonedDateTime dateTime, final Double lastMarginPrice) {
    ArgumentChecker.notNull(dateTime, "date");
    final LocalDate date = dateTime.toLocalDate();
    final LocalDate transactionDateLocal = _transactionDate.toLocalDate();
    final LocalDate lastMarginDateLocal = getFixingPeriodStartDate().toLocalDate();
    if (date.isAfter(lastMarginDateLocal)) {
      throw new ExpiredException("Valuation date, " + date + ", is after last margin date, " + lastMarginDateLocal);
    }
    double referencePrice;
    if (transactionDateLocal.isBefore(date)) { // Transaction was before last margining.
View Full Code Here

  @Deprecated
  @Override
  public InterestRateFutureSecurity toDerivative(final ZonedDateTime dateTime, final String... yieldCurveNames) {
    ArgumentChecker.notNull(dateTime, "date");
    ArgumentChecker.notNull(yieldCurveNames, "yield curve names");
    final LocalDate date = dateTime.toLocalDate();
    final LocalDate lastMarginDateLocal = getFixingPeriodStartDate().toLocalDate();
    if (date.isAfter(lastMarginDateLocal)) {
      throw new ExpiredException("Valuation date, " + date + ", is after last margin date, " + lastMarginDateLocal);
    }
    final String discountingCurveName = yieldCurveNames[0];
    final String forwardCurveName = yieldCurveNames[yieldCurveNames.length > 1 ? 1 : 0];
View Full Code Here

  }

  @Override
  public InterestRateFutureSecurity toDerivative(final ZonedDateTime dateTime) {
    ArgumentChecker.notNull(dateTime, "date");
    final LocalDate date = dateTime.toLocalDate();
    final LocalDate lastMarginDateLocal = getFixingPeriodStartDate().toLocalDate();
    if (date.isAfter(lastMarginDateLocal)) {
      throw new ExpiredException("Valuation date, " + date + ", is after last margin date, " + lastMarginDateLocal);
    }
    final double lastTradingTime = TimeCalculator.getTimeBetween(dateTime, getLastTradingDate());
    final double fixingPeriodStartTime = TimeCalculator.getTimeBetween(dateTime, getFixingPeriodStartDate());
View Full Code Here

  /** Serialization version. */
  private static final long serialVersionUID = 1L;

  @Override
  public LocalDate adjustDate(final Calendar workingDays, final LocalDate date) {
    LocalDate result = date;
    while (!workingDays.isWorkingDay(result)) {
      result = result.plusDays(1);
    }
    return result;
  }
View Full Code Here

  private static final BusinessDayConvention PRECEDING = new PrecedingBusinessDayConvention();
  private static final BusinessDayConvention FOLLOWING = new FollowingBusinessDayConvention();

  @Override
  public LocalDate adjustDate(final Calendar workingDayCalendar, final LocalDate date) {
    final LocalDate precedingDate = PRECEDING.adjustDate(workingDayCalendar, date);
    if (precedingDate.getMonth() == date.getMonth()) {
      return precedingDate;
    }
    return FOLLOWING.adjustDate(workingDayCalendar, date);
  }
View Full Code Here

   * @param includeEnd  whether to include the end
   * @param convention  the date adjuster, not null
   * @return the number of days between two dates
   */
  public static int getDaysBetween(final ZonedDateTime startDate, final boolean includeStart, final ZonedDateTime endDate, final boolean includeEnd, final TemporalAdjuster convention) {
    LocalDate date = startDate.toLocalDate();
    LocalDate localEndDate = endDate.toLocalDate();
    int mult = 1;
    if (startDate.isAfter(endDate)) {
      date = endDate.toLocalDate();
      localEndDate = startDate.toLocalDate();
      mult = -1;
View Full Code Here

  public static LocalDate addWorkDays(final LocalDate startDate, final int workingDaysToAdd, final Calendar holidayCalendar) {
    ArgumentChecker.notNull(startDate, "null startDate");
    ArgumentChecker.notNull(holidayCalendar, "null holidayCalendar");

    int daysLeft = workingDaysToAdd;
    LocalDate temp = startDate;
    while (daysLeft > 0) {
      temp = temp.plusDays(1);
      if (holidayCalendar.isWorkingDay(temp)) {
        daysLeft--;
      }
    }
    return temp;
View Full Code Here

TOP

Related Classes of org.threeten.bp.LocalDate

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.