Session Scheduler exposes the OnixS::FIX::Scheduling::SessionSchedule class to define the interval of time during which session must be logged on (active). It also provides facility to reset message sequence numbers automatically as it is commonly required by trading systems and venues.
The OnixS::FIX::Scheduling::SessionSchedule constructor initializes the session schedule for all supported cases that are based on the given parameters.
The first two parameters (
lastDay) define the activity week. During these days the session will be always connected at logon time and disconnected at logout time if the specified session duration equals to a single day. If the session must continue for entire week, then the scheduler will connect session at logon time on the day, specified by the firstDay parameter and disconnected at logout time on the day, specified by
lastDayparameters are supported. It is possible for the
firstDayparameter value to be greater than value of
lastDayparameter. In such a case, schedule will cross the end of the week and continue till
lastDayparameters are of the same value, then length (number of days) of the activity week depends on the values of
logoutTimeparameters. In particular, if
logonTimeis less than
logoutTime, then the activity week will equal to a single day. However, if
logonTimeis greater than
logoutTime, then the activity week will equal to seven days (first logon will be performed at logon time on the first day, last logout will be performed at logout time a week later).
logoutTime parameters respectively define time of logon and logout for the session for each activity day if the session duration is a single day. If the session must continue for the entire week, then the
logonTime parameter value specifies the time for logon to be performed on the first day of the activity week and the
logoutTime parameter value defines the time of logout, performed on the last day of the activity week.
logoutTimeparameter is less than
logonTimeparameter value, then it is assumed that the activity time crosses midnight. In such a case, the session scheduler will connect session at logon time on one day and disconnect it on the next calendar day.
The sessionDuration parameter defines whether session must continue for the entire activity week (specified by
lastDay parameters), or the activity time frame is limited to a single day (24 hours). In particular, if the parameter value equals to OnixS::FIX::Scheduling::SessionDuration::Day, then logon and logout occur on the same day (logout may occur on the next day, if value of
logoutTime parameter is less than value of
seqNumberResetPolicy parameter specifies whether the message sequence numbers must be reset and on which basis (daily or weekly).
seqNumberResetPolicyparameter must conform to the value of sessionDuration parameter. In particular, message sequence numbers cannot be reset on a daily basis if logon/logout frequency is one per week.
By default, the Scheduler uses the local time to determine when a session should be connected/disconnected in accordance with the Schedule. In this case, for different time zones, there is a need to create/configure different schedules. However, you can use OnixS::FIX::Scheduling::SessionScheduler::utcTimeUsage option for switching local time to UTC time usage. In this case, the Scheduler will use the UTC time and you can create/configure the one schedule using the UTC time for all time zones. This can be useful when you deploy your application in different time zones and you need the same behavior of the Scheduler in all time zones by creating only one schedule.
The schedule construction is simplified with parameters to satisfy the most common use cases. In particular, it exposes only the ability to define logon and logout time equal for all the activity days. However, sometimes it is necessary to define different logon and logout times for different days. OnixS::FIX::Scheduling::SessionSchedule provides this ability through the OnixS::FIX::Scheduling::SessionSchedule::logonTime and OnixS::FIX::Scheduling::SessionSchedule::logoutTime members.
Both OnixS::FIX::Scheduling::SessionSchedule::logonTime and OnixS::FIX::Scheduling::SessionSchedule::logoutTime members return and update logon and logout time appropriately for a given day of the week. Modifying entries of these collections give the more advanced capability to define different logon/logout time for different days.
The following example demonstrates how a schedule can be updated to make a session to be disconnected earlier on Friday, compared to other days.
Another example demonstrates how schedule can be updated to define one day off in the middle of the trading week.