final UnorderedCurrencyPair currencyPair = UnorderedCurrencyPair.of(payCurrency, receiveCurrency);
final FXForwardCurveDefinition forwardCurveDefinition = fxCurveDefinitionSource.getDefinition(forwardCurveName, currencyPair.toString());
if (forwardCurveDefinition == null) {
throw new OpenGammaRuntimeException("Couldn't find FX forward curve definition called " + forwardCurveName + " for target " + currencyPair);
}
final FXForwardCurveSpecification forwardCurveSpecification = fxCurveSpecificationSource.getSpecification(forwardCurveName, currencyPair.toString());
if (forwardCurveSpecification == null) {
throw new OpenGammaRuntimeException("Couldn't find FX forward curve specification called " + forwardCurveName + " for target " + currencyPair);
}
final YieldAndDiscountCurve payCurve = getPayCurve(inputs, payCurrency, payCurveName, payCurveConfig);
final YieldAndDiscountCurve receiveCurve = getReceiveCurve(inputs, receiveCurrency, receiveCurveName, receiveCurveConfig);
final DoublesCurve fxForwardCurve = getFXForwardCurve(inputs, forwardCurveDefinition, forwardCurveSpecification, now.toLocalDate());
final Map<String, Currency> curveCurrency = new HashMap<>();
curveCurrency.put(fullPayCurveName, payCurrency);
curveCurrency.put(fullReceiveCurveName, receiveCurrency);
final Object baseQuotePairsObject = inputs.getValue(ValueRequirementNames.CURRENCY_PAIRS);
if (baseQuotePairsObject == null) {
throw new OpenGammaRuntimeException("Could not get base/quote pair data");
}
final CurrencyPairs baseQuotePairs = (CurrencyPairs) baseQuotePairsObject;
final YieldAndDiscountCurve[] curves;
final String[] allCurveNames;
curves = new YieldAndDiscountCurve[] {payCurve, receiveCurve };
allCurveNames = new String[] {fullPayCurveName, fullReceiveCurveName };
// Implementation note: The ForexSecurityConverter create the Forex with currency order pay/receive. The curve are passed in the same order.
final ForexSecurityConverter converter = new ForexSecurityConverter(baseQuotePairs);
final InstrumentDefinition<?> definition = security.accept(converter);
final Forex forex = (Forex) definition.toDerivative(now, allCurveNames);
final FXForwardCurveInstrumentProvider provider = forwardCurveSpecification.getCurveInstrumentProvider();
final ValueRequirement spotRequirement = new ValueRequirement(provider.getDataFieldName(), ComputationTargetType.PRIMITIVE, provider.getSpotInstrument());
final double spotFX;
if (baseQuotePairs.getCurrencyPair(receiveCurrency, payCurrency).getBase().equals(receiveCurrency)) {
spotFX = (Double) inputs.getValue(spotRequirement);
} else {