Package com.opengamma.analytics.financial.model.finitedifference

Examples of com.opengamma.analytics.financial.model.finitedifference.ConvectionDiffusionPDE1DCoefficients


    final double strike = option.getStrike();
    final double maxForward = forward * _maxMoneyness;
    final BoundaryCondition lower = getLowerBoundaryCondition(option, strike);
    final BoundaryCondition upper = getUpperBoundaryCondition(option, _maxMoneyness * forward);
    final PDEGrid1D grid = getGrid(getTimeMesh(expiry), getSpaceMesh(maxForward, forward));
    final ConvectionDiffusionPDE1DCoefficients pde = getPDEProvider().getBackwardsLocalVol(expiry, localVolatility);
    final Function1D<Double, Double> payoff = getInitialConditionProvider().getEuropeanPayoff(strike, isCall);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> db = new PDE1DDataBundle<>(pde, payoff, lower, upper, grid);
    return (PDETerminalResults1D) getSolver().solve(db);
  }
View Full Code Here


    final double strike = option.getStrike();
    final double maxForward = forward * _maxMoneyness;
    final BoundaryCondition lower = getLowerBoundaryCondition(option, strike);
    final BoundaryCondition upper = getUpperBoundaryCondition(option, expiry);
    final PDEGrid1D grid = getGrid(getTimeMesh(expiry), getSpaceMesh(maxForward, forward));
    final ConvectionDiffusionPDE1DCoefficients pde = getPDEProvider().getBackwardsLocalVol(forwardCurve, expiry, localVolatility);
    final Function1D<Double, Double> payoff = getInitialConditionProvider().getEuropeanPayoff(strike, isCall);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> db = new PDE1DDataBundle<>(pde, payoff, lower, upper, grid);
    return (PDETerminalResults1D) getSolver().solve(db);
  }
View Full Code Here

  private PDEFullResults1D runForwardPDESolver(final ForwardCurve forwardCurve, final LocalVolatilitySurface<?> localVolatility,
      final boolean isCall, final double theta, final double maxT, final double maxAbsProxyDelta, final int
      nTimeSteps, final int nStrikeSteps, final double timeMeshLambda, final double strikeMeshBunching, final double centreMoneyness) {

    final PDE1DCoefficientsProvider provider = new PDE1DCoefficientsProvider();
    ConvectionDiffusionPDE1DCoefficients pde;
    if (localVolatility instanceof LocalVolatilitySurfaceStrike) {
      pde = provider.getForwardLocalVol(forwardCurve, (LocalVolatilitySurfaceStrike) localVolatility);
    } else if (localVolatility instanceof LocalVolatilitySurfaceMoneyness) {
      pde = provider.getForwardLocalVol((LocalVolatilitySurfaceMoneyness) localVolatility);
    } else {
View Full Code Here

    final double minMoneyness = Math.exp(-_maxProxyDelta * Math.sqrt(expiry));
    final double maxMoneyness = 1.0 / minMoneyness;
    final PDEGrid1D grid = getGrid(getTimeMesh(expiry), getSpaceMesh(minMoneyness, maxMoneyness));
    final BoundaryCondition lower = getLowerBoundaryCondition(option, minMoneyness);
    final BoundaryCondition upper = getUpperBoundaryCondition(option, maxMoneyness);
    final ConvectionDiffusionPDE1DCoefficients pde = getPDEProvider().getForwardLocalVol(localVolatility);
    final Function1D<Double, Double> intCond = getInitialConditionProvider().getForwardCallPut(isCall);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> db = new PDE1DDataBundle<>(pde, intCond, lower, upper, grid);
    return (PDETerminalResults1D) getSolver().solve(db);
  }
View Full Code Here

    final double minMoneyness = Math.exp(-_maxProxyDelta * Math.sqrt(expiry));
    final double maxMoneyness = 1.0 / minMoneyness;
    final PDEGrid1D grid = getGrid(getTimeMesh(expiry), getSpaceMesh(minMoneyness, maxMoneyness));
    final BoundaryCondition lower = getLowerBoundaryCondition(option, minMoneyness);
    final BoundaryCondition upper = getUpperBoundaryCondition(option, maxMoneyness);
    final ConvectionDiffusionPDE1DCoefficients pde = getPDEProvider().getForwardLocalVol(forwardCurve, localVolatility);
    final Function1D<Double, Double> intCond = getInitialConditionProvider().getForwardCallPut(isCall);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> db = new PDE1DDataBundle<>(pde, intCond, lower, upper, grid);
    return (PDETerminalResults1D) getSolver().solve(db);
  }
