Package org.jquantlib.time

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


    }

    public Pair<Double, Double> convertDates(final Date optionDate, final Period swapTenor) {
        final Date end = optionDate.add(swapTenor);
        // TODO: code review :: please verify against QL/C++ code
        QL.require(end.gt(optionDate) , "negative swap tenorgiven"); // QA:[RG]::verified // TODO: message
        final double optionTime = timeFromReference(optionDate);
        final double timeLength = dayCounter().yearFraction(optionDate, end);
        return new Pair<Double, Double>(optionTime, timeLength);
    }
View Full Code Here


            if (!IMM.isIMMdate(immDate, false)) {
                fail("\n  " + immDate.weekday() + " " + immDate + " is not an IMM date (calculated from " + counter.weekday() + " " + counter + ")");
            }

            // check that imm is <= to the next IMM date in the main cycle
            if (immDate.gt(IMM.nextDate(counter, true))) {
                fail("\n  " + immDate.weekday() + " " + immDate + " is not less than or equal to the next future in the main cycle " + IMM.nextDate(counter, true));
            }

            //
            // COMMENTED AT SOURCE QuantLib 0.8.1
View Full Code Here

            // when the reference period is not specified, try taking
            // it equal to (d1,d2)
            Date refPeriodStart = (!d3.isNull() ? d3 : d1);
            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...
View Full Code Here

                return -1.0 * yearFraction(dateEnd, dateStart, new Date(), new Date());

            Date newD2 = dateEnd;
            Date temp = dateEnd;
            double sum = 0.0;
            while (temp.gt(dateStart)) {
                temp = newD2.add(Period.ONE_YEAR_BACKWARD);
                if (temp.dayOfMonth() == 28 && temp.month().value() == 2 && Date.isLeap(temp.year()))
                    temp.inc();
                if (temp.ge(dateStart)) {
                    sum += 1.0;
View Full Code Here

            // when the reference period is not specified, try taking
            // it equal to (d1,d2)
            Date refPeriodStart = (!d3.isNull() ? d3 : d1);
            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...
View Full Code Here

        double delta_theta = 0.0, delta_rho = 0.0;
        for (int i = 0; i < a.cashFlow.size(); i++) {
            final CashFlow cashflow = a.cashFlow.get(i);
            final Date d = cashflow.date();
            if (d.gt(settlementDate)) {
                delta_theta -= cashflow.amount()
                * process.riskFreeRate().currentLink().zeroRate(d, rfdc, Compounding.Continuous, Frequency.Annual).rate()
                * process.riskFreeRate().currentLink().discount(d);
                delta_rho += cashflow.amount() * process.time(d) * process.riskFreeRate().currentLink().discount(t);
            }
View Full Code Here

        Date d = Date.minDate();
        for (int i = 0; i < cashflows.size(); i++) {
            d = Date.max(d, cashflows.get(i).date());
        }
        // TODO: code review :: please verify against QL/C++ code
        QL.ensure (d.gt(Date.minDate()), no_cashflows);
        return d;
    }


    public double npv(
View Full Code Here

            // when the reference period is not specified, try taking
            // it equal to (d1,d2)
            Date refPeriodStart = (!d3.isNull() ? d3 : d1);
            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...
View Full Code Here

            // when the reference period is not specified, try taking
            // it equal to (d1,d2)
            Date refPeriodStart = (!d3.isNull() ? d3 : d1);
            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...
View Full Code Here

                return -1.0 * yearFraction(dateEnd, dateStart, new Date(), new Date());

            Date newD2 = dateEnd;
            Date temp = dateEnd;
            double sum = 0.0;
            while (temp.gt(dateStart)) {
                temp = newD2.add(Period.ONE_YEAR_BACKWARD);
                if (temp.dayOfMonth() == 28 && temp.month().value() == 2 && Date.isLeap(temp.year()))
                    temp.inc();
                if (temp.ge(dateStart)) {
                    sum += 1.0;
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.