Examples of adjustDate()


Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    final Calendar holidays = cds.getCalendar();
    date = new IMMDates(cds.getStartDate().getYear()).getImmDateDecember();
    dates = new ArrayList<>();
    dates.add(cds.getStartDate());
    while (!date.isAfter(cds.getMaturityDate())) {
      dates.add(bdc.adjustDate(holidays, date));
      date = date.plusMonths(cds.getCouponFrequency().getPeriod().toTotalMonths());
    }
    expected1 = dates.toArray(new ZonedDateTime[dates.size()]);
    //CALCULATOR not tested in this file
    /* actual = CALCULATOR.constructISDACompliantCreditDefaultSwapPremiumLegSchedule(cds);
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    final Calendar holidays = cds.getCalendar();
    date = new IMMDates(cds.getStartDate().getYear()).getImmDateDecember();
    dates = new ArrayList<>();
    dates.add(cds.getStartDate());
    while (!date.isAfter(cds.getMaturityDate())) {
      dates.add(bdc.adjustDate(holidays, date));
      date = date.plusMonths(cds.getCouponFrequency().getPeriod().toTotalMonths());
    }
    expected1 = dates.toArray(new ZonedDateTime[dates.size()]);
    expected2 = new ZonedDateTime[dates.size()];
    expected3 = new ZonedDateTime[dates.size()];
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    final Calendar holidays = cds.getCalendar();
    date = new IMMDates(cds.getStartDate().getYear()).getImmDateDecember();
    dates = new ArrayList<>();
    dates.add(cds.getStartDate());
    while (!date.isAfter(cds.getMaturityDate())) {
      dates.add(bdc.adjustDate(holidays, date));
      date = date.plusMonths(cds.getCouponFrequency().getPeriod().toTotalMonths());
    }
    expected1 = dates.toArray(new ZonedDateTime[dates.size()]);
    expected2 = new ZonedDateTime[dates.size()];
    expected3 = new ZonedDateTime[dates.size()];
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    final Calendar holidays = cds.getCalendar();
    date = new IMMDates(cds.getStartDate().getYear()).getImmDateDecember();
    dates = new ArrayList<>();
    dates.add(cds.getStartDate());
    while (!date.isAfter(cds.getMaturityDate())) {
      dates.add(bdc.adjustDate(holidays, date));
      date = date.plusMonths(cds.getCouponFrequency().getPeriod().toTotalMonths());
    }
    expected1 = dates.toArray(new ZonedDateTime[dates.size()]);
    expected2 = new ZonedDateTime[dates.size()];
    expected3 = new ZonedDateTime[dates.size()];
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    final ZonedDateTime endDate = startDate.plus(tenor); // Unadjusted date.
    // Adjusted to month-end: when start date is last business day of the month, the end date is the last business day of the month.
    final boolean isStartDateEOM = (startDate.getMonth() != getAdjustedDate(startDate, 1, calendar).getMonth());
    if ((tenor.getDays() == 0) & (endOfMonthRule) & (isStartDateEOM)) {
      final BusinessDayConvention preceding = new PrecedingBusinessDayConvention();
      return preceding.adjustDate(calendar, endDate.with(TemporalAdjusters.lastDayOfMonth()));
    }
    return convention.adjustDate(calendar, endDate); // Adjusted by Business day convention
  }

  /**
 
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

      final boolean eomApply) {
    final ZonedDateTime[] result = new ZonedDateTime[dates.length];
    if (eomApply) {
      final BusinessDayConvention precedingDBC = new PrecedingBusinessDayConvention(); //To ensure that the date stays in the current month.
      for (int loopdate = 0; loopdate < dates.length; loopdate++) {
        result[loopdate] = precedingDBC.adjustDate(calendar, dates[loopdate].with(TemporalAdjusters.lastDayOfMonth()));
      }
      return result;
    }
    for (int loopdate = 0; loopdate < dates.length; loopdate++) {
      result[loopdate] = convention.adjustDate(calendar, dates[loopdate]);
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

  public static ZonedDateTime[] getAdjustedDateSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate, final Period period,
      final BusinessDayConvention businessDayConvention, final Calendar calendar, final boolean isEOM, final boolean stubShort) {
    boolean eomApply = false;
    if (isEOM) {
      final BusinessDayConvention following = new FollowingBusinessDayConvention();
      eomApply = (following.adjustDate(calendar, startDate.plusDays(1)).getMonth() != startDate.getMonth());
    }
    // When the end-of-month rule applies and the start date is on month-end, the dates are the last business day of the month.
    BusinessDayConvention actualBDC;
    final List<ZonedDateTime> adjustedDates = new ArrayList<>();
    ZonedDateTime date = startDate;
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    ZonedDateTime date = startDate;
    if (eomApply) {
      actualBDC = new PrecedingBusinessDayConvention(); //To ensure that the date stays in the current month.
      date = date.plus(period).with(TemporalAdjusters.lastDayOfMonth());
      while (date.isBefore(endDate)) { // date is strictly before endDate
        adjustedDates.add(actualBDC.adjustDate(calendar, date));
        date = date.plus(period).with(TemporalAdjusters.lastDayOfMonth());
      }
    } else {
      actualBDC = businessDayConvention;
      date = date.plus(period);
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

    }
    // For long stub the last date before end date, if any, is removed.
    if (!stubShort && adjustedDates.size() >= 1) {
      adjustedDates.remove(adjustedDates.size() - 1);
    }
    adjustedDates.add(actualBDC.adjustDate(calendar, endDate)); // the end date
    return adjustedDates.toArray(EMPTY_ARRAY);
  }

  public static ZonedDateTime[] getAdjustedDateSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate, final Frequency frequency,
      final BusinessDayConvention businessDayConvention, final Calendar calendar, final boolean isEOM) {
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention.adjustDate()

      // Remember if protectStart = TRUE then there is an extra day of accrued that is not captured here
      cashflowSchedule[nDatesInSchedule - 1] = reversedCashflowSchedule.get(0);
      final Calendar calendar = cds.getCalendar();
      final BusinessDayConvention bdc = cds.getBusinessDayAdjustmentConvention();
      for (int i = nDatesInSchedule - 2; i > 0; i--) {
        cashflowSchedule[nDatesInSchedule - i - 1] = bdc.adjustDate(calendar, reversedCashflowSchedule.get(i));
      }
      cashflowSchedule[0] = reversedCashflowSchedule.get(nDatesInSchedule - 1);
      return cashflowSchedule;
    }
    // TODO : Add the code for the back stub
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.