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

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.DepositIbor


  /**
   * Tests toDerivative.
   */
  public void toDerivativeBetweenSettleMaturity() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 20);
    final DepositIbor converted = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final double startTime = 0;
    final double endTime = TimeCalculator.getTimeBetween(referenceDate, END_DATE);
    final DepositIbor expected = new DepositIbor(EUR, startTime, endTime, NOTIONAL, 0, RATE, DEPOSIT_AF, INDEX);
    assertEquals("DepositDefinition: toDerivative", expected, converted);
  }
View Full Code Here


  /**
   * Tests toDerivative.
   */
  public void toDerivativeMaturity() {
    final ZonedDateTime referenceDate = END_DATE;
    final DepositIbor converted = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final double startTime = 0;
    final double endTime = TimeCalculator.getTimeBetween(referenceDate, END_DATE);
    final DepositIbor expected = new DepositIbor(EUR, startTime, endTime, NOTIONAL, 0, RATE, DEPOSIT_AF, INDEX);
    assertEquals("DepositDefinition: toDerivative", expected, converted);
  }
View Full Code Here

  /**
   * Tests present value when the valuation date is on trade date.
   */
  public void presentValueTrade() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvComputed = METHOD_DEPOSIT.presentValue(deposit, PROVIDER_MULTICURVES);
    final double dfEnd = PROVIDER_MULTICURVES.getDiscountFactor(deposit.getCurrency(), deposit.getEndTime());
    final double forward = PROVIDER_MULTICURVES.getForwardRate(deposit.getIndex(), deposit.getStartTime(), deposit.getEndTime(), deposit.getAccrualFactor());
    final double pvExpected = deposit.getAccrualFactor() * (deposit.getRate() - forward) * dfEnd;
    assertEquals("DepositCounterpartDiscountingMethod: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

  /**
   * Tests present value when the valuation date is on trade date. Compare Method to Calculator.
   */
  public void presentValueMethodVsCalculator() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvMethod = METHOD_DEPOSIT.presentValue(deposit, PROVIDER_MULTICURVES);
    final MultipleCurrencyAmount pvCalculator = deposit.accept(PVC, PROVIDER_MULTICURVES);
    assertEquals("DepositCounterpartDiscountingMethod: present value", pvMethod, pvCalculator);
  }
View Full Code Here

  /**
   * Tests present value curve sensitivity when the valuation date is on trade date.
   */
  public void presentValueCurveSensitivityTrade() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyParameterSensitivity pvpsDepositExact = PS_PV_C.calculateSensitivity(deposit, PROVIDER_MULTICURVES, PROVIDER_MULTICURVES.getAllNames());
    final MultipleCurrencyParameterSensitivity pvpsDepositFD = PS_PV_FDC.calculateSensitivity(deposit, PROVIDER_MULTICURVES);
    AssertSensivityObjects.assertEquals("DepositCounterpartDiscountingMethod: presentValueCurveSensitivity ", pvpsDepositExact, pvpsDepositFD, TOLERANCE_PV_DELTA);
  }
View Full Code Here

  /**
   * Tests present value curve sensitivity when the valuation date is on trade date. Compare Method to Calculator.
   */
  public void presentValueCurveSensitivityMethodVsCalculator() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyMulticurveSensitivity pvcsMethod = METHOD_DEPOSIT.presentValueCurveSensitivity(deposit, PROVIDER_MULTICURVES);
    final MultipleCurrencyMulticurveSensitivity pvcsCalculator = deposit.accept(PVCSC, PROVIDER_MULTICURVES);
    assertEquals("DepositCounterpartDiscountingMethod: present value", pvcsMethod, pvcsCalculator);
  }
View Full Code Here

  /**
   * Tests parSpread when the present is before the deposit start date.
   */
  public void parSpreadBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_MULTICURVES);
    final DepositIborDefinition deposit0Definition = DepositIborDefinition.fromTrade(referenceDate, NOTIONAL, RATE + parSpread, EURIBOR3M, CALENDAR);
    final DepositIbor deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER_MULTICURVES);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

  /**
   * Tests parSpread.
   */
  public void parSpreadMethodVsCalculator() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final double parSpreadMethod = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_MULTICURVES);
    final double parSpreadCalculator = deposit.accept(PSMQDC, PROVIDER_MULTICURVES);
    assertEquals("DepositDefinition: present value", parSpreadMethod, parSpreadCalculator, TOLERANCE_SPREAD);
  }
View Full Code Here

  /**
   * Tests parSpread curve sensitivity.
   */
  public void parSpreadCurveSensitivity() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final SimpleParameterSensitivity pspsDepositExact = PS_PSMQ_C.calculateSensitivity(deposit, PROVIDER_MULTICURVES, PROVIDER_MULTICURVES.getAllNames());
    final SimpleParameterSensitivity pspsDepositFD = PS_PSMQ_FDC.calculateSensitivity(deposit, PROVIDER_MULTICURVES);
    AssertSensivityObjects.assertEquals("DepositCounterpartDiscountingMethod: presentValueCurveSensitivity ", pspsDepositExact, pspsDepositFD, TOLERANCE_PV_DELTA);
  }
View Full Code Here

  /**
   * Tests parSpread curve sensitivity.
   */
  public void parSpreadCurveSensitivityMethodVsCalculator() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final MulticurveSensitivity pscsMethod = METHOD_DEPOSIT.parSpreadCurveSensitivity(deposit, PROVIDER_MULTICURVES);
    final MulticurveSensitivity pscsCalculator = deposit.accept(PSMQCSDC, PROVIDER_MULTICURVES);
    AssertSensivityObjects.assertEquals("CashDiscountingProviderMethod: parSpreadCurveSensitivity", pscsMethod, pscsCalculator, TOLERANCE_SPREAD);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.cash.derivative.DepositIbor

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.