Examples of YieldTermStructure


Examples of org.jquantlib.termstructures.YieldTermStructure

    @Test
    public void testReferenceChange() {
        QL.info("Testing term structure against evaluation date change...");

        final YieldTermStructure localTermStructure = new FlatForward(settlementDays, new NullCalendar(), 0.03, new Actual360());

        final int days[] = { 10, 30, 60, 120, 360, 720 };
        /*@DiscountFactor*/ final double[] expected = new /*@DiscountFactor*/ double[days.length];

        final Date today = new Settings().evaluationDate();

        for (int i=0; i<days.length; i++) {
            final Date anotherDay = today.add(days[i]);
            expected[i] = localTermStructure.discount(anotherDay);
        }

        final Date nextMonth = today.add(30);
        new Settings().setEvaluationDate(nextMonth);
        /*@DiscountFactor*/ final double[] calculated = new /*@DiscountFactor*/ double[days.length];

        for (int i=0; i<days.length; i++) {
            final Date anotherDay = nextMonth.add(days[i]);
            calculated[i] = localTermStructure.discount(anotherDay);
        }

        for (int i=0; i<days.length; i++) {
            if (!Closeness.isClose(expected[i],calculated[i])) {
                fail("\n  Discount at " + days[i] + " days:\n"
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

                    public Date maxDate() {
                        throw new UnsupportedOperationException();
                    }
                } );

        final YieldTermStructure implied = new ImpliedTermStructure<YieldTermStructure>(h, newSettlement);

        final Flag flag = new Flag();
        implied.addObserver(flag);

        // TODO: initialization needed (dependent of PiecewiseYieldCurve)
        // h.setLink(termStructure);

        // -------------------------------------------------------------------------------------------------------------
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final DayCounter dc = new Actual360();

        final SimpleQuote           spot  = new SimpleQuote(0.0);
        final SimpleQuote           qRate = new SimpleQuote(0.0);
        final YieldTermStructure    qTS   = Utilities.flatRate(today, qRate, dc);
        final SimpleQuote           rRate = new SimpleQuote(0.0);
        final YieldTermStructure    rTS   = Utilities.flatRate(today, rRate, dc);
        final SimpleQuote           vol   = new SimpleQuote(0.0);
        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

        final double /* @Real */tolerance = 1.0e-4;

View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final DayCounter dc = new Actual360();

        final SimpleQuote           spot  = new SimpleQuote(0.0);
        final SimpleQuote           qRate = new SimpleQuote(0.0);
        final YieldTermStructure    qTS   = Utilities.flatRate(today, qRate, dc);
        final SimpleQuote           rRate = new SimpleQuote(0.0);
        final YieldTermStructure    rTS   = Utilities.flatRate(today, rRate, dc);
        final SimpleQuote           vol   = new SimpleQuote(0.0);
        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

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

View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final DayCounter dc = new Actual360();

        final SimpleQuote           spot  = new SimpleQuote(0.0);
        final SimpleQuote           qRate = new SimpleQuote(0.0);
        final YieldTermStructure    qTS   = Utilities.flatRate(today, qRate, dc);
        final SimpleQuote           rRate = new SimpleQuote(0.0);
        final YieldTermStructure    rTS   = Utilities.flatRate(today, rRate, dc);
        final SimpleQuote           vol   = new SimpleQuote(0.0);
        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

        final double tolerance = 1.0e-3;
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

            final DayCounter dc = new Actual360();

            final SimpleQuote           spot  = new SimpleQuote(0.0);
            final SimpleQuote           qRate = new SimpleQuote(0.0);
            final YieldTermStructure    qTS   = Utilities.flatRate(today, qRate, dc);
            final SimpleQuote           rRate = new SimpleQuote(0.0);
            final YieldTermStructure    rTS   = Utilities.flatRate(today, rRate, dc);
            final SimpleQuote           vol   = new SimpleQuote(0.0);
            final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

            final StrikedTypePayoff payoff = new PlainVanillaPayoff(juValue.type, juValue.strike);
            final Date exDate = today.add(timeToDays(juValue.t));
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final DayCounter dc = new Actual360();
        final Date today = new Settings().evaluationDate();

        final SimpleQuote           spot  = new SimpleQuote(0.0);
        final SimpleQuote           qRate = new SimpleQuote(0.0);
        final YieldTermStructure    qTS   = Utilities.flatRate(today, qRate, dc);
        final SimpleQuote           rRate = new SimpleQuote(0.0);
        final YieldTermStructure    rTS   = Utilities.flatRate(today, rRate, dc);
        final SimpleQuote           vol   = new SimpleQuote(0.0);
        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

        for (final Type type : types) {
            for (final double strike : strikes) {
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final Date today = Date.todaysDate();
        new Settings().setEvaluationDate(today);

        final SimpleQuote           spot  = new SimpleQuote(0.0);
        final SimpleQuote           qRate = new SimpleQuote(0.0);
        final YieldTermStructure    qTS   = Utilities.flatRate(today, qRate, dc);
        final SimpleQuote           rRate = new SimpleQuote(0.0);
        final YieldTermStructure    rTS   = Utilities.flatRate(today, rRate, dc);
        final SimpleQuote           vol   = new SimpleQuote(0.0);
        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);

        for (final NewBarrierOptionData value : values) {
            final Date exDate = today.add( timeToDays(value.t) );
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final Date today = Date.todaysDate();
        new Settings().setEvaluationDate(today);

        final Quote                 underlying = new SimpleQuote(underlyingPrice);
        final Quote                 qH_SME     = new SimpleQuote(q);
        final YieldTermStructure    qTS        = Utilities.flatRate(today, qH_SME, dc);
        final Quote                 rH_SME     = new SimpleQuote(r);
        final YieldTermStructure    rTS        = Utilities.flatRate(today, rH_SME, dc);
        final SimpleQuote           volatility = new SimpleQuote(0.10);
        final BlackVolTermStructure volTS      = Utilities.flatVol(today, volatility, dc);

        final Date exDate = today.add(360);
        final Exercise exercise = new EuropeanExercise(exDate);
View Full Code Here

Examples of org.jquantlib.termstructures.YieldTermStructure

        final Date today = Date.todaysDate();
        new Settings().setEvaluationDate(today);

        final Quote                 underlying = new SimpleQuote(underlyingPrice);
        final Quote                 qH_SME     = new SimpleQuote(q);
        final YieldTermStructure    qTS        = Utilities.flatRate(today, qH_SME, dc);
        final Quote                 rH_SME     = new SimpleQuote(r);
        final YieldTermStructure    rTS        = Utilities.flatRate(today, rH_SME, dc);
        final SimpleQuote           volatility = new SimpleQuote(0.10);
        final BlackVolTermStructure volTS      = Utilities.flatVol(today, volatility, dc);

        final Date exDate = today.add(360);
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.