Examples of Cash


Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.Cash

  /**
   * Tests present value.
   */
  public void presentValueBetweenTradeAndSettle() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 13);
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvComputed = METHOD_DEPOSIT.presentValue(deposit, PROVIDER);
    final double dfEnd = PROVIDER.getDiscountFactor(EUR, deposit.getEndTime());
    final double dfStart = PROVIDER.getDiscountFactor(EUR, deposit.getStartTime());
    final double pvExpected = (NOTIONAL + deposit.getInterestAmount()) * dfEnd - NOTIONAL * dfStart;
    assertEquals("DepositDefinition: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.Cash

  /**
   * Tests present value.
   */
  public void presentValueSettle() {
    final ZonedDateTime referenceDate = SPOT_DATE;
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvComputed = METHOD_DEPOSIT.presentValue(deposit, PROVIDER);
    final double dfEnd = PROVIDER.getDiscountFactor(EUR, deposit.getEndTime());
    final double dfStart = PROVIDER.getDiscountFactor(EUR, deposit.getStartTime());
    final double pvExpected = (NOTIONAL + deposit.getInterestAmount()) * dfEnd - NOTIONAL * dfStart;
    assertEquals("DepositDefinition: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.Cash

  /**
   * Tests present value.
   */
  public void presentValueBetweenSettleMaturity() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 20);
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvComputed = METHOD_DEPOSIT.presentValue(deposit, PROVIDER);
    final double dfEnd = PROVIDER.getDiscountFactor(EUR, deposit.getEndTime());
    final double pvExpected = (NOTIONAL + deposit.getInterestAmount()) * dfEnd;
    assertEquals("DepositDefinition: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.Cash

  /**
   * Tests present value.
   */
  public void presentValueMaturity() {
    final ZonedDateTime referenceDate = END_DATE;
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvComputed = METHOD_DEPOSIT.presentValue(deposit, PROVIDER);
    final double pvExpected = NOTIONAL + deposit.getInterestAmount();
    assertEquals("DepositDefinition: present value", pvExpected, pvComputed.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.Cash

  /**
   * Tests present value curve sensitivity when the valuation date is on trade date.
   */
  public void presentValueCurveSensitivityTrade() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyParameterSensitivity pvpsDepositExact = PS_PV_C.calculateSensitivity(deposit, PROVIDER, PROVIDER.getAllNames());
    final MultipleCurrencyParameterSensitivity pvpsDepositFD = PS_PV_FDC.calculateSensitivity(deposit, PROVIDER);
    AssertSensivityObjects.assertEquals("CashDiscountingProviderMethod: presentValueCurveSensitivity ", pvpsDepositExact, pvpsDepositFD, TOLERANCE_PV_DELTA);
  }
View Full Code Here

Examples of org.wso2.carbon.billing.core.dataobjects.Cash

        checkSustract("-23.8", "-2.8", Cash.CURRENCY_USD, Cash.Sign.NEGATIVE, 21, 0);
    }

    private void checkAdd(String cashA, String cashB, String currency,
                          Cash.Sign sign, int wholeNumber, int decimalNumber) throws BillingException {
        successCase(Cash.add(new Cash(cashA), new Cash(cashB)).serializeToString(),
                currency, sign, wholeNumber, decimalNumber);
    }
View Full Code Here

Examples of org.wso2.carbon.billing.core.dataobjects.Cash

                currency, sign, wholeNumber, decimalNumber);
    }

    private void checkSustract(String cashA, String cashB, String currency,
                               Cash.Sign sign, int wholeNumber, int decimalNumber) throws BillingException {
        successCase(Cash.subtract(new Cash(cashA), new Cash(cashB)).serializeToString(),
                currency, sign, wholeNumber, decimalNumber);
    }
View Full Code Here

Examples of org.wso2.carbon.billing.core.dataobjects.Cash

        successCase(Cash.subtract(new Cash(cashA), new Cash(cashB)).serializeToString(),
                currency, sign, wholeNumber, decimalNumber);
    }

    private void checkSerialize(String cashStr, String cashStrShouldBe) throws BillingException {
        Cash cash = new Cash(cashStr);
        assertEquals("Cash string should be " + cashStrShouldBe, cash.serializeToString(), cashStrShouldBe);
    }
View Full Code Here

Examples of org.wso2.carbon.billing.core.dataobjects.Cash

        assertEquals("Cash string should be " + cashStrShouldBe, cash.serializeToString(), cashStrShouldBe);
    }

    private void successCase(String cashString, String currency, Cash.Sign sign, int wholeNumber, int decimalNumber)
            throws BillingException {
        Cash cash = new Cash(cashString);
        boolean success = currency.equals(cash.getCurrency()) &&
                sign == cash.getSign() &&
                wholeNumber == cash.getWholeNumber() &&
                decimalNumber == cash.getDecimalNumber();
        assertTrue(cashString + " failed", success);
    }
View Full Code Here

Examples of org.wso2.carbon.billing.core.dataobjects.Cash

    }

    public void failCase(String cashString) {
        boolean gotError;
        try {
            new Cash(cashString);
            gotError = false;
        } catch (BillingException e) {
            gotError = true;
        }
        assertTrue(cashString + "is not failed (should have failed)", gotError);
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.