Examples of Coupon


Examples of org.jquantlib.cashflow.Coupon

        notionals_.clear();
        Date lastPaymentDate = new Date();
        notionalSchedule_.add(new Date());
        for (int i=0; i<cashflows_.size(); ++i) {
          final Object cfObj = cashflows_.get(i);
          final Coupon coupon = Coupon.class.isAssignableFrom(cfObj.getClass()) ? (Coupon)cfObj : null;
            if (coupon==null){
                continue;
            }
            final double notional = coupon.nominal();
            // we add the notional only if it is the first one...
            if (notionals_.isEmpty()) {
                notionals_.add(coupon.nominal());
                lastPaymentDate = coupon.date().clone();
            } else if (!Closeness.isClose(notional, notionals_.get(notionals_.size() -1 ))) {
                // ...or if it has changed.
                QL.require(notional < notionals_.get(notionals_.size()-1), "increasing coupon notionals");
                notionals_.add(coupon.nominal());
                // in this case, we also add the last valid date for
                // the previous one...
                notionalSchedule_.add(lastPaymentDate);
                // ...and store the candidate for this one.
                lastPaymentDate = coupon.date().clone();
            } else {
                // otherwise, we just extend the valid range of dates
                // for the current notional.
                lastPaymentDate = coupon.date().clone();
            }
        }
        QL.require(!notionals_.isEmpty(), "no coupons provided");
        notionals_.add(0.0);
        notionalSchedule_.add(lastPaymentDate);
View Full Code Here

Examples of org.jquantlib.cashflow.Coupon

                // first not-expired coupon
                if (i > 0) {
                    lastDate = cashflows.get(i - 1).date().clone();
                } else {
                    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);
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.