Examples of FXOptionSecurity


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

    return getAllCurrencyPairs().contains(reversedCcys);
  }

  @Override
  protected String getCurrencyPair(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.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

  }

  @Override
  public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
    final Security security = target.getSecurity();
    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.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

    _blackSmileInterpolatorName = blackSmileInterpolatorName;
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    final Currency putCurrency = fxOption.getPutCurrency();
    final Currency callCurrency = fxOption.getCallCurrency();
    final double putAmount = fxOption.getPutAmount();
    final double callAmount = fxOption.getCallAmount();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final ValueRequirement priceRequirement = getPriceRequirement(target, desiredValue);
    final Object priceObject = inputs.getValue(priceRequirement);
    if (priceObject == null) {
      throw new OpenGammaRuntimeException("Pips PV was null");
View Full Code Here

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

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String surfaceName = desiredValue.getConstraint(SURFACE);
    final String surfaceType = desiredValue.getConstraint(PROPERTY_SURFACE_TYPE);
    final String xAxis = desiredValue.getConstraint(PROPERTY_X_AXIS);
    final String yAxis = desiredValue.getConstraint(PROPERTY_Y_AXIS);
    final String yAxisType = desiredValue.getConstraint(PROPERTY_Y_AXIS_TYPE);
    final String forwardCurveCalculationMethod = desiredValue.getConstraint(ForwardCurveValuePropertyNames.PROPERTY_FORWARD_CURVE_CALCULATION_METHOD);
    final String forwardCurveName = desiredValue.getConstraint(CURVE);
    final String h = desiredValue.getConstraint(PROPERTY_H);
    final String theta = desiredValue.getConstraint(PROPERTY_THETA);
    final String timeSteps = desiredValue.getConstraint(PROPERTY_TIME_STEPS);
    final String spaceSteps = desiredValue.getConstraint(PROPERTY_SPACE_STEPS);
    final String timeGridBunching = desiredValue.getConstraint(PROPERTY_TIME_GRID_BUNCHING);
    final String spaceGridBunching = desiredValue.getConstraint(PROPERTY_SPACE_GRID_BUNCHING);
    final String maxMoneyness = desiredValue.getConstraint(PROPERTY_MAX_MONEYNESS);
    final String pdeDirection = desiredValue.getConstraint(PROPERTY_PDE_DIRECTION);
    if (!(pdeDirection.equals(LocalVolatilityPDEValuePropertyNames.FORWARD_PDE))) {
      throw new OpenGammaRuntimeException("Can only use forward PDE; should never ask for this direction: " + pdeDirection);
    }
    final String strikeInterpolatorName = desiredValue.getConstraint(PROPERTY_RESULT_STRIKE_INTERPOLATOR);
    final String timeInterpolatorName = desiredValue.getConstraint(PROPERTY_RESULT_TIME_INTERPOLATOR);
    final ValueRequirement gridRequirement = getPDEGridRequirement(target, surfaceName, surfaceType, xAxis, yAxis, yAxisType,
        forwardCurveCalculationMethod, h, forwardCurveName,
        theta, timeSteps, spaceSteps, timeGridBunching, spaceGridBunching, maxMoneyness, pdeDirection);
    final Object pdeGridObject = inputs.getValue(gridRequirement);
    if (pdeGridObject == null) {
      throw new OpenGammaRuntimeException("PDE grid was null");
    }
    final PDEFullResults1D pdeGrid = (PDEFullResults1D) pdeGridObject;
    final double[] gridTimes = pdeGrid.getGrid().getTimeNodes();
    final double[] gridMoneyness = pdeGrid.getGrid().getSpaceNodes();
    final CurrencyPairs currencyPairs = OpenGammaExecutionContext.getCurrencyPairsSource(executionContext).getCurrencyPairs(CurrencyPairs.DEFAULT_CURRENCY_PAIRS);
    final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(fxOption.getPutCurrency(), fxOption.getCallCurrency());
    //TODO interpolate
    ///////////////////////////////
    final double tau = getExpiry(fxOption, now);
    final UnorderedCurrencyPair currencies = UnorderedCurrencyPair.of(fxOption.getCallCurrency(), fxOption.getPutCurrency());
    final ValueRequirement forwardCurveRequirement = getForwardCurveRequirement(forwardCurveCalculationMethod, forwardCurveName, currencies);
    final Object forwardCurveObject = inputs.getValue(forwardCurveRequirement);
    if (forwardCurveObject == null) {
      throw new OpenGammaRuntimeException("Forward curve was null");
    }
View Full Code Here

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

    final String spaceSteps = spaceStepsNames.iterator().next();
    final String timeGridBunching = timeGridBunchingNames.iterator().next();
    final String spaceGridBunching = spaceGridBunchingNames.iterator().next();
    final String maxMoneyness = maxMoneynessNames.iterator().next();
    final String pdeDirection = pdeDirectionNames.iterator().next();
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    final UnorderedCurrencyPair currencies = UnorderedCurrencyPair.of(fxOption.getCallCurrency(), fxOption.getPutCurrency()); //TODO down to subclass
    final ValueRequirement pdeGridRequirement = getPDEGridRequirement(target, surfaceName, surfaceType, xAxis, yAxis, yAxisType, forwardCurveCalculationMethod, h, forwardCurveName,
        theta, timeSteps, spaceSteps, timeGridBunching, spaceGridBunching, maxMoneyness, pdeDirection);
    final ValueRequirement forwardCurveRequirement = getForwardCurveRequirement(forwardCurveCalculationMethod, forwardCurveName, currencies);
    return Sets.newHashSet(pdeGridRequirement, forwardCurveRequirement);
  }
