Examples of DayCounter


Examples of org.jquantlib.daycounters.DayCounter

        /*@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

Examples of org.jquantlib.daycounters.DayCounter

                -0.1507936507937,
                0.1507936507937,
                0.2023809523810
        };

        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
                    +"\n expected:   "+expected[i],
                    abs(calculated - expected[i]) <= 1.0e-12);
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     * @warning term structures initialized by means of this
     *          constructor must manage their own reference date
     *          by overriding the referenceDate() method.
     */
    public BlackVolTermStructure() {
        this(new Calendar(), BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     * @warning term structures initialized by means of this
     *          constructor must manage their own reference date
     *          by overriding the referenceDate() method.
     */
    public BlackVolTermStructure(final Calendar cal) {
        this(cal, BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     *          by overriding the referenceDate() method.
     */
    public BlackVolTermStructure(
            final Calendar cal,
            final BusinessDayConvention bdc) {
        this(cal, bdc, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

    /**
     *  initialize with a fixed reference date
     */
    public BlackVolTermStructure(final Date referenceDate) {
        this(referenceDate, new Calendar(), BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     *  initialize with a fixed reference date
     */
    public BlackVolTermStructure(
            final Date referenceDate,
            final Calendar cal) {
        this(referenceDate, cal, BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     */
    public BlackVolTermStructure(
            final Date referenceDate,
            final Calendar cal,
            final BusinessDayConvention bdc) {
        this(referenceDate, cal, bdc, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     * calculate the reference date based on the global evaluation date
     */
    public BlackVolTermStructure(
            /*@Natural*/ final int settlementDays,
            final Calendar cal) {
        this(settlementDays, cal, BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

Examples of org.jquantlib.daycounters.DayCounter

     */
    public BlackVolTermStructure(
            /*@Natural*/ final int settlementDays,
            final Calendar cal,
            final BusinessDayConvention bdc) {
        this(settlementDays, cal, bdc, new DayCounter());
    }
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.