final Position position = target.getPosition();
final ValueRequirement desiredValue = desiredValues.iterator().next();
final ValueProperties constraints = desiredValue.getConstraints();
final Set<String> resultCurrencies = constraints.getValues(CURRENCY);
final FXForwardSecurity security = (FXForwardSecurity) position.getSecurity();
final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D ycReturnSeries = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) inputs.getValue(ValueRequirementNames.YIELD_CURVE_RETURN_SERIES);
final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D fcReturnSeries = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) inputs.getValue(ValueRequirementNames.FX_FORWARD_CURVE_RETURN_SERIES);
final DoubleLabelledMatrix1D sensitivities = (DoubleLabelledMatrix1D) inputs.getValue(ValueRequirementNames.YIELD_CURVE_NODE_SENSITIVITIES);
final Currency payCurrency = security.getPayCurrency();
final Currency receiveCurrency = security.getReceiveCurrency();
final CurrencyPair currencyPair = _currencyPairs.getCurrencyPair(payCurrency, receiveCurrency);
final String curveCurrency = desiredValue.getConstraint(CURVE_CURRENCY);
final Currency baseCurrency = currencyPair.getBase();
final ValueProperties resultProperties = desiredValues.iterator().next().getConstraints();
TenorLabelledLocalDateDoubleTimeSeriesMatrix1D returnSeries;
if (ycReturnSeries != null) {
returnSeries = ycReturnSeries;
} else if (fcReturnSeries != null) {
returnSeries = fcReturnSeries;
} else {
throw new OpenGammaRuntimeException("Could not get return series for either yield curve or FX forward curve");
}
if (returnSeries.size() != sensitivities.size()) {
throw new OpenGammaRuntimeException("Yield Curve Node Sensitivities vector of size " + sensitivities.size() + " but return series vector of size " + returnSeries.size());
}
TenorLabelledLocalDateDoubleTimeSeriesMatrix1D pnlSeriesVector;
if (resultCurrencies == null || resultCurrencies.size() != 1) {
s_logger.warn("No Currency property - returns result in base currency");
pnlSeriesVector = getPnLVector(returnSeries, sensitivities);
} else {
final String resultCurrency = Iterables.getOnlyElement(resultCurrencies);