Examples of UnorderedCurrencyPair


Examples of com.opengamma.util.money.UnorderedCurrencyPair

      if (curveNames.length != 1) {
        throw new OpenGammaRuntimeException("Can only handle a single curve at the moment");
      }
      domesticCurveName = curveNames[0];
    }
    final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(domesticCurrency, foreignCurrency);
    final FXForwardCurveDefinition definition = fxCurveDefinitionSource.getDefinition(domesticCurveName, currencyPair.toString());
    if (definition == null) {
      throw new OpenGammaRuntimeException("Couldn't find FX forward curve definition called " + domesticCurveName + " for target " + currencyPair);
    }
    final FXForwardCurveSpecification specification = fxCurveSpecificationSource.getSpecification(domesticCurveName, currencyPair.toString());
    if (specification == null) {
      throw new OpenGammaRuntimeException("Couldn't find FX forward curve specification called " + domesticCurveName + " for target " + currencyPair);
    }
    final FXForwardCurveInstrumentProvider provider = specification.getCurveInstrumentProvider();
    final ValueRequirement spotRequirement = new ValueRequirement(provider.getDataFieldName(), ComputationTargetType.PRIMITIVE, provider.getSpotInstrument());
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

    }
    final String domesticCurveName = domesticCurveCalculationConfig.getYieldCurveNames()[0];
    final Currency domesticCurrency = target.getValue(ComputationTargetType.CURRENCY);
    final Set<ValueRequirement> requirements = new HashSet<>();
    final Currency foreignCurrency = ComputationTargetType.CURRENCY.resolve(foreignCurrencySpec.getUniqueId());
    final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(domesticCurrency, foreignCurrency);
    final FXForwardCurveDefinition definition = fxCurveDefinitionSource.getDefinition(domesticCurveName, currencyPair.toString());
    if (definition == null) {
      s_logger.error("Couldn't find FX forward curve definition called " + domesticCurveName + " with target " + currencyPair);
      return null;
    }
    final FXForwardCurveSpecification fxForwardCurveSpec = fxCurveSpecificationSource.getSpecification(domesticCurveName, currencyPair.toString());
    if (fxForwardCurveSpec == null) {
      s_logger.error("Couldn't find FX forward curve specification called " + domesticCurveName + " with target " + currencyPair);
      return null;
    }
    final ValueProperties fxForwardCurveProperties = ValueProperties.builder().with(ValuePropertyNames.CURVE, domesticCurveName).get();
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

        .with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, InstrumentTypeProperties.FOREX)
        .with(InterpolatedDataProperties.X_INTERPOLATOR_NAME, interpolatorName)
        .with(InterpolatedDataProperties.LEFT_X_EXTRAPOLATOR_NAME, leftExtrapolatorName)
        .with(InterpolatedDataProperties.RIGHT_X_EXTRAPOLATOR_NAME, rightExtrapolatorName)
        .get();
    final UnorderedCurrencyPair currenciesTarget = UnorderedCurrencyPair.of(putCurrency, callCurrency);
    return new ValueRequirement(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA, ComputationTargetType.UNORDERED_CURRENCY_PAIR.specification(currenciesTarget), surfaceProperties);
  }
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

        .with(CURVE, curveNames)
        .get();
    final ValueProperties curveProperties = ValueProperties
        .with(CURVE, curveNames)
        .get();
    final UnorderedCurrencyPair ccyPair = UnorderedCurrencyPair.of(payCurrency, receiveCurrency);
    final Trade trade = Iterables.getOnlyElement(target.getPosition().getTrades());
    requirements.add(new ValueRequirement(CURVE_SPECIFICATION, ComputationTargetSpecification.NULL, curveProperties));
    requirements.add(ConventionBasedFXRateFunction.getSpotRateRequirement(ccyPair));
    requirements.add(new ValueRequirement(YIELD_CURVE_NODE_SENSITIVITIES, ComputationTargetSpecification.of(trade), properties));
    requirements.add(new ValueRequirement(CURVE_HISTORICAL_TIME_SERIES, ComputationTargetSpecification.NULL, tsProperties));
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

      final ValueProperties receiveCurveProperties = ValueProperties.builder()
          .with(ValuePropertyNames.CURVE, Iterables.getOnlyElement(receiveCurveNames))
          .with(ValuePropertyNames.CURVE_CALCULATION_CONFIG, Iterables.getOnlyElement(receiveCurveCalculationConfigs))
          .withOptional(ValuePropertyNames.RECEIVE_CURVE)
          .get();
      final UnorderedCurrencyPair ccyPair = target.getValue(ComputationTargetType.UNORDERED_CURRENCY_PAIR);
      Currency payCurrency;
      Currency receiveCurrency;
      final CurrencyPair baseQuotePair = _baseQuotePairs.getCurrencyPair(ccyPair.getFirstCurrency(), ccyPair.getSecondCurrency());
      if (baseQuotePair == null) {
        throw new OpenGammaRuntimeException("Could not get base/quote pair for currency pair " + ccyPair);
      }
      if (baseQuotePair.getBase().equals(ccyPair.getFirstCurrency())) {
        payCurrency = baseQuotePair.getBase();
        receiveCurrency = baseQuotePair.getCounter();
      } else {
        payCurrency = baseQuotePair.getCounter();
        receiveCurrency = baseQuotePair.getBase();
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

      Object receiveCurveObject = null;
      Set<String> payCurveNames = null;
      Set<String> payCurveCalculationConfigs = null;
      Set<String> receiveCurveNames = null;
      Set<String> receiveCurveCalculationConfigs = null;
      final UnorderedCurrencyPair ccyPair = UnorderedCurrencyPair.of(target.getUniqueId());
      Currency payCurrency;
      Currency receiveCurrency;
      final CurrencyPair baseQuotePair = _baseQuotePairs.getCurrencyPair(ccyPair.getFirstCurrency(), ccyPair.getSecondCurrency());
      if (baseQuotePair == null) {
        throw new OpenGammaRuntimeException("Could not get base/quote pair for currency pair " + ccyPair);
      }
      if (baseQuotePair.getBase().equals(ccyPair.getFirstCurrency())) {
        payCurrency = baseQuotePair.getBase();
        receiveCurrency = baseQuotePair.getCounter();
      } else {
        payCurrency = baseQuotePair.getCounter();
        receiveCurrency = baseQuotePair.getBase();
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

    super(ComputationTargetType.UNORDERED_CURRENCY_PAIR, defaultsPerCurrencyPair);
  }

  @Override
  public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
    final UnorderedCurrencyPair ccy = (UnorderedCurrencyPair) target.getValue();
    String currencyPair = ccy.getFirstCurrency().getCode() + ccy.getSecondCurrency().getCode();
    if (getAllCurrencyPairs().contains(currencyPair)) {
      return true;
    }
    currencyPair = ccy.getSecondCurrency().getCode() + ccy.getFirstCurrency().getCode();
    return getAllCurrencyPairs().contains(currencyPair);
  }
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

        final ValueRequirement desiredValue = desiredValues.iterator().next();
        final String curveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
        final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
        final DoubleArrayList expiries = new DoubleArrayList();
        final DoubleArrayList forwards = new DoubleArrayList();
        final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(target.getUniqueId());
        final FXForwardCurveDefinition definition = curveDefinitionSource.getDefinition(curveName, currencyPair.toString());
        if (definition == null) {
          throw new OpenGammaRuntimeException("Couldn't find FX forward curve definition called " + curveName + " for target " + target);
        }
        final FXForwardCurveSpecification specification = curveSpecificationSource.getSpecification(curveName, currencyPair.toString());
        if (specification == null) {
          throw new OpenGammaRuntimeException("Couldn't find FX forward curve specification called " + curveName + " for target " + target);
        }
        final FXForwardCurveInstrumentProvider provider = specification.getCurveInstrumentProvider();
        final Object dataObject = inputs.getValue(ValueRequirementNames.FX_FORWARD_CURVE_MARKET_DATA);
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

        .with(CURVE, fxForwardCurveName)
        .get();
    final ValueProperties curveProperties = ValueProperties
        .with(CURVE, fxForwardCurveName)
        .get();
    final UnorderedCurrencyPair ccyPair = UnorderedCurrencyPair.of(payCurrency, receiveCurrency);
    final Trade trade = Iterables.getOnlyElement(target.getPosition().getTrades());
    requirements.add(new ValueRequirement(CURVE_SPECIFICATION, ComputationTargetSpecification.NULL, curveProperties));
    requirements.add(ConventionBasedFXRateFunction.getSpotRateRequirement(ccyPair));
    requirements.add(new ValueRequirement(FX_FORWARD_POINTS_NODE_SENSITIVITIES, ComputationTargetSpecification.of(trade), properties));
    requirements.add(new ValueRequirement(CURVE_HISTORICAL_TIME_SERIES, ComputationTargetSpecification.NULL, tsProperties));
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

    super(ComputationTargetType.UNORDERED_CURRENCY_PAIR, defaultsPerCurrencyPair);
  }

  @Override
  public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
    final UnorderedCurrencyPair ccy = (UnorderedCurrencyPair) target.getValue();
    String currencyPair = ccy.getFirstCurrency().getCode() + ccy.getSecondCurrency().getCode();
    if (getAllCurrencyPairs().contains(currencyPair)) {
      return true;
    }
    currencyPair = ccy.getSecondCurrency().getCode() + ccy.getFirstCurrency().getCode();
    return getAllCurrencyPairs().contains(currencyPair);
  }
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.