View Full Code Here

  private PDEFullResults1D runForwardPDESolver(final LocalVolatilitySurfaceMoneyness localVolatility, final boolean isCall,
      final double theta, final double maxT, final double maxAbsProxyDelta, final int nTimeSteps, final int nStrikeSteps,
      final double timeMeshLambda, final double strikeMeshBunching, final double centreMoneyness) {

    final PDE1DCoefficientsProvider provider = new PDE1DCoefficientsProvider();
    final ConvectionDiffusionPDE1DCoefficients pde = provider.getForwardLocalVol(localVolatility);
    final ConvectionDiffusionPDESolver solver = new ThetaMethodFiniteDifference(theta, true);

    final double minMoneyness = Math.exp(-maxAbsProxyDelta * Math.sqrt(maxT));
    final double maxMoneyness = 1.0 / minMoneyness;
    ArgumentChecker.isTrue(minMoneyness < centreMoneyness, "min moneyness of {} greater than centreMoneyness of {}. Increase maxAbsProxydelta", minMoneyness, centreMoneyness);
View Full Code Here

      nTimeNodes, final int nFwdNodes, final double timeMeshLambda, final double spotMeshBunching, final double fwdNodeCentre) {
    final ForwardCurve forwardCurve = _marketData.getForwardCurve();

    final PDE1DCoefficientsProvider pdeProvider = new PDE1DCoefficientsProvider();
    final InitialConditionsProvider intProvider = new InitialConditionsProvider();
    final ConvectionDiffusionPDE1DCoefficients pde = pdeProvider.getBackwardsLocalVol(forwardCurve, expiry, localVolatility);
    final Function1D<Double, Double> payoff = intProvider.getEuropeanPayoff(strike, isCall);
    // final ZZConvectionDiffusionPDEDataBundle db = provider.getBackwardsLocalVol(strike, expiry, isCall, localVolatility, forwardCurve);
    final ConvectionDiffusionPDESolver solver = new ThetaMethodFiniteDifference(theta, false);

    BoundaryCondition lower;
View Full Code Here

  @Test
  public void pdePriceTest() {
    final PDE1DCoefficientsProvider pde_provider = new PDE1DCoefficientsProvider();
    final InitialConditionsProvider int_provider = new InitialConditionsProvider();
    //final ZZConvectionDiffusionPDEDataBundle db = provider.getBackwardsLocalVol(STRIKE, EXPIRY, true, LOCAL_VOL, FORWARD_CURVE);
    final ConvectionDiffusionPDE1DCoefficients pde = pde_provider.getBackwardsLocalVol(FORWARD_CURVE, EXPIRY, LOCAL_VOL);
    final Function1D<Double, Double> payoff = int_provider.getEuropeanPayoff(STRIKE, true);
    final ConvectionDiffusionPDESolver solver = new ThetaMethodFiniteDifference(0.5, false);
    final double forward = FORWARD_CURVE.getForward(EXPIRY);

    final int nTimeNodes = 50;
View Full Code Here

      }
    };

    // ZZConvectionDiffusionPDEDataBundle pdeBundle1 = getBackwardsPDEDataBundle(EXPIRY, LOCAL_VOL, payoff);
    // ConvectionDiffusionPDE1DCoefficients pde = PDE_PROVIDER.getLogBackwardsLocalVol(FORWARD_CURVE, EXPIRY, LOCAL_VOL);
    final ConvectionDiffusionPDE1DCoefficients pde = PDE_PROVIDER.getLogBackwardsLocalVol(0.0, 0.0, EXPIRY, LOCAL_VOL_SPECIAL);

    final double theta = 0.5;
    final double range = Math.log(5);
    final double yL = lnFT - range;
    final double yH = lnFT + range;
View Full Code Here

    final double fT = DIV_CURVES.getF(EXPIRY);
    final double dT = DIV_CURVES.getD(EXPIRY);

    final double dStar = dT / (fT - dT);

    final ConvectionDiffusionPDE1DCoefficients pde = PDE_PROVIDER.getLogBackwardsLocalVol(EXPIRY, lv);

    final double theta = 0.5;
    final double yL = -0.5;
    final double yH = 0.5;
    final ConvectionDiffusionPDESolver solver = new ThetaMethodFiniteDifference(theta, false);
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.finitedifference.ConvectionDiffusionPDE1DCoefficients

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.