Examples of yearFraction()


Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

        /*@Time*/ final double t_r = rfdc.yearFraction(process.riskFreeRate().currentLink().referenceDate(),
                a.exercise.lastDate());
        greeks.rho = black.rho(t_r) + 0.5 * black.dividendRho(t_q);

        /*@Time*/ final double t_v = voldc.yearFraction(
                process.blackVolatility().currentLink().referenceDate(),
                a.exercise.lastDate());
        greeks.vega = black.vega(t_v)/Math.sqrt(3.0) +
        black.dividendRho(t_q)*volatility/6.0;

 
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

            greeks.rho = black.rho(t);

            t = divdc.yearFraction(process.dividendYield().currentLink().referenceDate(), a.exercise.lastDate());
            greeks.dividendRho = black.dividendRho(t);

            t = voldc.yearFraction(process.blackVolatility().currentLink().referenceDate(), a.exercise.lastDate());
            greeks.vega        = black.vega(t);
            greeks.theta       = black.theta(spot, t);

            moreGreeks.thetaPerDay        = black.thetaPerDay(spot, t);
            moreGreeks.strikeSensitivity  = black.strikeSensitivity();
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

                                            expected.put("vega",(value_p - value_m)/(2*dv));

                                            // perturb date and get theta
                                            final Date yesterday = today.sub(1);
                                            final Date tomorrow  = today.add(1);
                                            final double dT = dc.yearFraction(yesterday, tomorrow);
                                            new Settings().setEvaluationDate(yesterday);
                                            value_m = option.NPV();
                                            new Settings().setEvaluationDate(tomorrow);
                                            value_p = option.NPV();
                                            new Settings().setEvaluationDate(Date.todaysDate());
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

                                                        vol.setValue(v);
                                                        expected.put("vega", (value_p - value_m) / (2 * dv));

                                                        final Date yesterday = today.sub(1);
                                                        final Date tomorrow = today.add(1);
                                                        final double dT = dc.yearFraction(yesterday, tomorrow);
                                                        new Settings().setEvaluationDate(yesterday);
                                                        value_m = option.NPV();
                                                        new Settings().setEvaluationDate(tomorrow);
                                                        value_p = option.NPV();
                                                        new Settings().setEvaluationDate(today);
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

        final DayCounter dayCounter = new SimpleDayCounter();

        for (final Date start = first; start.le(last); start.inc()) {
            for (int i=0; i<expected.length-1; i++) {
                final Date end = start.add(p[i]);
                /*@Time*/ final double  calculated = dayCounter.yearFraction(start, end);

                if (abs(calculated-expected[i]) > 1.0e-12) {
                    fail("from " + start + " to " + end + ":\n"
                            + "    calculated: " + calculated + "\n"
                            + "    expected:   " + expected[i]);
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

        final DayCounter dayCounter = new SimpleDayCounter();

        for (final Date start = first; start.le(last); start.inc()) {
            for (int i=0; i<expected.length-1; i++) {
                final Date end = start.add(p[i]);
                /*@Time*/ final double  calculated = dayCounter.yearFraction(start, end);

                if (abs(calculated-expected[i]) <= 1.0e-12) {
                    fail("from " + start + " to " + end + ":\n"
                            + "    calculated: " + calculated + "\n"
                            + "    expected:   " + expected[i]);
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()

        final DayCounter dayCounter = new Business252(new Brazil(Brazil.Market.SETTLEMENT));

        for (int i=1; i<testDates.length-1; i++) {
            final Date start = testDates[i-1];
            final Date end = testDates[i];
            /*@Time*/ final double  calculated = dayCounter.yearFraction(start, end);
            // System.out.println(calculated);
            assertFalse(dayCounter.getClass().getName()
                    +"\n from "+start
                    +"\n to "+end
                    +"\n calculated: "+calculated
View Full Code Here

Examples of org.jquantlib.daycounters.SimpleDayCounter.yearFraction()

        final DayCounter dayCounter = new SimpleDayCounter();

        for (final Date start = first; start.le(last); start.inc()) {
            for (int i=0; i<expected.length-1; i++) {
                final Date end = start.add(p[i]);
                /*@Time*/ final double  calculated = dayCounter.yearFraction(start, end);

                if (abs(calculated-expected[i]) > 1.0e-12) {
                    fail("from " + start + " to " + end + ":\n"
                            + "    calculated: " + calculated + "\n"
                            + "    expected:   " + expected[i]);
View Full Code Here

Examples of org.jquantlib.daycounters.SimpleDayCounter.yearFraction()

        final DayCounter dayCounter = new SimpleDayCounter();

        for (final Date start = first; start.le(last); start.inc()) {
            for (int i=0; i<expected.length-1; i++) {
                final Date end = start.add(p[i]);
                /*@Time*/ final double  calculated = dayCounter.yearFraction(start, end);

                if (abs(calculated-expected[i]) <= 1.0e-12) {
                    fail("from " + start + " to " + end + ":\n"
                            + "    calculated: " + calculated + "\n"
                            + "    expected:   " + expected[i]);
View Full Code Here

Examples of org.jquantlib.daycounters.SimpleDayCounter.yearFraction()

        final DayCounter dayCounter = new SimpleDayCounter();

        for (final Date start = first; start.le(last); start.inc()) {
            for (int i=0; i<expected.length-1; i++) {
                final Date end = start.add(p[i]);
                /*@Time*/ final double  calculated = dayCounter.yearFraction(start, end);

                if (abs(calculated-expected[i]) > 1.0e-12) {
                    fail("from " + start + " to " + end + ":\n"
                            + "    calculated: " + calculated + "\n"
                            + "    expected:   " + expected[i]);
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.