Examples of CurrencyAmount


Examples of com.opengamma.util.money.CurrencyAmount

   * @param fx The Forex derivative.
   * @param curves The curve bundle containing the discounting curves.
   * @return The multi-currency present value.
   */
  public MultipleCurrencyAmount presentValue(final Forex fx, final YieldCurveBundle curves) {
    final CurrencyAmount pv1 = METHOD_PAY.presentValue(fx.getPaymentCurrency1(), curves);
    final CurrencyAmount pv2 = METHOD_PAY.presentValue(fx.getPaymentCurrency2(), curves);
    return MultipleCurrencyAmount.of(pv1, pv2);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

   */
  public CurrencyAmount presentValueFromPrice(final BondFutureOptionPremiumTransaction option, final YieldCurveBundle curves, final double price) {
    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);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

   */
  public CurrencyAmount presentValue(final BondFutureOptionPremiumTransaction transaction, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(transaction, "transaction");
    ArgumentChecker.notNull(curves, "curves");
    final double priceSecurity = METHOD_SECURITY.optionPrice(transaction.getUnderlyingOption(), curves);
    final CurrencyAmount pvTransaction = presentValueFromPrice(transaction, curves, priceSecurity);
    return pvTransaction;
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

  public double forward(final Swap<CouponFixedAccruedCompounding, CouponONCompounded> fixedCouponSwap, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(fixedCouponSwap, "Swap");
    ArgumentChecker.isTrue(fixedCouponSwap.getFirstLeg().getNumberOfPayments() == 1, "Swap should have one fixed payment");
    ArgumentChecker.isTrue(fixedCouponSwap.getSecondLeg().getNumberOfPayments() == 1, "Swap should have one floating payment");
    CouponFixedAccruedCompounding cpnFixed = fixedCouponSwap.getFirstLeg().getNthPayment(0);
    CurrencyAmount pvLegFloating = METHOD_COUPON_ON_CMP.presentValue(fixedCouponSwap.getSecondLeg().getNthPayment(0), curves);
    double dfPay = curves.getCurve(cpnFixed.getFundingCurveName()).getDiscountFactor(cpnFixed.getPaymentTime());
    double rate = Math.pow(-pvLegFloating.getAmount() / (dfPay * cpnFixed.getNotional()), 1.0d / cpnFixed.getPaymentYearFraction()) - 1.0d;
    return rate;
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

  public double forwardModified(final Swap<CouponFixedAccruedCompounding, CouponONCompounded> fixedCouponSwap, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(fixedCouponSwap, "Swap");
    ArgumentChecker.isTrue(fixedCouponSwap.getFirstLeg().getNumberOfPayments() == 1, "Swap should have one fixed payment");
    ArgumentChecker.isTrue(fixedCouponSwap.getSecondLeg().getNumberOfPayments() == 1, "Swap should have one floating payment");
    CouponFixedAccruedCompounding cpnFixed = fixedCouponSwap.getFirstLeg().getNthPayment(0);
    CurrencyAmount pvLegFloating = METHOD_COUPON_ON_CMP.presentValue(fixedCouponSwap.getSecondLeg().getNthPayment(0), curves);
    double dfPay = curves.getCurve(cpnFixed.getFundingCurveName()).getDiscountFactor(cpnFixed.getPaymentTime());
    double rate = -pvLegFloating.getAmount() / (dfPay * cpnFixed.getNotional()) - 1.0d;
    return rate;
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    final double forward = spot * dfForeign / dfDomestic;
    final double volatility = black.getVolatilityModel().getVolatility(optionForex.getTimeToExpiry());
    final BlackFunctionData dataBlack = new BlackFunctionData(forward, dfDomestic, volatility);
    final Function1D<BlackFunctionData, Double> func = BLACK_FUNCTION.getPriceFunction(optionForex);
    final double price = func.evaluate(dataBlack) * Math.abs(optionForex.getUnderlyingForex().getPaymentCurrency1().getAmount()) * (optionForex.isLong() ? 1.0 : -1.0);
    final CurrencyAmount priceCurrency = CurrencyAmount.of(optionForex.getUnderlyingForex().getCurrency2(), price);
    return MultipleCurrencyAmount.of(priceCurrency);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    final double forward = spot * dfForeign / dfDomestic;
    final double volatility = FXVolatilityUtils.getVolatility(smile, optionForex.getCurrency1(), optionForex.getCurrency2(), optionForex.getTimeToExpiry(), optionForex.getStrike(), forward);
    final BlackFunctionData dataBlack = new BlackFunctionData(forward, dfDomestic, volatility);
    final Function1D<BlackFunctionData, Double> func = BLACK_FUNCTION.getPriceFunction(optionForex);
    final double price = func.evaluate(dataBlack) * Math.abs(optionForex.getUnderlyingForex().getPaymentCurrency1().getAmount()) * (optionForex.isLong() ? 1.0 : -1.0);
    final CurrencyAmount priceCurrency = CurrencyAmount.of(optionForex.getUnderlyingForex().getCurrency2(), price);
    return MultipleCurrencyAmount.of(priceCurrency);
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

   * @param optionDigital The option.
   * @param smile The curve and smile data.
   * @return The gamma.
   */
  public double gammaRelative(final ForexOptionDigital optionDigital, final SmileDeltaTermStructureDataBundle smile) {
    final CurrencyAmount gamma = gamma(optionDigital, smile);
    return gamma.getAmount() / Math.abs(optionDigital.getUnderlyingForex().getPaymentCurrency2().getAmount());
  }
View Full Code Here

Examples of com.opengamma.util.money.CurrencyAmount

    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    Validate.isTrue(smile.checkCurrencies(optionDigital.getCurrency1(), optionDigital.getCurrency2()), "Option currencies not compatible with smile data");
    final ForexOptionVanilla[] callSpread = callSpread(optionDigital, getSpread());
    // Spread value
    final CurrencyAmount gammaM = ((ForexOptionVanillaBlackSmileMethod) getBaseMethod()).gamma(callSpread[0], smile, optionDigital.payDomestic());
    final CurrencyAmount gammaP = ((ForexOptionVanillaBlackSmileMethod) getBaseMethod()).gamma(callSpread[1], smile, optionDigital.payDomestic());
    return gammaM.plus(gammaP);
  }
View Full Code Here

Examples of com.worldpay.util.CurrencyAmount

            return "error";
        }

        // create the currency amount
        double orderTotal = orderHeader.getDouble("grandTotal").doubleValue();
        CurrencyAmount currencyAmount = null;
        try {
            Currency currency = SelectCurrency.getInstanceByISOCode(defCur);
            currencyAmount = new CurrencyAmount(orderTotal, currency);
        } catch (ArgumentException ae) {
            Debug.logError(ae, "Problems building CurrencyAmount", module);
            request.setAttribute("_ERROR_MESSAGE_", "<li>Merchant Configuration Error, please contact customer service.");
            return "error";
        }
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.