Examples of adjust()


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"); // 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"); // 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

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

        }
        // regular periods
        for (int i = 2; i < schedule_.size() - 1; ++i) {
            start = end;
            end = schedule_.date(i);
            paymentDate = calendar.adjust(end, paymentAdjustment_);
            if ((i - 1) < couponRates_.length) {
                rate = couponRates_[i - 1];
            } else {
                rate = couponRates_[couponRates_.length - 1];
            }
View Full Code Here

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

        if (schedule_.size() > 2) {
            // last period might be short or long
            final int N = schedule_.size();
            start = end;
            end = schedule_.date(N - 1);
            paymentDate = calendar.adjust(end, paymentAdjustment_);
            if ((N - 2) < couponRates_.length) {
                rate = couponRates_[N - 2];
            } else {
                rate = couponRates_[couponRates_.length - 1];
            }
View Full Code Here

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

            }
            if (schedule_.isRegular(N - 1)) {
                leg.add(new FixedRateCoupon(nominal, paymentDate, rate, paymentDayCounter_, start, end, start, end));
            } else {
                Date ref = start.add(schedule_.tenor());
                ref = calendar.adjust(ref, schedule_.businessDayConvention());
                leg.add(new FixedRateCoupon(nominal, paymentDate, rate, paymentDayCounter_, start, end, start, ref));
            }
        }
        return leg;
    }
View Full Code Here

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

        final Calendar calendar = new Target();

        // FIXME: outdated...
        Date settlementDate = new Date(18, Month.September, 2008);
        // must be a business day
        settlementDate = calendar.adjust(settlementDate);

        final int fixingDays = 3;
        final int settlementDays = 3;

        final Date todaysDate = calendar.advance(settlementDate, -fixingDays, TimeUnit.Days);
View Full Code Here

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

        }

        // Adjust todaysDate using different businessDayConventions

        // Using FOLLOWING as a business day convention
        final Date nextFollowingBusinessDay = unitedStatesCalendar.adjust(dateToday,BusinessDayConvention.Following);
        if (unitedStatesCalendar.isBusinessDay(nextFollowingBusinessDay)) {
            System. out.println("NextFollowingBusinessDate = "+ nextFollowingBusinessDay+ " from today is a business date");
        }

        // Using MODIFIED_FOLLOWING as a business day convention
View Full Code Here

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

        if (unitedStatesCalendar.isBusinessDay(nextFollowingBusinessDay)) {
            System. out.println("NextFollowingBusinessDate = "+ nextFollowingBusinessDay+ " from today is a business date");
        }

        // Using MODIFIED_FOLLOWING as a business day convention
        final Date nextModified_FollowingBusinessDay = unitedStatesCalendar.adjust(dateToday, BusinessDayConvention.ModifiedFollowing);
        if (unitedStatesCalendar.isBusinessDay(nextModified_FollowingBusinessDay)) {
            System.out.println("NextModified_FollowingBusinessDate = "+ nextModified_FollowingBusinessDay+ " from today is a business date");
        }

        // Using PRECEDING as a business day convention
View Full Code Here

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

        if (unitedStatesCalendar.isBusinessDay(nextModified_FollowingBusinessDay)) {
            System.out.println("NextModified_FollowingBusinessDate = "+ nextModified_FollowingBusinessDay+ " from today is a business date");
        }

        // Using PRECEDING as a business day convention
        final Date nextPrecidingBusinessDay = unitedStatesCalendar.adjust(dateToday,BusinessDayConvention.Preceding);
        if (unitedStatesCalendar.isBusinessDay(nextPrecidingBusinessDay)) {
            System.out.println("NextPrecidingBusinessDay = "+ nextPrecidingBusinessDay+ " from today is a business date");
        }

        // Using MODIFIED_PRECEDING as a business day convention
View Full Code Here

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

        if (unitedStatesCalendar.isBusinessDay(nextPrecidingBusinessDay)) {
            System.out.println("NextPrecidingBusinessDay = "+ nextPrecidingBusinessDay+ " from today is a business date");
        }

        // Using MODIFIED_PRECEDING as a business day convention
        final Date nextModified_PrecidingBusinessDay = unitedStatesCalendar.adjust(dateToday, BusinessDayConvention.ModifiedPreceding);
        if (unitedStatesCalendar.isBusinessDay(nextModified_PrecidingBusinessDay)) {
            System.out.println("NextModified_PrecidingBusinessDay = "+ nextModified_PrecidingBusinessDay+ " from today is a business date");
        }

        // Using UNADJUSTED as a business day convention
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.