Package org.jquantlib.daycounters

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


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

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

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

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

     *  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

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

     * 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

     */
    public BlackVolTermStructure(
            /*@Natural*/ final int settlementDays,
            final Calendar cal,
            final BusinessDayConvention bdc) {
        this(settlementDays, cal, bdc, new DayCounter());
    }
View Full Code Here

        final Date paymentDate = cf.date();
        boolean firstCouponFound = false;
        /*@Real*/double nominal = Constants.NULL_REAL;
        /*@Time*/double accrualPeriod = Constants.NULL_REAL;
        DayCounter dc = null;

        /*@Rate*/double result = 0.0;

        // QL starts at the next cashflow and only continues to the one after to
        // check that it isn't the same date. Also stop at the penultimate flow. The last flow
        // is not a Coupon
        final int startIndex = cashflows_.indexOf(cf);
        for (final CashFlow flow : Iterables.unmodifiableIterable(cashflows_.listIterator(startIndex))) {
            if (flow.date().ne(paymentDate)) {
                break;
            }
            //TODO: code review: should the last element be excluded?
            final Coupon cp = (Coupon)flow;
            if (cp != null) {
                if (firstCouponFound) {
                    assert(nominal       == cp.nominal() &&
                            accrualPeriod == cp.accrualPeriod() &&
                            //FIXME: implement equals for dayCounters!
                            dc.getClass()            == cp.dayCounter().getClass()):
                                "cannot aggregate accrued amount of two " +
                                "different coupons on "+ paymentDate.toString();
                } else {
                    firstCouponFound = true;
                    nominal = cp.nominal();
View Full Code Here

TOP

Related Classes of org.jquantlib.daycounters.DayCounter

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.