return null;
}
final Set<String> curveCalculationMethods = constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_METHOD);
final String curveCalculationMethod;
if (curveCalculationMethods == null) {
final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
curveCalculationMethod = curveCalculationConfig.getCalculationMethod();
} else {
curveCalculationMethod = Iterables.getOnlyElement(curveCalculationMethods);
}
final Set<String> calculationMethods = constraints.getValues(ValuePropertyNames.CALCULATION_METHOD);
final ValueRequirement ycnsRequirement = getYCNSRequirement(payCurveName, payCurveCalculationConfigName, receiveCurveName, receiveCurveCalculationConfigName,
curveCurrency.getCode(), curveName, curveCalculationMethods, calculationMethods, security);
final ValueProperties returnSeriesBaseConstraints = desiredValue.getConstraints().copy()
.withoutAny(ValuePropertyNames.RECEIVE_CURVE)
.withoutAny(ValuePropertyNames.RECEIVE_CURVE_CALCULATION_CONFIG)
.withoutAny(ValuePropertyNames.PAY_CURVE)
.withoutAny(ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG)
.withoutAny(ValuePropertyNames.CURVE_CURRENCY)
.withoutAny(ValuePropertyNames.PROPERTY_PNL_CONTRIBUTIONS)
.withoutAny(ValuePropertyNames.CURVE_CALCULATION_METHOD)
.withoutAny(ValuePropertyNames.CALCULATION_METHOD).get();
final Set<String> resultCurrencies = constraints.getValues(CURRENCY);
final String resultCurrency;
final CurrencyPair baseQuotePair = _currencyPairs.getCurrencyPair(payCurrency, receiveCurrency);
final Currency tradeBaseCurrency = baseQuotePair.getBase();
final Currency tradeNonBaseCurrency = baseQuotePair.getCounter();
final Set<ValueRequirement> requirements = new HashSet<>();
if (resultCurrencies != null && resultCurrencies.size() == 1) {
final Currency ccy = Currency.of(Iterables.getOnlyElement(resultCurrencies));
if (!(ccy.equals(payCurrency) || ccy.equals(receiveCurrency))) {
requirements.add(ConventionBasedFXRateFunction.getHistoricalTimeSeriesRequirement(UnorderedCurrencyPair.of(tradeBaseCurrency, ccy)));
resultCurrency = ccy.getCode();
} else if (ccy.equals(tradeNonBaseCurrency)) {
requirements.add(ConventionBasedFXRateFunction.getHistoricalTimeSeriesRequirement(UnorderedCurrencyPair.of(tradeNonBaseCurrency, tradeBaseCurrency)));
resultCurrency = tradeNonBaseCurrency.getCode();
} else {
requirements.add(ConventionBasedFXRateFunction.getHistoricalTimeSeriesRequirement(UnorderedCurrencyPair.of(tradeNonBaseCurrency, tradeBaseCurrency)));
resultCurrency = tradeBaseCurrency.getCode();
}
} else {
resultCurrency = tradeBaseCurrency.getCode();
}
final ValueRequirement returnSeriesRequirement;
if (curveCalculationMethod.equals(FXImpliedYieldCurveFunction.FX_IMPLIED)) {
final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
final LinkedHashMap<String, String[]> exogenousConfigData = curveCalculationConfig.getExogenousConfigData();
if (exogenousConfigData != null) {
final String underlyingCurveConfigName = Iterables.getOnlyElement(exogenousConfigData.entrySet()).getKey();