Package com.opengamma.engine.marketdata

Examples of com.opengamma.engine.marketdata.OverrideOperationCompiler


    final ValueSpecification inputSpec = input.getSpecification();
    final YieldAndDiscountCurve curve = (YieldAndDiscountCurve) input.getValue();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String shift = desiredValue.getConstraint(SHIFT);
    final ValueProperties.Builder properties = createValueProperties(inputSpec).with(SHIFT, shift);
    final OverrideOperationCompiler compiler = OpenGammaExecutionContext.getOverrideOperationCompiler(executionContext);
    if (compiler == null) {
      throw new IllegalStateException("No override operation compiler for " + shift + " in execution context");
    }
    s_logger.debug("Applying {} to yield curve {}", shift, curve);
    final Object result = compiler.compile(shift, executionContext.getComputationTargetResolver()).apply(desiredValue, curve);
    s_logger.debug("Got result {}", result);
    return Collections.singleton(new ComputedValue(new ValueSpecification(inputSpec.getValueName(), inputSpec.getTargetSpecification(), properties.get()), result));
  }
View Full Code Here


    final ValueSpecification inputSpec = input.getSpecification();
    final SnapshotDataBundle marketData = (SnapshotDataBundle) input.getValue();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String shift = desiredValue.getConstraint(SHIFT);
    final ValueProperties.Builder properties = createValueProperties(inputSpec).with(SHIFT, shift);
    final OverrideOperationCompiler compiler = OpenGammaExecutionContext.getOverrideOperationCompiler(executionContext);
    if (compiler == null) {
      throw new IllegalStateException("No override operation compiler for " + shift + " in execution context");
    }
    s_logger.debug("Applying {} to {}", shift, marketData);
    final OverrideOperation operation = compiler.compile(shift, executionContext.getComputationTargetResolver());
    for (final Map.Entry<ExternalIdBundle, Double> dataPoint : marketData.getDataPointSet()) {
      s_logger.debug("Applying to {}", dataPoint);
      final Object result = operation.apply(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, dataPoint.getKey()),
          dataPoint.getValue());
      s_logger.debug("Got result {}", result);
View Full Code Here

    final ComputedValue input = inputs.getAllValues().iterator().next();
    @SuppressWarnings("unchecked")
    final T inputValue = (T) input.getValue();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String shift = desiredValue.getConstraint(SHIFT_PROPERTY);
    final OverrideOperationCompiler compiler = OpenGammaExecutionContext.getOverrideOperationCompiler(executionContext);
    if (compiler == null) {
      throw new IllegalStateException("No override operation compiler for " + shift + " in execution context");
    }
    s_logger.debug("Applying {} to yield curve {}", shift, inputValue);
    final T result = apply(executionContext, compiler.compile(shift, executionContext.getComputationTargetResolver()), inputValue, input.getSpecification());
    s_logger.debug("Got result {}", result);
    return Collections.singleton(new ComputedValue(new ValueSpecification(desiredValue.getValueName(), target.toSpecification(), desiredValue.getConstraints()), result));
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  public void init(final ComponentRepository repo, final LinkedHashMap<String, String> configuration) {
    initPnlRequirementsGatherer();
    initFunctionCompilationContext(repo, configuration);
    final OverrideOperationCompiler ooc = initOverrideOperationCompiler(repo, configuration);
    initFunctionExecutionContext(repo, configuration, ooc);
  }
View Full Code Here

    final ComponentInfo info = new ComponentInfo(FunctionCompilationContext.class, getClassifier());
    repo.registerComponent(info, context);
  }

  protected OverrideOperationCompiler initOverrideOperationCompiler(final ComponentRepository repo, final LinkedHashMap<String, String> configuration) {
    final OverrideOperationCompiler ooc = new MarketDataELCompiler();
    final ComponentInfo info = new ComponentInfo(OverrideOperationCompiler.class, getClassifier());
    repo.registerComponent(info, ooc);
    return ooc;
  }
View Full Code Here

   * Fetches the override operation to apply to market data in the given configuration. If there is no operation to apply, returns null.
   *
   * @return the shift operation, or null for non
   */
  private OverrideOperation getCacheMarketDataOperation(ViewCalculationConfiguration calcConfig) {
    OverrideOperationCompiler compiler = null;
    ComputationTargetResolver.AtVersionCorrection resolver = null;
    final Set<String> marketDataShift = calcConfig.getDefaultProperties().getValues(MARKET_DATA_SHIFT_PROPERTY);
    OverrideOperation operation = null;
    if (marketDataShift != null) {
      if (marketDataShift.size() != 1) {
        // This doesn't really mean much
        s_logger.error("Market data shift for {} not valid - {}", calcConfig.getName(), marketDataShift);
      } else {
        if (compiler == null) {
          compiler = getViewProcessContext().getOverrideOperationCompiler();
          resolver = getViewProcessContext().getFunctionCompilationService().getFunctionCompilationContext().getRawComputationTargetResolver().atVersionCorrection(getVersionCorrection());
        }
        final String shiftExpr = marketDataShift.iterator().next();
        try {
          operation = compiler.compile(shiftExpr, resolver);
        } catch (final IllegalArgumentException e) {
          s_logger.error("Market data shift for  {} not valid - {}", calcConfig.getName(), shiftExpr);
          s_logger.info("Invalid market data shift", e);
        }
      }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.marketdata.OverrideOperationCompiler

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.