Package com.opengamma.engine.value

Examples of com.opengamma.engine.value.ComputedValue


    final ValueProperties constraints = desiredValue.getConstraints().copy()
        .with(ValuePropertyNames.FUNCTION, getUniqueId())
        .get();
    final ValueSpecification stdVolSpec = new ValueSpecification(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA,
        target.toSpecification(), constraints);
    return Collections.singleton(new ComputedValue(stdVolSpec, stdVolSurface));
  }
View Full Code Here


          }
        }
        final VolatilitySurfaceData<?, ?> volSurfaceData = new VolatilitySurfaceData<Object, Object>(_definition.getName(), _specification.getName(),
            _definition.getTarget().getUniqueId(),
            expiries, _definition.getYs(), volatilityValues);
        final ComputedValue resultValue = new ComputedValue(_result, volSurfaceData);
        return Collections.singleton(resultValue);
      }

      @Override
      public boolean canHandleMissingInputs() {
View Full Code Here

    return Collections.singleton(new ValueSpecification(input.getValueName(), input.getTargetSpecification(), properties));
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final ComputedValue input = inputs.getAllValues().iterator().next();
    final ValueSpecification inputSpec = input.getSpecification();
    VolatilitySurface volatilitySurface = (VolatilitySurface) input.getValue();
    final ValueProperties.Builder properties = createValueProperties(inputSpec);
    final String shift = desiredValues.iterator().next().getConstraint(SHIFT);
    properties.with(SHIFT, shift);
    try {
      final double shiftAmount = Double.parseDouble(shift);
      volatilitySurface = volatilitySurface.withConstantMultiplicativeShift(shiftAmount);
    } catch (NumberFormatException e) {
      s_logger.error("Volatility surface shift not valid - {}", shift);
    }
    return Collections.singleton(new ComputedValue(new ValueSpecification(inputSpec.getValueName(), inputSpec.getTargetSpecification(), properties.get()), volatilitySurface));
  }
View Full Code Here

    input.addTimeSeries(timeSeriesSpecification(0), localDateDoubleTimeSeries(10));
    input.addTimeSeries(timeSeriesSpecification(1), localDateDoubleTimeSeries(10));
    input.addTimeSeries(timeSeriesSpecification(2), localDateDoubleTimeSeries(10));
    input.addTimeSeries(timeSeriesSpecification(3), localDateDoubleTimeSeries(10));
    input.addTimeSeries(timeSeriesSpecification(4), localDateDoubleTimeSeries(10));
    final FunctionInputs inputs = new FunctionInputsImpl(null, new ComputedValue(INPUT_VALUE, input));
    final Set<ComputedValue> result = FUNCTION.execute(new FunctionExecutionContext(), inputs, ComputationTarget.NULL, Collections.singleton(DESIRED_VALUE));
    assertEquals(result.size(), 1);
    final ComputedValue value = result.iterator().next();
    assertEquals(value.getValue().getClass(), DoubleLabelledMatrix2D.class);
    final DoubleLabelledMatrix2D matrix = (DoubleLabelledMatrix2D) value.getValue();
    assertEquals(matrix.getXLabels().length, 5);
    assertEquals(matrix.getYLabels().length, 5);
  }
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testExecuteNoData() {
    final HistoricalViewEvaluationMarketData input = new HistoricalViewEvaluationMarketData();
    final FunctionInputs inputs = new FunctionInputsImpl(null, new ComputedValue(INPUT_VALUE, input));
    FUNCTION.execute(new FunctionExecutionContext(), inputs, ComputationTarget.NULL, Collections.singleton(DESIRED_VALUE));
  }
