Package com.opengamma.analytics.financial.forex.derivative

Examples of com.opengamma.analytics.financial.forex.derivative.Forex


    if (optionDigital.payDomestic()) {
      amountPaid = Math.abs(optionDigital.getUnderlyingForex().getPaymentCurrency2().getAmount());
      strikeRelM = strikeM;
      strikeRelP = strikeP;
      final double amount = amountPaid / (strikeRelP - strikeRelM);
      final Forex forexM = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(amount),
          optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(-strikeRelM * amount));
      final Forex forexP = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(amount),
          optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(-strikeRelP * amount));
      callSpread[0] = new ForexOptionVanilla(forexM, optionDigital.getExpirationTime(), optionDigital.isCall(),
          (optionDigital.isLong() == optionDigital.isCall()));
      callSpread[1] = new ForexOptionVanilla(forexP, optionDigital.getExpirationTime(), optionDigital.isCall(),
          !(optionDigital.isLong() == optionDigital.isCall()));
    } else {
      amountPaid = Math.abs(optionDigital.getUnderlyingForex().getPaymentCurrency1().getAmount());
      strikeRelM = 1.0 / strikeP;
      strikeRelP = 1.0 / strikeM;
      final double amount = amountPaid / (strikeRelP - strikeRelM);
      final Forex forexM = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(amount),
          optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(-strikeRelM * amount));
      final Forex forexP = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(amount),
          optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(-strikeRelP * amount));
      callSpread[0] = new ForexOptionVanilla(forexM, optionDigital.getExpirationTime(), !optionDigital.isCall(),
          !(optionDigital.isLong() == optionDigital.isCall()));
      callSpread[1] = new ForexOptionVanilla(forexP, optionDigital.getExpirationTime(), !optionDigital.isCall(),
          (optionDigital.isLong() == optionDigital.isCall()));
View Full Code Here


    if (optionDigital.payDomestic()) {
      amountPaid = Math.abs(optionDigital.getUnderlyingForex().getPaymentCurrency2().getAmount());
      strikeRelM = strikeM;
      strikeRelP = strikeP;
      double amount = amountPaid / (strikeRelP - strikeRelM);
      Forex forexM = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(amount), optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(-strikeRelM * amount));
      Forex forexP = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(amount), optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(-strikeRelP * amount));
      callSpread[0] = new ForexOptionVanilla(forexM, optionDigital.getExpirationTime(), optionDigital.isCall(), (optionDigital.isLong() == optionDigital.isCall()));
      callSpread[1] = new ForexOptionVanilla(forexP, optionDigital.getExpirationTime(), optionDigital.isCall(), !(optionDigital.isLong() == optionDigital.isCall()));
    } else {
      amountPaid = Math.abs(optionDigital.getUnderlyingForex().getPaymentCurrency1().getAmount());
      strikeRelM = 1.0 / strikeP;
      strikeRelP = 1.0 / strikeM;
      double amount = amountPaid / (strikeRelP - strikeRelM);
      Forex forexM = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(amount), optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(-strikeRelM * amount));
      Forex forexP = new Forex(optionDigital.getUnderlyingForex().getPaymentCurrency2().withAmount(amount), optionDigital.getUnderlyingForex().getPaymentCurrency1().withAmount(-strikeRelP * amount));
      callSpread[0] = new ForexOptionVanilla(forexM, optionDigital.getExpirationTime(), !optionDigital.isCall(), !(optionDigital.isLong() == optionDigital.isCall()));
      callSpread[1] = new ForexOptionVanilla(forexP, optionDigital.getExpirationTime(), !optionDigital.isCall(), (optionDigital.isLong() == optionDigital.isCall()));
    }
    return callSpread;
  }
