Package com.opengamma.engine.value.ValueProperties

Examples of com.opengamma.engine.value.ValueProperties.Builder


  }

  @Override
  protected ValueProperties.Builder getResultProperties(final ComputationTarget target, final String putCurve, final String putCurveCalculationConfig, final String callCurve,
      final String callCurveCalculationConfig, final CurrencyPair baseQuotePair, final ValueProperties optionalProperties) {
    final Builder properties = super.getResultProperties(target, putCurve, putCurveCalculationConfig, callCurve, callCurveCalculationConfig, baseQuotePair, optionalProperties);
    return properties.withAny(ValuePropertyNames.BINARY_OVERHEDGE)
        .withAny(ValuePropertyNames.BINARY_SMOOTHING_FULLWIDTH);
  }
View Full Code Here


        .withAny(ValuePropertyNames.BINARY_SMOOTHING_FULLWIDTH);
  }

  @Override
  protected ValueProperties.Builder getResultProperties(final ComputationTarget target, final ValueRequirement desiredValue, final CurrencyPair baseQuotePair) {
    final Builder properties = super.getResultProperties(target, desiredValue, baseQuotePair);
    final String binaryOverhead = desiredValue.getConstraint(ValuePropertyNames.BINARY_OVERHEDGE);
    final String binarySmoothing = desiredValue.getConstraint(ValuePropertyNames.BINARY_SMOOTHING_FULLWIDTH);
    return properties.with(ValuePropertyNames.BINARY_OVERHEDGE, binaryOverhead)
        .with(ValuePropertyNames.BINARY_SMOOTHING_FULLWIDTH, binarySmoothing);
  }
View Full Code Here

      return requirements;
    }

    @Override
    public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
      final Builder builder = createValueProperties();
      final FXForwardSecurity security = (FXForwardSecurity) target.getPosition().getSecurity();
      final CurrencyPair currencyPair = _currencyPairs.getCurrencyPair(security.getPayCurrency(), security.getReceiveCurrency());
      if (currencyPair == null) {
        return null;
      }
      final Currency currencyBase = currencyPair.getBase();
      String resultCurrency = null;
      for (final Map.Entry<ValueSpecification, ValueRequirement> entry : inputs.entrySet()) {
        final ValueSpecification inputSpec = entry.getKey();
        final ValueRequirement inputReq = entry.getValue();
        if (inputReq.getValueName().equals(YIELD_CURVE_RETURN_SERIES) || inputReq.getValueName().equals(FX_FORWARD_CURVE_RETURN_SERIES)) {
          final Set<String> resultCurrencies = inputReq.getConstraints().getValues(RESULT_CURRENCY);
          if (resultCurrencies != null && resultCurrencies.size() == 1) {
            resultCurrency = inputReq.getConstraint(RESULT_CURRENCY);
          } else {
            // should never reach here, but just in case
            resultCurrency = currencyBase.getCode();
          }
        }
        for (final String propertyName : inputSpec.getProperties().getProperties()) {
          if (ValuePropertyNames.FUNCTION.equals(propertyName)) {
            continue;
          }
          final Set<String> values = inputSpec.getProperties().getValues(propertyName);
          if (values == null || values.isEmpty()) {
            builder.withAny(propertyName);
          } else {
            builder.with(propertyName, values);
          }
        }
      }
      if (resultCurrency == null) {
        return null;
      }
      builder.with(ValuePropertyNames.CURRENCY, resultCurrency)
          .with(ValuePropertyNames.PROPERTY_PNL_CONTRIBUTIONS, ValueRequirementNames.YIELD_CURVE_NODE_SENSITIVITIES);
      final ValueProperties properties = builder.get();
      final ComputationTargetSpecification targetSpec = target.toSpecification();
      return ImmutableSet.of(new ValueSpecification(ValueRequirementNames.YIELD_CURVE_PNL_SERIES, targetSpec, properties));
    }
View Full Code Here

      if (getValueRequirementName().equals(input.getValueName())) {
        return inputs.keySet();
      }
    }
    ValueSpecification superSpec = super.getResults(context, target, inputs).iterator().next();
    Builder properties = superSpec.getProperties().copy()
        .withAny(s_priceShift)
        .withAny(s_volShift)
        .withAny(s_priceShiftType)
        .withAny(s_volShiftType);
       
    return Collections.singleton(new ValueSpecification(getValueRequirementName(), target.toSpecification(), properties.get()));   
  }
View Full Code Here

      if (getValueRequirementName().equals(input.getValueName())) {
        return inputs.keySet();
      }
    }
    ValueSpecification superSpec = super.getResults(context, target, inputs).iterator().next();
    Builder properties = superSpec.getProperties().copy()
        .withAny(s_priceShift)
        .withAny(s_volShift)
        .withAny(s_priceShiftType)
        .withAny(s_volShiftType);
       
    return Collections.singleton(new ValueSpecification(getValueRequirementName(), target.toSpecification(), properties.get()));   
  }
View Full Code Here

    return _targetType;
  }

  @Override
  public Set<ValueSpecification> getResults(FunctionCompilationContext context, ComputationTarget target) {
    final Builder builder = createValueProperties();
    for (String preservedProperty : _preservedProperties) {
      builder.withAny(preservedProperty);
    }
    return ImmutableSet.of(new ValueSpecification(_aliasedValueRequirementName, target.toSpecification(), builder.get()));
  }
View Full Code Here

  }

  @Override
  public Set<ValueSpecification> getResults(FunctionCompilationContext context, ComputationTarget target, Map<ValueSpecification, ValueRequirement> inputs) {
    final ValueSpecification inputSpec = Iterables.getOnlyElement(inputs.keySet());
    final Builder builder = createValueProperties();
    appendPreservedProperties(inputSpec.getProperties(), builder);
    return ImmutableSet.of(new ValueSpecification(_aliasedValueRequirementName, target.toSpecification(), builder.get()));
  }
View Full Code Here

    final ValueRequirement desiredValue = desiredValues.iterator().next();
    return ImmutableSet.of(new ComputedValue(new ValueSpecification(desiredValue.getValueName(), target.toSpecification(), desiredValue.getConstraints()), result));
  }

  private ValueRequirement createValueRequirement(ComputationTarget target, ValueRequirement desiredValue) {
    final Builder constraints = _inputConstraints.copy();
    appendPreservedProperties(desiredValue.getConstraints(), constraints);
    return new ValueRequirement(_inputRequirementName, target.toSpecification(), constraints.get());
  }
View Full Code Here

  private ValueProperties without(final ValueProperties compose, final Collection<String> symmetricDiff) {
    if (symmetricDiff.isEmpty()) {
      return compose;
    }
    final Builder filtered = compose.copy();
    for (final String propertyName : symmetricDiff) {
      filtered.withoutAny(propertyName);
    }
    return filtered.get();
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.value.ValueProperties.Builder

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.