Examples of CurrencyAmount


Examples of com.opengamma.util.money.CurrencyAmount

  @Test
  /**
   * Tests the present value: Method vs Calculator
   */
  public void presentValueMethodVsCalculator() {
    final CurrencyAmount pvMethod = METHOD_TRANSACTION.presentValue(BILL_TRA, CURVE_BUNDLE);
    final double pvCalculator = BILL_TRA.accept(PVC, CURVE_BUNDLE);
    assertEquals("Bill Security: discounting method - present value", pvMethod.getAmount(), pvCalculator, TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

   */
  public void parSpread() {
    final double spread = METHOD_TRANSACTION.parSpread(BILL_TRA, CURVE_BUNDLE);
    final BillTransactionDefinition bill0Definition = BillTransactionDefinition.fromYield(BILL_SEC_DEFINITION, QUANTITY, SETTLE_DATE, YIELD + spread, CALENDAR);
    final BillTransaction bill0 = bill0Definition.toDerivative(REFERENCE_DATE, NAME_CURVES);
    final CurrencyAmount pv0 = METHOD_TRANSACTION.presentValue(bill0, CURVE_BUNDLE);
    assertEquals("Bill Security: discounting method - par spread", 0, pv0.getAmount(), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

   * @return The present value.
   */
  public CurrencyAmount presentValuePositiveNotional(final AnnuityCouponFixed annuity, final MulticurveProviderInterface multicurves) {
    ArgumentChecker.notNull(annuity, "Annuity");
    ArgumentChecker.notNull(multicurves, "Multi-curves provider");
    CurrencyAmount pv = CurrencyAmount.of(annuity.getCurrency(), 0);
    for (final CouponFixed cpn : annuity.getPayments()) {
      pv = pv.plus(METHOD_CPN_FIXED.presentValuePositiveNotional(cpn, multicurves));
    }
    return pv;
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

  @Test
  /**
   * Tests the present value against explicit computation.
   */
  public void presentValue() {
    final CurrencyAmount pvComputed = METHOD_SECURITY.presentValue(BILL_IAM_SEC, CURVE_BUNDLE);
    final double pvExpected = NOTIONAL * CURVE_BUNDLE.getCurve(NAME_CURVES[1]).getDiscountFactor(BILL_IAM_SEC.getEndTime());
    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

  @Test
  /**
   * Tests the present value: Method vs Calculator
   */
  public void presentValueMethodVsCalculator() {
    final CurrencyAmount pvMethod = METHOD_SECURITY.presentValue(BILL_IAM_SEC, CURVE_BUNDLE);
    final double pvCalculator = BILL_IAM_SEC.accept(PVC, CURVE_BUNDLE);
    assertEquals("Bill Security: discounting method - present value", pvMethod.getAmount(), pvCalculator, TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    assertEquals("Bill Security: discounting method - price", PRICE, priceComputed, TOLERANCE_PRICE);
  }

  @Test
  public void presentValueFromPrice() {
    final CurrencyAmount pvComputed = METHOD_SECURITY.presentValueFromPrice(BILL_IAM_SEC, PRICE, CURVE_BUNDLE);
    final double pvExpected = NOTIONAL * PRICE * CURVE_BUNDLE.getCurve(NAME_CURVES[0]).getDiscountFactor(BILL_IAM_SEC.getSettlementTime());
    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }

  @Test
  public void presentValueFromYield() {
    final CurrencyAmount pvComputed = METHOD_SECURITY.presentValueFromYield(BILL_IAM_SEC, YIELD, CURVE_BUNDLE);
    final double price = METHOD_SECURITY.priceFromYield(BILL_IAM_SEC, YIELD);
    final double pvExpected = NOTIONAL * price * CURVE_BUNDLE.getCurve(NAME_CURVES[0]).getDiscountFactor(BILL_IAM_SEC.getSettlementTime());
    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

  }

  @Test
  public void priceFromCurves() {
    final double priceComputed = METHOD_SECURITY.priceFromCurves(BILL_IAM_SEC, CURVE_BUNDLE);
    final CurrencyAmount pvComputed = METHOD_SECURITY.presentValue(BILL_IAM_SEC, CURVE_BUNDLE);
    final double priceExpected = pvComputed.getAmount() / (NOTIONAL * CURVE_BUNDLE.getCurve(NAME_CURVES[0]).getDiscountFactor(BILL_IAM_SEC.getSettlementTime()));
    assertEquals("Bill Security: discounting method - price", priceExpected, priceComputed, TOLERANCE_PRICE);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    assertEquals("Bill Security: discounting method - price", PRICE, priceComputed, TOLERANCE_PRICE);
  }

  @Test
  public void presentValueFromPrice() {
    final CurrencyAmount pvComputed = METHOD_SECURITY.presentValueFromPrice(BILL_BEL_IAM_SEC, PRICE, ISSUER_MULTICURVE);
    final double pvExpected = NOTIONAL * PRICE * ISSUER_MULTICURVE.getMulticurveProvider().getDiscountFactor(EUR, BILL_BEL_IAM_SEC.getSettlementTime());
    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }

  @Test
  public void presentValueFromYield() {
    final CurrencyAmount pvComputed = METHOD_SECURITY.presentValueFromYield(BILL_BEL_IAM_SEC, YIELD, ISSUER_MULTICURVE);
    final double price = METHOD_SECURITY.priceFromYield(BILL_BEL_IAM_SEC, YIELD);
    final double pvExpected = NOTIONAL * price * ISSUER_MULTICURVE.getMulticurveProvider().getDiscountFactor(EUR, BILL_BEL_IAM_SEC.getSettlementTime());
    assertEquals("Bill Security: discounting method - present value", pvExpected, pvComputed.getAmount(), TOLERANCE_PV);
  }
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.