OnixS C++ CME iLink 3 Binary Order Entry Handler  1.17.0
API Documentation

Session Scheduler exposes the OnixS::CME::iLink3::Scheduling::SessionSchedule class to define the interval of time during which session must be connected on (active).

Defining Session Connection Time-frames

The OnixS::CME::iLink3::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.

Note
All combinations of values for firstDay and lastDay parameters are supported. It is possible for the firstDay parameter value to be greater than value of lastDay parameter. In such a case, schedule will cross the end of the week and continue till lastDay. If firstDay and lastDay parameters are of the same value, then length (number of days) of the activity week depends on the values of logonTime and logoutTime parameters. In particular, if logonTime is less than logoutTime, then the activity week will equal to a single day. However, if logonTime is 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).

The logonTime and logoutTime parameters respectively define time of logon and logout for the session for each activity day.

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::CME::iLink3::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.

Example

using namespace OnixS::CME::iLink3;
// Session continues since 8:00 till 17:00 each day of a business week.
SessionSchedule regularSingleDay(
TimeOfDay(8, 0), TimeOfDay(17, 0));

Advanced Cases

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::CME::iLink3::Scheduling::SessionSchedule provides this ability through the OnixS::CME::iLink3::Scheduling::SessionSchedule::logonTime and OnixS::CME::iLink3::Scheduling::SessionSchedule::logoutTime members.

Both OnixS::CME::iLink3::Scheduling::SessionSchedule::logonTime and OnixS::CME::iLink3::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.

Example

The following example demonstrates how a schedule can be updated to make a session to be disconnected earlier on Friday, compared to other days.

using namespace OnixS::CME::iLink3;
void constructScheduleWithShortTradingForFriday()
{
// Initially, constructs schedule with the same logon/logout time for all days.
SessionSchedule scheduleWithShortFriday(
TimeOfDay(8, 0),
TimeOfDay(17, 0));
// Then, updates value of logout event for Friday day.
scheduleWithShortFriday.logoutTime(
// And that's all.
}

Another example demonstrates how schedule can be updated to define one day off in the middle of the trading week.

using namespace OnixS::CME::iLink3;
void constructScheduleWithWednesdayAsOffDay()
{
// Initially, constructs schedule with same logon/logout time for all days.
SessionSchedule scheduleWithWednesdayOff(
TimeOfDay(8, 0),
TimeOfDay(17, 0));
// Then, disables logon and logout on Wednesday.
scheduleWithWednesdayOff.logonTime(
scheduleWithWednesdayOff.logoutTime(
// And that's all.
}