Package org.jquantlib.exercise

Examples of org.jquantlib.exercise.AmericanExercise


    @Override
    public void calculate() {
        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 StrikedTypePayoff , NON_STRIKE_PAYOFF_GIVEN); // QA:[RG]::verified
        final StrikedTypePayoff payoff = (StrikedTypePayoff)a.payoff;

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

View Full Code Here


    final CommonVars vars = new CommonVars();

    vars.conversionRatio = 1.0e-16;

    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,
View Full Code Here

            final List<Date> dates,
            final List<Double> dividends) {

        super(FDDividendAmericanEngine.class,
              type, underlying, strike, r, q, vol,
              settlementDate, new AmericanExercise(settlementDate, expirationDate),
              dates, dividends);
    }
View Full Code Here

            final List<Double> dividends,
            final Calendar cal) {

        super(FDDividendAmericanEngine.class,
              type, underlying, strike, r, q, vol,
              settlementDate, new AmericanExercise(settlementDate, expirationDate),
              dates, dividends, cal);
    }
View Full Code Here

            final Calendar cal,
            final DayCounter dc) {

        super(FDDividendAmericanEngine.class,
              type, underlying, strike, r, q, vol,
              settlementDate, new AmericanExercise(settlementDate, expirationDate),
              dates, dividends, cal, dc);
    }
View Full Code Here

            final Date expirationDate,
            final List<Date> dates,
            final List<Double> dividends) {

        super(type, underlying, strike, r, q, vol,
              settlementDate, new AmericanExercise(settlementDate, expirationDate),
              dates, dividends);
    }
View Full Code Here

            final List<Date> dates,
            final List<Double> dividends,
            final Calendar cal) {

        super(type, underlying, strike, r, q, vol,
              settlementDate, new AmericanExercise(settlementDate, expirationDate),
              dates, dividends, cal);
    }
View Full Code Here

            final List<Double> dividends,
            final Calendar cal,
            final DayCounter dc) {

        super(type, underlying, strike, r, q, vol,
              settlementDate, new AmericanExercise(settlementDate, expirationDate),
              dates, dividends, cal, dc);
    }
View Full Code Here

            final StrikedTypePayoff payoff = new PlainVanillaPayoff(value.type, value.strike);

            final int daysToExpiry = (int) (value.t * 360 + 0.5);
            final Date exDate = today.clone().addAssign(daysToExpiry);
            final Exercise exercise = new AmericanExercise(today, exDate);

            spot.setValue(value.s);
            qRate.setValue(value.q);
            rRate.setValue(value.r);
            vol.setValue(value.v);
View Full Code Here

        final double /* @Real */tolerance = 3.0e-3;

        for (final AmericanOptionData value : values) {
            final StrikedTypePayoff payoff = new PlainVanillaPayoff(value.type, value.strike);
            final Date exDate = today.add(timeToDays(value.t));
            final Exercise exercise = new AmericanExercise(today, exDate);

            spot.setValue(value.s);
            qRate.setValue(value.q);
            rRate.setValue(value.r);
            vol.setValue(value.v);
View Full Code Here

TOP

Related Classes of org.jquantlib.exercise.AmericanExercise

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.