Examples of adjust()


Examples of org.jquantlib.time.Calendar.adjust()

  public void testCachedFixed() {

      QL.info("Testing fixed-coupon bond prices against cached values...");

        final Calendar calendar = new Target();
        final Date today = calendar.adjust(Date.todaysDate());
        // final Date today = calendar.adjust(new Date(6,Month.June,2007));
        // final Date today = new Date(22,Month.November,2004);
        final Settings settings = new Settings();
        settings.setEvaluationDate(today);
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

      QL.info("Testing Brazilian public bond prices against cached values...");

        final Calendar calendar = new Target();
        // final Date today = calendar.adjust(Date.todaysDate());
      final Date today = calendar.adjust(new Date(6,Month.June,2007));
      final Settings settings = new Settings();
      settings.setEvaluationDate(today);

        //final double faceAmount = 1000000.0;
        final double faceAmount = 1000.0;
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

                new Entry( new Date(26, 1, 1973), new Date(26, 1, 1973) ),
            };

        final Calendar unitedStatesCalendar = new UnitedStates(UnitedStates.Market.NYSE);
        for (final Entry entry : entries) {
            final Date result = unitedStatesCalendar.adjust(entry.date, BusinessDayConvention.ModifiedFollowing);
            System.out.println("adjusted is " + result.isoDate() + "  ::  expected is " + entry.expected.isoDate());
            assertEquals(result, entry.expected);
        }
    }
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

                new Entry( new Date(26, 1, 1973), new Date(26, 1, 1973) ),
            };

        final Calendar unitedStatesCalendar = new UnitedStates(UnitedStates.Market.NYSE);
        for (final Entry entry : entries) {
            final Date result = unitedStatesCalendar.adjust(entry.date, BusinessDayConvention.ModifiedPreceding);
            System.out.println("adjusted is " + result.isoDate() + "  ::  expected is " + entry.expected.isoDate());
            assertEquals(result, entry.expected);
        }
    }
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

        // the following is not always correct (original C++ comment)
        final Calendar calendar = schedule.calendar();

        Date refStart, start, refEnd, end;
        final Date lastPaymentDate = calendar.adjust(schedule.date(n), paymentAdj);

        for (int i = 0; i < n; i++) {
            refStart = start = schedule.date(i);
            refEnd   =   end = schedule.date(i+1);
            final Date paymentDate = isZero ? lastPaymentDate : calendar.adjust(end, paymentAdj);
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

        final Date lastPaymentDate = calendar.adjust(schedule.date(n), paymentAdj);

        for (int i = 0; i < n; i++) {
            refStart = start = schedule.date(i);
            refEnd   =   end = schedule.date(i+1);
            final Date paymentDate = isZero ? lastPaymentDate : calendar.adjust(end, paymentAdj);

            if (i == 0 && !schedule.isRegular(i + 1)) {
                refStart = calendar.adjust(end.sub(schedule.tenor()), paymentAdj);
            }
            if (i == n - 1 && !schedule.isRegular(i + 1)) {
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

            refStart = start = schedule.date(i);
            refEnd   =   end = schedule.date(i+1);
            final Date paymentDate = isZero ? lastPaymentDate : calendar.adjust(end, paymentAdj);

            if (i == 0 && !schedule.isRegular(i + 1)) {
                refStart = calendar.adjust(end.sub(schedule.tenor()), paymentAdj);
            }
            if (i == n - 1 && !schedule.isRegular(i + 1)) {
                refEnd = calendar.adjust(start.add(schedule.tenor()), paymentAdj);
            }
            if (Detail.get(gearings, i, 1.0) == 0.0) {
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

            if (i == 0 && !schedule.isRegular(i + 1)) {
                refStart = calendar.adjust(end.sub(schedule.tenor()), paymentAdj);
            }
            if (i == n - 1 && !schedule.isRegular(i + 1)) {
                refEnd = calendar.adjust(start.add(schedule.tenor()), paymentAdj);
            }
            if (Detail.get(gearings, i, 1.0) == 0.0) {
                add(new FixedRateCoupon(
                        Detail.get(nominals, i, 1.0),
                        paymentDate,
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

        // the following is not always correct
        final Calendar calendar = schedule_.calendar();

        // first period might be short or long
        Date start = schedule_.date(0), end = schedule_.date(1);
        Date paymentDate = calendar.adjust(end, paymentAdjustment_);
        InterestRate rate = couponRates_[0];
        /*@Real*/ double nominal = notionals_[0];
        if (schedule_.isRegular(1)) {
            // TODO: code review :: please verify against QL/C++ code
            QL.require(firstPeriodDayCounter_==null || !firstPeriodDayCounter_.equals(paymentDayCounter_) , "regular first coupon does not allow a first-period day count"); // QA:[RG]::verified // TODO: message
View Full Code Here

Examples of org.jquantlib.time.Calendar.adjust()

            // TODO: code review :: please verify against QL/C++ code
            QL.require(firstPeriodDayCounter_==null || !firstPeriodDayCounter_.equals(paymentDayCounter_) , "regular first coupon does not allow a first-period day count"); // QA:[RG]::verified // TODO: message
            leg.add(new FixedRateCoupon(nominal, paymentDate, rate, paymentDayCounter_, start, end, start, end));
        } else {
            Date ref = end.sub(schedule_.tenor());
            ref = calendar.adjust(ref, schedule_.businessDayConvention());
            // FIXME: empty() method on dayCounter missing --> substituted by == null (probably incorrect)
            final DayCounter dc = (firstPeriodDayCounter_ == null) ? paymentDayCounter_ : firstPeriodDayCounter_;
            leg.add(new FixedRateCoupon(nominal, paymentDate, rate, dc, start, end, ref, end));
        }
        // regular periods
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.