Package com.opengamma.engine.value

Examples of com.opengamma.engine.value.ComputedValue


      throw new OpenGammaRuntimeException("Could not get any values for security " + position.getSecurity());
    }
    result = result.multiply(position.getQuantity().doubleValue());
    final ValueProperties resultProperties = getResultProperties(desiredValue, currencyString);
    final ValueSpecification resultSpec = new ValueSpecification(ValueRequirementNames.PNL_SERIES, target.toSpecification(), resultProperties);
    return Sets.newHashSet(new ComputedValue(resultSpec, result));
  }
View Full Code Here


    final Map<ValueGreek, Double> sensitivities = _converter.evaluate(dataBundle);
    final Set<ComputedValue> results = new HashSet<ComputedValue>();
    ValueGreek valueGreek;
    Double valueGreekResult;
    ValueSpecification resultSpecification;
    ComputedValue resultValue;
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    for (final ValueRequirement dV : desiredValues) {
      valueGreek = AvailableValueGreeks.getValueGreekForValueRequirementName(dV.getValueName());
      valueGreekResult = sensitivities.get(valueGreek);
      resultSpecification = new ValueSpecification(dV.getValueName(), targetSpec, dV.getConstraints());
      resultValue = new ComputedValue(resultSpecification, valueGreekResult);
      results.add(resultValue);
    }
    return results;
  }
View Full Code Here

    final Map<PositionGreek, Double> positionGreeks = _converter.evaluate(dataBundle);
    final Set<ComputedValue> results = new HashSet<ComputedValue>();
    PositionGreek positionGreek;
    Double positionGreekResult;
    ValueSpecification resultSpecification;
    ComputedValue resultValue;
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    final ValueProperties properties = createValueProperties().get();
    for (final ValueRequirement dV : desiredValues) {
      positionGreek = AvailablePositionGreeks.getPositionGreekForValueRequirementName(dV.getValueName());
      positionGreekResult = positionGreeks.get(positionGreek);
      resultSpecification = new ValueSpecification(dV.getValueName(), targetSpec, properties);
      resultValue = new ComputedValue(resultSpecification, positionGreekResult);
      results.add(resultValue);
    }
    return results;
  }
View Full Code Here

    if (pnlSeries == null) {
      throw new OpenGammaRuntimeException("Could not get any values for security " + position.getSecurity());
    }
    pnlSeries = pnlSeries.multiply(position.getQuantity().doubleValue());
    final ValueSpecification resultSpec = new ValueSpecification(ValueRequirementNames.PNL_SERIES, target.toSpecification(), desiredValue.getConstraints());
    return Sets.newHashSet(new ComputedValue(resultSpec, pnlSeries));
  }
View Full Code Here

  @Override
  public Set<ComputedValue> execute(FunctionExecutionContext executionContext, FunctionInputs inputs, ComputationTarget target, Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
    ValueRequirement desiredValue = desiredValues.iterator().next();
    Object result = inputs.getValue(_valueRequirementName);
    return ImmutableSet.of(new ComputedValue(new ValueSpecification(_valueRequirementName, target.toSpecification(), desiredValue.getConstraints()), result));
  }
View Full Code Here

        .with(ValuePropertyNames.SAMPLING_FUNCTION, samplingFunctionName.iterator().next())
        .with(ValuePropertyNames.RETURN_CALCULATOR, returnCalculatorName.iterator().next())
        .with(ValuePropertyNames.PROPERTY_PNL_CONTRIBUTIONS, "Delta")
        .get();
    final ValueSpecification resultSpecification = new ValueSpecification(ValueRequirementNames.PNL_SERIES, positionSpec, properties);
    final ComputedValue resultValue = new ComputedValue(resultSpecification, result);
    return Collections.singleton(resultValue);
  }
View Full Code Here

  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final ComputedValue fairValueCV = inputs.getComputedValue(ValueRequirementNames.FAIR_VALUE);
    final Object fairValueObj = fairValueCV.getValue();
    if (fairValueObj == null) {
      throw new OpenGammaRuntimeException("Asset fair value was null");
    }
    final double fairValue = (Double) fairValueObj;
    final Object priceSeriesObj = inputs.getValue(ValueRequirementNames.PRICE_SERIES);
    if (priceSeriesObj == null) {
      throw new OpenGammaRuntimeException("Asset price series was null");
    }
    final Set<String> returnCalculatorNames = desiredValue.getConstraints().getValues(ValuePropertyNames.RETURN_CALCULATOR);
    final TimeSeriesReturnCalculator returnCalculator = getTimeSeriesReturnCalculator(returnCalculatorNames);
    final LocalDateDoubleTimeSeries returnSeries = (LocalDateDoubleTimeSeries) returnCalculator.evaluate((LocalDateDoubleTimeSeries) priceSeriesObj);
    final ValueSpecification resultSpec = new ValueSpecification(ValueRequirementNames.PNL_SERIES, target.toSpecification(), desiredValue.getConstraints());
    //final Object result = returnSeries.multiply(fairValue);
    final Object result = returnSeries.multiply(fairValue).multiply(target.getPosition().getQuantity().doubleValue());
    return Collections.singleton(new ComputedValue(resultSpec, result));
  }
View Full Code Here

    final String fullCurveName = callCurrencyCurve + "_" + callCurrency.getCode();
    final MultipleCurrencyInterestRateCurveSensitivity curveSensitivities = (MultipleCurrencyInterestRateCurveSensitivity) curveSensitivitiesObject;
    final Map<String, List<DoublesPair>> sensitivitiesForCurrency = curveSensitivities.getSensitivity(Currency.of(resultCurrency)).getSensitivities();
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.VALUE_RHO, target.toSpecification(), getResultProperties(target, desiredValue, baseQuotePair).get());
    final double rho = sensitivitiesForCurrency.get(fullCurveName).get(0).second;
    return Collections.singleton(new ComputedValue(spec, rho));
  }
View Full Code Here

    } else {
      scale = Double.parseDouble(scaleFactors.iterator().next());
    }
    if (data instanceof SmileDeltaTermStructureDataBundle) {
      final CurrencyAmount result = forex.accept(CALCULATOR, data);
      return Collections.singleton(new ComputedValue(spec, result.getAmount() / scale));
    }
    throw new OpenGammaRuntimeException("Can only calculate theta for surfaces with smiles");
  }
View Full Code Here

    final LocalDate[] schedule = HOLIDAY_REMOVER.getStrippedSchedule(scheduleCalculator.getSchedule(startDate, now, true, false), WEEKEND_CALENDAR); //REVIEW emcleod should "fromEnd" be hard-coded?
    DateDoubleTimeSeries<?> pnlSeries = samplingFunction.getSampledTimeSeries(dbTimeSeries.getTimeSeries(), schedule);
    pnlSeries = DIFFERENCE.evaluate(pnlSeries);
    pnlSeries = pnlSeries.multiply(pv);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.PNL_SERIES, target.toSpecification(), desiredValue.getConstraints());
    return Collections.singleton(new ComputedValue(spec, pnlSeries));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.value.ComputedValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.