View Full Code Here

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

@Deprecated
public class ForexLocalVolatilityPDEPresentValueFunctionOld extends AbstractFunction.NonCompiledInvoker {

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    final Currency putCurrency = fxOption.getPutCurrency();
    final Currency callCurrency = fxOption.getCallCurrency();
    final double putAmount = fxOption.getPutAmount();
    final double callAmount = fxOption.getCallAmount();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String surfaceName = desiredValue.getConstraint(SURFACE);
    final String surfaceType = desiredValue.getConstraint(PROPERTY_SURFACE_TYPE);
    final String xAxis = desiredValue.getConstraint(PROPERTY_X_AXIS);
    final String yAxis = desiredValue.getConstraint(PROPERTY_Y_AXIS);
View Full Code Here

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

    final String spaceGridBunching = spaceGridBunchingNames.iterator().next();
    final String maxMoneyness = maxMoneynessNames.iterator().next();
    final String pdeDirection = pdeDirectionNames.iterator().next();
    final String strikeInterpolatorName = strikeInterpolatorNames.iterator().next();
    final String timeInterpolatorName = timeInterpolatorNames.iterator().next();
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    final ValueRequirement priceRequirement = getPriceRequirement(target, surfaceName, surfaceType, xAxis, yAxis, yAxisType, forwardCurveCalculationMethod, h, forwardCurveName,
        theta, timeSteps, spaceSteps, timeGridBunching, spaceGridBunching, maxMoneyness, pdeDirection, strikeInterpolatorName, timeInterpolatorName);
    ///////////////////////////// Here we ask for the current spot rate from the data provider, but we could get the spot rate directly from the forward curve /////////////
    final ValueRequirement spotRequirement = getSpotRequirement(fxOption);
    ///////////////////////////////////////////
View Full Code Here

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

  // REVIEW 2012-03-19 Andrew -- The interpolations for each greek are independent of each other. Would it give a higher throughput
  // if we had separate function instances, one for each one, so that the dependency graph can exploit the resultant parallelism.

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    // Constraints have to be the same on all output values (except for the interpolator), so grab them from the first
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String surfaceName = desiredValue.getConstraint(SURFACE);
    final String surfaceType = desiredValue.getConstraint(PROPERTY_SURFACE_TYPE);
    final String xAxis = desiredValue.getConstraint(PROPERTY_X_AXIS);
    final String yAxis = desiredValue.getConstraint(PROPERTY_Y_AXIS); //Review R White 12/03/2012 Not sure why integratedVariance is a property of the y axis
    final String yAxisType = desiredValue.getConstraint(PROPERTY_Y_AXIS_TYPE);
    final String forwardCurveCalculationMethod = desiredValue.getConstraint(CURVE_CALCULATION_METHOD);
    final String forwardCurveName = desiredValue.getConstraint(CURVE);
    final String h = desiredValue.getConstraint(PROPERTY_H);
    final String theta = desiredValue.getConstraint(PROPERTY_THETA);
    final String timeSteps = desiredValue.getConstraint(PROPERTY_TIME_STEPS);
    final String spaceSteps = desiredValue.getConstraint(PROPERTY_SPACE_STEPS);
    final String timeGridBunching = desiredValue.getConstraint(PROPERTY_TIME_GRID_BUNCHING);
    final String spaceGridBunching = desiredValue.getConstraint(PROPERTY_SPACE_GRID_BUNCHING);
    final String maxMoneyness = desiredValue.getConstraint(PROPERTY_MAX_MONEYNESS);
    final String pdeDirection = desiredValue.getConstraint(PROPERTY_PDE_DIRECTION);
    if (!(pdeDirection.equals(LocalVolatilityPDEValuePropertyNames.FORWARD_PDE))) {
      throw new OpenGammaRuntimeException("Can only use forward PDE; should never ask for this direction: " + pdeDirection);
    }
    final ValueRequirement gridGreekRequirement = getGridGreeksRequirement(target, surfaceName, surfaceType, xAxis, yAxis, yAxisType,
        forwardCurveCalculationMethod, h, forwardCurveName, theta, timeSteps, spaceSteps, timeGridBunching, spaceGridBunching, maxMoneyness, pdeDirection);
    final Object gridGreeksObject = inputs.getValue(gridGreekRequirement);
    if (gridGreeksObject == null) {
      throw new OpenGammaRuntimeException("Grid greeks were null");
    }
    final CurrencyPairs currencyPairs = OpenGammaExecutionContext.getCurrencyPairsSource(executionContext).getCurrencyPairs(CurrencyPairs.DEFAULT_CURRENCY_PAIRS);
    final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(fxOption.getPutCurrency(), fxOption.getCallCurrency());
    final double strike = getStrike(fxOption, currencyPair);
    final PDEResultCollection gridGreeks = (PDEResultCollection) gridGreeksObject;
    final ComputationTargetSpecification spec = target.toSpecification();
    final Set<ComputedValue> result = new HashSet<ComputedValue>();
    for (final ValueRequirement value : desiredValues) {
View Full Code Here

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

    return FinancialSecurityTypes.FX_OPTION_SECURITY;
  }

  @Override
  protected ComputationTargetReference getVolatilitySurfaceAndForwardCurveTarget(final ComputationTarget target) {
    final FXOptionSecurity fxOption = (FXOptionSecurity) target.getSecurity();
    return ComputationTargetType.UNORDERED_CURRENCY_PAIR.specification(UnorderedCurrencyPair.of(fxOption.getCallCurrency(), fxOption.getPutCurrency()));
  }
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.