Package org.jquantlib.time.calendars

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


        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


        QL.info("::::: " + this.getClass().getSimpleName() + " :::::");
    }

    @Test
    public void testAdvance() {
        final NullCalendar nullCalendar = new NullCalendar();
        final Date d = new Date(11, Month.October, 2009);
        final Date dCopy = d.clone();
        assertEquals(dCopy, d);
        final Date advancedDate = nullCalendar.advance(d, new Period(3, TimeUnit.Months));
        assertEquals(dCopy, d);
        assertFalse(advancedDate.equals(d));
    }
View Full Code Here

    @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

    public CapVolatilityStructure(final DayCounter dc) {
        super(dc == null ? new Actual365Fixed() : dc);
    }

    public CapVolatilityStructure(final Date referenceDate, final Calendar cal, final DayCounter dc) {
        super(referenceDate, cal == null ? new NullCalendar() : cal, dc == null ? new Actual365Fixed() : dc);
    }
View Full Code Here

    public CapVolatilityStructure(final Date referenceDate, final Calendar cal, final DayCounter dc) {
        super(referenceDate, cal == null ? new NullCalendar() : cal, dc == null ? new Actual365Fixed() : dc);
    }

    public CapVolatilityStructure(final int settlementDays, final Calendar cal, final DayCounter dc) {
        super(settlementDays, cal == null ? new NullCalendar() : cal, dc == null ? new Actual365Fixed() : dc);
    }
View Full Code Here

    //
    // public methods
    //

    public Schedule(final List<Date> dates) {
      this(dates, new NullCalendar(), BusinessDayConvention.Unadjusted);
    }
View Full Code Here

            }
        }


        // calendar needed for endOfMonth adjustment
        final 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(new Boolean(true));
            break;

          case Backward:

            dates_.add(terminationDate);

            seed = terminationDate.clone();
            if ( nextToLastDate != null && !nextToLastDate.isNull() ) {
                dates_.add(0, nextToLastDate);
                final Date temp = nullCalendar.advance(seed, tenor_.mul(periods).negative(), convention, endOfMonth);
                if (temp.ne(nextToLastDate)) {
                    isRegular_.add(0, new Boolean(false));
                } else {
                    isRegular_.add(0, new Boolean(true));
                }
                seed = nextToLastDate.clone();
            }

            exitDate = effectiveDate.clone();
            if ( firstDate != null && !firstDate.isNull() ) {
                exitDate = firstDate.clone();
            }

            while (true) {
                final Date temp = nullCalendar.advance(seed, tenor_.mul(periods).negative(), convention, endOfMonth);
                if (temp .lt(exitDate)) {
                    break;
                } else {
                    dates_.add(0, temp);
                    isRegular_.add(0, new Boolean(true));
                    ++periods;
                }
            }

            if (endOfMonth && calendar.isEndOfMonth(seed)) {
                convention = BusinessDayConvention.Preceding;
            }

            if (calendar.adjust(dates_.get(0),convention).ne(
                calendar.adjust(effectiveDate, convention))) {
                dates_.add(0, effectiveDate);
                isRegular_.add(0, new Boolean(false));
            }
            break;

          case Twentieth:
          case TwentiethIMM:
          case ThirdWednesday:
            QL.require(!endOfMonth,
                       "endOfMonth convention incompatible with " + rule_ +
                       " date generation rule"); // TODO: message
          // fall through
          case Forward:

            dates_.add(effectiveDate);

            seed = effectiveDate.clone();

            if (firstDate != null && !firstDate.isNull() ) {
                dates_.add(firstDate);
                final Date temp = nullCalendar.advance(seed, tenor_.mul(periods), convention, endOfMonth);
                if (temp.ne(firstDate) ) {
                    isRegular_.add(new Boolean(false));
                } else {
                    isRegular_.add(new Boolean(true));
                }
                seed = firstDate.clone();
            } else if (rule_ == DateGeneration.Rule.Twentieth ||
                       rule_ == DateGeneration.Rule.TwentiethIMM) {
                final Date next20th = nextTwentieth(effectiveDate, rule_);
                if (next20th.ne(effectiveDate)) {
                    dates_.add(next20th);
                    isRegular_.add(new Boolean(false));
                    seed = next20th.clone();
                }
            }

            exitDate = terminationDate.clone();
            if ( nextToLastDate != null && !nextToLastDate.isNull() ) {
                exitDate = nextToLastDate.clone();
            }

            while (true) {
                final Date temp = nullCalendar.advance(seed, tenor_.mul(periods), convention, endOfMonth);
                if ( temp.gt(exitDate) ) {
                    break;
                } else {
                    dates_.add(temp);
                    isRegular_.add(new Boolean(true));
View Full Code Here

    public LocalConstantVol(
            final int settlementDays,
            final Calendar cal,
            final /*@Volatility*/ double volatility,
            final DayCounter dayCounter) {
        super(settlementDays, new NullCalendar());
        this.volatility = new Handle<Quote>(new SimpleQuote(volatility));
        this.dayCounter = dayCounter;
    }
View Full Code Here

    public LocalConstantVol(
            final int settlementDays,
            final Calendar cal,
            final Handle<Quote> volatility,
            final DayCounter dayCounter) {
        super(settlementDays, new NullCalendar());
        this.volatility = volatility;
        this.dayCounter = dayCounter;
        this.volatility.addObserver(this);
    }
View Full Code Here

    //
    // public methods
    //

    public Schedule(final List<Date> dates) {
      this(dates, new NullCalendar(), BusinessDayConvention.Unadjusted);
    }
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.