Examples of BusinessDayConvention


Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention

    final ZonedDateTime spotDateLeg = ScheduleCalculator.getAdjustedDate(_valuationTime, spotLagLeg, calendar);
    final Period maturityTenor = swapNode.getMaturityTenor().getPeriod();
    final IndexON indexON = new IndexON(indexConvention.getName(), currency, dayCount, publicationLag);
    final Period paymentPeriod = convention.getPaymentTenor().getPeriod();
    final boolean eomLeg = convention.isIsEOM();
    final BusinessDayConvention businessDayConvention = convention.getBusinessDayConvention();
    final int paymentLag = convention.getPaymentLag();
    final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDateLeg,
                                                                       swapNode.getStartTenor().getPeriod(),
                                                                       businessDayConvention,
                                                                       calendar,
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention

      final DepositConvention depositConvention = (DepositConvention) convention;
      final Currency currency = depositConvention.getCurrency();
      final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
                                                          _holidaySource,
                                                          depositConvention.getRegionCalendar());
      final BusinessDayConvention businessDayConvention = depositConvention.getBusinessDayConvention();
      final boolean isEOM = depositConvention.isIsEOM();
      final DayCount dayCount = depositConvention.getDayCount();
      final int settlementDays = depositConvention.getSettlementDays();
      final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, calendar);
      final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDate,
                                                                         startPeriod,
                                                                         businessDayConvention,
                                                                         calendar,
                                                                         isEOM);
      final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(startDate,
                                                                       maturityPeriod,
                                                                       businessDayConvention,
                                                                       calendar,
                                                                       isEOM);
      final double accrualFactor = dayCount.getDayCountFraction(startDate, endDate);
      return new CashSecurity(currency,
                              depositConvention.getRegionCalendar(),
                              startDate,
                              endDate,
                              dayCount,
                              _rate,
                              _amount);
    } else if (convention instanceof IborIndexConvention) {
      final IborIndexConvention iborConvention = (IborIndexConvention) convention;
      final Currency currency = iborConvention.getCurrency();
      final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
                                                          _holidaySource,
                                                          iborConvention.getRegionCalendar());
      final BusinessDayConvention businessDayConvention = iborConvention.getBusinessDayConvention();
      final boolean isEOM = iborConvention.isIsEOM();
      final DayCount dayCount = iborConvention.getDayCount();
      final int settlementDays = iborConvention.getSettlementDays();
      final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, calendar);
      final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDate,
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention

    final Period indexTenor = rateFuture.getUnderlyingTenor().getPeriod();
    final double paymentAccrualFactor = indexTenor.toTotalMonths() / 12.; //TODO don't use this method
    final Currency currency = indexConvention.getCurrency();
    final Calendar fixingCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getFixingCalendar());
    final Calendar regionCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getRegionCalendar());
    final BusinessDayConvention businessDayConvention = indexConvention.getBusinessDayConvention();
    final DayCount dayCount = indexConvention.getDayCount();
    final boolean eom = indexConvention.isIsEOM();
    final int spotLag = indexConvention.getSettlementDays();
    final IborIndex iborIndex = new IborIndex(currency, indexTenor, spotLag, dayCount, businessDayConvention, eom, indexConvention.getName());
    final ExchangeTradedInstrumentExpiryCalculator expiryCalculator = ExchangeTradedInstrumentExpiryCalculatorFactory.getCalculator(expiryCalculatorName);
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention

    validateBusinessDayConvention(businessDayConventionBean.getName());
    return BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention(businessDayConventionBean.getName());
  }

  public static void validateBusinessDayConvention(final String name) {
    final BusinessDayConvention bdc = BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention(name);
    if (bdc == null) {
      throw new OpenGammaRuntimeException("Bad value for businessDayConvention (" + name + ")");
    }
  }
View Full Code Here

Examples of com.opengamma.financial.convention.businessday.BusinessDayConvention

    assertDateArrayEquals(expected2, extractCalculatedSchedule2);
    assertDateArrayEquals(expected3, extractCalculatedSchedule3);
    assertDateArrayEquals(expected4, extractCalculatedSchedule4);

    cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithStubType(StubType.FRONTSHORT);
    final BusinessDayConvention bdc = cds.getBusinessDayAdjustmentConvention();
    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

        cds.getNotional(),
        cds.getRecoveryRate(),
        cds.getIncludeAccruedPremium(),
        cds.getProtectionStart(),
        cds.getParSpread());
    final BusinessDayConvention bdc = cds.getBusinessDayAdjustmentConvention();
    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

    assertDateArrayEquals(expected2, extractCalculatedSchedule2);
    assertDateArrayEquals(expected3, extractCalculatedSchedule3);
    assertDateArrayEquals(expected4, extractCalculatedSchedule4);

    cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithStubType(StubType.FRONTSHORT);
    final BusinessDayConvention bdc = cds.getBusinessDayAdjustmentConvention();
    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

        cds.getNotional(),
        cds.getRecoveryRate(),
        cds.getIncludeAccruedPremium(),
        cds.getProtectionStart(),
        cds.getParSpread());
    final BusinessDayConvention bdc = cds.getBusinessDayAdjustmentConvention();
    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

    ArgumentChecker.notNull(tenor, "Tenor");
    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

   */
  public static ZonedDateTime[] getAdjustedDateSchedule(final ZonedDateTime[] dates, final BusinessDayConvention convention, final Calendar calendar,
      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
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.