.get();
return Collections.singleton(new ValueRequirement(ValueRequirementNames.PNL_SERIES, target.toSpecification(), newConstraints));
}
final Set<ValueRequirement> requirements = new HashSet<>();
final String calculationMethod = Iterables.getOnlyElement(calculationMethods);
final FinancialSecurity security = (FinancialSecurity) target.getPosition().getSecurity();
if (CalculationPropertyNamesAndValues.DISCOUNTING.equals(calculationMethod)) {
requirements.add(new ValueRequirement(ValueRequirementNames.FX_CURRENCY_EXPOSURE, ComputationTargetSpecification.of(target.getPosition().getSecurity()),
ValueProperties.builder()
.with(ValuePropertyNames.CALCULATION_METHOD, CalculationPropertyNamesAndValues.DISCOUNTING)
.with(ValuePropertyNames.PAY_CURVE, payCurveNames.iterator().next())
.with(ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG, payCurveCalculationConfigs.iterator().next())
.with(ValuePropertyNames.RECEIVE_CURVE, receiveCurveNames.iterator().next())
.with(ValuePropertyNames.RECEIVE_CURVE_CALCULATION_CONFIG, receiveCurveCalculationConfigs.iterator().next()).get()));
} else if (CalculationPropertyNamesAndValues.FORWARD_POINTS.equals(calculationMethod)) {
final Set<String> forwardCurveNames = constraints.getValues(ValuePropertyNames.FORWARD_CURVE_NAME);
if (forwardCurveNames == null || forwardCurveNames.size() != 1) {
return null;
}
final String forwardCurveName = Iterables.getOnlyElement(forwardCurveNames);
requirements.add(new ValueRequirement(ValueRequirementNames.FX_CURRENCY_EXPOSURE, ComputationTargetSpecification.of(target.getPosition().getSecurity()),
ValueProperties.builder()
.with(ValuePropertyNames.CALCULATION_METHOD, CalculationPropertyNamesAndValues.FORWARD_POINTS)
.with(ValuePropertyNames.PAY_CURVE, payCurveNames.iterator().next())
.with(ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG, payCurveCalculationConfigs.iterator().next())
.with(ValuePropertyNames.RECEIVE_CURVE, receiveCurveNames.iterator().next())
.with(ValuePropertyNames.RECEIVE_CURVE_CALCULATION_CONFIG, receiveCurveCalculationConfigs.iterator().next())
.with(ValuePropertyNames.FORWARD_CURVE_NAME, forwardCurveName).get()));
} else {
return null;
}
final Set<String> resultCurrencies = constraints.getValues(CURRENCY);
final Currency payCurrency = security.accept(ForexVisitors.getPayCurrencyVisitor());
final Currency receiveCurrency = security.accept(ForexVisitors.getReceiveCurrencyVisitor());
final String resultCurrency;
final CurrencyPair baseQuotePair = _currencyPairs.getCurrencyPair(payCurrency, receiveCurrency);
final Currency baseCurrency = baseQuotePair.getBase();
final Currency nonBaseCurrency = baseQuotePair.getCounter();
if (resultCurrencies != null && resultCurrencies.size() == 1) {