Package com.opengamma.engine.value

Examples of com.opengamma.engine.value.ComputedValueResult


      final String targetTypeIdVersion = rs.getString("target_type_id_version");
      final UniqueId targetId = UniqueId.of(targetTypeIdScheme, targetTypeIdValue, targetTypeIdVersion);
      final ValueProperties valueProperties = RiskValueProperties.parseJson(valueRequirementsSyntheticForm);
      final String configurationName = rs.getString("config_name");
      final ValueSpecification valueSpecification = ValueSpecification.of(valueName, computationTargetType, targetId, valueProperties);
      final ComputedValueResult computedValue = new ComputedValueResult(valueSpecification, value, AggregatedExecutionLog.EMPTY);
      final ViewResultEntry viewResultEntry = new ViewResultEntry(configurationName, computedValue);

      return viewResultEntry;
    }
View Full Code Here


    assertEquals(UniqueId.of("ViewProcess", client.getUniqueId().getValue()), resultModel.getViewProcessId());
    assertEquals(UniqueId.of("ViewCycle", client.getUniqueId().getValue(), "1"), resultModel.getViewCycleId());

    assertEquals(
        newHashSet(
            new ComputedValueResult(
                new ValueSpecification(
                    "Value2",
                    ComputationTargetSpecification.of(UniqueId.of("Scheme", "PrimitiveValue")),
                    ValueProperties.with("Function", newHashSet("MarketDataSourcingFunction")).get()),
                (byte) 2, AggregatedExecutionLog.EMPTY),
            new ComputedValueResult(
                new ValueSpecification(
                    "Value1",
                    ComputationTargetSpecification.of(UniqueId.of("Scheme", "PrimitiveValue")),
                    ValueProperties.with("Function", newHashSet("MarketDataSourcingFunction")).get()),
                (byte) 1, AggregatedExecutionLog.EMPTY)
View Full Code Here

    final InMemoryViewComputationResultModel result = new InMemoryViewComputationResultModel();
    final ComputationTargetSpecification computationTargetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Sec", "APPL"));
    final ValueProperties properties = ValueProperties.with(ValuePropertyNames.FUNCTION, "asd").get();
    final ValueSpecification valueSpec = new ValueSpecification("value", computationTargetSpec, properties);
    final ComputedValueResult cvr = new ComputedValueResult(valueSpec, 1000.0, AggregatedExecutionLog.EMPTY, null, null, InvocationResult.SUCCESS);
    //cvr.setRequirements(newHashSet(_requirement));
    result.addValue("config_1", cvr);
   
    // Result will be skipped but should not cause any exception to be thrown
    _batchMaster.addJobResults(run.getObjectId(), result);
View Full Code Here

  public void addJobResults() {
    final UniqueId marketDataUid = _cycleMetadataStub.getMarketDataSnapshotId();
    _batchMaster.createMarketData(marketDataUid);
    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);
    final InMemoryViewComputationResultModel result = new InMemoryViewComputationResultModel();
    final ComputedValueResult cvr = new ComputedValueResult(_specification, 1000.0, AggregatedExecutionLog.EMPTY, "someComputeNode", null, InvocationResult.SUCCESS);
    //cvr.setRequirements(newHashSet(_requirement));
    result.addValue("config_1", cvr);
    _batchMaster.addJobResults(run.getObjectId(), result);
  }
View Full Code Here

  public void truncateSmallValueToZero() {
    final UniqueId marketDataUid = _cycleMetadataStub.getMarketDataSnapshotId();
    _batchMaster.createMarketData(marketDataUid);
    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);
    final InMemoryViewComputationResultModel result = new InMemoryViewComputationResultModel();
    final ComputedValueResult cvr = new ComputedValueResult(_specification, 1e-323, AggregatedExecutionLog.EMPTY, "someComputeNode", null, InvocationResult.SUCCESS);
    //cvr.setRequirements(newHashSet(_requirement));
    result.addValue("config_1", cvr);
    _batchMaster.addJobResults(run.getObjectId(), result);
   
    List<ViewResultEntry> resultEntries = _batchMaster.getBatchValues(run.getObjectId(), PagingRequest.ALL).getFirst();
View Full Code Here

    final String spec1value1 = "spec1value1";
    final String spec2value1 = "spec2value1";

    final InMemoryViewComputationResultModel results1 = new InMemoryViewComputationResultModel();
    results1.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results1.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, spec1value1, AggregatedExecutionLog.EMPTY));
    results1.addValue(CALC_CONFIG, new ComputedValueResult(_spec2, spec2value1, AggregatedExecutionLog.EMPTY));

    final ResultsCache cache = new ResultsCache();
    cache.put(results1);

    final ResultsCache.Result result1_1 = cache.getResult(CALC_CONFIG, _spec1, String.class);
    final ResultsCache.Result result2_1 = cache.getResult(CALC_CONFIG, _spec2, String.class);
    assertEquals(spec1value1, result1_1.getValue());
    assertEquals(spec2value1, result2_1.getValue());
    assertNull(result1_1.getHistory());
    assertNull(result2_1.getHistory());
    assertTrue(result1_1.isUpdated());
    assertTrue(result2_1.isUpdated());

    final String spec1value2 = "spec1value2";
    final InMemoryViewComputationResultModel results2 = new InMemoryViewComputationResultModel();
    results2.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results2.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, spec1value2, AggregatedExecutionLog.EMPTY));
    cache.put(results2);

    final ResultsCache.Result result1_2 = cache.getResult(CALC_CONFIG, _spec1, String.class);
    final ResultsCache.Result result2_2 = cache.getResult(CALC_CONFIG, _spec2, String.class);
    assertEquals(spec1value2, result1_2.getValue());
