Examples of FXOptionSecurity


Examples of com.opengamma.financial.security.option.FXOptionSecurity

    return ComputationTargetType.UNORDERED_CURRENCY_PAIR.specification(UnorderedCurrencyPair.of(fxOption.getCallCurrency(), fxOption.getPutCurrency()));
  }

  @Override
  protected ComputationTargetReference getDiscountingCurveTarget(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    return ComputationTargetType.CURRENCY.specification(fxOption.getCallCurrency());
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

    return InstrumentTypeProperties.FOREX;
  }

  @Override
  protected EuropeanVanillaOption getOption(final FinancialSecurity security, final ZonedDateTime date) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) security;
    final Currency putCurrency = fxOption.getPutCurrency();
    final Currency callCurrency = fxOption.getCallCurrency();
    double strike;
    if (FXUtils.isInBaseQuoteOrder(putCurrency, callCurrency)) {
      strike = fxOption.getCallAmount() / fxOption.getPutAmount();
    } else {
      strike = fxOption.getPutAmount() / fxOption.getCallAmount();
    }
    final double t = TimeCalculator.getTimeBetween(date, fxOption.getExpiry().getExpiry());
    return new EuropeanVanillaOption(strike, t, true); //TODO this shouldn't be hard coded to a call
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

    super(FinancialSecurityTypes.FX_OPTION_SECURITY, currencyCurveConfigAndDiscountingCurveNames);
  }

  @Override
  public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    final String firstCurrency = fxOption.getPutCurrency().getCode();
    final String secondCurrency = fxOption.getCallCurrency().getCode();
    final Collection<String> currencies = getTargets();
    return currencies.contains(firstCurrency) && currencies.contains(secondCurrency);
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

    return currencies.contains(firstCurrency) && currencies.contains(secondCurrency);
  }

  @Override
  protected String getFirstCurrency(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    return fxOption.getPutCurrency().getCode();
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

    return fxOption.getPutCurrency().getCode();
  }

  @Override
  protected String getSecondCurrency(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    return fxOption.getCallCurrency().getCode();
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

  public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
    final Security security = target.getTrade().getSecurity();
    if (!(security instanceof FXOptionSecurity)) {
      return false;
    }
    final FXOptionSecurity fxOption = (FXOptionSecurity) security;
    final Currency putCurrency = fxOption.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = fxOption.accept(ForexVisitors.getCallCurrencyVisitor());
    final String currencyPair = UnorderedCurrencyPair.of(putCurrency, callCurrency).getObjectId().getValue();
    if (getAllCurrencyPairs().contains(currencyPair)) {
      return true;
    }
    final String firstCcy = currencyPair.substring(0, 3);
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

  }


  @Override
  protected String getCurrencyPair(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getTrade().getSecurity();
    final Currency putCurrency = fxOption.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = fxOption.accept(ForexVisitors.getCallCurrencyVisitor());
    return UnorderedCurrencyPair.of(putCurrency, callCurrency).getObjectId().getValue();
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

    }
    final Security security = target.getTrade().getSecurity();
    if (!(security instanceof FXOptionSecurity)) {
      return false;
    }
    final FXOptionSecurity fxOption = (FXOptionSecurity) security;
    final Currency putCurrency = fxOption.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = fxOption.accept(ForexVisitors.getCallCurrencyVisitor());
    final String currencyPair = UnorderedCurrencyPair.of(putCurrency, callCurrency).getObjectId().getValue();
    if (getAllCurrencyPairs().contains(currencyPair)) {
      return true;
    }
    final String firstCcy = currencyPair.substring(0, 3);
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

      throw new OpenGammaRuntimeException("Forward curve was null");
    }
    final ForwardCurve forwardCurve = (ForwardCurve) forwardCurveObject;
    final ValueRequirement volDataRequirement = getUnderlyingVolatilityDataRequirement(surfaceName, id);
    final SmileSurfaceDataBundle data = getData(inputs, volDataRequirement, forwardCurveRequirement);
    final FXOptionSecurity fxOption = (FXOptionSecurity) security;
    final CurrencyPairs currencyPairs = OpenGammaExecutionContext.getCurrencyPairsSource(executionContext).getCurrencyPairs(CurrencyPairs.DEFAULT_CURRENCY_PAIRS);
    final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(fxOption.getPutCurrency(), fxOption.getCallCurrency());
    final EuropeanVanillaOption option = getOption(security, now, currencyPair);
    return Collections.singleton(new ComputedValue(spec, getResult(calculator, localVolatilitySurface, forwardCurve, data, option)));
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.FXOptionSecurity

    return getAllCurrencyPairs().contains(reversedCcys);
  }

  @Override
  protected String getCurrencyPair(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getTrade().getSecurity();
    final Currency putCurrency = fxOption.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = fxOption.accept(ForexVisitors.getCallCurrencyVisitor());
    return UnorderedCurrencyPair.of(putCurrency, callCurrency).getObjectId().getValue();
  }
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.