Package org.jquantlib.pricingengines

Examples of org.jquantlib.pricingengines.AnalyticEuropeanEngine


                  final StrikedTypePayoff payoff = new PlainVanillaPayoff(type, strike);
                  final StrikedTypePayoff refPayoff = new PlainVanillaPayoff(type, strike + dividendValue);
                  final BlackScholesMertonProcess stochProcess = new BlackScholesMertonProcess(new Handle<Quote>(spot), qTS, rTS, volTS);
                  final PricingEngine engine = new AnalyticDividendEuropeanEngine(stochProcess);
                  final PricingEngine ref_engine = new AnalyticEuropeanEngine(stochProcess);

                  final DividendVanillaOption option = new DividendVanillaOption(payoff, exercise,dividendDates, dividends);
                  option.setPricingEngine(engine);

                  final VanillaOption ref_option = new VanillaOption(refPayoff, exercise);
View Full Code Here


        // Analytic formulas:

        // Black-Scholes for European
        String method = "Black-Scholes";
        europeanOption.setPricingEngine(new AnalyticEuropeanEngine(bsmProcess));
        System.out.printf(fmt, method, europeanOption.NPV(), Double.NaN, Double.NaN );

        // Barone-Adesi and Whaley approximation for American
        method = "Barone-Adesi/Whaley";
        americanOption.setPricingEngine(new BaroneAdesiWhaleyApproximationEngine(bsmProcess));
View Full Code Here

        // engines are built-in for the time being
        final PricingEngine engine;
        switch (exercise.type()) {
          case European:
            engine = new AnalyticEuropeanEngine(newProcess);
            break;
          case American:
            engine = new FDAmericanEngine(newProcess);
            break;
          case Bermudan:
View Full Code Here

            new RelinkableHandle<BlackVolTermStructure>(process.blackVolatility().currentLink());

        final GeneralizedBlackScholesProcess bsProcess =
            new GeneralizedBlackScholesProcess(stateVariable, dividendTS, riskFreeTS, volTS);

        final AnalyticEuropeanEngine baseEngine = new AnalyticEuropeanEngine(bsProcess);

        final VanillaOption.ArgumentsImpl baseArguments = (VanillaOption.ArgumentsImpl) baseEngine.getArguments();

        baseArguments.payoff = A.payoff;
        baseArguments.exercise = A.exercise;

        baseArguments.validate();

        final VanillaOption.ResultsImpl baseResults = (VanillaOption.ResultsImpl) baseEngine.getResults();

        R.value = 0.0;
        greeks.delta = 0.0;
        greeks.gamma = 0.0;
        greeks.theta = 0.0;
        greeks.vega = 0.0;
        greeks.rho = 0.0;
        greeks.dividendRho = 0.0;


        double /* @Real */ r, v, weight, lastContribution = 1.0;
        double /* @Real */ theta_correction;

        int i;
        for (i = 0; lastContribution > relativeAccuracy && i < maxIterations || i < (int)(lambda*t); i++) {

            // constant vol/rate assumption. It should be relaxed
            v = Math.sqrt((variance + i * jumpSquareVol) / t);
            r = riskFreeRate - process.jumpIntensity().currentLink().value() * k + i * muPlusHalfSquareVol / t;
            riskFreeTS.linkTo(new FlatForward(rateRefDate, r, voldc));
            volTS.linkTo(new BlackConstantVol(rateRefDate, volcal, v, voldc));

            baseArguments.validate();
            baseEngine.calculate();

            weight = p.op(i);
            R.value += weight * baseResults.value;
            greeks.delta += weight * baseResults.greeks().delta;
            greeks.gamma += weight * baseResults.greeks().gamma;
 
View Full Code Here

        GeneralizedBlackScholesProcess stochasticProcess = new BlackScholesMertonProcess(underlyingH, flatDividendTS, flatTermStructure, flatVolTS);

        VanillaOption europeanOption = new EuropeanOption(payoff, europeanExercise);

        europeanOption.setPricingEngine(new AnalyticEuropeanEngine(stochasticProcess));

        return europeanOption.NPV();

}
View Full Code Here

        final GeneralizedBlackScholesProcess stochProcess = makeProcess(u,q,r,vol);
        final PricingEngine engine;

        switch (engineType) {
            case Analytic:
                engine = new AnalyticEuropeanEngine(stochProcess);
                break;
            case JR:
                engine = new BinomialVanillaEngine<JarrowRudd>(JarrowRudd.class, stochProcess, binomialSteps);
                break;
            case CRR:
View Full Code Here

                    new Handle<Quote>(spot),
                    new Handle<YieldTermStructure>(qTS),
                    new Handle<YieldTermStructure>(rTS),
                    new Handle<BlackVolTermStructure>(volTS));

            final PricingEngine engine = new AnalyticEuropeanEngine(stochProcess);

            final EuropeanOption option = new EuropeanOption(payoff, exercise);
            option.setPricingEngine(engine);

            final double calculated = option.NPV();
View Full Code Here

        final BlackScholesMertonProcess stochProcess = new BlackScholesMertonProcess(
                new Handle<Quote>(spot),
                new Handle<YieldTermStructure>(qTS),
                new Handle<YieldTermStructure>(rTS),
                new Handle<BlackVolTermStructure>(volTS));
        final PricingEngine engine = new AnalyticEuropeanEngine(stochProcess);

        VanillaOption option = new EuropeanOption(payoff, exercise);
        option.setPricingEngine(engine);

        calculated = option.delta();
View Full Code Here

                        final BlackScholesMertonProcess stochProcess = new BlackScholesMertonProcess(
                                new Handle<Quote>(spot),
                                new Handle<YieldTermStructure>(qTS),
                                new Handle<YieldTermStructure>(rTS),
                                new Handle<BlackVolTermStructure>(volTS));
                        final PricingEngine engine = new AnalyticEuropeanEngine(stochProcess);

                        if (payoff==null)
                            throw new IllegalArgumentException();

                        final EuropeanOption option = new EuropeanOption(payoff, exercise);
View Full Code Here

        final BlackScholesMertonProcess stochProcess = new BlackScholesMertonProcess(
                new Handle<Quote>(u),
                new Handle<YieldTermStructure>(qTS),
                new Handle<YieldTermStructure>(rTS),
                new Handle<BlackVolTermStructure>(volTS));
        final PricingEngine engine = new AnalyticEuropeanEngine(stochProcess);

        final EuropeanOption option1 = new EuropeanOption(payoff, exercise);
        final EuropeanOption option2 = new EuropeanOption(payoff, exercise);
        option1.setPricingEngine(engine);
        option2.setPricingEngine(engine);
View Full Code Here

TOP

Related Classes of org.jquantlib.pricingengines.AnalyticEuropeanEngine

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.