@Override
public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) {
final ValueProperties constraints = desiredValue.getConstraints();
final String lookbackPeriodString = anyConstraintOrNull(constraints, ValuePropertyNames.SAMPLING_PERIOD);
final DateConstraint startDate;
if (lookbackPeriodString == null) {
if (!OpenGammaCompilationContext.isPermissive(context)) {
return null;
}
startDate = DateConstraint.VALUATION_TIME.minus(DEFAULT_SAMPLING_PERIOD);
} else {
startDate = DateConstraint.VALUATION_TIME.minus(Period.parse(lookbackPeriodString));
}
final ViewDefinition viewDefinition = context.getViewCalculationConfiguration().getViewDefinition();
final HistoricalViewEvaluationTarget tempTarget = new HistoricalViewEvaluationTarget(viewDefinition.getMarketDataUser(), startDate.toString(), true, DateConstraint.VALUATION_TIME.toString(),
false, null, HistoricalViewEvaluationMarketDataMode.HISTORICAL);
final ViewCalculationConfiguration calcConfig = createViewCalculationConfiguration(tempTarget.getViewDefinition(), context.getViewCalculationConfiguration().getName());
addValueRequirements(context, target, calcConfig);
tempTarget.getViewDefinition().addViewCalculationConfiguration(calcConfig);
final TempTargetRepository targets = OpenGammaCompilationContext.getTempTargets(context);