Package org.jquantlib.time.calendars

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


    // b) all indexes but o/n and s/n
    super(familyName, tenor, settlementDays,
        currency, new UnitedKingdom(UnitedKingdom.Market.Exchange),
        liborConvention(tenor), liborEOM(tenor), dayCounter, h);
    financialCenterCalendar_ = financialCenterCalendar;
    jointCalendar_ = new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange),
        financialCenterCalendar_,
        JointCalendarRule.JoinHolidays);
    QL.require(this.tenor().units()!= TimeUnit.Days,
        "for daily tenors (" + this.tenor() +
            ") dedicated DailyTenor constructor must be used");
View Full Code Here


        advancedDate = unitedStatesCalendar.advance(dateToday,new Period(1, TimeUnit.Years), BusinessDayConvention.Preceding);
        System.out.println("Next business date when today's date is advanced 1 year = "+ advancedDate);

        //<==================Joining Calendars===============================>
        final Calendar unitedStatesCalendarGvtBondCalendar = new UnitedStates(Market.GOVERNMENTBOND);
        final Calendar jointCalendar = new JointCalendar(unitedStatesCalendar,unitedStatesCalendarGvtBondCalendar,JointCalendarRule.JoinBusinessDays);

        //The above joint calendar has been obtained by joining businessdays of newyork stock exchange and government bond calendar
        //which means a day will be a business day for the joint calendar if it is a business day for both of the calendars used
        //(NYSE,GovtBond) and will be a holiday if the day is a holiday in atleast one of the calendars.

        //Let's get the list of holidays for the joint calendar from the date today to date advanced(obtained by advancing date today by 90 days)
        final List<Date> listOfHoliDays = jointCalendar.holidayList(jointCalendar, dateToday, dateAdvanced, true);

        //Now let's get the same holiday list between dateToday and dateAdvanced using isBusinessDay API
        final List<Date> holidayListObtainedUsingCalAPI = new ArrayList<Date>();
        final Date start = dateToday.clone();
        for (; !start.eq(dateAdvanced); start.inc()) {
            if (jointCalendar.isHoliday(start)){
                holidayListObtainedUsingCalAPI.add(start.clone());
            }
        }

        //Essentially both the lists obtained above are same
View Full Code Here

      final Handle<YieldTermStructure> h) {
      super(familyName,
          new Period(1,TimeUnit.Days),
          settlementDays,
          currency,
              new JointCalendar(new UnitedKingdom(Market.Exchange),
              new Target(),
              JointCalendarRule.JoinBusinessDays),
          liborConvention(new Period(1,TimeUnit.Days)),
          liborEOM(new Period(1,TimeUnit.Days)),
          dayCounter,
View Full Code Here

        liborConvention(tenor),
        liborEOM(tenor),
        dayCounter,
        h);
    this.financialCenterCalendar = financialCenterCalendar;
    this.jointCalendar = new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange),
        financialCenterCalendar,
        JointCalendarRule.JoinHolidays);
    QL.require(this.tenor().units()!= TimeUnit.Days,
        "for daily tenors (" + this.tenor() + ") dedicated DailyTenor constructor must be used");
View Full Code Here

    public EURLibor(final Period tenor, final Handle<YieldTermStructure> h) {
        super("EURLibor",
                tenor,
                2, // settlement days
                new EURCurrency(),
                new JointCalendar(new UnitedKingdom(Market.Exchange),
                          new Target(),
                          JointCalendarRule.JoinBusinessDays),
                eurliborConvention(tenor),
                eurliborEOM(tenor),
                new Actual360(),
View Full Code Here

        final CommonVars vars,
            final Interpolator interpolator,
            /*@Real*/ final double tolerance) {
     
        // re-adjust settlement
        vars.calendar = new JointCalendar(new BMAIndex().fixingCalendar(),
                                          new USDLibor(new Period(3, TimeUnit.Months)).fixingCalendar(),
                                          JointCalendarRule.JoinHolidays);
        vars.today = vars.calendar.adjust(Date.todaysDate());
        new Settings().setEvaluationDate(vars.today);
        vars.settlement = vars.calendar.advance(vars.today, vars.settlementDays, TimeUnit.Days);
View Full Code Here

        Calendar c1 = new Target(),
                 c2 = new UnitedKingdom(),
                 c3 = new UnitedStates(UnitedStates.Market.NYSE),
                 c4 = new Japan();

        Calendar c12h = new JointCalendar(c1,c2,JointCalendarRule.JoinHolidays),
                 c12b = new JointCalendar(c1,c2,JointCalendarRule.JoinBusinessDays),
                 c123h = new JointCalendar(c1,c2,c3,JointCalendarRule.JoinHolidays),
                 c123b = new JointCalendar(c1,c2,c3,JointCalendarRule.JoinBusinessDays),
                 c1234h = new JointCalendar(c1,c2,c3,c4,JointCalendarRule.JoinHolidays),
                 c1234b = new JointCalendar(c1,c2,c3,c4,JointCalendarRule.JoinBusinessDays);

        // test one year, starting today
        Date firstDate = Date.todaysDate(),
             endDate = firstDate.add(new Period(1, TimeUnit.Years));

        for (Date d = firstDate; d.lt(endDate); d.inc()) {

            boolean b1 = c1.isBusinessDay(d),
                 b2 = c2.isBusinessDay(d),
                 b3 = c3.isBusinessDay(d),
                 b4 = c4.isBusinessDay(d);

            if ((b1 && b2) != c12h.isBusinessDay(d))
              Assert.fail("At date " + d + ":\n"
                           + "    inconsistency between joint calendar "
                           + c12h.name() + " (joining holidays)\n"
                           + "    and its components");

            if ((b1 || b2) != c12b.isBusinessDay(d))
              Assert.fail("At date " + d + ":\n"
                           + "    inconsistency between joint calendar "
                           + c12b.name() + " (joining business days)\n"
                           + "    and its components");

            if ((b1 && b2 && b3) != c123h.isBusinessDay(d))
              Assert.fail("At date " + d + ":\n"
                           + "    inconsistency between joint calendar "
                           + c123h.name() + " (joining holidays)\n"
                           + "    and its components");

            if ((b1 || b2 || b3) != c123b.isBusinessDay(d))
              Assert.fail("At date " + d + ":\n"
                           + "    inconsistency between joint calendar "
                           + c123b.name() + " (joining business days)\n"
                           + "    and its components");

            if ((b1 && b2 && b3 && b4) != c1234h.isBusinessDay(d))
              Assert.fail("At date " + d + ":\n"
                           + "    inconsistency between joint calendar "
                           + c1234h.name() + " (joining holidays)\n"
                           + "    and its components");

            if ((b1 || b2 || b3 || b4) != c1234b.isBusinessDay(d))
              Assert.fail("At date " + d + ":\n"
                           + "    inconsistency between joint calendar "
                           + c1234b.name() + " (joining business days)\n"
                           + "    and its components");

        }
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.time.calendars.JointCalendar$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.