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 (firstDay and 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 lastDay parameter.
The logonTime and 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.
The sessionDuration parameter defines whether session must continue for the entire activity week (specified by firstDay and 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 logonTime parameter).
Final seqNumberResetPolicy parameter specifies whether the message sequence numbers must be reset and on which basis (daily or weekly).
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.