specification = source.getSpecification(fullSpecificationName, instrumentType);
if (specification == null) {
throw new OpenGammaRuntimeException("Could not get volatility surface specification named " + fullSpecificationName + " for instrument type " + instrumentType);
}
}
@SuppressWarnings("synthetic-access")
final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.VOLATILITY_SURFACE_SPEC, target.toSpecification(),
createValueProperties()
.with(ValuePropertyNames.SURFACE, surfaceName)
.with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, instrumentType)
.with(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_QUOTE_TYPE, specification.getSurfaceQuoteType())
.with(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_UNITS, specification.getQuoteUnits()).get());
return Collections.singleton(new ComputedValue(spec, specification));
}
@Override
public ComputationTargetType getTargetType() {
return ComputationTargetType.ANYTHING;
}
@SuppressWarnings("synthetic-access")
@Override
public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target) {
return Collections.singleton(new ValueSpecification(ValueRequirementNames.VOLATILITY_SURFACE_SPEC, target.toSpecification(),
createValueProperties()
.withAny(ValuePropertyNames.SURFACE)
.withAny(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE)
.withAny(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_QUOTE_TYPE)
.withAny(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_UNITS).get()));