Examples of PlainVanillaPayoff


Examples of org.jquantlib.instruments.PlainVanillaPayoff

        // bootstrap the yield/dividend/volatility curves
        final Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(underlying));
        final Handle<YieldTermStructure> flatDividendTS = new Handle<YieldTermStructure>(new FlatForward(settlementDate, dividendYield, dayCounter));
        final Handle<YieldTermStructure> flatTermStructure = new Handle<YieldTermStructure>(new FlatForward(settlementDate, riskFreeRate, dayCounter));
        final Handle<BlackVolTermStructure> flatVolTS = new Handle<BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));
        final Payoff payoff = new PlainVanillaPayoff(type, strike);

        // European Options
        final VanillaOption europeanOption = new EuropeanOption(payoff, europeanExercise);

        // Bermundan options (can be thought as a collection of European Options)
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        final Handle<YieldTermStructure> flatDividends =
              new Handle<YieldTermStructure>(new FlatForward(referenceDate, q, divdc));
        final Handle<BlackVolTermStructure> flatVol =
              new Handle<BlackVolTermStructure>(new BlackConstantVol(referenceDate, volcal, v, voldc));

        final PlainVanillaPayoff payoff = (PlainVanillaPayoff)(this.a.payoff);
        QL.require(payoff != null, "non-plain payoff given");

        final double maturity = rfdc.yearFraction(this.a.settlementDate, maturityDate);

        final GeneralizedBlackScholesProcess bs = new GeneralizedBlackScholesProcess(underlying, flatDividends,
                                                    flatRiskFree, flatVol);
        // final T tree = new T(bs, maturity, timeSteps_, payoff.strike());
        final T tree;
        try {
            final Constructor<T> c = typeT.getConstructor(StochasticProcess1D.class, double.class, int.class, double.class);
            tree = typeT.cast( c.newInstance(bs, maturity, timeSteps_, payoff.strike() ));
        } catch (final Exception e) {
            throw new LibraryException(e); // QA:[RG]::verified
        }

        final double creditSpread = this.a.creditSpread.currentLink().value();
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

                                 final DayCounter dayCounter,
                                 final Schedule schedule,
                                 final Date issueDate,
                                 final int  settlementDays,
                                 final double redemption) {
        super(new PlainVanillaPayoff(Option.Type.Call,bond.faceAmount()/100.0 * redemption/conversionRatio), exercise);
        this.bond_ = bond;
        this.conversionRatio_ = conversionRatio;
        this.callability_ = callability;
        this.dividends_ = dividends;
        this.creditSpread_ = creditSpread;
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        // bootstrap the yield/dividend/volatility curves
        final Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(underlying));
        final Handle<YieldTermStructure> flatDividendTS = new Handle<YieldTermStructure>(new FlatForward(settlementDate, dividendYield, dayCounter));
        final Handle<YieldTermStructure> flatTermStructure = new Handle<YieldTermStructure>(new FlatForward(settlementDate, riskFreeRate, dayCounter));
        final Handle<BlackVolTermStructure> flatVolTS = new Handle<BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));
        final Payoff payoff = new PlainVanillaPayoff(type, strike);

        final BlackScholesMertonProcess bsmProcess = new BlackScholesMertonProcess(underlyingH, flatDividendTS, flatTermStructure, flatVolTS);

        // European Options
        final VanillaOption europeanOption = new EuropeanOption(payoff, europeanExercise);
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        QL.require(a.exercise.type()==Exercise.Type.American , NOT_AN_AMERICAN_OPTION); // QA:[RG]::verified
        QL.require(a.exercise instanceof AmericanExercise , NON_AMERICAN_EXERCISE_GIVEN); // QA:[RG]::verified
        final AmericanExercise ex = (AmericanExercise)a.exercise;
        QL.require(!ex.payoffAtExpiry() , PAYOFF_AT_EXPIRY_NOT_HANDLED); // QA:[RG]::verified
        QL.require(a.payoff instanceof PlainVanillaPayoff , NON_PLAIN_PAYOFF_GIVEN); // QA:[RG]::verified
        PlainVanillaPayoff payoff = (PlainVanillaPayoff)a.payoff;

        final double /* @Real */variance = process.blackVolatility().currentLink().blackVariance(ex.lastDate(), payoff.strike());
        double /* @DiscountFactor */dividendDiscount = process.dividendYield().currentLink().discount(ex.lastDate());
        double /* @DiscountFactor */riskFreeDiscount = process.riskFreeRate().currentLink().discount(ex.lastDate());
        double /* @Real */spot = process.stateVariable().currentLink().value();
        QL.require(spot > 0.0, "negative or null underlying given"); // TODO: message
        double /* @Real */strike = payoff.strike();

        if (payoff.optionType()==Option.Type.Put) {
            // use put-call symmetry
            // swap spot and strike, has to be done inline
            double tmp = spot; spot = strike; strike = tmp;

            // swap riskFreeDiscount and dividenDiscount, has to be done inline
            tmp = riskFreeDiscount; riskFreeDiscount = dividendDiscount; dividendDiscount = tmp;

            payoff = new PlainVanillaPayoff(Option.Type.Call, strike);
        }

        if (dividendDiscount>=1.0) {
            // early exercise is never optimal - use Black formula
            final double /*@Real*/ forwardPrice = spot * dividendDiscount / riskFreeDiscount;
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        if (System.getProperty("EXPERIMENTAL") == null)
            throw new UnsupportedOperationException("Work in progress");


        this.maturity_ = maturity;
        payoff_ = new PlainVanillaPayoff(type, strike.doubleValue());
        this.s0_ = s0;
        this.sigma_ = sigma;
        this.r_ = r;

        final double rDiscount = Math.exp(- (r.doubleValue()) * maturity_.doubleValue());
 
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        QL.require(a.averageType==AverageType.Geometric , "not a geometric average option"); // TODO: message
        QL.require(a.exercise.type()==Exercise.Type.European , "not an European Option"); // TODO: message
        final Date exercise = a.exercise.lastDate();

        QL.require(a.payoff instanceof PlainVanillaPayoff , "non-plain payoff given"); // TODO: message
        final PlainVanillaPayoff payoff = (PlainVanillaPayoff)arguments_.payoff;

        /*@Volatility*/ final double volatility = process.blackVolatility().currentLink().blackVol(exercise, payoff.strike());
        /*@Real*/ final double variance = process.blackVolatility().currentLink().blackVariance(exercise, payoff.strike());
        /*@DiscountFactor*/ final double  riskFreeDiscount = process.riskFreeRate().currentLink().discount(exercise);
        final DayCounter rfdc  = process.riskFreeRate().currentLink().dayCounter();
        final DayCounter divdc = process.dividendYield().currentLink().dayCounter();
        final DayCounter voldc = process.blackVolatility().currentLink().dayCounter();

View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        public PayoffWrapper(final Payoff p) {
            this.payoff = p;
        }

        public PayoffWrapper(final Option.Type type, final double strike) {
            payoff = new PlainVanillaPayoff(type, strike);
        }
View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

            final Handle<YieldTermStructure> flatRate = new Handle<YieldTermStructure>(new FlatForward(0, new NullCalendar(), h1, dayCounter));
            final Handle<BlackConstantVol> flatVol = new Handle<BlackConstantVol>(new BlackConstantVol(0, new NullCalendar(), h2, dayCounter));

            //instantiate the option
            final Exercise exercise = new EuropeanExercise(maturity);
            final Payoff payoff = new PlainVanillaPayoff(type, strike);

            //FIXME:Review BlackScholes, GeneralizedBlackScholesStochasticProcess
            //Handle<StochasticProcess> stochasticProcess = new Handle<StochasticProcess>(new GeneralizedBlackScholesProcess(underlying, flatRate, flatVol));

View Full Code Here

Examples of org.jquantlib.instruments.PlainVanillaPayoff

        // binomial trees with constant coefficient
        final Handle<YieldTermStructure> flatRiskFree = new Handle<YieldTermStructure>(new FlatForward(referenceDate, rRate, rfdc));
        final Handle<YieldTermStructure> flatDividends = new Handle<YieldTermStructure>(new FlatForward(referenceDate, qRate, divdc));
        final Handle<BlackVolTermStructure> flatVol = new Handle<BlackVolTermStructure>(new BlackConstantVol(referenceDate, volcal, v, voldc));
        final PlainVanillaPayoff payoff = (PlainVanillaPayoff) a.payoff;
        QL.require(payoff!=null , "non-plain payoff given"); // TODO: message

        final double maturity = rfdc.yearFraction(referenceDate, maturityDate);

        final StochasticProcess1D bs = new GeneralizedBlackScholesProcess(process.stateVariable(), flatDividends, flatRiskFree, flatVol);
        final TimeGrid grid = new TimeGrid(maturity, timeSteps_);
        final Tree tree = (Tree)getTreeInstance(bs, maturity, timeSteps_, payoff.strike());

        final BlackScholesLattice<Tree> lattice = new BlackScholesLattice<Tree>(tree, rRate, maturity, timeSteps_);
        final DiscretizedVanillaOption option = new DiscretizedVanillaOption(a, process, grid);

        option.initialize(lattice, maturity);
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.