View Full Code Here

  @Test
  public void putResultsWithHistory() {
    final InMemoryViewComputationResultModel results1 = new InMemoryViewComputationResultModel();
    results1.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results1.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, 1d, AggregatedExecutionLog.EMPTY));
    final ResultsCache cache = new ResultsCache();
    cache.put(results1);

    final ResultsCache.Result result1 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(1d, result1.getValue());
    assertEquals(1, result1.getHistory().size());
    assertEquals(1d, result1.getHistory().iterator().next());

    final InMemoryViewComputationResultModel results2 = new InMemoryViewComputationResultModel();
    results2.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    results2.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, 2d, AggregatedExecutionLog.EMPTY));
    cache.put(results2);

    final ResultsCache.Result result2 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(2d, result2.getValue());
    assertEquals(2, result2.getHistory().size());
View Full Code Here

  @Test
  public void errorValues() {
    final InMemoryViewComputationResultModel resultsModel1 = new InMemoryViewComputationResultModel();
    resultsModel1.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    resultsModel1.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, MissingOutput.EVALUATION_ERROR, AggregatedExecutionLog.EMPTY));
    final ResultsCache cache = new ResultsCache();
    cache.put(resultsModel1);

    final ResultsCache.Result result1 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(MissingOutput.EVALUATION_ERROR, result1.getValue());
    assertNull(result1.getHistory());

    final InMemoryViewComputationResultModel resultsModel2 = new InMemoryViewComputationResultModel();
    resultsModel2.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    resultsModel2.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, 1d, AggregatedExecutionLog.EMPTY));
    cache.put(resultsModel2);

    final InMemoryViewComputationResultModel resultsModel3 = new InMemoryViewComputationResultModel();
    resultsModel3.setViewCycleExecutionOptions(ViewCycleExecutionOptions.builder().setValuationTime(Instant.now()).create());
    resultsModel3.addValue(CALC_CONFIG, new ComputedValueResult(_spec1, MissingOutput.EVALUATION_ERROR, AggregatedExecutionLog.EMPTY));
    cache.put(resultsModel3);

    final ResultsCache.Result result2 = cache.getResult(CALC_CONFIG, _spec1, Double.class);
    assertEquals(MissingOutput.EVALUATION_ERROR, result2.getValue());
    final List<Object> history = Lists.newArrayList(result2.getHistory());
View Full Code Here

        for (Map.Entry<Pair<String, ValueProperties>, ComputedValueResult> valueEntry : values.entrySet()) {
          String valueName = valueEntry.getKey().getFirst();
          String currency = getCurrency(targetSpec.getUniqueId(), targetType);
          s_logger.debug("{} currency returned for id:{} targetType:{}", currency, targetSpec.getUniqueId(), targetType);
          if (currency != null) {
            ComputedValueResult computedValue = valueEntry.getValue();
            if (isGoodValue(computedValue)) {
              statusResult.put(new ViewStatusKeyBean(_securityType, valueName, currency, targetType.getName()), ViewStatus.VALUE);
            }
          } else {
            s_logger.error("Discarding result as NULL return as Currency for id: {} targetType:{}", targetSpec.getUniqueId(), targetType);
View Full Code Here

                if (values == null) {
                  values = new ArrayList<ComputedValueResult>(scopedValues.size());
                  newResult.put(calcConfig, values);
                }
                for (final ComputedValueResult value : scopedValues) {
                  values.add(new ComputedValueResult(new ValueSpecification(value.getSpecification().getValueName(), target, value.getSpecification().getProperties()), value.getValue(), value
                      .getAggregatedExecutionLog()));
                }
              }
              targetResult = new ViewTargetResultModel() {
View Full Code Here

TOP

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

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.