Package org.jquantlib.pricingengines

Examples of org.jquantlib.pricingengines.PricingEngine$Arguments


            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 AnalyticBarrierEngine(stochProcess);

            final BarrierOption barrierOption = new BarrierOption(value.barrierType, value.barrier, value.rebate, payoff, exercise);
            barrierOption.setPricingEngine(engine);

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


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

            final PricingEngine engine = new AnalyticBarrierEngine(stochProcess);

            final BarrierOption barrierCallOption = new BarrierOption(value.barrierType, value.barrier, rebate, callPayoff, exercise);
            barrierCallOption.setPricingEngine(engine);

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

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


            final BarrierOption barrierCallOption = new BarrierOption(value.barrierType, value.barrier, rebate, callPayoff, exercise);
            barrierCallOption.setPricingEngine(engine);
View Full Code Here

    final Exercise euExercise = new EuropeanExercise(vars.maturityDate);
    final Exercise amExercise = new AmericanExercise(vars.issueDate,
        vars.maturityDate);

    final int timeSteps = 1001;
    final PricingEngine engine = new BinomialConvertibleEngine<CoxRossRubinstein>(
        CoxRossRubinstein.class,
        vars.process, timeSteps);

    final Handle<YieldTermStructure> discountCurve = new Handle<YieldTermStructure>(
        new ForwardSpreadedTermStructure(vars.riskFreeRate,
            vars.creditSpread));

    // zero-coupon
    Schedule schedule = new MakeSchedule(vars.issueDate, vars.maturityDate,
        new Period(Frequency.Once), vars.calendar,
        BusinessDayConvention.Following).backwards().schedule();

    final ConvertibleZeroCouponBond euZero = new ConvertibleZeroCouponBond(
        euExercise, vars.conversionRatio, vars.no_dividends,
        vars.no_callability, vars.creditSpread, vars.issueDate,
        vars.settlementDays, vars.dayCounter, schedule, vars.redemption);
    euZero.setPricingEngine(engine);

    final ConvertibleZeroCouponBond amZero = new ConvertibleZeroCouponBond(
        amExercise, vars.conversionRatio, vars.no_dividends,
        vars.no_callability, vars.creditSpread, vars.issueDate,
        vars.settlementDays, vars.dayCounter, schedule, vars.redemption);
    amZero.setPricingEngine(engine);

    final ZeroCouponBond zero = new ZeroCouponBond(vars.settlementDays,
        vars.calendar, 100.0, vars.maturityDate,
        BusinessDayConvention.Following, vars.redemption,
        vars.issueDate);

    final PricingEngine bondEngine = new DiscountingBondEngine(discountCurve);
    zero.setPricingEngine(bondEngine);

    double tolerance = 1.0e-2 * (vars.faceAmount / 100.0);

    double error = Math.abs(euZero.NPV() - zero.settlementValue());
View Full Code Here

    final Exercise euExercise = new EuropeanExercise(vars.maturityDate);

    vars.settlementDays = 0;

    final int timeSteps = 1001;
    final PricingEngine engine = new BinomialConvertibleEngine<CoxRossRubinstein>(CoxRossRubinstein.class, vars.process, timeSteps);
    final PricingEngine vanillaEngine = new BinomialVanillaEngine<CoxRossRubinstein>(CoxRossRubinstein.class, vars.process, timeSteps);

    vars.creditSpread.linkTo(new SimpleQuote(0.0));

    final double conversionStrike = vars.redemption / vars.conversionRatio;
    final StrikedTypePayoff payoff = new PlainVanillaPayoff(Option.Type.Call,
View Full Code Here

        // obtain stochastic process
        this.stochProcess = new BlackScholesMertonProcess(new Handle<Quote>(spot), qTS, rTS, volTS);

        // obtain a pricing engine and assign to this option :: 3 intervals a day
        final int timeSteps = (int) (exercise.lastDate().sub(referenceDate) * 3);
        final PricingEngine engine;
        try {
            final Constructor<T> baseConstructor = engineClass.getConstructor(
                    GeneralizedBlackScholesProcess.class, int.class);
            engine = baseConstructor.newInstance(stochProcess, timeSteps);
        } catch (final Exception e) {
View Full Code Here

        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol.value(), dc);

        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 AnalyticDiscreteGeometricAveragePriceAsianEngine(stochProcess);

        final AverageType averageType = AverageType.Geometric;
        /* @Real */final double runningAccumulator = 1.0;
        /* @Size */final int pastFixings = 0;
        /* @Size */final int futureFixings = 10;
View Full Code Here

                    d.addAssign(new Period(3, TimeUnit.Months));
                    for (d.addAssign(THREEMONTH); d.le(maturity.lastDate()); d.addAssign(THREEMONTH)) {
                        fixingDates.add(d.clone());
                    }

                    final PricingEngine engine = new AnalyticDiscreteGeometricAveragePriceAsianEngine(process);

                    final DiscreteAveragingAsianOption option = new DiscreteAveragingAsianOption(
                            AverageType.Geometric, runningAverage, pastFixings, fixingDates, payoff, maturity);
                    option.setPricingEngine(engine);
View Full Code Here

        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

        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 AnalyticContinuousGeometricAveragePriceAsianEngine(stochProcess);

        final AverageType averageType = AverageType.Geometric;
        final Option.Type type = Option.Type.Put;
        /* @Real */final double strike = 85.0;

        final Date exerciseDate = today.clone().addAssign(90);

        /* @Size */int pastFixings = Integer.MAX_VALUE;
        /* @Real */double runningAccumulator = Double.NaN;

        final StrikedTypePayoff payoff = new PlainVanillaPayoff(type, strike);
        final Exercise exercise = new EuropeanExercise(exerciseDate);

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

        /* @Real */double calculated = option.NPV();
        /* @Real */final double expected = 4.6922;
        /* @Real */double tolerance = 1.0e-4;

        if (Math.abs(calculated - expected) > tolerance) {
            reportFailure("value", averageType, runningAccumulator, pastFixings, new ArrayList<Date>(), payoff, exercise, spot
                    .value(), qRate.value(), rRate.value(), today, vol.value(), expected, calculated, tolerance);

        }
        // trying to approximate the continuous version with the discrete version
        runningAccumulator = 1.0;
        pastFixings = 0;

        final List<Date> fixingDates = new ArrayList<Date>(91);

        for (/* @Size */int i = 0; i < 91; i++) {
            fixingDates.add(today.clone().addAssign(i));
        }

        final PricingEngine engine2 = new AnalyticDiscreteGeometricAveragePriceAsianEngine(stochProcess);
        final DiscreteAveragingAsianOption option2 = new DiscreteAveragingAsianOption(
                averageType, runningAccumulator, pastFixings, fixingDates, payoff, exercise);
        option2.setPricingEngine(engine2);

        calculated = option2.NPV();
View Full Code Here

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

        final PricingEngine engine = new AnalyticContinuousGeometricAveragePriceAsianEngine(stochProcess);



        final Date today = new Settings().evaluationDate();
View Full Code Here

TOP

Related Classes of org.jquantlib.pricingengines.PricingEngine$Arguments

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.