Package org.threeten.bp

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


    for (final Map.Entry<LocalDate, MultipleCurrencyAmount> entry : payments.entrySet()) {
      assertEquals(paymentDate, entry.getKey());
      assertEquals(1, entry.getValue().size());
      assertEquals(FIXED_INCOME_CURRENCY, entry.getValue().getCurrencyAmounts()[0].getCurrency());
      assertEquals(SWAP_NOTIONAL * SWAP_FIXED_RATE / 2, entry.getValue().getCurrencyAmounts()[0].getAmount(), 1e-15);
      paymentDate = paymentDate.plusMonths(6);
    }
  }

  @Test
  public void testFX() {
View Full Code Here


   
    // Add the Quarterly IMM months out 3 years
    final Set<Month> immQuarters = EnumSet.of(Month.MARCH, Month.JUNE, Month.SEPTEMBER, Month.DECEMBER);
    LocalDate nextQuarter = valDate;
    do {
      nextQuarter = nextQuarter.plusMonths(1);
    } while (!immQuarters.contains(nextQuarter.getMonth()));
   
    for (int q = 1; q <= 12; q++) {
      expirySet.add(nextQuarter.with(thirdFriday).plusDays(1));
      nextQuarter = nextQuarter.plusMonths(3);
View Full Code Here

      nextQuarter = nextQuarter.plusMonths(1);
    } while (!immQuarters.contains(nextQuarter.getMonth()));
   
    for (int q = 1; q <= 12; q++) {
      expirySet.add(nextQuarter.with(thirdFriday).plusDays(1));
      nextQuarter = nextQuarter.plusMonths(3);
    }
   
    return expirySet;
  }
 
View Full Code Here

    final LocalDate today = LocalDate.now(OpenGammaClock.getInstance());
    final LocalDate lastTradeDateOfERM1 = LocalDate.of(2011, 6, 13);

    final ExternalId actual = PROVIDER_EUR.getInstrument(5, SNAPSHOT_DATE);
    final String expected;
    if (today.isBefore(lastTradeDateOfERM1.plusMonths(11))) {
      expected = "ERM1 Comdty";
    } else {
      expected = "ERM11 Comdty";
    }
    assertEquals(expected, actual.getValue());
View Full Code Here

  @Override
  public Temporal adjustInto(final Temporal temporal) {
    ArgumentChecker.notNull(temporal, "temporal");
    LocalDate result = LocalDate.from(temporal);
    while (!FUTURE_EXPIRY_MONTHS.contains(result.getMonth())) {
      result = result.plusMonths(1);
    }
    return temporal.with(result);
  }

}
View Full Code Here

  public LocalDate getExpiryMonth(final int n, final LocalDate today) {
    ArgumentChecker.isTrue(n > 0, "n must be greater than zero");
    ArgumentChecker.notNull(today, "today");
    final LocalDate nextExpiryMonth = today.with(MONTH_ADJUSTER);
    if (today.isAfter(today.with(THIRD_MONDAY_ADJUSTER))) {
      return nextExpiryMonth.plusMonths(3 * n);
    }
    return nextExpiryMonth.plusMonths(3 * (n - 1));
  }

  @Override
View Full Code Here

    ArgumentChecker.notNull(today, "today");
    final LocalDate nextExpiryMonth = today.with(MONTH_ADJUSTER);
    if (today.isAfter(today.with(THIRD_MONDAY_ADJUSTER))) {
      return nextExpiryMonth.plusMonths(3 * n);
    }
    return nextExpiryMonth.plusMonths(3 * (n - 1));
  }

  @Override
  public String getName() {
    return NAME;
View Full Code Here

    LocalDate expiry = date.with(_nextExpiryAdjuster.getDayOfMonthAdjuster()); // Compute the expiry of valuationDate's month
    if (!expiry.isAfter(date)) { // If it is not strictly after valuationDate...
      expiry = (date.plusMonths(1)).with(_nextExpiryAdjuster.getDayOfMonthAdjuster());
    }
    if (nthExpiry > 1) {
      expiry = (expiry.plusMonths(nthExpiry - 1)).with(_nextExpiryAdjuster.getDayOfMonthAdjuster());
    }
    return expiry;
  }

  /**
 
View Full Code Here

    LocalDate expiry = valDate.with(THIRD_WED_ADJUSTER);
    if (!expiry.isAfter(valDate)) { // If it is not strictly after valuationDate...
      expiry = (valDate.plusMonths(1)).with(THIRD_WED_ADJUSTER)// nextExpiry is third Wednesday of next month
    }
    if (nthMonth > 1) {
      expiry = (expiry.plusMonths(nthMonth - 1)).with(THIRD_WED_ADJUSTER);
    }
    return expiry;
  }

  public static LocalDate getIRFutureQuarterlyExpiryDate(final int nthFuture, final LocalDate valDate, final Calendar holidayCalendar) {
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.