Package com.opengamma.analytics.financial.instrument.cash

Examples of com.opengamma.analytics.financial.instrument.cash.DepositZeroDefinition


  private static final Calendar CALENDAR = new MondayToFridayCalendar("Weekend");
  private static final String CURVE_NAME = "Curve";

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullCurrency() {
    new DepositZeroDefinition(null, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
  }
View Full Code Here


    new DepositZeroDefinition(null, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullStart() {
    new DepositZeroDefinition(EUR, null, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
  }
View Full Code Here

    new DepositZeroDefinition(EUR, null, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullEnd() {
    new DepositZeroDefinition(EUR, SPOT_DATE, null, NOTIONAL, DEPOSIT_AF, RATE);
  }
View Full Code Here

    new DepositZeroDefinition(EUR, SPOT_DATE, null, NOTIONAL, DEPOSIT_AF, RATE);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullRate() {
    new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, null);
  }
View Full Code Here

  /**
   * Tests the equal and hash code methods.
   */
  public void equalHash() {
    assertEquals("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION, DEPOSIT_DEFINITION);
    final DepositZeroDefinition other = new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
    assertEquals("DepositZeroDefinition: equal-hash code", other, DEPOSIT_DEFINITION);
    assertEquals("DepositZeroDefinition: equal-hash code", other.hashCode(), DEPOSIT_DEFINITION.hashCode());
    DepositZeroDefinition modified;
    modified = new DepositZeroDefinition(Currency.USD, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
    assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
    modified = new DepositZeroDefinition(Currency.EUR, SPOT_DATE.plusDays(1), END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
    assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
    modified = new DepositZeroDefinition(Currency.EUR, SPOT_DATE, END_DATE.plusDays(1), NOTIONAL, DEPOSIT_AF, RATE);
    assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
    modified = new DepositZeroDefinition(Currency.EUR, SPOT_DATE, END_DATE, NOTIONAL + 1000, DEPOSIT_AF, RATE);
    assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
    modified = new DepositZeroDefinition(Currency.EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF + 0.01, RATE);
    assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
    modified = new DepositZeroDefinition(Currency.EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, new PeriodicInterestRate(RATE_FIGURE, 1));
    assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
  }
View Full Code Here

  @Test
  /**
   * Tests the builders.
   */
  public void from() {
    final DepositZeroDefinition from = DepositZeroDefinition.from(EUR, SPOT_DATE, END_DATE, DAY_COUNT, RATE, CALENDAR);
    final DepositZeroDefinition comp = new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, 1.0, DEPOSIT_AF, RATE);
    assertEquals("DepositZeroDefinition - From", comp, from);
  }
View Full Code Here

   */
  public void parSpreadTrade() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositZero deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double psMethod = METHOD_DEPOSIT.parSpread(deposit, CURVES);
    final DepositZeroDefinition deposit0Definition = new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, new PeriodicInterestRate(RATE_FIGURE + psMethod, 1));
    final DepositZero deposit0 = deposit0Definition.toDerivative(referenceDate, CURVES_NAME[0]);
    final CurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, CURVES);
    assertEquals("DepositZero: par spread", 0, pv0.getAmount(), TOLERANCE_PRICE);
    final double psCalculator = deposit.accept(PSC, CURVES);
    assertEquals("DepositZero: par rate", psMethod, psCalculator, TOLERANCE_RATE);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.instrument.cash.DepositZeroDefinition

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.