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

Examples of com.opengamma.analytics.financial.instrument.cash.CashDefinition.toDerivative()


  public void parRateBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final double parRate = METHOD_DEPOSIT.parRate(deposit, PROVIDER);
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, parRate, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER);
    assertEquals("DepositDefinition: par rate", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here


  public void parSpreadBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER);
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, RATE + parSpread, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER);
    assertEquals("DepositDefinition: par spread", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

  public void parSpreadOnStart() {
    final ZonedDateTime referenceDate = DEPOSIT_DEFINITION.getStartDate();
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER);
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, RATE + parSpread, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

  public void parSpreadAfterStart() {
    final ZonedDateTime referenceDate = ScheduleCalculator.getAdjustedDate(DEPOSIT_DEFINITION.getStartDate(), 1, TARGET);
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER); // Spread will be -(1/delta+rate), as there is no initial amount
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, RATE + parSpread, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

  public void parRateBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double parRate = METHOD_DEPOSIT.parRate(deposit, CURVES);
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, parRate, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate, CURVES_NAME[0]);
    final CurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, CURVES);
    assertEquals("DepositDefinition: par rate", 0, pv0.getAmount(), TOLERANCE_PRICE);
  }

  @Test
View Full Code Here

  public void parSpreadBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, CURVES);
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, RATE + parSpread, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate, CURVES_NAME[0]);
    final CurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, CURVES);
    assertEquals("DepositDefinition: par spread", 0, pv0.getAmount(), TOLERANCE_PRICE);
  }

  @Test
View Full Code Here

  public void parSpreadOnStart() {
    final ZonedDateTime referenceDate = DEPOSIT_DEFINITION.getStartDate();
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, CURVES);
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, RATE + parSpread, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate, CURVES_NAME[0]);
    final CurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, CURVES);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(), TOLERANCE_PRICE);
  }

  @Test
View Full Code Here

  public void parSpreadAfterStart() {
    final ZonedDateTime referenceDate = ScheduleCalculator.getAdjustedDate(DEPOSIT_DEFINITION.getStartDate(), 1, TARGET);
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, CURVES); // Spread will be -(1/delta+rate), as there is no initial amount
    final CashDefinition deposit0Definition = new CashDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, RATE + parSpread, DEPOSIT_AF);
    final Cash deposit0 = deposit0Definition.toDerivative(referenceDate, CURVES_NAME[0]);
    final CurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, CURVES);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(), TOLERANCE_PRICE);
  }

  @Test
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.