Package com.opengamma.analytics.financial.model.option.definition

Examples of com.opengamma.analytics.financial.model.option.definition.YieldCurveWithBlackCubeBundle


    final Object curveSpecObject = inputs.getValue(curveSpecRequirement);
    if (curveSpecObject == null) {
      throw new OpenGammaRuntimeException("Could not get " + curveSpecRequirement);
    }
    final InterpolatedYieldCurveSpecificationWithSecurities curveSpec = (InterpolatedYieldCurveSpecificationWithSecurities) curveSpecObject;
    final YieldCurveWithBlackCubeBundle data = new YieldCurveWithBlackCubeBundle(volatilitySurface.getSurface(), curves);
    final YieldCurveWithBlackCubeBundle fixedData = fixedCurves == null ? null : new YieldCurveWithBlackCubeBundle(volatilitySurface.getSurface(), fixedCurves);
    final Object jacobianObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE_JACOBIAN);
    if (jacobianObject == null) {
      throw new OpenGammaRuntimeException("Could not get " + ValueRequirementNames.YIELD_CURVE_JACOBIAN);
    }
    final double[][] array = FunctionUtils.decodeJacobian(jacobianObject);
View Full Code Here


  @Override
  protected Set<ComputedValue> getResult(final InstrumentDerivative bondFutureOption, final YieldCurveWithBlackCubeBundle data, final MultiCurveCalculationConfig curveCalculationConfig,
      final ValueSpecification spec, final FunctionInputs inputs, final Set<ValueRequirement> desiredValues, final BondFutureOptionSecurity security) {
    final ValueRequirement desiredValue = Iterables.getOnlyElement(desiredValues);
    final String curveName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
    final YieldCurveWithBlackCubeBundle fixedData = null; //TODO deal with fixed curves
    final Object curveSpecObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE_SPEC);
    if (curveSpecObject == null) {
      throw new OpenGammaRuntimeException("Could not get curve specification for " + curveName);
    }
    final InterpolatedYieldCurveSpecificationWithSecurities curveSpec = (InterpolatedYieldCurveSpecificationWithSecurities) curveSpecObject;
View Full Code Here

   
    // Compute present value under current market
    final double pvBase = irFutureOption.accept(s_pvCalculator, market);
   
    // Form market scenario
    final YieldCurveWithBlackCubeBundle marketScen;
    ValueProperties constraints = desiredValues.iterator().next().getConstraints();
   
    // Apply shift to yield curve(s)
    final YieldCurveBundle curvesScen = new YieldCurveBundle();
    String priceShiftTypeConstraint = constraints.getValues(s_priceShiftType).iterator().next();
    String priceConstraint = constraints.getValues(s_priceShift).iterator().next();
   
    if (priceConstraint.equals("")) {
      // use base market prices
      curvesScen.addAll(market);
    } else {
      final Double shift = Double.valueOf(priceConstraint);
      // As curve may be functional, we can only apply a parallel shift.
      Double parallelShift;
      for (String crvName : market.getAllNames()) {
        YieldAndDiscountCurve curve = market.getCurve(crvName);
        if (priceShiftTypeConstraint.equalsIgnoreCase("Additive")) {
          parallelShift = shift;
        } else {
          if (!(priceShiftTypeConstraint.equalsIgnoreCase("Multiplicative"))) {
            s_logger.debug("Valid PriceShiftType's: Additive and Multiplicative. Found: " + priceShiftTypeConstraint + " Defaulting to Multiplicative.");
          }
          // We (arbitrarily) choose to scale by the rate at the short end
          double shortRate = curve.getInterestRate(0.0);
          parallelShift = shift * shortRate;
        }
        YieldAndDiscountCurve curveShifted = curve.withParallelShift(parallelShift);
        curvesScen.setCurve(crvName, curveShifted);
      }
    }
   
    // Apply shift to vol surface
    String volConstraint = constraints.getValues(s_volShift).iterator().next();
    if (volConstraint.equals("")) {
      // use base market vols
      marketScen = market;
    } else {
      // bump vol surface
      final Double shiftVol = Double.valueOf(volConstraint);
      String volShiftTypeConstraint = constraints.getValues(s_volShiftType).iterator().next();
      final boolean additiveShift;
      if (volShiftTypeConstraint.equalsIgnoreCase("Additive")) {
        additiveShift = true;
      } else if (volShiftTypeConstraint.equalsIgnoreCase("Multiplicative")) {
        additiveShift = false;
      } else {
        s_logger.debug("In ScenarioPnLFunctions, VolShiftType's are Additive and Multiplicative. Found: " + priceShiftTypeConstraint + " Defaulting to Multiplicative.");
        additiveShift = false;
      }
      final Surface<Double, Double, Double> volSurfaceScen = SurfaceShiftFunctionFactory.getShiftedSurface(market.getBlackParameters(), shiftVol, additiveShift);
      marketScen = new YieldCurveWithBlackCubeBundle(volSurfaceScen, curvesScen);
    }
   
    // Compute present value under scenario
    final double pvScen = irFutureOption.accept(s_pvCalculator, marketScen);
   
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.option.definition.YieldCurveWithBlackCubeBundle

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.