Package com.opengamma.util.money

Examples of com.opengamma.util.money.CurrencyAmount.plus()


  public void presentValue() {
    final CurrencyAmount pvTransactionComputed = METHOD_TRANSACTION.presentValue(BILL_TRA, CURVE_BUNDLE);
    CurrencyAmount pvSecurity = METHOD_SECURITY.presentValue(BILL_TRA.getBillPurchased(), CURVE_BUNDLE);
    pvSecurity = pvSecurity.multipliedBy(QUANTITY);
    final double pvSettle = BILL_TRA_DEFINITION.getSettlementAmount() * CURVE_BUNDLE.getCurve(NAME_CURVES[0]).getDiscountFactor(BILL_TRA.getBillPurchased().getSettlementTime());
    assertEquals("Bill Security: discounting method - present value", pvSecurity.plus(pvSettle).getAmount(), pvTransactionComputed.getAmount(), TOLERANCE_PV);
  }

  @Test
  /**
   * Tests the present value: Method vs Calculator
View Full Code Here


  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

  public CurrencyAmount presentValue(final AnnuityCouponFixed annuity, final YieldCurveBundle curves) {
    Validate.notNull(curves);
    Validate.notNull(annuity);
    CurrencyAmount pv = CurrencyAmount.of(annuity.getCurrency(), 0);
    for (final CouponFixed cpn : annuity.getPayments()) {
      pv = pv.plus(METHOD_CPN_FIXED.presentValue(cpn, curves));
    }
    return pv;
  }

  /**
 
View Full Code Here

  public CurrencyAmount presentValuePositiveNotional(final AnnuityCouponFixed annuity, final YieldCurveBundle curves) {
    Validate.notNull(curves);
    Validate.notNull(annuity);
    CurrencyAmount pv = CurrencyAmount.of(annuity.getCurrency(), 0);
    for (final CouponFixed cpn : annuity.getPayments()) {
      pv = pv.plus(METHOD_CPN_FIXED.presentValuePositiveNotional(cpn, curves));
    }
    return pv;
  }

  /**
 
View Full Code Here

  public CurrencyAmount presentValuePositiveNotional(final Annuity<CouponFixedAccruedCompounding> annuity, final YieldCurveBundle curves) {
    Validate.notNull(curves);
    Validate.notNull(annuity);
    CurrencyAmount pv = CurrencyAmount.of(annuity.getCurrency(), 0);
    for (final Payment cpn : annuity.getPayments()) {
      pv = pv.plus(METHOD_CPN_ACCRUED.presentValuePositiveNotional((CouponFixedAccruedCompounding) cpn, curves));
    }
    return pv;
  }
}
View Full Code Here

    ArgumentChecker.notNull(option, "option");
    ArgumentChecker.notNull(curves, "curves");
    final Currency ccy = option.getUnderlyingOption().getCurrency();
    final CurrencyAmount premiumPV = option.getPremium().accept(PVC, curves).getCurrencyAmount(ccy);
    final double optionPV = price * option.getQuantity() * option.getUnderlyingOption().getUnderlyingFuture().getNotional();
    return premiumPV.plus(optionPV);
  }

  /**
   * Computes the present value of a bond future option. The option security price is computed according to the data available in the bundle.
   * If the underlying future price is available it is used, if not it is computed from the curves.
View Full Code Here

    final SwaptionBermudaFixedIbor swaptionBermuda = swaptionBermudaDefinition.toDerivative(REFERENCE_DATE, CURVES_NAME);

    // Loop for pricing
    startTime = System.currentTimeMillis();
    for (int looptest = 0; looptest < nbTest; looptest++) {
      totalPv = totalPv.plus(METHOD_BERMUDA.presentValue(swaptionBermuda, BUNDLE_HW));
    }
    endTime = System.currentTimeMillis();
    System.out.println(nbTest + " pv Bermuda swaption Hull-White numerical integration method: " + (endTime - startTime) + " ms");
    // Performance note: HW price: 19-Jan-12: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 440 ms for 20 swaptions.
View Full Code Here

    // Otherwise we create a new MultipleCurrencyAmount
    if (currentTotal instanceof CurrencyAmount) {

      CurrencyAmount total = (CurrencyAmount) currentTotal;
      if (total.getCurrency() == currentAmount.getCurrency()) {
        return total.plus(currentAmount);
      } else {
        return MultipleCurrencyAmount.of(total).plus(currentAmount);
      }
    } else if (currentTotal instanceof MultipleCurrencyAmount) {
      return ((MultipleCurrencyAmount) currentTotal).plus(currentAmount);
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.