Examples of UnorderedCurrencyPair


Examples of com.opengamma.util.money.UnorderedCurrencyPair

    final Collection<FXForwardSecurity> fxForwards = new ArrayList<>();
    final Random random = new Random(1235);
    for (int i = 0; i < SIZE; i++) {
      FXForwardSecurity fxForward = null;
      try {
        final UnorderedCurrencyPair ccys = CCYS[random.nextInt(CCYS.length)];
        final LocalDate tradeDate = getTradeDate(random, ccys.getFirstCurrency());
        final Tenor tenor = TENORS[random.nextInt(TENORS.length)];
        fxForward = makeFXForward(random, ccys, tradeDate, tenor);
      } catch (final Exception e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

        final ValueRequirement desiredValue = desiredValues.iterator().next();
        final String surfaceName = desiredValue.getConstraint(ValuePropertyNames.SURFACE);
        final String instrumentType = desiredValue.getConstraint(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE);
        VolatilitySurfaceSpecification specification = null;
        if (instrumentType.equals(InstrumentTypeProperties.FOREX)) {
          final UnorderedCurrencyPair pair = UnorderedCurrencyPair.of(target.getUniqueId());
          String name = pair.getFirstCurrency().getCode() + pair.getSecondCurrency().getCode();
          String fullSpecificationName = surfaceName + "_" + name;
          specification = source.getSpecification(fullSpecificationName, instrumentType);
          if (specification == null) {
            name = pair.getSecondCurrency().getCode() + pair.getFirstCurrency().getCode();
            fullSpecificationName = surfaceName + "_" + name;
            specification = source.getSpecification(fullSpecificationName, instrumentType);
            if (specification == null) {
              throw new OpenGammaRuntimeException("Could not get volatility surface specification named " + fullSpecificationName);
            }
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

   * OPENGAMMA_EURUSD_FX_VANILLA_OPTION and OPENGAMMA_USDEUR_FX_VANILLA_OPTION.
   * {@inheritDoc}
   */
  @Override
  protected VolatilitySurfaceDefinition<?, ?> getDefinition(final VolatilitySurfaceDefinitionSource definitionSource, final ComputationTarget target, final String definitionName) {
    final UnorderedCurrencyPair pair = UnorderedCurrencyPair.of(target.getUniqueId());
    String name = pair.getFirstCurrency().getCode() + pair.getSecondCurrency().getCode();
    String fullDefinitionName = definitionName + "_" + name;
    VolatilitySurfaceDefinition<?, ?> definition = definitionSource.getDefinition(fullDefinitionName, InstrumentTypeProperties.FOREX);
    if (definition == null) {
      name = pair.getSecondCurrency().getCode() + pair.getFirstCurrency().getCode();
      fullDefinitionName = definitionName + "_" + name;
      definition = definitionSource.getDefinition(fullDefinitionName, InstrumentTypeProperties.FOREX);
      if (definition == null) {
        s_logger.error("Could not get volatility surface definition named " + fullDefinitionName + " for instrument type " + InstrumentTypeProperties.FOREX);
        return null;
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

   * OPENGAMMA_EURUSD_FX_VANILLA_OPTION and OPENGAMMA_USDEUR_FX_VANILLA_OPTION.
   * {@inheritDoc}
   */
  @Override
  protected VolatilitySurfaceSpecification getSpecification(final VolatilitySurfaceSpecificationSource specificationSource, final ComputationTarget target, final String specificationName) {
    final UnorderedCurrencyPair pair = UnorderedCurrencyPair.of(target.getUniqueId());
    String name = pair.getFirstCurrency().getCode() + pair.getSecondCurrency().getCode();
    String fullSpecificationName = specificationName + "_" + name;
    VolatilitySurfaceSpecification specification = specificationSource.getSpecification(fullSpecificationName, InstrumentTypeProperties.FOREX);
    if (specification == null) {
      name = pair.getSecondCurrency().getCode() + pair.getFirstCurrency().getCode();
      fullSpecificationName = specificationName + "_" + name;
      specification = specificationSource.getSpecification(fullSpecificationName, InstrumentTypeProperties.FOREX);
      if (specification == null) {
        s_logger.error("Could not get volatility surface specification named " + fullSpecificationName + " for instrument type " + InstrumentTypeProperties.FOREX);
        return null;
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

    return ImmutableSet.of(new ValueSpecification(ValueRequirementNames.FX_FORWARD_CURVE_RETURN_SERIES, target.toSpecification(), properties));
  }

  @Override
  public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) {
    final UnorderedCurrencyPair currencyPair = (UnorderedCurrencyPair) target.getValue();
    final ValueProperties constraints = desiredValue.getConstraints();
    final Set<String> curveNames = constraints.getValues(ValuePropertyNames.CURVE);
    if (curveNames == null || curveNames.size() != 1) {
      return null;
    }
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

        final ValueRequirement desiredValue = desiredValues.iterator().next();
        final String surfaceName = desiredValue.getConstraint(ValuePropertyNames.SURFACE);
        final String instrumentType = desiredValue.getConstraint(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE);
        VolatilitySurfaceDefinition<?, ?> definition = null;
        if (instrumentType.equals(InstrumentTypeProperties.FOREX)) {
          final UnorderedCurrencyPair pair = UnorderedCurrencyPair.of(target.getUniqueId());
          String name = pair.getFirstCurrency().getCode() + pair.getSecondCurrency().getCode();
          String fullDefinitionName = surfaceName + "_" + name;
          definition = source.getDefinition(fullDefinitionName, instrumentType);
          if (definition == null) {
            name = pair.getSecondCurrency().getCode() + pair.getFirstCurrency().getCode();
            fullDefinitionName = surfaceName + "_" + name;
            definition = source.getDefinition(fullDefinitionName, instrumentType);
            if (definition == null) {
              throw new OpenGammaRuntimeException("Could not get volatility surface definition named " + fullDefinitionName);
            }
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

    final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
    final ValueRequirement putFundingCurve = getCurveRequirement(putCurveName, putCurrency, putCurveCalculationConfig);
    final ValueRequirement callFundingCurve = getCurveRequirement(callCurveName, callCurrency, callCurveCalculationConfig);
    final ValueRequirement fxVolatilitySurface = getSurfaceRequirement(surfaceName, putCurrency, callCurrency, interpolatorName, leftExtrapolatorName, rightExtrapolatorName);
    final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(putCurrency, callCurrency);
    final ValueRequirement spotRequirement = ConventionBasedFXRateFunction.getSpotRateRequirement(currencyPair);
    final ValueRequirement pairQuoteRequirement = new ValueRequirement(ValueRequirementNames.CURRENCY_PAIRS, ComputationTargetSpecification.NULL);
    return Sets.newHashSet(putFundingCurve, callFundingCurve, fxVolatilitySurface, spotRequirement, pairQuoteRequirement);
  }
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

        return null;
      }
      final FinancialSecurity security = (FinancialSecurity) target.getPosition().getSecurity();
      final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
      final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
      final UnorderedCurrencyPair currencies = UnorderedCurrencyPair.of(putCurrency, callCurrency);
      final String surfaceName = Iterables.getOnlyElement(surfaceNames);
      final String samplingPeriod = Iterables.getOnlyElement(samplingPeriods);
      final CurrencyPair currencyPair = _currencyPairs.getCurrencyPair(putCurrency, callCurrency);
      final String vegaResultCurrency = getResultCurrency(target, currencyPair);
      final String currencyBase = currencyPair.getBase().getCode(); // The base currency
View Full Code Here

Examples of com.opengamma.util.money.UnorderedCurrencyPair

      final ConfigDBVolatilitySurfaceSpecificationSource specificationSource = new ConfigDBVolatilitySurfaceSpecificationSource(configSource);
      final Position position = target.getPosition();
      final FinancialSecurity security = (FinancialSecurity) position.getSecurity();
      final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
      final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
      final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(putCurrency, callCurrency);
      final VolatilitySurfaceDefinition<Object, Object> definition = getSurfaceDefinition(currencyPair, surfaceName, definitionSource);
      final VolatilitySurfaceSpecification specification = getSurfaceSpecification(currencyPair, surfaceName, specificationSource);
      final Period samplingPeriod = getSamplingPeriod(desiredValue.getConstraint(ValuePropertyNames.SAMPLING_PERIOD));
      final LocalDate startDate = now.minus(samplingPeriod);
      final String scheduleCalculatorName = desiredValue.getConstraint(ValuePropertyNames.SCHEDULE_CALCULATOR);
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.