Package com.opengamma.engine.value

Examples of com.opengamma.engine.value.ComputedValue


  private static final Logger s_logger = LoggerFactory.getLogger(HistoricalTimeSeriesSecurityFunction.class);

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs,
      final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final ComputedValue htsValue = inputs.getComputedValue(ValueRequirementNames.HISTORICAL_TIME_SERIES);
    if (htsValue == null) {
      s_logger.warn("Cannot get time series for {}", target);
    }
    final ManageableHistoricalTimeSeries mhts = (ManageableHistoricalTimeSeries) htsValue.getValue();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    return Collections.singleton(new ComputedValue(
        new ValueSpecification(desiredValue.getValueName(), target.toSpecification(), desiredValue.getConstraints()), mhts.getTimeSeries()));
  }
View Full Code Here


    }
    if (summedValue == null) {
      return null;
    }
    final ValueSpecification specification = new ValueSpecification(_requirementName, target.toSpecification(), desiredValue.getConstraints());
    return Collections.singleton(new ComputedValue(specification, summedValue));
  }
View Full Code Here

    @SuppressWarnings("synthetic-access")
    @Override
    public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs,
        final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
      final VolatilityCubeData map = buildMarketDataMap(executionContext, inputs);
      return Sets.newHashSet(new ComputedValue(_marketDataResult, map));
    }
View Full Code Here

    final ValueProperties properties = createValueProperties()
        .with(ValuePropertyNames.SURFACE, surfaceName)
        .with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, InstrumentTypeProperties.BOND_FUTURE_OPTION).get();
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA, target.toSpecification(), properties);
    if (surfaceQuoteUnits.equals(SurfaceAndCubePropertyNames.VOLATILITY_QUOTE)) {
      return Collections.singleton(new ComputedValue(spec, getSurfaceFromVolatilityQuote(surfaceData, now, calendar)));
    } else if (surfaceQuoteUnits.equals(SurfaceAndCubePropertyNames.PRICE_QUOTE)) {
      final NodalDoublesCurve futuresPrices = getFuturePricesCurve(target, curveName, inputs);
      final VolatilitySurfaceData<Double, Double> volSurface = getSurfaceFromPriceQuote(specification, surfaceData, futuresPrices, now, surfaceQuoteType, calendar);
      if (volSurface != null) {
        return Collections.singleton(new ComputedValue(spec, volSurface));
      }
    }
    throw new OpenGammaRuntimeException("Encountered an unexpected surfaceQuoteUnits. Valid values are found in SurfaceAndCubePropertyNames as VolatilityQuote or PriceQuote.");
  }
View Full Code Here

        bundle.add(dataField, identifier, timeSeries);
      } else {
        s_logger.warn("Could not get time series for {}", identifier);
      }
    }
    return Collections.singleton(new ComputedValue(new ValueSpecification(ValueRequirementNames.CREDIT_SPREAD_CURVE_HISTORICAL_TIME_SERIES, target.toSpecification(),
        desiredValue.getConstraints()), bundle));
  }
View Full Code Here

        normalizedData.setOtherData(data.getOtherData());
        normalizedData.setATMStrikes(normalizedATMStrikes);
        normalizedData.setATMVolatilities(normalizedATMVols);
        normalizedData.setDataIds(normalizedVolatilityPointIds);
        normalizedData.setRelativeStrikes(normalizedRelativeStrikes);
        return Sets.newHashSet(new ComputedValue(_cubeResult, normalizedData));
      }
    };
  }
View Full Code Here

        bundle.add(dataField, id, timeSeries);
      }
    } else {
      s_logger.warn("Couldn't get time series for {}", id);
    }
    return Collections.singleton(new ComputedValue(new ValueSpecification(ValueRequirementNames.FX_FORWARD_CURVE_HISTORICAL_TIME_SERIES, target.toSpecification(),
        desiredValue.getConstraints()), bundle));
  }
View Full Code Here

        }
      }
    }
    final Surface<Double, Double, Double> surface = InterpolatedDoublesSurface.from(t.toDoubleArray(), k.toDoubleArray(), sigma.toDoubleArray(), _interpolator);
    final VolatilitySurface volatilitySurface = new VolatilitySurface(surface);
    return Collections.singleton(new ComputedValue(_result, volatilitySurface));
  }
View Full Code Here

        } else {
          s_logger.info("Couldn't get time series for {}", priceIndexId);
        }
      }
    }
    return Collections.singleton(new ComputedValue(new ValueSpecification(ValueRequirementNames.CURVE_HISTORICAL_TIME_SERIES, target.toSpecification(),
        desiredValue.getConstraints()), bundle));
  }
View Full Code Here

    return Collections.singleton(new ValueSpecification(input.getValueName(), input.getTargetSpecification(), properties));
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final ComputedValue input = inputs.getAllValues().iterator().next();
    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);
      if (result instanceof Number) {
        dataPoint.setValue(((Number) result).doubleValue());
      } else {
        s_logger.warn("Result of override operation was not numeric");
      }
    }
    return Collections.singleton(new ComputedValue(new ValueSpecification(inputSpec.getValueName(), inputSpec.getTargetSpecification(), properties.get()), marketData));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.value.ComputedValue

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.