Package com.opengamma.analytics.financial.simpleinstruments.pricing

Examples of com.opengamma.analytics.financial.simpleinstruments.pricing.SimpleFutureDataBundle


    ArgumentChecker.notNull(future, "future");
    ArgumentChecker.notNull(dataBundle, "data bundle");
    ArgumentChecker.isTrue(dataBundle.getFundingCurve() instanceof YieldCurve, "Calculator expects a YieldCurve, have {}", dataBundle.getFundingCurve().getClass());
    final YieldCurve discCrv = (YieldCurve) dataBundle.getFundingCurve();
    final double settlement = future.accept(SETTLEMENT_TIME);
    SimpleFutureDataBundle bumpedMarket = new SimpleFutureDataBundle(discCrv.withSingleShift(settlement, SHIFT), dataBundle.getMarketPrice(),
        dataBundle.getSpotValue(), dataBundle.getDividendYield(), dataBundle.getCostOfCarry());
    final double pvUp = future.accept(_presentValueCalculator, bumpedMarket);
    bumpedMarket = new SimpleFutureDataBundle(discCrv.withSingleShift(settlement, -SHIFT), dataBundle.getMarketPrice(),
        dataBundle.getSpotValue(), dataBundle.getDividendYield(), dataBundle.getCostOfCarry());
    final double pvDown = future.accept(_presentValueCalculator, bumpedMarket);
    final double sensitivity = (pvUp - pvDown) / (2.0 * SHIFT);
    final NodeYieldSensitivityCalculator distributor = PresentValueNodeSensitivityCalculator.getDefaultInstance();
    final List<Double> result = distributor.curveToNodeSensitivity(Arrays.asList(DoublesPair.of(settlement, sensitivity)), discCrv);
View Full Code Here


    final double settlement = 1.45;
    final double fixing = 1.44;
    final EquityIndexDividendFuture eidf = new EquityIndexDividendFuture(fixing, settlement, 95., Currency.JPY, 10);

    final double currentPrice = 100.0;
    final SimpleFutureDataBundle dataBundle = new SimpleFutureDataBundle(null, currentPrice, null, null, null);
    // FIXME Case - presentValue needs discounting..
    final double pv = eidf.accept(PVC, dataBundle);
    assertEquals(50.0, pv, 1e-12);

  }
View Full Code Here

    final Double spotUnderlyer = getSpot(inputs);
    Double dividendYield = timeSeriesBundle.get(MarketDataRequirementNames.DIVIDEND_YIELD, getSpotAssetId(security)).getTimeSeries().getLatestValue();
    final String fundingCurveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
    final String curveConfigName = desiredValue.getConstraint(ValuePropertyNames.CURVE_CALCULATION_CONFIG);
    final YieldAndDiscountCurve fundingCurve = getYieldCurve(security, inputs, fundingCurveName, curveConfigName);
    return new SimpleFutureDataBundle(fundingCurve, null, spotUnderlyer, dividendYield, null);
  }
View Full Code Here

    final ZonedDateTime valuationTime = ZonedDateTime.now(executionContext.getValuationClock());
    final InstrumentDefinitionWithData<?, Double> definition = security.accept(_converter);
    final InstrumentDerivative derivative = definition.toDerivative(valuationTime, lastMarginPrice);

    // 2. Build up the market data bundle
    final SimpleFutureDataBundle market = getFutureDataBundle(security, inputs, timeSeriesBundle, desiredValues.iterator().next());
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final YieldCurveBundle curveBundle = new YieldCurveBundle();
    final String fundingCurveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
    curveBundle.setCurve(fundingCurveName, market.getFundingCurve());
    // 3. Create specification that matches the properties promised in getResults
    // Build up InstrumentLabelledSensitivities for the Curve
    final Object curveSpecObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE_SPEC);
    if (curveSpecObject == null) {
      throw new OpenGammaRuntimeException("Curve specification was null");
View Full Code Here

  @Override
  protected SimpleFutureDataBundle getFutureDataBundle(final FutureSecurity security, final FunctionInputs inputs,
    final HistoricalTimeSeriesBundle timeSeriesBundle, final ValueRequirement desiredValue) {
    final Double marketPrice = getMarketPrice(security, inputs);
    final Double spotUnderlyer = getSpot(inputs);
    return new SimpleFutureDataBundle(null, marketPrice, spotUnderlyer, null, null);
  }
View Full Code Here

  @Override
  protected SimpleFutureDataBundle getFutureDataBundle(final FutureSecurity security, final FunctionInputs inputs,
    final HistoricalTimeSeriesBundle timeSeriesBundle, final ValueRequirement desiredValue) {
    final Double spotUnderlyer = getSpot(inputs);
    final Double costOfCarry = getCostOfCarry(security, inputs);
    return new SimpleFutureDataBundle(null, null, spotUnderlyer, null, costOfCarry);
  }
View Full Code Here

  @Override
  protected SimpleFutureDataBundle getFutureDataBundle(final FutureSecurity security, final FunctionInputs inputs,
    final HistoricalTimeSeriesBundle timeSeriesBundle, final ValueRequirement desiredValue) {
    final Double marketPrice = getMarketPrice(security, inputs);
    return new SimpleFutureDataBundle(null, marketPrice, null, null, null);
  }
View Full Code Here

      }
    }
    final InstrumentDerivative derivative = tradeDefinition.toDerivative(valuationTime, referencePrice);
    // Build the DataBundle it requires
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final SimpleFutureDataBundle dataBundle = getFutureDataBundle(security, inputs, timeSeriesBundle, desiredValue);
    // Call OG-Analytics
    final T value = derivative.accept(_calculator, dataBundle);
    final ValueSpecification specification = new ValueSpecification(_valueRequirementName, target.toSpecification(), createValueProperties(target, desiredValue).get());
    return Collections.singleton(new ComputedValue(specification, value));
  }
View Full Code Here

    }

    final InstrumentDerivative derivative = security.accept(_converter).toDerivative(now, lastMarginPrice, new String[0]);

    // 2. Build up the (simple) market data bundle
    final SimpleFutureDataBundle market = new SimpleFutureDataBundle(null, getMarketPrice(security, inputs), null, null, null);

    // 3. The Calculation - what we came here to do
    final Object results = computeValues(derivative, market);

    // 4. Create result specification to match the properties promised and return
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.simpleinstruments.pricing.SimpleFutureDataBundle

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.