Package com.opengamma.analytics.financial.interestrate.payments.derivative

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.CouponONCompounded


      FIXING_PERIOD_END_TIMES[i] = TimeCalculator.getTimeBetween(referenceDate, ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1]);
      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, NOTIONAL);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here


      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1],
          ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, curveNames[0], EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, notionalAccrued, curveNames[1]);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here

      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 1],
          ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, notionalAccrued);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here

      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2],
          ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, curveNames[0], EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, notionalAccrued, curveNames[1]);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here

      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 2],
          ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, notionalAccrued);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here

      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 4],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3],
          ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 4]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, curveNames[0], EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, notionalAccrued, curveNames[1]);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here

      FIXING_PERIOD_ACCRUAL_FACTOR[i] = EUR_DAY_COUNT.getDayCountFraction(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3], ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 4],
          EUR_CALENDAR);
      FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT[i] = TimeCalculator.getTimeBetween(ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 3],
          ON_COMPOUNDED_COUPON_DEFINITION.getFixingPeriodDates()[i + 4]);
    }
    final CouponONCompounded cpnExpected = new CouponONCompounded(EUR_CUR, paymentTime, EUR_PAYMENT_YEAR_FRACTION, NOTIONAL, EUR_OIS, FIXING_PERIOD_START_TIMES,
        FIXING_PERIOD_END_TIMES, FIXING_PERIOD_ACCRUAL_FACTOR, FIXING_PERIOD_ACCRUAL_FACTOR_ACT_ACT, notionalAccrued);
    assertEquals("CouponONCompounded definition: toDerivative", cpnExpected, cpnConverted);
  }
View Full Code Here

  public void presentValueStarted() {
    final double fixing = 0.0015;
    final ZonedDateTimeDoubleTimeSeries TS_ON = ImmutableZonedDateTimeDoubleTimeSeries.ofUTC(new ZonedDateTime[] {DateUtils.getUTCDate(2011, 5, 20), DateUtils.getUTCDate(2011, 5, 23) }, new double[] {
      0.0010, fixing });
    final ZonedDateTime referenceDate = ScheduleCalculator.getAdjustedDate(EFFECTIVE_DATE, 1, TARGET);
    final CouponONCompounded cpnONCompoundedStarted = (CouponONCompounded) CPN_ON_COMPOUNDED_DEFINITION.toDerivative(referenceDate, TS_ON);
    final double notionalAccrued = NOTIONAL * Math.pow(1 + fixing, CPN_ON_COMPOUNDED_DEFINITION.getFixingPeriodAccrualFactors()[0]);
    assertEquals("CouponONCompoundedDiscountingMethod: present value", notionalAccrued, cpnONCompoundedStarted.getNotionalAccrued(), TOLERANCE_PV);
    final MultipleCurrencyAmount pvComputed = METHOD_CPN_OIS.presentValue(cpnONCompoundedStarted, MULTICURVES);
    double ratio = 1.0;
    for (int i = 0; i < cpnONCompoundedStarted.getFixingPeriodAccrualFactors().length; i++) {
      ratio *= Math.pow(
          1 + MULTICURVES.getForwardRate(cpnONCompoundedStarted.getIndex(), cpnONCompoundedStarted.getFixingPeriodStartTimes()[i], cpnONCompoundedStarted.getFixingPeriodEndTimes()[i],
              cpnONCompoundedStarted.getFixingPeriodAccrualFactorsActAct()[i]), cpnONCompoundedStarted.getFixingPeriodAccrualFactors()[i]);
    }
    final double df = MULTICURVES.getDiscountFactor(cpnONCompoundedStarted.getCurrency(), cpnONCompoundedStarted.getPaymentTime());
    final double pvExpected = cpnONCompoundedStarted.getNotionalAccrued() * ratio * df;
    assertEquals("CouponONCompoundedDiscountingMethod: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.payments.derivative.CouponONCompounded

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.