View Full Code Here

  @Deprecated
  @Override
  public ForexOptionDigital toDerivative(final ZonedDateTime date, final String... yieldCurveNames) {
    ArgumentChecker.notNull(date, "date");
    ArgumentChecker.notNull(yieldCurveNames, "yieldCurveNames");
    final Forex fx = _underlyingForex.toDerivative(date, yieldCurveNames);
    final DayCount actAct = DayCountFactory.INSTANCE.getDayCount("Actual/Actual ISDA");
    final double expirationTime = actAct.getDayCountFraction(date, _expirationDate);
    return new ForexOptionDigital(fx, expirationTime, _isCall, _isLong, _payDomestic);
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public ForexOptionDigital toDerivative(final ZonedDateTime date) {
    ArgumentChecker.notNull(date, "date");
    final Forex fx = _underlyingForex.toDerivative(date);
    final DayCount actAct = DayCountFactory.INSTANCE.getDayCount("Actual/Actual ISDA");
    final double expirationTime = actAct.getDayCountFraction(date, _expirationDate);
    return new ForexOptionDigital(fx, expirationTime, _isCall, _isLong, _payDomestic);
  }
View Full Code Here

  @Deprecated
  @Override
  public ForexOptionVanilla toDerivative(final ZonedDateTime date, final String... yieldCurveNames) {
    ArgumentChecker.notNull(date, "date");
    ArgumentChecker.notNull(yieldCurveNames, "yieldCurveNames");
    final Forex fx = _underlyingForex.toDerivative(date, yieldCurveNames);
    final double expirationTime = TimeCalculator.getTimeBetween(date, _expirationDate);
    return new ForexOptionVanilla(fx, expirationTime, _isCall, _isLong);
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public ForexOptionVanilla toDerivative(final ZonedDateTime date) {
    ArgumentChecker.notNull(date, "date");
    final Forex fx = _underlyingForex.toDerivative(date);
    final double expirationTime = TimeCalculator.getTimeBetween(date, _expirationDate);
    return new ForexOptionVanilla(fx, expirationTime, _isCall, _isLong);
  }
View Full Code Here

  public Forex toDerivative(final ZonedDateTime date, final String... yieldCurveNames) {
    ArgumentChecker.notNull(date, "date");
    ArgumentChecker.notNull(yieldCurveNames, "Curves");
    final PaymentFixed payment1 = _paymentCurrency1.toDerivative(date, yieldCurveNames[0]);
    final PaymentFixed payment2 = _paymentCurrency2.toDerivative(date, yieldCurveNames[1]);
    return new Forex(payment1, payment2);
  }
View Full Code Here

  @Override
  public Forex toDerivative(final ZonedDateTime date) {
    ArgumentChecker.notNull(date, "date");
    final PaymentFixed payment1 = _paymentCurrency1.toDerivative(date);
    final PaymentFixed payment2 = _paymentCurrency2.toDerivative(date);
    return new Forex(payment1, payment2);
  }
View Full Code Here

  public InstrumentDerivative toDerivative(final ZonedDateTime date, final String... yieldCurveNames) {
    ArgumentChecker.isTrue(!date.isAfter(_farLeg.getExchangeDate()), "date is after payment far date");
    if (date.isAfter(_nearLeg.getExchangeDate())) { // Implementation note: only the far leg left.
      return _farLeg.toDerivative(date, yieldCurveNames);
    }
    final Forex nearLeg = _nearLeg.toDerivative(date, yieldCurveNames);
    final Forex farLeg = _farLeg.toDerivative(date, yieldCurveNames);
    return new ForexSwap(nearLeg, farLeg);
  }
View Full Code Here

  public InstrumentDerivative toDerivative(final ZonedDateTime date) {
    ArgumentChecker.isTrue(!date.isAfter(_farLeg.getExchangeDate()), "date is after payment far date");
    if (date.isAfter(_nearLeg.getExchangeDate())) { // Implementation note: only the far leg left.
      return _farLeg.toDerivative(date);
    }
    final Forex nearLeg = _nearLeg.toDerivative(date);
    final Forex farLeg = _farLeg.toDerivative(date);
    return new ForexSwap(nearLeg, farLeg);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.forex.derivative.Forex

Copyright © 2018 www.massapicom. 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.