@Override public Set<ComputedValue> execute( final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) { final Object positionOrNode = getTarget(target); final ConventionBundleSource conventionSource = OpenGammaExecutionContext.getConventionBundleSource(executionContext); final ConventionBundle bundle = conventionSource.getConventionBundle( ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "USD_CAPM")); final Clock snapshotClock = executionContext.getValuationClock(); final LocalDate now = snapshotClock.zonedDateTime().toLocalDate(); final ValueRequirement desiredValue = desiredValues.iterator().next(); final ValueProperties constraints = desiredValue.getConstraints(); final Period samplingPeriod = getSamplingPeriod(constraints.getValues(ValuePropertyNames.SAMPLING_PERIOD)); final LocalDate startDate = now.minus(samplingPeriod); final HistoricalTimeSeries riskFreeRateTSObject = (HistoricalTimeSeries) inputs.getValue(ValueRequirementNames.HISTORICAL_TIME_SERIES); final Object assetPnLObject = inputs.getValue( new ValueRequirement( ValueRequirementNames.PNL_SERIES, positionOrNode)); // TODO replace with return series when portfolio weights are in if (assetPnLObject == null) { throw new OpenGammaRuntimeException("Asset P&L was null"); } final Object assetFairValueObject = inputs.getValue(new ValueRequirement(ValueRequirementNames.FAIR_VALUE, positionOrNode)); if (assetFairValueObject == null) { throw new OpenGammaRuntimeException("Asset fair value was null"); } final Object betaObject = inputs.getValue(new ValueRequirement(ValueRequirementNames.CAPM_BETA, positionOrNode)); if (betaObject == null) { throw new OpenGammaRuntimeException("Beta was null"); } final double beta = (Double) betaObject; final double fairValue = (Double) assetFairValueObject; DoubleTimeSeries<?> assetReturnTS = ((DoubleTimeSeries<?>) assetPnLObject).divide(fairValue); DoubleTimeSeries<?> riskFreeReturnTS = riskFreeRateTSObject.getTimeSeries().divide(100 * DAYS_PER_YEAR); DoubleTimeSeries<?>[] series = TimeSeriesIntersector.intersect(riskFreeReturnTS, assetReturnTS); riskFreeReturnTS = series[0]; assetReturnTS = series[1]; final TreynorRatioCalculator calculator = getCalculator(constraints.getValues(ValuePropertyNames.EXCESS_RETURN_CALCULATOR)); final double ratio = calculator.evaluate(assetReturnTS, riskFreeReturnTS, beta); final ValueProperties resultProperties = getResultProperties(desiredValues.iterator().next()); return Sets.newHashSet( new ComputedValue( new ValueSpecification( new ValueRequirement( ValueRequirementNames.TREYNOR_RATIO, positionOrNode, resultProperties), getUniqueId()), ratio)); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final Set<String> curves = desiredValue.getConstraints().getValues(ValuePropertyNames.CURVE); final Set<String> curveCalcConfigs = desiredValue.getConstraints().getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if ((curves == null) || (curves.size() != 1)) { s_logger.warn("no curve specified"); // Can't support an unbound request; an injection function must be used (or declare all as // optional and use [PLAT-1771]) return null; } if ((curveCalcConfigs == null) || (curveCalcConfigs.size() != 1)) { s_logger.warn("no curve config specified"); return null; } final String curve = curves.iterator().next(); final String curveCalcConfig = curveCalcConfigs.iterator().next(); final Set<ValueRequirement> requirements = Sets.newHashSet(); requirements.add(getCurveRequirement(target, curve, curveCalcConfig)); requirements.add(getCurveSpecRequirement(target, curve)); requirements.addAll( getSensitivityRequirements( context.getSecuritySource(), (RawSecurity) target.getSecurity())); return requirements; }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { Set<String> values = desiredValue.getConstraints().getValues(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY); if ((values == null) || values.isEmpty()) { return Collections.singleton( new ValueRequirement( ValueRequirementNames.HISTORICAL_TIME_SERIES_LATEST, target.toSpecification(), desiredValue .getConstraints() .copy() .withoutAny(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY) .with(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY, "") .get())); } else if (values.size() > 1) { return Collections.singleton( new ValueRequirement( ValueRequirementNames.HISTORICAL_TIME_SERIES_LATEST, target.toSpecification(), desiredValue .getConstraints() .copy() .withoutAny(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY) .with(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY, values.iterator().next()) .get())); } return Collections.emptySet(); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> forwardCurveCalculationMethods = constraints.getValues(CURVE_CALCULATION_METHOD); if (forwardCurveCalculationMethods == null || forwardCurveCalculationMethods.size() != 1) { return null; } final Set<String> surfaceNames = constraints.getValues(SURFACE); if (surfaceNames == null || surfaceNames.size() != 1) { return null; } final String surfaceName = surfaceNames.iterator().next(); final ValueRequirement forwardCurveRequirement = getForwardCurveRequirement(target, desiredValue); final ValueRequirement volatilitySurfaceRequirement = getVolatilityDataRequirement( target, surfaceName, getInstrumentType(), getSurfaceQuoteType(), getSurfaceQuoteUnits()); final ValueRequirement interpolatorRequirement = getInterpolatorRequirement(target, desiredValue); return Sets.newHashSet( interpolatorRequirement, forwardCurveRequirement, volatilitySurfaceRequirement); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> curveNames = constraints.getValues(CURVE); if (curveNames == null || curveNames.size() != 1) { return null; } final Set<String> curveExposureConfigs = constraints.getValues(CURVE_EXPOSURES); if (curveExposureConfigs == null) { return null; } final Set<String> curveType = constraints.getValues(PROPERTY_CURVE_TYPE); if (curveType == null) { return null; } if (super.getRequirements(context, target, desiredValue) == null) { return null; } final Set<ValueRequirement> requirements = new HashSet<>(); final ValueProperties curveProperties = ValueProperties.with(CURVE, curveNames).get(); final ValueProperties properties = ValueProperties.with(PROPERTY_CURVE_TYPE, curveType) .with(CURVE_EXPOSURES, curveExposureConfigs) .get(); requirements.add( new ValueRequirement( CURVE_DEFINITION, ComputationTargetSpecification.NULL, curveProperties)); requirements.add( new ValueRequirement(BLOCK_CURVE_SENSITIVITIES, target.toSpecification(), properties)); return requirements; }
@SuppressWarnings("unchecked") @Override public Set<ComputedValue> execute( final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) { final HistoricalTimeSeriesSource timeSeriesSource = OpenGammaExecutionContext.getHistoricalTimeSeriesSource(executionContext); final ValueRequirement desiredValue = desiredValues.iterator().next(); Object value = timeSeriesSource.getLatestDataPoint(target.getUniqueId()); if (value == null) { value = MissingMarketDataSentinel.getInstance(); } else { final String adjusterString = desiredValue.getConstraint(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY); final HistoricalTimeSeriesAdjustment htsa = HistoricalTimeSeriesAdjustment.parse(adjusterString); value = htsa.adjust(((Pair<LocalDate, Double>) value).getValue()); } return Collections.singleton( new ComputedValue( new ValueSpecification( desiredValue.getValueName(), desiredValue.getTargetSpecification(), desiredValue.getConstraints()), value)); }
private static List<RequirementBasedColumnKey> getRequirements( ViewDefinition viewDefinition, EnumSet<ComputationTargetType> targetTypes) { List<RequirementBasedColumnKey> result = new ArrayList<RequirementBasedColumnKey>(); for (ViewCalculationConfiguration calcConfig : viewDefinition.getAllCalculationConfigurations()) { String calcConfigName = calcConfig.getName(); if (targetTypes.contains(ComputationTargetType.POSITION) || targetTypes.contains(ComputationTargetType.PORTFOLIO_NODE)) { for (Pair<String, ValueProperties> portfolioOutput : calcConfig.getAllPortfolioRequirements()) { String valueName = portfolioOutput.getFirst(); ValueProperties constraints = portfolioOutput.getSecond(); RequirementBasedColumnKey columnKey = new RequirementBasedColumnKey(calcConfigName, valueName, constraints); result.add(columnKey); } } for (ValueRequirement specificRequirement : calcConfig.getSpecificRequirements()) { if (!targetTypes.contains(specificRequirement.getTargetSpecification().getType())) { continue; } String valueName = specificRequirement.getValueName(); ValueProperties constraints = specificRequirement.getConstraints(); RequirementBasedColumnKey columnKey = new RequirementBasedColumnKey(calcConfigName, valueName, constraints); result.add(columnKey); } } return result; }
@Override public Set<ComputedValue> execute( final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) { double parentValue = 0; double targetValue = 0; final UniqueId targetIdentifier = target.getUniqueId(); for (final ComputedValue c : inputs.getAllValues()) { if (targetIdentifier.equals(c.getSpecification().getTargetSpecification().getUniqueId())) { targetValue = (Double) c.getValue(); } else { parentValue = (Double) c.getValue(); } } final ValueRequirement desiredValue = desiredValues.iterator().next(); return Collections.singleton( new ComputedValue( new ValueSpecification( ValueRequirementNames.WEIGHT, target.toSpecification(), desiredValue.getConstraints()), targetValue / parentValue)); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); Set<String> values = constraints.getValues(VALUE_PROPERTY_NAME); final String inputValue; if ((values == null) || values.isEmpty()) { inputValue = DEFAULT_VALUE_NAME; } else if (values.size() == 1) { inputValue = values.iterator().next(); } else { return null; } // Propogate the desired value constraints onto the requirements, removing those specific to // this function and adding a unit homogeneity clause final ValueProperties.Builder requirementConstraintsBuilder = constraints.copy().withoutAny(VALUE_PROPERTY_NAME); for (String unit : UnitProperties.unitPropertyNames()) { values = constraints.getValues(unit); if (values == null) { // Unit was not specified on the output, but we specify it on the inputs so we can check // homogeneity to ensure the division is valid requirementConstraintsBuilder.withOptional(unit); } } // Request value on the value and parent final ValueProperties requirementConstraints = requirementConstraintsBuilder.get(); return ImmutableSet.of( new ValueRequirement(inputValue, getValueTarget(target), requirementConstraints), new ValueRequirement(inputValue, getParentTarget(target), requirementConstraints)); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> payCurveNames = constraints.getValues(ValuePropertyNames.PAY_CURVE); if (payCurveNames == null || payCurveNames.size() != 1) { return null; } final Set<String> receiveCurveNames = constraints.getValues(ValuePropertyNames.RECEIVE_CURVE); if (receiveCurveNames == null || receiveCurveNames.size() != 1) { return null; } final Set<String> payCurveConfigNames = constraints.getValues(ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG); if (payCurveConfigNames == null || payCurveConfigNames.size() != 1) { return null; } final Set<String> receiveCurveConfigNames = constraints.getValues(ValuePropertyNames.RECEIVE_CURVE_CALCULATION_CONFIG); if (receiveCurveConfigNames == null || receiveCurveConfigNames.size() != 1) { return null; } final Set<String> daysForwardNames = constraints.getValues(PROPERTY_DAYS_TO_MOVE_FORWARD); if (daysForwardNames == null || daysForwardNames.size() != 1) { return null; } final String payCurveName = payCurveNames.iterator().next(); final String receiveCurveName = receiveCurveNames.iterator().next(); final String payCurveCalculationConfig = payCurveConfigNames.iterator().next(); final String receiveCurveCalculationConfig = receiveCurveConfigNames.iterator().next(); final FinancialSecurity security = (FinancialSecurity) target.getSecurity(); final Currency payCurrency = security.accept(ForexVisitors.getPayCurrencyVisitor()); final Currency receiveCurrency = security.accept(ForexVisitors.getReceiveCurrencyVisitor()); final ValueRequirement payFundingCurve = YieldCurveFunctionUtils.getCurveRequirementForFXForward( ComputationTargetSpecification.of(payCurrency), payCurveName, payCurveCalculationConfig, true); final ValueRequirement receiveFundingCurve = YieldCurveFunctionUtils.getCurveRequirementForFXForward( ComputationTargetSpecification.of(receiveCurrency), receiveCurveName, receiveCurveCalculationConfig, false); final ValueProperties optionalProperties = ValueProperties.builder() .with(PROPERTY_DAYS_TO_MOVE_FORWARD, daysForwardNames) .withOptional(PROPERTY_DAYS_TO_MOVE_FORWARD) .get(); final ValueRequirement pairQuoteRequirement = new ValueRequirement( ValueRequirementNames.CURRENCY_PAIRS, ComputationTargetSpecification.NULL, optionalProperties); return Sets.newHashSet(payFundingCurve, receiveFundingCurve, pairQuoteRequirement); }
public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { Set<ValueRequirement> superReqs = super.getRequirements(context, target, desiredValue); if (superReqs == null) { return null; } // Test constraints are provided, else set to "" final ValueProperties constraints = desiredValue.getConstraints(); ValueProperties.Builder scenarioDefaults = null; final Set<String> priceShiftSet = constraints.getValues(s_priceShift); if (priceShiftSet == null || priceShiftSet.isEmpty()) { scenarioDefaults = constraints.copy().withoutAny(s_priceShift).with(s_priceShift, ""); } final Set<String> priceShiftTypeSet = constraints.getValues(s_priceShiftType); if (priceShiftTypeSet == null || priceShiftTypeSet.isEmpty()) { if (scenarioDefaults == null) { scenarioDefaults = constraints .copy() .withoutAny(s_priceShiftType) .with(s_priceShiftType, "Multiplicative"); } else { scenarioDefaults = scenarioDefaults.withoutAny(s_priceShiftType).with(s_priceShiftType, "Multiplicative"); } } final Set<String> volShiftSet = constraints.getValues(s_volShift); if (volShiftSet == null || volShiftSet.isEmpty()) { if (scenarioDefaults == null) { scenarioDefaults = constraints.copy().withoutAny(s_volShift).with(s_volShift, ""); } else { scenarioDefaults = scenarioDefaults.withoutAny(s_volShift).with(s_volShift, ""); } } final Set<String> volShiftSetType = constraints.getValues(s_volShiftType); if (volShiftSetType == null || volShiftSetType.isEmpty()) { if (scenarioDefaults == null) { scenarioDefaults = constraints.copy().withoutAny(s_volShiftType).with(s_volShiftType, "Multiplicative"); } else { scenarioDefaults = scenarioDefaults.withoutAny(s_volShiftType).with(s_volShiftType, "Multiplicative"); } } // If defaults have been added, this adds additional copy of the Function into dep graph with // the adjusted constraints if (scenarioDefaults != null) { return Collections.singleton( new ValueRequirement( getValueRequirementName(), target.toSpecification(), scenarioDefaults.get())); } else { // Scenarios are defined, so we're satisfied return superReqs; } }
@Override public Set<ComputedValue> execute( final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) { String curveName = null; String curveCalculationConfig = null; for (final ValueRequirement requirement : desiredValues) { final ValueProperties constraints = requirement.getConstraints(); final Set<String> values = constraints.getValues(ValuePropertyNames.CURVE); if (values != null) { curveName = values.iterator().next(); } final Set<String> curveConfigValues = constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if (curveConfigValues != null) { curveCalculationConfig = curveConfigValues.iterator().next(); } } assert curveName != null; assert curveCalculationConfig != null; final RawSecurity security = (RawSecurity) target.getSecurity(); // final BigDecimal qty = target.getPosition().getQuantity(); final ValueRequirement curveRequirement = getCurveRequirement(target, curveName, curveCalculationConfig); final Object curveObject = inputs.getValue(curveRequirement); if (curveObject == null) { throw new OpenGammaRuntimeException("Could not get " + curveRequirement); } Object curveSpecObject = null; final ValueRequirement curveSpecRequirement = getCurveSpecRequirement(target, curveName); curveSpecObject = inputs.getValue(curveSpecRequirement); if (curveSpecObject == null) { throw new OpenGammaRuntimeException("Could not get " + curveSpecRequirement); } final YieldAndDiscountCurve curve = (YieldAndDiscountCurve) curveObject; final InterpolatedYieldCurveSpecificationWithSecurities curveSpec = (InterpolatedYieldCurveSpecificationWithSecurities) curveSpecObject; final LinkedHashMap<String, YieldAndDiscountCurve> interpolatedCurves = new LinkedHashMap<String, YieldAndDiscountCurve>(); interpolatedCurves.put(curveName, curve); final YieldCurveBundle bundle = new YieldCurveBundle(interpolatedCurves); final DoubleMatrix1D sensitivitiesForCurves = getSensitivities(executionContext.getSecuritySource(), inputs, security, curveSpec, curve); final ValueProperties.Builder properties = createValueProperties(target) .with(ValuePropertyNames.CURVE, curveName) .with(ValuePropertyNames.CURVE_CALCULATION_CONFIG, curveCalculationConfig); final ComputationTargetSpecification targetSpec = target.toSpecification(); final ValueSpecification resultSpec = new ValueSpecification(YCNS_REQUIREMENT, targetSpec, properties.get()); final Set<ComputedValue> results = YieldCurveNodeSensitivitiesHelper.getInstrumentLabelledSensitivitiesForCurve( curveName, bundle, sensitivitiesForCurves, curveSpec, resultSpec); // s_logger.debug("execute, returning " + results); return results; }
/** * Respecifies the properties to match a tighter requirement. * * <p>This adds a new requirement to the specification. It requires {@code * requirement.isSatisfiedBy(this) == true}. * * @param requirement additional requirement to reduce properties against * @return the value specification based on this with the additional requirement added, not null */ public ValueSpecification compose(final ValueRequirement requirement) { assert requirement.isSatisfiedBy(this); final ValueProperties oldProperties = getProperties(); final ValueProperties newProperties = oldProperties.compose(requirement.getConstraints()); if (newProperties == oldProperties) { return this; } else { return new ValueSpecification(getValueName(), getTargetSpecification(), newProperties); } }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> surfaceNames = constraints.getValues(ValuePropertyNames.SURFACE); if (surfaceNames == null || surfaceNames.size() != 1) { return null; } final Set<String> curveCalculationConfigNames = constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) { return null; } final String curveCalculationConfigName = curveCalculationConfigNames.iterator().next(); final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context); final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource); final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName); if (curveCalculationConfig == null) { s_logger.error( "Could not find curve calculation configuration named " + curveCalculationConfigName); return null; } final Currency currency = FinancialSecurityUtils.getCurrency(target.getSecurity()); if (!ComputationTargetSpecification.of(currency).equals(curveCalculationConfig.getTarget())) { s_logger.error( "Security currency and curve calculation config id were not equal; have {} and {}", currency, curveCalculationConfig.getTarget()); return null; } final String surfaceName = surfaceNames.iterator().next(); final Set<ValueRequirement> requirements = new HashSet<>(); requirements.addAll( YieldCurveFunctionUtils.getCurveRequirements( curveCalculationConfig, curveCalculationConfigSource)); requirements.add(getVolatilityRequirement(surfaceName, currency)); final FinancialSecurity security = (FinancialSecurity) target.getSecurity(); try { final Set<ValueRequirement> timeSeriesRequirements = _definitionConverter.getConversionTimeSeriesRequirements( security, security.accept(_visitor)); if (timeSeriesRequirements == null) { return null; } requirements.addAll(timeSeriesRequirements); return requirements; } catch (final Exception e) { s_logger.error(e.getMessage()); return null; } }
@Override public Set<ValueSpecification> getResults( final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) { if (inputs.size() == 1) { final ValueSpecification input = Iterables.getOnlyElement(inputs.keySet()); if (ValueRequirementNames.PNL_SERIES.equals(input.getValueName())) { return Collections.singleton(input); } } final FXForwardSecurity security = (FXForwardSecurity) target.getPosition().getSecurity(); final CurrencyPair currencyPair = _currencyPairs.getCurrencyPair(security.getPayCurrency(), security.getReceiveCurrency()); if (currencyPair == null) { return null; } final Currency currencyBase = currencyPair.getBase(); String resultCurrency = null; final ValueProperties.Builder builder = createValueProperties(); for (final Map.Entry<ValueSpecification, ValueRequirement> entry : inputs.entrySet()) { final ValueSpecification inputSpec = entry.getKey(); final ValueRequirement inputReq = entry.getValue(); if (inputReq.getValueName().equals(RETURN_SERIES)) { final Set<String> resultCurrencies = inputReq.getConstraints().getValues(CURRENCY); if (resultCurrencies != null && resultCurrencies.size() == 1) { resultCurrency = inputReq.getConstraint(CURRENCY); } else { resultCurrency = currencyBase.getCode(); } } for (final String propertyName : inputSpec.getProperties().getProperties()) { if (ValuePropertyNames.FUNCTION.equals(propertyName)) { continue; } final Set<String> values = inputSpec.getProperties().getValues(propertyName); if (values == null || values.isEmpty()) { builder.withAny(propertyName); } else { builder.with(propertyName, values); } } } if (resultCurrency == null) { return null; } builder .with(ValuePropertyNames.CURRENCY, resultCurrency) .with( ValuePropertyNames.PROPERTY_PNL_CONTRIBUTIONS, ValueRequirementNames.FX_CURRENCY_EXPOSURE); return ImmutableSet.of( new ValueSpecification( ValueRequirementNames.PNL_SERIES, target.toSpecification(), builder.get())); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final Set<String> daysForwardNames = desiredValue.getConstraints().getValues(PROPERTY_DAYS_TO_MOVE_FORWARD); if (daysForwardNames == null || daysForwardNames.size() != 1) { return null; } return super.getRequirements(context, target, desiredValue); }
/** * Creates a new specification to satisfy the given requirement. * * <p>The properties must include the function identifier and be able to satisfy the constraints * of the original requirement. * * @param requirementSpecification a requirement, not null * @param properties the value properties, not null and must include the function identifier */ public ValueSpecification( final ValueRequirement requirementSpecification, final ValueProperties properties) { ArgumentChecker.notNull(requirementSpecification, "requirementSpecification"); ArgumentChecker.notNull(properties, "properties"); ArgumentChecker.notNull( properties.getValues(ValuePropertyNames.FUNCTION), "properties.FUNCTION"); assert requirementSpecification.getConstraints().isSatisfiedBy(properties); // requirement specification interns its valueName _valueName = requirementSpecification.getValueName(); _targetSpecification = requirementSpecification.getTargetSpecification(); _properties = properties; }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final Set<ValueRequirement> requirements = new HashSet<>(); final ValueProperties constraints = desiredValue.getConstraints(); // curve final String curveName = constraints.getStrictValue(ValuePropertyNames.CURVE); if (curveName == null) { return null; } // interpolator final String interpolatorName = constraints.getStrictValue( ForwardCurveValuePropertyNames.PROPERTY_FORWARD_CURVE_INTERPOLATOR); if (interpolatorName == null) { return null; } // interpolator left extrapolator final String leftExtrapolatorName = constraints.getStrictValue( ForwardCurveValuePropertyNames.PROPERTY_FORWARD_CURVE_LEFT_EXTRAPOLATOR); if (leftExtrapolatorName == null) { return null; } // interpolator right extrapolator final String rightExtrapolatorName = constraints.getStrictValue( ForwardCurveValuePropertyNames.PROPERTY_FORWARD_CURVE_RIGHT_EXTRAPOLATOR); if (rightExtrapolatorName == null) { return null; } final ValueProperties futureCurveProperties = ValueProperties.builder() .with( InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, InstrumentTypeProperties.EQUITY_FUTURE_PRICE) .with(ValuePropertyNames.CURVE, curveName) .get(); requirements.add( new ValueRequirement( ValueRequirementNames.FUTURE_PRICE_CURVE_DATA, target.toSpecification(), futureCurveProperties)); return requirements; }
/** * Simplifies the type based on the associated {@link ComputationTargetResolver}. * * @param valueReq the requirement to process, not null * @return the possibly simplified requirement, not null */ public ValueRequirement simplifyType(final ValueRequirement valueReq) { final ComputationTargetReference oldTargetRef = valueReq.getTargetReference(); final ComputationTargetReference newTargetRef = ComputationTargetResolverUtils.simplifyType( oldTargetRef, getCompilationContext().getComputationTargetResolver()); if (newTargetRef == oldTargetRef) { return valueReq; } else { return MemoryUtils.instance( new ValueRequirement(valueReq.getValueName(), newTargetRef, valueReq.getConstraints())); } }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final Set<String> curveNames = desiredValue.getConstraints().getValues(ValuePropertyNames.CURVE); if (curveNames == null || curveNames.size() != 1) { return null; } final String curveName = Iterables.getOnlyElement(curveNames); final Set<String> curveCalculationConfigNames = desiredValue.getConstraints().getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) { return null; } final String curveCalculationConfigName = Iterables.getOnlyElement(curveCalculationConfigNames); final EquityVarianceSwapSecurity security = (EquityVarianceSwapSecurity) target.getSecurity(); return Sets.newHashSet( getSpotRequirement(security), getDiscountRequirement(security, curveName, curveCalculationConfigName)); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final Set<ValueRequirement> requirements = super.getRequirements(context, target, desiredValue); if (requirements == null) { return null; } requirements.add( new ValueRequirement( ValueRequirementNames.GAMMA, target.toSpecification(), desiredValue.getConstraints())); return requirements; }
/** * Creates a new specification to satisfy the the given requirement. * * <p>The properties of the new specification are the constraints from the requirement with the * function identifier added. * * @param requirementSpecification a value requirement, not null * @param functionIdentifier the unique identifier of the function producing this value, not null */ public ValueSpecification( final ValueRequirement requirementSpecification, final String functionIdentifier) { ArgumentChecker.notNull(requirementSpecification, "requirementSpecification"); ArgumentChecker.notNull(functionIdentifier, "functionIdentifier"); // requirement specification interns its valueName _valueName = requirementSpecification.getValueName(); _targetSpecification = requirementSpecification.getTargetSpecification(); _properties = requirementSpecification .getConstraints() .copy() .with(ValuePropertyNames.FUNCTION, functionIdentifier) .get(); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> forwardCurveNames = constraints.getValues(YieldCurveFunction.PROPERTY_FORWARD_CURVE); if (forwardCurveNames == null || forwardCurveNames.size() != 1) { return null; } final Set<String> fundingCurveNames = constraints.getValues(YieldCurveFunction.PROPERTY_FUNDING_CURVE); if (fundingCurveNames == null || fundingCurveNames.size() != 1) { return null; } final Set<String> surfaceNames = constraints.getValues(ValuePropertyNames.SURFACE); if (surfaceNames == null || surfaceNames.size() != 1) { return null; } final Set<String> curveCalculationMethods = constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_METHOD); if (curveCalculationMethods == null || curveCalculationMethods.size() != 1) { return null; } final String forwardCurveName = forwardCurveNames.iterator().next(); final String fundingCurveName = fundingCurveNames.iterator().next(); final String surfaceName = surfaceNames.iterator().next(); final String curveCalculationMethod = curveCalculationMethods.iterator().next(); final Set<ValueRequirement> requirements = Sets.newHashSetWithExpectedSize(4); final Currency currency = FinancialSecurityUtils.getCurrency(target.getSecurity()); requirements.add( getCurveRequirement( forwardCurveName, forwardCurveName, fundingCurveName, curveCalculationMethod, currency)); requirements.add( getCurveRequirement( fundingCurveName, forwardCurveName, fundingCurveName, curveCalculationMethod, currency)); requirements.add(getVolatilityRequirement(surfaceName, currency)); return requirements; }
@Override public ComputedValue getComputedValue(final ValueRequirement requirement) { final Pair<String, Object> key = Pair.of( requirement.getValueName(), targetSpecKey(_resolver.getTargetSpecification(requirement.getTargetReference()))); final ComputedValue[] values = _valuesByRequirement.get(key); if (values != null) { for (final ComputedValue value : values) { // Shortcut to check the properties as we already know the name and target match if (requirement.getConstraints().isSatisfiedBy(value.getSpecification().getProperties())) { return value; } } } return null; }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> curveCalculationConfigNames = constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) { return null; } final String curveCalculationConfigName = curveCalculationConfigNames.iterator().next(); final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context); final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource); final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName); if (curveCalculationConfig == null) { s_logger.error( "Could not find curve calculation configuration named " + curveCalculationConfigName); return null; } final FinancialSecurity security = (FinancialSecurity) target.getSecurity(); final Currency currency = FinancialSecurityUtils.getCurrency(security); if (!currency.equals(curveCalculationConfig.getUniqueId())) { s_logger.error( "Security currency and curve calculation config id were not equal; have {} and {}", currency, curveCalculationConfig.getUniqueId()); } final Set<ValueRequirement> requirements = new HashSet<ValueRequirement>(); requirements.addAll( YieldCurveFunctionUtils.getCurveRequirements( curveCalculationConfig, curveCalculationConfigSource)); final Set<ValueRequirement> timeSeriesRequirements = getDerivativeTimeSeriesRequirements( security, security.accept(_visitor), _definitionConverter); if (timeSeriesRequirements == null) { return null; } requirements.addAll(timeSeriesRequirements); return requirements; }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext compilationContext, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> rootFinderAbsoluteTolerance = constraints.getValues(PROPERTY_ROOT_FINDER_ABSOLUTE_TOLERANCE); if (rootFinderAbsoluteTolerance == null || rootFinderAbsoluteTolerance.size() != 1) { return null; } final Set<String> rootFinderRelativeTolerance = constraints.getValues(PROPERTY_ROOT_FINDER_RELATIVE_TOLERANCE); if (rootFinderRelativeTolerance == null || rootFinderRelativeTolerance.size() != 1) { return null; } final Set<String> maxIterations = constraints.getValues(PROPERTY_ROOT_FINDER_MAX_ITERATIONS); if (maxIterations == null || maxIterations.size() != 1) { return null; } final Set<String> decomposition = constraints.getValues(PROPERTY_DECOMPOSITION); if (decomposition == null || decomposition.size() != 1) { return null; } final Set<String> useFiniteDifference = constraints.getValues(PROPERTY_USE_FINITE_DIFFERENCE); if (useFiniteDifference == null || useFiniteDifference.size() != 1) { return null; } if (!_originalConfiguration.getTarget().equals(target.toSpecification())) { s_logger.info( "Invalid target, was {} - expected {}", target, _originalConfiguration.getTarget()); return null; } final ValueProperties properties = ValueProperties.builder() .with(CURVE_CALCULATION_METHOD, _originalConfiguration.getCalculationMethod()) .with(CURVE_CALCULATION_CONFIG, _originalConfiguration.getCalculationConfigName()) .with(CURVE, _originalCurveName) .get(); return Collections.singleton( new ValueRequirement(YIELD_CURVE, target.toSpecification(), properties)); }
@Override public Set<ValueRequirement> getRequirements( final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final Set<ValueRequirement> requirements = super.getRequirements(context, target, desiredValue); if (requirements == null) { return null; } final ValueProperties constraints = desiredValue.getConstraints(); final Set<String> cutoffNames = constraints.getValues(SABRRightExtrapolationFunction.PROPERTY_CUTOFF_STRIKE); if (cutoffNames == null || cutoffNames.size() != 1) { return null; } final Set<String> muNames = constraints.getValues(SABRRightExtrapolationFunction.PROPERTY_TAIL_THICKNESS_PARAMETER); if (muNames == null || muNames.size() != 1) { return null; } return requirements; }
@Override public Set<ComputedValue> execute( final FunctionExecutionContext context, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) throws AsynchronousExecution { final MultipleCurrencyParameterSensitivity sensitivities = (MultipleCurrencyParameterSensitivity) inputs.getValue(BLOCK_CURVE_SENSITIVITIES); final ValueRequirement desiredValue = desiredValues.iterator().next(); final ValueProperties properties = desiredValue.getConstraints(); final String desiredCurveName = desiredValue.getConstraint(CURVE); final Map<Pair<String, Currency>, DoubleMatrix1D> entries = sensitivities.getSensitivities(); final Set<ComputedValue> results = new HashSet<>(); for (final Map.Entry<Pair<String, Currency>, DoubleMatrix1D> entry : entries.entrySet()) { final String curveName = entry.getKey().getFirst(); if (desiredCurveName.equals(curveName)) { final ValueProperties curveSpecificProperties = properties.copy().withoutAny(CURVE).with(CURVE, curveName).get(); final CurveDefinition curveDefinition = (CurveDefinition) inputs.getValue( new ValueRequirement( CURVE_DEFINITION, ComputationTargetSpecification.NULL, ValueProperties.builder().with(CURVE, curveName).get())); final DoubleLabelledMatrix1D ycns = MultiCurveUtils.getLabelledMatrix(entry.getValue(), curveDefinition); final ValueSpecification spec = new ValueSpecification( YIELD_CURVE_NODE_SENSITIVITIES, target.toSpecification(), curveSpecificProperties); results.add(new ComputedValue(spec, ycns)); return results; } } s_logger.info( "Could not get sensitivities to " + desiredCurveName + " for " + target.getName()); return Collections.emptySet(); }
@Override public Set<ValueSpecification> getResults( final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) { String currencyPairConfigName = null; String payCurveName = null; String payCurveCalculationConfig = null; String receiveCurveName = null; String receiveCurveCalculationConfig = null; String daysForward = null; for (final Map.Entry<ValueSpecification, ValueRequirement> entry : inputs.entrySet()) { final ValueSpecification specification = entry.getKey(); final ValueRequirement requirement = entry.getValue(); if (specification.getValueName().equals(ValueRequirementNames.CURRENCY_PAIRS)) { currencyPairConfigName = specification.getProperty(CurrencyPairsFunction.CURRENCY_PAIRS_NAME); daysForward = requirement.getConstraint(PROPERTY_DAYS_TO_MOVE_FORWARD); } else if (requirement.getValueName().equals(ValueRequirementNames.YIELD_CURVE)) { final ValueProperties constraints = requirement.getConstraints(); if (constraints.getProperties().contains(ValuePropertyNames.PAY_CURVE)) { payCurveName = Iterables.getOnlyElement(constraints.getValues(ValuePropertyNames.CURVE)); payCurveCalculationConfig = Iterables.getOnlyElement( constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG)); } else if (constraints.getProperties().contains(ValuePropertyNames.RECEIVE_CURVE)) { receiveCurveName = Iterables.getOnlyElement(constraints.getValues(ValuePropertyNames.CURVE)); receiveCurveCalculationConfig = Iterables.getOnlyElement( constraints.getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG)); } } } assert currencyPairConfigName != null; final CurrencyPairs baseQuotePairs = OpenGammaCompilationContext.getCurrencyPairsSource(context) .getCurrencyPairs(currencyPairConfigName); final FinancialSecurity security = (FinancialSecurity) target.getSecurity(); final Currency payCurrency = security.accept(ForexVisitors.getPayCurrencyVisitor()); final Currency receiveCurrency = security.accept(ForexVisitors.getReceiveCurrencyVisitor()); final CurrencyPair baseQuotePair = baseQuotePairs.getCurrencyPair(payCurrency, receiveCurrency); if (baseQuotePair == null) { s_logger.error( "Could not get base/quote pair for currency pair (" + payCurrency + ", " + receiveCurrency + ")"); return null; } final ValueSpecification resultSpec = new ValueSpecification( getValueRequirementName(), target.toSpecification(), getResultProperties( target, payCurveName, receiveCurveName, payCurveCalculationConfig, receiveCurveCalculationConfig, baseQuotePair, daysForward) .get()); return Collections.singleton(resultSpec); }
@Override public Set<ComputedValue> execute( final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) throws AsynchronousExecution { final ZonedDateTime now = ZonedDateTime.now(executionContext.getValuationClock()); final ValueRequirement requirement = desiredValues.iterator().next(); final ValueProperties properties = requirement.getConstraints().copy().get(); final LegacyVanillaCDSSecurity security = (LegacyVanillaCDSSecurity) target.getSecurity(); // LegacyVanillaCreditDefaultSwapDefinition cds = // _converter.visitLegacyVanillaCDSSecurity(security); final ValueRequirement desiredValue = desiredValues.iterator().next(); // all same constraints final String quoteConventionString = desiredValue.getConstraint(ISDAFunctionConstants.CDS_QUOTE_CONVENTION); final StandardCDSQuotingConvention quoteConvention = StandardCDSQuotingConvention.parse(quoteConventionString); final CdsRecoveryRateIdentifier recoveryRateIdentifier = security.accept( new CreditSecurityToRecoveryRateVisitor(executionContext.getSecuritySource())); Object recoveryRateObject = inputs.getValue( new ValueRequirement( "PX_LAST", ComputationTargetType.PRIMITIVE, recoveryRateIdentifier.getExternalId())); if (recoveryRateObject == null) { throw new OpenGammaRuntimeException("Could not get recovery rate"); // s_logger.warn("Could not get recovery rate, defaulting to 0.4: " + recoveryRateIdentifier); // recoveryRateObject = 0.4; } final double recoveryRate = (Double) recoveryRateObject; // get the isda curve final Object isdaObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE); if (isdaObject == null) { throw new OpenGammaRuntimeException("Couldn't get isda curve"); } final ISDACompliantYieldCurve yieldCurve = (ISDACompliantYieldCurve) isdaObject; // spreads NodalTenorDoubleCurve spreadObject = (NodalTenorDoubleCurve) inputs.getValue(ValueRequirementNames.BUCKETED_SPREADS); if (spreadObject == null) { throw new OpenGammaRuntimeException("Unable to get spreads"); } final double[] spreads = ArrayUtils.toPrimitive(spreadObject.getYData()); // final String pillarString = IMMDateGenerator.isIMMDate(security.getMaturityDate()) ? // requirement.getConstraint(ISDAFunctionConstants.ISDA_BUCKET_TENORS) : // ISDACompliantCreditCurveFunction.NON_IMM_PILLAR_TENORS; final ZonedDateTime[] bucketDates = SpreadCurveFunctions.getPillarDates(now, spreadObject.getXData()); final CDSQuoteConvention[] quotes = SpreadCurveFunctions.getQuotes( security.getMaturityDate(), spreads, security.getParSpread(), quoteConvention, false); // spreads NodalTenorDoubleCurve pillarObject = (NodalTenorDoubleCurve) inputs.getValue(ValueRequirementNames.PILLAR_SPREADS); if (pillarObject == null) { throw new OpenGammaRuntimeException("Unable to get pillars"); } // CDS analytics for credit curve (possible performance improvement if earlier result obtained) // final LegacyVanillaCreditDefaultSwapDefinition curveCDS = cds.withStartDate(now); // security.setStartDate(now); // needed for curve instruments final CDSAnalytic[] bucketCDSs = new CDSAnalytic[bucketDates.length]; for (int i = 0; i < bucketCDSs.length; i++) { // security.setMaturityDate(bucketDates[i]); final CDSAnalyticVisitor visitor = new CDSAnalyticVisitor( now.toLocalDate(), _holidaySource, _regionSource, security.getStartDate().toLocalDate(), bucketDates[i].toLocalDate(), recoveryRate); bucketCDSs[i] = security.accept(visitor); } final ZonedDateTime[] pillarDates = SpreadCurveFunctions.getPillarDates(now, pillarObject.getXData()); final CDSAnalytic[] pillarCDSs = new CDSAnalytic[pillarDates.length]; for (int i = 0; i < pillarCDSs.length; i++) { // security.setMaturityDate(bucketDates[i]); final CDSAnalyticVisitor visitor = new CDSAnalyticVisitor( now.toLocalDate(), _holidaySource, _regionSource, security.getStartDate().toLocalDate(), pillarDates[i].toLocalDate(), recoveryRate); pillarCDSs[i] = security.accept(visitor); } final ISDACompliantCreditCurve creditCurve = (ISDACompliantCreditCurve) inputs.getValue(ValueRequirementNames.HAZARD_RATE_CURVE); if (creditCurve == null) { throw new OpenGammaRuntimeException("Couldnt get credit curve"); } // final CDSAnalytic analytic = CDSAnalyticConverter.create(cds, now.toLocalDate()); final CDSAnalyticVisitor visitor = new CDSAnalyticVisitor(now.toLocalDate(), _holidaySource, _regionSource, recoveryRate); final CDSAnalytic analytic = security.accept(visitor); final BuySellProtection buySellProtection = security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL; // final String term = new Tenor(Period.between(security.getStartDate().toLocalDate(), // security.getMaturityDate().toLocalDate())).getPeriod().toString(); // final Double cdsQuoteDouble = (Double) inputs.getValue(new // ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, // ComputationTargetType.PRIMITIVE, ExternalId.of("Tenor", term))); final Double cdsQuoteDouble = (Double) inputs.getValue(MarketDataRequirementNames.MARKET_VALUE); if (cdsQuoteDouble == null) { throw new OpenGammaRuntimeException("Couldn't get spread for " + security); } final CDSQuoteConvention quote = SpreadCurveFunctions.getQuotes( security.getMaturityDate(), new double[] {cdsQuoteDouble}, security.getParSpread(), quoteConvention, true)[0]; boolean isNonIMMFAndFromPUF = !IMMDateLogic.isIMMDate(security.getMaturityDate().toLocalDate()) && quote instanceof PointsUpFront; boolean isNonIMMAndFromSpread = !IMMDateLogic.isIMMDate(security.getMaturityDate().toLocalDate()) && (quote instanceof QuotedSpread || quote instanceof ParSpread); int buySellPremiumFactor = security.isBuy() ? -1 : 1; final double notional = security.getNotional().getAmount(); final double coupon = security.getParSpread() * ONE_BPS; final PointsUpFront puf = getPointsUpfront(quote, buySellProtection, yieldCurve, analytic, creditCurve); final double accruedPremiumPrim = isNonIMMAndFromSpread || isNonIMMFAndFromPUF ? 0 : analytic.getAccruedPremium(coupon); // final double accruedPremium = isNonIMMAndFromSpread || isNonIMMFAndFromPUF ? 0 : // analytic.getAccruedPremium(coupon) * notional * buySellPremiumFactor; final double accruedPremium = isNonIMMAndFromSpread || isNonIMMFAndFromPUF ? 0 : accruedPremiumPrim * notional * buySellPremiumFactor; final int accruedDays = isNonIMMAndFromSpread || isNonIMMFAndFromPUF ? 0 : analytic.getAccuredDays(); final double quotedSpread = getQuotedSpread(quote, puf, buySellProtection, yieldCurve, analytic).getQuotedSpread(); final double upfrontAmount = isNonIMMAndFromSpread ? 0 : getUpfrontAmount(analytic, puf, notional, accruedPremiumPrim, buySellProtection); final double cleanPV = puf.getPointsUpFront() * notional; final double principal = isNonIMMAndFromSpread ? 0 : cleanPV; final double cleanPrice = getCleanPrice(puf); final TenorLabelledMatrix1D bucketedCS01 = getBucketedCS01( analytic, bucketCDSs, spreadObject.getXData(), quote, notional, yieldCurve, creditCurve); final double parallelCS01 = getParallelCS01( quote, analytic, yieldCurve, notional, pillarCDSs, ArrayUtils.toPrimitive(pillarObject.getYData())); final Set<ComputedValue> results = Sets.newHashSetWithExpectedSize(_valueRequirements.length); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.ACCRUED_PREMIUM, target.toSpecification(), properties), accruedPremium)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.ACCRUED_DAYS, target.toSpecification(), properties), accruedDays)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.QUOTED_SPREAD, target.toSpecification(), properties), quotedSpread / ONE_BPS)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.UPFRONT_AMOUNT, target.toSpecification(), properties), upfrontAmount)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.DIRTY_PRESENT_VALUE, target.toSpecification(), properties), upfrontAmount)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.CLEAN_PRESENT_VALUE, target.toSpecification(), properties), cleanPV)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.PRINCIPAL, target.toSpecification(), properties), principal)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.CLEAN_PRICE, target.toSpecification(), properties), cleanPrice)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.BUCKETED_CS01, target.toSpecification(), properties), bucketedCS01)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.PARALLEL_CS01, target.toSpecification(), properties), parallelCS01)); results.add( new ComputedValue( new ValueSpecification( ValueRequirementNames.POINTS_UPFRONT, target.toSpecification(), properties), puf.getPointsUpFront())); return results; }