Package org.jquantlib.daycounters

Examples of org.jquantlib.daycounters.SimpleDayCounter$Impl


        /*@Time*/ final double expected[] = { 0.25, 0.5, 1.0 };

        // 4 years should be enough
        final Date first = new Date(1,Month.January,2002);
        final Date last  = new Date(31,Month.December,2005);
        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


        /*@Time*/ final double expected[] = new double[] { 1.0, 1.0, 1.0 };

        // 1 years should be enough
        final Date first = new Date(1,Month.January,2004);
        final Date last  = new Date(31,Month.December,2004);
        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

        /*@Time*/ final double expected[] = { 0.25, 0.5, 1.0 };

        // 4 years should be enough
        final Date first = new Date(1,Month.January,2002);
        final Date last  = new Date(31,Month.December,2005);
        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

        /*@Time*/ final double expected[] = new double[] { 1.0, 1.0, 1.0 };

        // 1 years should be enough
        final Date first = new Date(1,Month.January,2004);
        final Date last  = new Date(31,Month.December,2004);
        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

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

       
        final DayCounter business252China = new Business252(new China(China.Market.SSE));
        final DayCounter simpleDayCounter = new SimpleDayCounter();     
        final DayCounter actual360 = new Actual360();       
        final DayCounter actual365Fixed = new Actual365Fixed();       
        final DayCounter actualActual = new ActualActual();       
        final DayCounter thirty360 = new Thirty360();       
        final DayCounter thirty360_2 = new Thirty360();
       
        assertFalse(thirty360.equals(null));
        assertEquals(thirty360, thirty360);
        assertEquals(thirty360, thirty360_2);
       
        assertFalse(simpleDayCounter.equals(business252Brazil));
        assertFalse(business252Brazil.equals(simpleDayCounter));
        assertFalse(actual360.equals(actual365Fixed));
        assertFalse(actual365Fixed.equals(actual360));
        assertFalse(actualActual.equals(thirty360));
        assertFalse(thirty360.equals(actualActual));
View Full Code Here

TOP

Related Classes of org.jquantlib.daycounters.SimpleDayCounter$Impl

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.