Package org.jquantlib.time.calendars

Examples of org.jquantlib.time.calendars.NullCalendar$Impl


    @Test
    public void testReferenceChange() {
        QL.info("Testing term structure against evaluation date change...");

        final YieldTermStructure localTermStructure = new FlatForward(settlementDays, new NullCalendar(), 0.03, new Actual360());

        final int days[] = { 10, 30, 60, 120, 360, 720 };
        /*@DiscountFactor*/ final double[] expected = new /*@DiscountFactor*/ double[days.length];

        final Date today = new Settings().evaluationDate();
View Full Code Here


        final double faceAmount = 1000000.0;

        // with implicit settlement calculation:

      final Calendar bondCalendar = new NullCalendar();
      final DayCounter bondDayCount = new ActualActual(ActualActual.Convention.ISMA);
      final int settlementDays = 1;

    final Handle<YieldTermStructure> discountCurve = new Handle<YieldTermStructure>(Utilities.flatRate(today, 0.03, new Actual360()));
View Full Code Here

            final /*@Volatility*/ double v,
            final Date referenceDate,
            final Exercise exercise,
            final List<Date> dates,
            final List<Double> dividends) {
        this(engineClass, type, u, strike, r, q, v, referenceDate, exercise, dates, dividends, new NullCalendar(), new Actual360());
    }
View Full Code Here

            final /*@Volatility*/ double v,
            final Date referenceDate,
            final Exercise exercise,
            final List<Date> dates,
            final List<Double> dividends) {
        this(type, u, strike, r, q, v, referenceDate, exercise, dates, dividends, new NullCalendar(), new Actual360());
    }
View Full Code Here

                throw new IllegalStateException("unknown Rule (" + rule + ")");
            }
        }

        // calendar needed for endOfMonth adjustment
        Calendar nullCalendar = new NullCalendar();
        int periods = 1;
        Date seed, exitDate;
        switch (rule) {

        case ZERO:
            tenor = new Period(0, TimeUnit.DAYS);
            dates.add(effectiveDate);
            dates.add(terminationDate);
            isRegular.add(true);
            break;

        case BACKWARD:

            dates.add(terminationDate);

            seed = terminationDate;
            if (nextToLastDate != Date.NULL_DATE && nextToLastDate != null) {
                // Add it after 1'st element
                dates.add(1, nextToLastDate);
                Date temp = nullCalendar.advance(seed, new Period(-periods * tenor.getLength(), tenor.getUnits()), convention,
                        endOfMonth);
                if (!temp.equals(nextToLastDate))
                    isRegular.add(0, false);
                else
                    isRegular.add(0, true);
                seed = nextToLastDate;
            }

            exitDate = effectiveDate;
            if (firstDate != Date.NULL_DATE && firstDate != null)
                exitDate = firstDate;

            while (true) {
                Date temp = nullCalendar.advance(seed, new Period(-periods * tenor.getLength(), tenor.getUnits()), convention,
                        endOfMonth);
                if (temp.lt(exitDate))
                    break;
                else {
                    dates.add(0, temp);
                    isRegular.add(0, true);
                    ++periods;
                }
            }

            if (endOfMonth && calendar.isEndOfMonth(seed))
                convention = BusinessDayConvention.PRECEDING;

            if (!calendar.adjust(dates.get(0), convention).eq(calendar.adjust(effectiveDate, convention))) {
                dates.add(0, effectiveDate);
                isRegular.add(0, false);
            }
            break;

        case THIRD_WEDNESDAY:
            if (endOfMonth)
                throw new IllegalStateException("endOfMonth convention incompatible with " + rule + " date generation rule");
            // fall through
        case FORWARD:

            dates.add(effectiveDate);

            seed = effectiveDate;
            if (firstDate != Date.NULL_DATE && firstDate != null) {
                dates.add(firstDate);
                Date temp = nullCalendar.advance(seed, new Period(periods * tenor.getLength(), tenor.getUnits()), convention,
                        endOfMonth);
                if (temp != firstDate)
                    isRegular.add(false);
                else
                    isRegular.add(true);
                seed = firstDate;
            }

            exitDate = terminationDate;
            if (nextToLastDate != Date.NULL_DATE && nextToLastDate != null)
                exitDate = nextToLastDate;

            while (true) {
                Date temp = nullCalendar.advance(seed, new Period(periods * tenor.getLength(), tenor.getUnits()), convention,
                        endOfMonth);
                if (temp.gt(exitDate))
                    break;
                else {
                    dates.add(temp);
View Full Code Here

            final Date referenceDate,
            final Handle<? extends Quote> forward,
            final DayCounter dayCounter,
            final Compounding compounding,
            final Frequency frequency) {
        super(referenceDate, new NullCalendar(), dayCounter);
        this.compounding = compounding;
        this.frequency = frequency;
        this.forward = forward;
        this.forward.addObserver(this);
        updateRate();
View Full Code Here

            final Date referenceDate,
            final /*@Rate*/ double forward,
            final DayCounter dayCounter,
            final Compounding compounding,
            final Frequency frequency) {
        super(referenceDate, new NullCalendar(), dayCounter);
        this.forward = new Handle<SimpleQuote>(new SimpleQuote(forward));
        this.compounding = compounding;
        this.frequency = frequency;
        updateRate();
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.time.calendars.NullCalendar$Impl

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.