Package org.jquantlib.time

Examples of org.jquantlib.time.Date$ISODate


     * is used if no date is given.
     *
     * @return
     */
    public /* @Rate */double previousCoupon(){
        return previousCoupon(new Date());
    }
View Full Code Here


    }

    protected void calculateNotionalsFromCashflows() {
        notionalSchedule_.clear();
        notionals_.clear();
        Date lastPaymentDate = new Date();
        notionalSchedule_.add(new Date());
        for (int i=0; i<cashflows_.size(); ++i) {
            final Coupon coupon = (Coupon)cashflows_.get(i);
            if (coupon==null){
                continue;
            }
View Full Code Here

            /* @Real */final double redemption, final Date date) {
        notionals_.clear();
        notionalSchedule_.clear();
        redemptions_.clear();

        notionalSchedule_.add(new Date());
        notionals_.add( notional);

        notionalSchedule_.add(date);
        notionals_.add(0.0);

View Full Code Here

        final InterestRate y = new InterestRate(yield, dayCounter, compounding,
                frequency);

        /* @Real */double price = 0.0;
        /* @DiscountFactor */double discount = 1.0;
        Date lastDate = new Date();

        for (int i = 0; i < cashflows.size(); ++i) {
            if (cashflows.get(i).hasOccurred(settlement)) {
                continue;
            }

            final Date couponDate = cashflows.get(i).date();
            /* @Real */final double amount = cashflows.get(i).amount();

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

        /* @Real */double price = 0.0;
        for (int i = 0; i < cashflows.size(); ++i) {
            if (cashflows.get(i).hasOccurred(settlement)) {
                continue;
            }
            final Date couponDate = cashflows.get(i).date();
            /* @Real */final double amount = cashflows.get(i).amount();
            price += amount * spreadedCurve.discount(couponDate);
        }
        price /= spreadedCurve.discount(settlement);
        return price / faceAmount * 100.0;
 
View Full Code Here

        final DayCounter dayCounter = index_.dayCounter();
        final List<CashFlow> flows = null /* cashFlows() */; // FIXME: translate cashFlows();

        QL.require(this.size_ == flows.size() , wrong_number_of_cashflows); // QA:[RG]::verified // TODO: message

        final Date settlement = index_.termStructure().currentLink().referenceDate();
        final Date startDate = ((IborCoupon) flows.get(0)).fixingDate();
        for (int i = 0; i < size_; ++i) {
            final IborCoupon coupon = (IborCoupon) flows.get(i);
            QL.require(coupon.date().eq(coupon.accrualEndDate()) , irregular_coupon_types); // QA:[RG]::verified // TODO: message

            initialValues_.set(i, coupon.rate());
View Full Code Here

        this.notional = notionalAmount;
        this.index = index;

        // do I adjust this ?
        // valueDate_ = calendar_.adjust(valueDate_,businessDayConvention_);
        final Date fixingDate = calendar.advance (valueDate, -1 * settlementDays, TimeUnit.Days);

        forwardRate = new InterestRate(index.fixing(fixingDate), index.dayCounter(), Compounding.Simple, Frequency.Once);
        this.strikeForwardRate = new InterestRate(strikeForwardRate, index.dayCounter(), Compounding.Simple, Frequency.Once);
        final double strike = notional * this.strikeForwardRate.compoundFactor(valueDate, maturityDate);
        payoff = new ForwardTypePayoff(fraType, strike);
View Full Code Here

        return forwardRate;
    }

    @Override
    public void performCalculations() {
        final Date fixingDate = calendar.advance(valueDate, -1 * settlementDays, TimeUnit.Days);
        forwardRate = new InterestRate(index.fixing(fixingDate), index.dayCounter(), Compounding.Simple, Frequency.Once);
        underlyingSpotValue = spotValue();
        underlyingIncome = 0.0;
        super.performCalculations();
    }
View Full Code Here

    // public methods
    //

    public Date startDate() /* @ReadOnly */ {
        QL.require(legs.size() > 0 , "no legs given"); // QA:[RG]::verified // TODO: message
        Date d = CashFlows.getInstance().startDate(this.legs.get(0));
        for (int j = 1; j < this.legs.size(); j++) {
            d = Date.min(d, CashFlows.getInstance().startDate(this.legs.get(j)));
        }
        return d;
    }
View Full Code Here

        return d;
    }

    public Date maturityDate() /* @ReadOnly */ {
        QL.require(legs.size() > 0 , "no legs given"); // QA:[RG]::verified // TODO: message
        Date d = CashFlows.getInstance().maturityDate(this.legs.get(0));
        for (int j = 1; j < this.legs.size(); j++) {
            d = Date.max(d, CashFlows.getInstance().maturityDate(this.legs.get(j)));
        }
        return d;
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.time.Date$ISODate

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.