Package com.opengamma.analytics.financial.model.interestrate.curve

Examples of com.opengamma.analytics.financial.model.interestrate.curve.ForwardCurve


    final double[] mus = new double[] {-0.1, 0, 0.1 };

    final MultiHorizonMixedLogNormalModelData mlnData = new MultiHorizonMixedLogNormalModelData(weights, sigmas, mus);
    final double spot = 100.;
    final double r = 0.1;
    final ForwardCurve fwdCurve = new ForwardCurve(spot, r);

    final double t = 1.0 / 365.;
    final double rootT = Math.sqrt(t);
    final double fwd = fwdCurve.getForward(t);

    BlackVolatilitySurfaceStrike ivs = MixedLogNormalVolatilitySurface.getImpliedVolatilitySurface(fwdCurve, mlnData);
    LocalVolatilitySurfaceStrike lvs = MixedLogNormalVolatilitySurface.getLocalVolatilitySurface(fwdCurve, mlnData);
    LocalVolatilitySurfaceMoneyness lvsm = LocalVolatilitySurfaceConverter.toMoneynessSurface(lvs, fwdCurve);
View Full Code Here


      // Get the forward curve
      final Object forwardCurveObject = inputs.getValue(ValueRequirementNames.FORWARD_CURVE);
      if (forwardCurveObject == null) {
        throw new OpenGammaRuntimeException("Could not get forward curve");
      }
      final ForwardCurve forwardCurve = (ForwardCurve) forwardCurveObject;
      stdVolSurface = getSurfaceFromPriceQuote(valDate, rawSurface, forwardCurve, specification);
    } else {
      throw new OpenGammaRuntimeException("Cannot handle quote units " + surfaceQuoteUnits);
    }
    // Return
View Full Code Here

    final double q = 0;
    final double b = r - q;
    final double k = 120.0;
    final double sigma = 0.4;
    final boolean isCall = true;
    final ForwardCurve fc = new ForwardCurve(spot, r);

    final LocalVolatilitySurfaceStrike lv = new LocalVolatilitySurfaceStrike(ConstantDoublesSurface.from(sigma));

    final int tN = 60;
    final int sN = 80 * tN;

    final double pdePrice = PRICER.price(spot, k, r, b, t, lv, true, false, sN, tN);
    final double price = Math.exp(-r * t) * BlackFormulaRepository.price(fc.getForward(t), k, t, sigma, isCall);

    //    System.out.println(price + "\t" + pdePrice);
    assertEquals(price, pdePrice, 1e-5 * price);
  }
View Full Code Here

    final double r = 0.1;
    final double q = 0.07;
    final double b = r - q;
    final double k = 120.0;
    final boolean isCall = true;
    final ForwardCurve fc = new ForwardCurve(spot, b);
    final YieldAndDiscountCurve discountCurve = new YieldCurve("test", ConstantDoublesCurve.from(r));
    final double[] w = new double[] {0.7, 0.25, 0.05 };
    final double[] sigma = new double[] {0.3, 0.6, 1.0 };
    final double[] mu = new double[] {0.0, 0.3, -0.5 };
View Full Code Here

   
    // Form market scenario
    ValueProperties constraints = desiredValues.iterator().next().getConstraints();
   
    // Apply shift to forward price curve
    final ForwardCurve fwdCurveScen;
    String priceShiftTypeConstraint = constraints.getValues(s_priceShiftType).iterator().next();
    String stockConstraint = constraints.getValues(s_priceShift).iterator().next();
   
    if (stockConstraint.equals("")) {
      fwdCurveScen = market.getForwardCurve(); // use base market prices
View Full Code Here

   
    // Form market scenario
    ValueProperties constraints = desiredValues.iterator().next().getConstraints();
   
    // Apply shift to forward price curve
    final ForwardCurve fwdCurveScen;
    String priceShiftTypeConstraint = constraints.getValues(s_priceShiftType).iterator().next();
    String stockConstraint = constraints.getValues(s_priceShift).iterator().next();
   
    if (stockConstraint.equals("")) {
      fwdCurveScen = market.getForwardCurve(); // use base market prices
View Full Code Here

  protected StaticReplicationDataBundle buildMarketBundle(final ExternalId underlyingId, final FunctionExecutionContext executionContext,
      final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {

    final YieldCurve discountingCurve = getDiscountingCurve(inputs);
    final ForwardCurve forwardCurve = getForwardCurve(inputs);
    final BlackVolatilitySurface<?> blackVolSurf = getVolatilitySurface(executionContext, inputs, target);
    return new StaticReplicationDataBundle(blackVolSurf, discountingCurve, forwardCurve);
  }
View Full Code Here

    if (timeToExpiry == 0) { // TODO: See JIRA [PLAT-3222]
      timeToExpiry = 0.0015;
    }

    // From the curve requirements, we get the forward and zero coupon prices
    final ForwardCurve forwardCurve = getForwardCurve(inputs);
    final double forward = forwardCurve.getForward(timeToExpiry);
    final double discountFactor = getDiscountingCurve(inputs).getDiscountFactor(timeToExpiry);

    // From the market value, we can then invert the Black formula
    final ComputedValue optionPriceValue = inputs.getComputedValue(MarketDataRequirementNames.MARKET_VALUE);
    if (optionPriceValue == null) {
View Full Code Here

  @Override
  protected StaticReplicationDataBundle buildMarketBundle(final ExternalId underlyingId, final FunctionExecutionContext executionContext,
      final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {

    final YieldCurve discountingCurve = getDiscountingCurve(inputs);
    final ForwardCurve forwardCurve = getForwardCurve(inputs);
    final BlackVolatilitySurface<?> blackVolSurf = getVolatilitySurface(executionContext, inputs, target);
    return new StaticReplicationDataBundle(blackVolSurf, discountingCurve, forwardCurve);
  }
View Full Code Here

    if (timeToExpiry == 0) { // TODO: See JIRA [PLAT-3222]
      timeToExpiry = 0.0015;
    }

    // From the curve requirements, we get the forward and zero coupon prices
    final ForwardCurve forwardCurve = getForwardCurve(inputs);
    final double forward = forwardCurve.getForward(timeToExpiry);
    final double discountFactor = getDiscountingCurve(inputs).getDiscountFactor(timeToExpiry);

    // From the market value, we can then invert the Black formula
    final Object optionPriceObject = inputs.getComputedValue(MarketDataRequirementNames.MARKET_VALUE);
    if (optionPriceObject == null) {
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.interestrate.curve.ForwardCurve

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.