@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> surfaceNames = constraints.getValues(ValuePropertyNames.SURFACE); if (surfaceNames == null || surfaceNames.size() != 1) { return null; } final Set<String> curveCalculationConfigNames = constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) { return null; } final String curveCalculationConfigName = curveCalculationConfigNames.iterator().next(); final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context); final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource); final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName); if (curveCalculationConfig == null) { s_logger.error( "Could not find curve calculation configuration named " + curveCalculationConfigName); return null; } final Currency currency = FinancialSecurityUtils.getCurrency(target.getSecurity()); if (!ComputationTargetSpecification.of(currency).equals(curveCalculationConfig.getTarget())) { s_logger.error( "Security currency and curve calculation config id were not equal; have {} and {}", currency, curveCalculationConfig.getTarget()); return null; } final String surfaceName = surfaceNames.iterator().next(); final Set<ValueRequirement> requirements = new HashSet<>(); requirements.addAll( YieldCurveFunctionUtils.getCurveRequirements( curveCalculationConfig, curveCalculationConfigSource)); requirements.add(getVolatilityRequirement(surfaceName, currency)); final FinancialSecurity security = (FinancialSecurity) target.getSecurity(); try { final Set<ValueRequirement> timeSeriesRequirements = _definitionConverter.getConversionTimeSeriesRequirements( security, security.accept(_visitor)); if (timeSeriesRequirements == null) { return null; } requirements.addAll(timeSeriesRequirements); return requirements; } catch (final Exception e) { s_logger.error(e.getMessage()); return null; } }
static Set<ValueRequirement> getDerivativeTimeSeriesRequirements( final FinancialSecurity security, final InstrumentDefinition<?> definition, final FixedIncomeConverterDataProvider definitionConverter) { return definitionConverter.getConversionTimeSeriesRequirements(security, definition); }