Package com.opengamma.analytics.financial.greeks

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


    return riskFactors;
  }

  // TODO handle theta separately?
  private Double getValueGreek(final Greek greek, final double greekValue, final Map<UnderlyingType, Double> underlyings, final OptionTradeData tradeData) {
    final Underlying order = greek.getUnderlying();
    return TaylorExpansionMultiplierCalculator.getValue(underlyings, order) * greekValue * tradeData.getNumberOfContracts()
        * tradeData.getPointValue() / TaylorExpansionMultiplierCalculator.getMultiplier(order);
  }
View Full Code Here


  public DoubleTimeSeries<?> evaluate(final SensitivityAndReturnDataBundle... data) {
    Validate.notNull(data, "data");
    DoubleTimeSeries<?> result = null;
    DoubleTimeSeries<?> pnl = null;
    for (final SensitivityAndReturnDataBundle bundle : data) {
      final Underlying underlying = bundle.getUnderlying();
      final Map<UnderlyingType, DoubleTimeSeries<?>> underlyingData = bundle.getUnderlyingReturnTS();
      if (result == null) {
        result = TaylorExpansionMultiplierCalculator.getTimeSeries(underlyingData, underlying);
        result = result.multiply(bundle.getValue());
      } else {
View Full Code Here

  @Override
  public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) {
    final Position position = target.getPosition();
    final Security security = position.getSecurity();
    List<UnderlyingType> underlyings;
    Underlying order;
    final Set<ValueRequirement> requirements = new HashSet<ValueRequirement>();
    final String underlyingGreekRequirementName = AvailableValueGreeks.getGreekRequirementNameForValueGreekName(getRequirementName());
    requirements.add(new ValueRequirement(underlyingGreekRequirementName, ComputationTargetType.SECURITY, security.getUniqueId(), getInputConstraint(desiredValue)));
    order = AvailableGreeks.getGreekForValueRequirementName(underlyingGreekRequirementName).getUnderlying();
    if (order == null) {
      throw new UnsupportedOperationException("No available order for configured value greek " + getRequirementName());
    }
    underlyings = order.getUnderlyings();
    if (underlyings.isEmpty()) {
      ;
      // TODO what to do here? will only happen for the price
    } else {
      for (final UnderlyingType underlying : underlyings) {
View Full Code Here

    final Position position = target.getPosition();
    final Security security = position.getSecurity();
    final GreekResultCollection greekResultCollection = new GreekResultCollection();
    final Map<UnderlyingType, Double> underlyingData = new HashMap<UnderlyingType, Double>();
    Greek greek;
    Underlying order;
    List<UnderlyingType> underlyings;
    final String underlyingGreekRequirementName = AvailableValueGreeks.getGreekRequirementNameForValueGreekName(getRequirementName());
    final Double greekResult = (Double) inputs.getValue(underlyingGreekRequirementName);
    greek = AvailableGreeks.getGreekForValueRequirementName(underlyingGreekRequirementName);
    greekResultCollection.put(greek, greekResult);
    double pointValue = 1.0;
    if (security instanceof EquityOptionSecurity) {
      pointValue = ((EquityOptionSecurity) security).getPointValue();
    }
    final OptionTradeData tradeData = new OptionTradeData(position.getQuantity().doubleValue(), pointValue);
    order = greek.getUnderlying();
    underlyings = order.getUnderlyings();
    for (final UnderlyingType underlying : underlyings) {
      final Double underlyingValue = (Double) inputs.getValue(UnderlyingTypeToValueRequirementMapper.getValueRequirement(underlying, security));
      if (underlyingValue == null) {
        throw new NullPointerException("Could not get value for " + underlying + " for security " + security);
      } else {
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.greeks.Underlying

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.