Пример #1
0
  /**
   * Make a set of standard CDS represented as a MultiCdsAnalytic instance. The maturities of the
   * CDS are measured from the next IMM date (after the trade date), and the tenors are the given
   * matIndices multiplied by the coupon interval (3 months).
   *
   * @param tradeDate the trade date
   * @param accStartDate the accrual start date
   * @param matIndices the CDS tenors are these multiplied by the coupon interval (3 months)
   * @return a set of CDS represented as a MultiCdsAnalytic
   */
  public MultiCdsAnalytic makeMultiImmCds(
      LocalDate tradeDate, LocalDate accStartDate, int[] matIndices) {
    if (!_couponInterval.equals(DEFAULT_COUPON_INT)) {
      throw new IllegalArgumentException(
          "coupon interval must be 3M for this method. However it is set to "
              + _couponInterval.toString());
    }
    ArgChecker.notNull(tradeDate, "tradeDate");
    ArgChecker.notEmpty(matIndices, "matIndicies");

    LocalDate nextIMM = ImmDateLogic.getNextIMMDate(tradeDate);
    LocalDate stepinDate = tradeDate.plusDays(_stepIn);
    LocalDate valueDate = addWorkDays(tradeDate, _cashSettle, _calendar);

    return new MultiCdsAnalytic(
        tradeDate,
        stepinDate,
        valueDate,
        accStartDate,
        nextIMM,
        matIndices,
        _payAccOnDefault,
        _couponIntervalTenor,
        _stubType,
        _protectStart,
        _recoveryRate,
        _businessdayAdjustmentConvention,
        DEFAULT_CALENDAR,
        _accrualDayCount,
        _curveDayCount);
  }
Пример #2
0
 /**
  * Checks if this periodic frequency equals another periodic frequency.
  *
  * <p>The comparison checks the frequency period.
  *
  * @param obj the other frequency, null returns false
  * @return true if equal
  */
 @Override
 public boolean equals(Object obj) {
   if (obj == this) {
     return true;
   }
   if (obj == null || getClass() != obj.getClass()) {
     return false;
   }
   Frequency other = (Frequency) obj;
   return period.equals(other.period);
 }