security = target.getPosition().getSecurityLink().resolve(context.getSecuritySource());
}
Set<Currency> targetCurrencies = security != null ? ImmutableSet.copyOf(FinancialSecurityUtils.getCurrencies(security, context.getSecuritySource())) : null;
ViewDefinition viewDefinition = context.getViewCalculationConfiguration().getViewDefinition();
final HistoricalViewEvaluationTarget tempTarget = new HistoricalViewEvaluationTarget(viewDefinition.getMarketDataUser(), startDateConstraint, includeStartConstraint, endDateConstraint,
includeEndConstraint, targetCurrencies, marketDataMode);
final ValueRequirement requirement = getNestedRequirement(context.getComputationTargetResolver(), target, desiredValue.getConstraints());
if (requirement == null) {
return null;
}
final ViewCalculationConfiguration calcConfig = new ViewCalculationConfiguration(tempTarget.getViewDefinition(), context.getViewCalculationConfiguration().getName());
calcConfig.addSpecificRequirement(requirement);
tempTarget.getViewDefinition().addViewCalculationConfiguration(calcConfig);
final TempTargetRepository targets = OpenGammaCompilationContext.getTempTargets(context);
final UniqueId tempTargetId = targets.locateOrStore(tempTarget);
return Collections.singleton(new ValueRequirement(ValueRequirementNames.HISTORICAL_TIME_SERIES, new ComputationTargetSpecification(TempTarget.TYPE, tempTargetId), ValueProperties.withAny(
ViewEvaluationFunction.PROPERTY_CALC_CONFIG).get()));
}