Examples of GreekResultCollection


Examples of com.opengamma.analytics.financial.greeks.GreekResultCollection

  private final Function1D<GreekDataBundle, Map<PositionGreek, Double>> _converter = new GreekToPositionGreekConverter();
  //TODO pass in required greek rather than using the entire set
  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target,
      final Set<ValueRequirement> desiredValues) {
    final GreekResultCollection greekResultCollection = new GreekResultCollection();
    Object greekResult;   
    Greek greek;
    for (final String valueName : AvailableGreeks.getAllGreekNames()) {
      greekResult = inputs.getValue(valueName);
      if (greekResult == null) {
        s_logger.warn("Could not get value for " + valueName);
      }
      if (!(greekResult instanceof Double)) {
        throw new IllegalArgumentException("Can only handle Double greeks.");
      }
      greek = AvailableGreeks.getGreekForValueRequirementName(valueName);
      greekResultCollection.put(greek, (Double) greekResult);
    }
    final GreekDataBundle dataBundle = new GreekDataBundle(greekResultCollection, null, new OptionTradeData(target.getPosition().getQuantity().doubleValue(), 25));
    final Map<PositionGreek, Double> positionGreeks = _converter.evaluate(dataBundle);
    final Set<ComputedValue> results = new HashSet<ComputedValue>();
    PositionGreek positionGreek;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.