Examples of PureLocalVolatilitySurface


Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(swap, "swap");
    ArgumentChecker.notNull(discountCurve, "discount curve");
    ArgumentChecker.notNull(marketVols, "market volatilities");
    final DupireLocalVolatilityCalculator dupire = new DupireLocalVolatilityCalculator();
    final PureImpliedVolatilitySurface pureSurf = getPureImpliedVolFromMarket(spot, discountCurve, dividends, marketVols);
    final PureLocalVolatilitySurface plv = dupire.getLocalVolatility(pureSurf);
    final double t = swap.getTimeToSettlement();
    final double[] ev = VAR_SWAP_BKW_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, t, plv);
    //TODO while calculating both with and without div correction is go for testing, don't want it for production
    final double res = (swap.correctForDividends() ? ev[0] : ev[1]) / t;
    return res;
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(swap, "swap");
    ArgumentChecker.notNull(discountCurve, "discount curve");
    ArgumentChecker.notNull(dividends, "dividends");
    ArgumentChecker.notNull(marketVols, "market volatilities");

    final PureLocalVolatilitySurface plv = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);
    final EquityDividendsCurvesBundle divCurves = new EquityDividendsCurvesBundle(spot, discountCurve, dividends);
    final LocalVolatilitySurfaceStrike lv = VolatilitySurfaceConverter.convertLocalVolSurface(plv, divCurves);

    final double eps = 1e-5;
    final int index = swap.correctForDividends() ? 0 : 1;
    final double t = swap.getTimeToSettlement();

    //up - here we assume that the local vol surface is invariant to a change of spot and form a new pure local vol surface corresponding to the bumped spot
    final double sUp = spot * (1 + eps);
    final EquityDividendsCurvesBundle divCurvesUp = new EquityDividendsCurvesBundle(sUp, discountCurve, dividends);
    final PureLocalVolatilitySurface plvUp = VolatilitySurfaceConverter.convertLocalVolSurface(lv, divCurvesUp);
    final double up = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(sUp, discountCurve, dividends, t, plvUp)[index];
    //down
    final double sDown = spot * (1 - eps);
    final EquityDividendsCurvesBundle divCurvesDown = new EquityDividendsCurvesBundle(sDown, discountCurve, dividends);
    final PureLocalVolatilitySurface plvDown = VolatilitySurfaceConverter.convertLocalVolSurface(lv, divCurvesDown);
    final double down = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(sDown, discountCurve, dividends, t, plvDown)[index];

    final double delta = (up - down) / 2 / eps / t;
    return delta;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(swap, "swap");
    ArgumentChecker.notNull(discountCurve, "discount curve");
    ArgumentChecker.notNull(dividends, "dividends");
    ArgumentChecker.notNull(marketVols, "market volatilities");

    final PureLocalVolatilitySurface plv = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);
    final EquityDividendsCurvesBundle divCurves = new EquityDividendsCurvesBundle(spot, discountCurve, dividends);
    final LocalVolatilitySurfaceStrike lv = VolatilitySurfaceConverter.convertLocalVolSurface(plv, divCurves);

    final double eps = 1e-5;
    final int index = swap.correctForDividends() ? 0 : 1;
    final double t = swap.getTimeToSettlement();

    final double mid = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, t, plv)[index];
    //up - here we assume that the local vol surface is invariant to a change of spot and form a new pure local vol surface corresponding to the bumped spot
    final double sUp = spot * (1 + eps);
    final EquityDividendsCurvesBundle divCurvesUp = new EquityDividendsCurvesBundle(sUp, discountCurve, dividends);
    final PureLocalVolatilitySurface plvUp = VolatilitySurfaceConverter.convertLocalVolSurface(lv, divCurvesUp);
    final double up = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(sUp, discountCurve, dividends, t, plvUp)[index];
    //down
    final double sDown = spot * (1 - eps);
    final EquityDividendsCurvesBundle divCurvesDown = new EquityDividendsCurvesBundle(sDown, discountCurve, dividends);
    final PureLocalVolatilitySurface plvDown = VolatilitySurfaceConverter.convertLocalVolSurface(lv, divCurvesDown);
    final double down = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(sDown, discountCurve, dividends, t, plvDown)[index];

    final double gamma = (up + down - 2 * mid) / eps / eps / t;
    return gamma;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(swap, "swap");
    ArgumentChecker.notNull(discountCurve, "discount curve");
    ArgumentChecker.notNull(dividends, "dividends");
    ArgumentChecker.notNull(marketVols, "market volatilities");

    final PureLocalVolatilitySurface plv = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);
    final EquityDividendsCurvesBundle divCurves = new EquityDividendsCurvesBundle(spot, discountCurve, dividends);
    final LocalVolatilitySurfaceStrike lv = VolatilitySurfaceConverter.convertLocalVolSurface(plv, divCurves);
    final double eps = 1e-5;
    final int index = swap.correctForDividends() ? 0 : 1;
    final double t = swap.getTimeToSettlement();

    //up
    final LocalVolatilitySurfaceStrike lvUp = new LocalVolatilitySurfaceStrike(flooredShiftSurface(lv.getSurface(), eps));
    final PureLocalVolatilitySurface plvUp = VolatilitySurfaceConverter.convertLocalVolSurface(lvUp, divCurves);
    final double up = Math.sqrt(VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, t, plvUp)[index] / t);
    //down
    final LocalVolatilitySurfaceStrike lvDown = new LocalVolatilitySurfaceStrike(flooredShiftSurface(lv.getSurface(), -eps));
    final PureLocalVolatilitySurface plvDown = VolatilitySurfaceConverter.convertLocalVolSurface(lvDown, divCurves);
    final double down = Math.sqrt(VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, t, plvDown)[index] / t);
    final double vega = (up - down) / 2 / eps;
    return vega;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(swap, "swap");
    ArgumentChecker.notNull(discountCurve, "discount curve");
    ArgumentChecker.notNull(dividends, "dividends");
    ArgumentChecker.notNull(marketVols, "market volatilities");

    final PureLocalVolatilitySurface plv = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);

    final double eps = 1e-5;
    final int index = swap.correctForDividends() ? 0 : 1;
    final double t = swap.getTimeToSettlement();

    //up
    final PureLocalVolatilitySurface plvUp = new PureLocalVolatilitySurface(flooredShiftSurface(plv.getSurface(), eps));
    final double up = Math.sqrt(VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, t, plvUp)[index] / t);
    //down
    final PureLocalVolatilitySurface plvDown = new PureLocalVolatilitySurface(flooredShiftSurface(plv.getSurface(), -eps));
    final double down = Math.sqrt(VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, t, plvDown)[index] / t);
    final double vega = (up - down) / 2 / eps;
    return vega;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

   * @return The price
   */
  public double priceFromImpliedVolsForwardPDE(final EquityVarianceSwap swap, final double spot, final YieldAndDiscountCurve discountCurve, final AffineDividends dividends,
      final SmileSurfaceDataBundle marketVols) {

    final PureLocalVolatilitySurface pureSurf = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);

    final double[] ev = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance(spot, discountCurve, dividends, swap.getTimeToSettlement(), pureSurf);
    final double res = swap.correctForDividends() ? ev[0] : ev[1];
    return res;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(swap, "swap");
    ArgumentChecker.notNull(discountCurve, "discount curve");
    final double eps = 1e-5;

    //this surface is assumed invariant to change in the spot
    final PureLocalVolatilitySurface pureSurf = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);

    //price the variance swap by static replication of the log-payoff and dividend correction terms
    final double[] evUp = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance((1 + eps) * spot, discountCurve, dividends, swap.getTimeToSettlement(), pureSurf);
    final double[] evDown = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance((1 - eps) * spot, discountCurve, dividends, swap.getTimeToSettlement(), pureSurf);

