Package org.jquantlib.termstructures.yieldcurves

Examples of org.jquantlib.termstructures.yieldcurves.FlatForward


                   "negative value after subtracting dividends");

        // binomial trees with constant coefficient
        final Handle<Quote> underlying = new Handle<Quote>(new SimpleQuote(s0));
        final Handle<YieldTermStructure> flatRiskFree =
              new Handle<YieldTermStructure>(new FlatForward(referenceDate, riskFreeRate, rfdc));
        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");
View Full Code Here


        // Define exercise for American Options
        final Exercise americanExercise = new AmericanExercise(settlementDate, maturity);

        // 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);
View Full Code Here

        ((BlackVarianceCurve)varianceCurve).setInterpolation();

        //Dividend termstructure
        final SimpleQuote dividendQuote = new SimpleQuote(0.3);
        final RelinkableHandle<Quote>  handleToInterestRateQuote = new RelinkableHandle<Quote>(dividendQuote);
        final YieldTermStructure dividendTermStructure = new FlatForward(2,new UnitedStates(Market.NYSE),handleToInterestRateQuote, new Actual365Fixed(), Compounding.Continuous,Frequency.Daily);

        //Risk free term structure
        final SimpleQuote riskFreeRateQuote = new SimpleQuote(0.3);
        final RelinkableHandle<Quote>  handleToRiskFreeRateQuote = new RelinkableHandle<Quote>(riskFreeRateQuote);
        final YieldTermStructure riskFreeTermStructure = new FlatForward(2,new UnitedStates(Market.NYSE),handleToRiskFreeRateQuote, new Actual365Fixed(), Compounding.Continuous,Frequency.Daily);

        //Creating the process
        final StochasticProcess1D process = new GeneralizedBlackScholesProcess(handleToStockQuote,new RelinkableHandle<YieldTermStructure>(dividendTermStructure),new RelinkableHandle<YieldTermStructure>(riskFreeTermStructure),new RelinkableHandle<BlackVolTermStructure>(varianceCurve),new EulerDiscretization());

        //Calculating the drift of the stochastic process after time = 18th day from today with value of the stock as specified from the quote
View Full Code Here

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

View Full Code Here

        final Calendar calendar = new Target();
        final Date today = Date.todaysDate();
        final DayCounter dayCount = new Actual365Fixed();
        final Handle<Quote> stateVariable = new Handle(new SimpleQuote(s0_.doubleValue()));
        final Handle<YieldTermStructure> riskFreeRate = new Handle(new FlatForward(today, r_.doubleValue(), dayCount));

        final Handle<YieldTermStructure> dividendYield = new Handle(new FlatForward(today, 0.0, dayCount));

        final Handle<BlackVolTermStructure> volatility = new Handle(new BlackConstantVol(today, calendar, sigma_.doubleValue(),dayCount));

        final StochasticProcess1D diffusion = new BlackScholesMertonProcess(
                stateVariable, dividendYield, riskFreeRate, volatility);
View Full Code Here

        final Exercise europeanExercise = new EuropeanExercise(exerciseDate);
        final Exercise americanExercise = new AmericanExercise(settlementDate,exerciseDate);

        final Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(underlying));
        final Handle<YieldTermStructure> flatTermStructure = new Handle<YieldTermStructure>(
                new FlatForward(settlementDate, riskFreeRate, dayCounter));
        final Handle<YieldTermStructure> flatDividendTS = new Handle<YieldTermStructure>(
                new FlatForward(settlementDate, dividendYield, dayCounter));
        final Handle<BlackVolTermStructure> flatVolTS = new Handle<BlackVolTermStructure>(
                new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));

        final BlackScholesMertonProcess stochasticProcess = new BlackScholesMertonProcess(
                underlyingH, flatDividendTS, flatTermStructure, flatVolTS);
View Full Code Here

        clock.startClock();

        System.out.println("//==========================================FlatForward termstructure===================");
        final SimpleQuote interestRateQuote = new SimpleQuote(0.3);
        final RelinkableHandle<Quote>  handleToInterestRateQuote = new RelinkableHandle<Quote>(interestRateQuote);
        final YieldTermStructure flatforward = new FlatForward(2,new UnitedStates(Market.NYSE),handleToInterestRateQuote,new Actual365Fixed(), Compounding.Continuous,Frequency.Daily);

        final Date today  = Date.todaysDate();
        final Date date10 = today.clone().addAssign(10);
        final Date date20 = today.clone().addAssign(20);
        final Date date30 = today.clone().addAssign(30);
        final Date date40 = today.clone().addAssign(40);
        final Date date50 = today.clone().addAssign(50);


        //Calculating discount factor
        System.out.println("The discount factor for the date 30 days from today is = "+flatforward.discount(date30.clone()));

        //Calculating forward rate
        System.out.println("The forward rate between the date 30 days from today to 50 days from today is = "+flatforward.forwardRate(date30.clone(), date50.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        //Calculating parRate for the dates as shown below-
        final Date[] dates = { date10.clone(), date20.clone(), date30.clone(), date40.clone(), date50.clone() };
        System.out.println("The par rate for the bond having coupon dates as shown above is = "+flatforward.parRate(dates, Frequency.Semiannual, false));

        //Calculating zero rate
        System.out.println("The zero rate for the bond having coupon date as 10 days from today = "+flatforward.zeroRate(date10.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        System.out.println("//==========================================ForwardSpreadedTermStructure==================");
        //As the name suggests this termstructure adds a spread to the forward rates it calculates by getting the spread rate
        //from the spread rate quote
        final SimpleQuote spreadRateQuote = new SimpleQuote(0.2);
View Full Code Here

            //bootstrap the yield/vol curves
            final DayCounter dayCounter = new Actual365Fixed();
            final Handle<Quote> h1 = new Handle<Quote>(riskFreeRate.currentLink());
            final Handle<Quote> h2 = new Handle<Quote>(volatility.currentLink());
            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);
View Full Code Here

        final double rRate = process.riskFreeRate().currentLink().zeroRate(maturityDate, rfdc, Compounding.Continuous, Frequency.NoFrequency).rate();
        final double qRate = process.dividendYield().currentLink().zeroRate(maturityDate, divdc, Compounding.Continuous, Frequency.NoFrequency).rate();
        final Date referenceDate = process.riskFreeRate().currentLink().referenceDate();

        // 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);
View Full Code Here

        Exercise europeanExercise = new EuropeanExercise(maturityDate);
        Payoff payoff = new PlainVanillaPayoff(type, strike);

        final Calendar calendar = new Target();
        Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(underlying));
        Handle<YieldTermStructure> flatDividendTS = new Handle<YieldTermStructure>(new FlatForward(settlementDate, dividendYield, dayCounter));
        Handle<YieldTermStructure> flatTermStructure = new Handle<YieldTermStructure>(new FlatForward(settlementDate, riskFreeRate, dayCounter));
        Handle<BlackVolTermStructure> flatVolTS = new Handle<BlackVolTermStructure>(new BlackConstantVol(settlementDate, calendar, volatility, dayCounter));

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

        VanillaOption europeanOption = new EuropeanOption(payoff, europeanExercise);
View Full Code Here

TOP

Related Classes of org.jquantlib.termstructures.yieldcurves.FlatForward

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.