ConfigDBCurveCalculationConfigSource.reinitOnChanges(context, this);
}
@Override
public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
final SwapSecurity security = (SwapSecurity) target.getSecurity();
final Clock snapshotClock = executionContext.getValuationClock();
final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
final ValueRequirement desiredValue = desiredValues.iterator().next();
final String curveCalculationConfigName = desiredValue.getConstraint(ValuePropertyNames.CURVE_CALCULATION_CONFIG);
final String daysForward = desiredValue.getConstraint(PROPERTY_DAYS_TO_MOVE_FORWARD);
final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
if (curveCalculationConfig == null) {
throw new OpenGammaRuntimeException("Could not find curve calculation configuration named " + curveCalculationConfigName);
}
final Currency currency = FinancialSecurityUtils.getCurrency(security);
final String[] curveNames = curveCalculationConfig.getYieldCurveNames();
final int numCurveNames = curveNames.length;
final String[] fullCurveNames = new String[numCurveNames];
for (int i = 0; i < numCurveNames; i++) {
fullCurveNames[i] = curveNames[i] + currency.getCode();
}
final YieldCurveBundle bundle = YieldCurveFunctionUtils.getAllYieldCurves(inputs, curveCalculationConfig, curveCalculationConfigSource);
final InstrumentDefinition<?> definition = security.accept(_visitor);
if (definition == null) {
throw new OpenGammaRuntimeException("Definition for security " + security + " was null");
}
final ZonedDateTimeDoubleTimeSeries[] fixingSeries = new ZonedDateTimeDoubleTimeSeries[] {FixingTimeSeriesVisitor.convertTimeSeries(
(HistoricalTimeSeries) inputs.getValue(ValueRequirementNames.HISTORICAL_TIME_SERIES)) };