View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

    ArgumentChecker.notNull(dividends, "dividends");
    ArgumentChecker.notNull(marketVols, "market volatilities");
    final double eps = 1e-5;

    final EquityDividendsCurvesBundle div = new EquityDividendsCurvesBundle(spot, discountCurve, dividends);
    final PureLocalVolatilitySurface pureSurf = getPureLocalVolFromMarket(spot, discountCurve, dividends, marketVols);
    //this surface is assumed invariant to change in the spot
    final LocalVolatilitySurfaceStrike lv = convertLV(pureSurf, div);

    //price the variance swap by static replication of the log-payoff and dividend correction terms
    //up
    final EquityDividendsCurvesBundle divUp = new EquityDividendsCurvesBundle((1 + eps) * spot, discountCurve, dividends);
    final PureLocalVolatilitySurface plvUp = convertLV(lv, divUp);
    final double[] evUp = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance((1 + eps) * spot, discountCurve, dividends, swap.getTimeToSettlement(), plvUp);
    //down
    final EquityDividendsCurvesBundle divDown = new EquityDividendsCurvesBundle((1 - eps) * spot, discountCurve, dividends);
    final PureLocalVolatilitySurface plvDown = convertLV(lv, divDown);
    final double[] evDown = VAR_SWAP_FWD_PDE_CALCULATOR.expectedVariance((1 - eps) * spot, discountCurve, dividends, swap.getTimeToSettlement(), plvDown);
    final double res = swap.correctForDividends() ? (evUp[0] - evDown[0]) / spot / eps : (evUp[1] - evDown[1]) / spot / eps;
    return res;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

        final double s = (f - d) * x + d;
        return s / (s - d) * from.getVolatility(t, s);
      }
    };
    return new PureLocalVolatilitySurface(FunctionalDoublesSurface.from(func));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.local.PureLocalVolatilitySurface

        final double f = divCurves.getF(t);
        final double s = (f - d) * x + d;
        return volSurface.getVolatility(t, s) * s / (s - d);
      }
    };
    return new PureLocalVolatilitySurface(FunctionalDoublesSurface.from(pureLocalVol));
  }
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.