QuickFIX/J

SessionSchedule incorrectly handles Daylight Savings timezone change

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Default Default
  • Resolution: Unresolved
  • Affects Version/s: 1.3.3
  • Fix Version/s: 1.6.0
  • Component/s: Engine
  • Labels:
    None

Description

This is a follow up for a recent issue we had with our production system.
Few days after daylight switch in USA (which happened to be on November 2nd 2008) our system disconnected one hour early from the exchange.
Here is a little test case to illustrate:
 
    public void testSettingsWithStartEndDayWithDST() throws Exception {
        SessionSettings settings = new SessionSettings();
        settings.setString(Session.SETTING_TIMEZONE, "America/New_York");
        settings.setString(Session.SETTING_START_DAY, DayConverter.toString(Calendar.SUNDAY));
        settings.setString(Session.SETTING_START_TIME, "20:00:00");
        settings.setString(Session.SETTING_END_DAY, DayConverter.toString(Calendar.FRIDAY));
        settings.setString(Session.SETTING_END_TIME, "17:00:00");
        
// mockSystemTimeSource.setTime(getTimeStamp(2008, Calendar.NOVEMBER, 2, 18, 0, 0,
// TimeZone.getTimeZone("America/New_York")));
        
        SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
        SessionSchedule schedule = new SessionSchedule(settings, sessionID);
        
        System.out.println(schedule);
        
        //November,2 -> Sunday
        doIsSessionTimeTest(schedule, true, 2008, Calendar.NOVEMBER, 2, 20, 0, 0,
                TimeZone.getTimeZone("America/New_York"));
        //November,7 -> Friday
        doIsSessionTimeTest(schedule, true, 2008, Calendar.NOVEMBER, 7, 17, 0, 0,
                TimeZone.getTimeZone("America/New_York"));
    }

*All times below are New York times.

For the sake of the example, our system starts every Sunday at 18:00 while actual trading starts (again every Sunday) at 20:00. Trading ends next Friday at 17:00. So, if you run the test as it is, it passes.
But if you uncomment "mockSystemTimeSource.setTime" the test fails, exactly for the same reason why our system shutdown trading one hour early.

The problem is with the way SessionSchedule converts END_* configuration into actual time point. Sunday November 2nd and Monday November 7th are both EST (winter time), BUT SessionSchedule actually goes back to previous Monday (October 27) which is still EDT (summer time) and thus converts to UTC incorrectly with 1 hour shift.

Activity

Hide
Valery Trubnikov added a comment - 26/Nov/08 2:36 PM

As a sidenote - the problem seems to be even more complex for systems that do not go down every week but instead rely on quickfixj to handle trading start/stop.
If such system is configured with America/New_York timezone (or any other DST-aware tz), start/stop times in SessionSchedule will be incorrect after DST switch, because they are only calculated upon program start.

Show
Valery Trubnikov added a comment - 26/Nov/08 2:36 PM As a sidenote - the problem seems to be even more complex for systems that do not go down every week but instead rely on quickfixj to handle trading start/stop. If such system is configured with America/New_York timezone (or any other DST-aware tz), start/stop times in SessionSchedule will be incorrect after DST switch, because they are only calculated upon program start.
Hide
Mehul Patel added a comment - 17/Nov/10 5:15 PM

This seems to be happening in 1.4 too.

Show
Mehul Patel added a comment - 17/Nov/10 5:15 PM This seems to be happening in 1.4 too.

People

Vote (8)
Watch (8)

Dates

  • Created:
    26/Nov/08 2:31 PM
    Updated:
    22/Sep/11 8:44 AM