Skip to content

Calendars

Jean Palate edited this page Aug 22, 2018 · 1 revision

Using national calendars

The code below explains the use of national calendars in Tramo-Seats (similar in X13)

        // create a new context
        ProcessingContext context = new ProcessingContext();
        // create the national calendar with the different holidays
        NationalCalendar be = new NationalCalendar();
        be.add(new FixedDay(20, Month.July));
        be.add(EasterRelatedDay.EasterMonday);
        // ...
        // add the calendar to the context (give it a name)
        context.getGregorianCalendars().set("BE", new NationalCalendarProvider(be));

        // generate a new specification with the new holidays 
        TramoSeatsSpecification spec = TramoSeatsSpecification.RSA5.clone();
        spec.getTramoSpecification().getRegression().getCalendar().getTradingDays().setHolidays("BE");
        // compute with the right context
        CompositeResults rslt = TramoSeatsProcessingFactory.process(Data.P, spec, context);
        // ...
Clone this wiki locally