Package com.opengamma.util.money

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


   * Tests the present value against explicit computation.
   */
  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
View Full Code Here


  public CurrencyAmount presentValue(final BillTransaction bill, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(bill, "Bill");
    ArgumentChecker.notNull(curves, "Curves");
    final CurrencyAmount pvBill = METHOD_SECURITY.presentValue(bill.getBillPurchased(), curves);
    final double pvSettle = bill.getSettlementAmount() * curves.getCurve(bill.getBillPurchased().getDiscountingCurveName()).getDiscountFactor(bill.getBillPurchased().getSettlementTime());
    return pvBill.multipliedBy(bill.getQuantity()).plus(pvSettle);
  }

  @Override
  public CurrencyAmount presentValue(final InstrumentDerivative instrument, final YieldCurveBundle curves) {
    ArgumentChecker.isTrue(instrument instanceof BillTransaction, "Bill Transaction");
View Full Code Here

    final CurrencyPairs currencyPairs = (CurrencyPairs) inputs.getValue(CURRENCY_PAIRS);
    SecuritySource securitySource = executionContext.getSecuritySource();
    final CurrencyAmount ca = FinancialSecurityUtils.getNotional(target.getSecurity(), currencyPairs, securitySource);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.NOTIONAL, target.toSpecification(), desiredValue.getConstraints().copy().get());
    if (desiredValue.getConstraint(PROPERTY_BUY).equals(NEGATIVE)) {
      return Collections.singleton(new ComputedValue(spec, ca.multipliedBy(-1)));
    }
    return Collections.singleton(new ComputedValue(spec, ca));
  }

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