View Full Code Here

    input.addTimeSeries(timeSeriesSpecification(1), localDateObjectTimeSeries(10));
    input.addTimeSeries(timeSeriesSpecification(2), localDateDoubleTimeSeries(10, 0, 5));
    input.addTimeSeries(timeSeriesSpecification(3), localDateObjectTimeSeries(10));
    input.addTimeSeries(timeSeriesSpecification(4), localDateDoubleTimeSeries(10, 0, 5));
    input.addTimeSeries(timeSeriesSpecification(5), localDateDoubleTimeSeries(0, 0, 5));
    final FunctionInputs inputs = new FunctionInputsImpl(null, new ComputedValue(INPUT_VALUE, input));
    final Set<ComputedValue> result = FUNCTION.execute(new FunctionExecutionContext(), inputs, ComputationTarget.NULL, Collections.singleton(DESIRED_VALUE));
    assertEquals(result.size(), 1);
    final ComputedValue value = result.iterator().next();
    assertEquals(value.getValue().getClass(), DoubleLabelledMatrix2D.class);
    final DoubleLabelledMatrix2D matrix = (DoubleLabelledMatrix2D) value.getValue();
    assertEquals(matrix.getXLabels().length, 3);
    assertEquals(matrix.getYLabels().length, 3);
  }
View Full Code Here

    input.addTimeSeries(timeSeriesSpecification(0), localDateDoubleTimeSeries(10, 0, 5));
    input.addTimeSeries(timeSeriesSpecification(1), localDateDoubleTimeSeries(15, 3, 7));
    input.addTimeSeries(timeSeriesSpecification(2), localDateDoubleTimeSeries(10, 1, 5));
    input.addTimeSeries(timeSeriesSpecification(3), localDateDoubleTimeSeries(15, 0, 7));
    input.addTimeSeries(timeSeriesSpecification(4), localDateDoubleTimeSeries(10, 2, 5));
    final FunctionInputs inputs = new FunctionInputsImpl(null, new ComputedValue(INPUT_VALUE, input));
    final Set<ComputedValue> result = FUNCTION.execute(new FunctionExecutionContext(), inputs, ComputationTarget.NULL, Collections.singleton(DESIRED_VALUE));
    assertEquals(result.size(), 1);
    final ComputedValue value = result.iterator().next();
    assertEquals(value.getValue().getClass(), DoubleLabelledMatrix2D.class);
    final DoubleLabelledMatrix2D matrix = (DoubleLabelledMatrix2D) value.getValue();
    assertEquals(matrix.getXLabels().length, 5);
    assertEquals(matrix.getYLabels().length, 5);
  }
View Full Code Here

    final HistoricalViewEvaluationMarketData input = new HistoricalViewEvaluationMarketData();
    input.addTimeSeries(timeSeriesSpecification(0), localDateDoubleTimeSeries(LocalDate.of(2013, 1, 1), 10));
    input.addTimeSeries(timeSeriesSpecification(1), localDateDoubleTimeSeries(LocalDate.of(2013, 1, 1), 15));
    input.addTimeSeries(timeSeriesSpecification(2), localDateDoubleTimeSeries(LocalDate.of(2013, 2, 1), 10));
    input.addTimeSeries(timeSeriesSpecification(3), localDateDoubleTimeSeries(LocalDate.of(2013, 2, 1), 15));
    final FunctionInputs inputs = new FunctionInputsImpl(null, new ComputedValue(INPUT_VALUE, input));
    FUNCTION.execute(new FunctionExecutionContext(), inputs, ComputationTarget.NULL, Collections.singleton(DESIRED_VALUE));
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    final VolatilitySurfaceData<Tenor, Tenor> surfaceData = (VolatilitySurfaceData<Tenor, Tenor>) volatilityDataObject;
    final ValueProperties properties = createValueProperties().with(ValuePropertyNames.SURFACE, surfaceName)
        .with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, InstrumentTypeProperties.SWAPTION_ATM).get();
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, getSurface(surfaceData)));
  }
View Full Code Here

    if (gammaObject == null) {
      throw new OpenGammaRuntimeException("Could not get gamma");
    }
    final double gamma = (Double) gammaObject;
    final double valueGamma = CALCULATOR.valueGreek(derivative, market, gamma);
    return Collections.singleton(new ComputedValue(resultSpec, valueGamma));
  }
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.