Package org.jquantlib.time

Examples of org.jquantlib.time.Date.sub()


        QL.info("Testing observability of dates using operation Date#sub()");

        final Date me = Date.todaysDate();
        final Flag f = new Flag();
        me.addObserver(f);
        me.sub(1);
        if (f.isUp()) {
            fail("Observer was notified of date change whilst it was not expected");
        }
    }
View Full Code Here


        final RelinkableHandle<Date> h = new RelinkableHandle<Date>(me1);

        final Flag f = new Flag();
        h.addObserver(f);

        me1.sub(1);
        if (f.isUp()) {
            fail("Observer was notified of date change whilst it was not expected");
        }
    }
View Full Code Here

                    final CashFlow coupon = cashflows.get(i);
                    if (coupon instanceof Coupon && coupon != null) {
                        // if (coupon)
                        lastDate = ((Coupon) coupon).accrualStartDate();
                    } else {
                        lastDate = couponDate.sub(new Period(1, TimeUnit.Years));
                    }
                }
                discount *= y.discountFactor(settlement, couponDate, lastDate,
                        couponDate);
            } else {
View Full Code Here

            Date refPeriodEnd   = (!d4.isNull() ? d4 : d2);

            QL.ensure(refPeriodEnd.gt(refPeriodStart) && refPeriodEnd.gt(d1) , "invalid reference period")// QA:[RG]::verified // TODO: message

            // estimate roughly the length in months of a period
            int months = (int) (0.5 + 12 * (refPeriodEnd.sub(refPeriodStart)) / 365.0);

            // for short periods...
            if (months == 0) {
                // ...take the reference period as 1 year from d1
                refPeriodStart = d1;
View Full Code Here

            Date refPeriodEnd   = (!d4.isNull() ? d4 : d2);

            QL.ensure(refPeriodEnd.gt(refPeriodStart) && refPeriodEnd.gt(d1) , "invalid reference period")// TODO: message

            // estimate roughly the length in months of a period
            int months = (int) (0.5 + 12 * (refPeriodEnd.sub(refPeriodStart)) / 365.0);

            // for short periods...
            if (months == 0) {
                // ...take the reference period as 1 year from d1
                refPeriodStart = d1;
View Full Code Here

                    final Object cpnObj = cashflows.get(i);
                  final Coupon coupon = Coupon.class.isAssignableFrom(cpnObj.getClass()) ? (Coupon)cpnObj : null;
                    if (coupon != null) {
                        lastDate = coupon.accrualStartDate().clone();
                    } else {
                        lastDate = couponDate.sub(new Period(1, TimeUnit.Years));
                    }
                }
                discount *= y.discountFactor(settlement, couponDate, lastDate, couponDate);
            } else {
                discount *= y.discountFactor(lastDate, couponDate);
View Full Code Here

        QL.info("Testing observability of dates using operation Date#sub()");

        final Date me = Date.todaysDate();
        final Flag f = new Flag();
        me.addObserver(f);
        me.sub(1);
        if (f.isUp()) {
            fail("Observer was notified of date change whilst it was not expected");
        }
    }
View Full Code Here

        final RelinkableHandle<Date> h = new RelinkableHandle<Date>(me1);

        final Flag f = new Flag();
        h.addObserver(f);

        me1.sub(1);
        if (f.isUp()) {
            fail("Observer was notified of date change whilst it was not expected");
        }
    }
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.