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[] configCurveNames = curveCalculationConfig.getYieldCurveNames();
if (Arrays.binarySearch(configCurveNames, curveName) < 0) {
s_logger.error("Curve named {} is not available in curve calculation configuration called {}", curveName, curveCalculationConfigName);
return null;
}
final String curveCalculationMethod = curveCalculationConfig.getCalculationMethod();
final Set<ValueRequirement> requirements = new HashSet<>();
requirements.addAll(YieldCurveFunctionUtils.getCurveRequirements(curveCalculationConfig, curveCalculationConfigSource));
if (!curveCalculationMethod.equals(FXImpliedYieldCurveFunction.FX_IMPLIED)) {
requirements.add(getCurveSpecRequirement(currency, curveName));
}