OnixS C++ B3 BOE Binary Order Entry  1.2.0
API Documentation

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

Defining Session Connection Time-frames

The OnixS::B3::BOE::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::B3::BOE::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::B3::BOE;
// Session continues since 8:00 till 17:00 each day of a business week.
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::B3::BOE::Scheduling::SessionSchedule provides this ability through the OnixS::B3::BOE::Scheduling::SessionSchedule::logonTime and OnixS::B3::BOE::Scheduling::SessionSchedule::logoutTime members.

Both OnixS::B3::BOE::Scheduling::SessionSchedule::logonTime and OnixS::B3::BOE::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::B3::BOE;
void constructScheduleWithShortTradingForFriday()
{
// Initially, construct a schedule with the same logon / logout time for all days.
TimeOfDay(8, 0), TimeOfDay(17, 0));
// Then, update the value of the logout event for Friday.
scheduleWithShortFriday.logoutTime(DayOfWeek::Friday, TimeOfDay(16, 30));
}

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

using namespace OnixS::B3::BOE;
void constructScheduleWithWednesdayAsOffDay()
{
// Initially, construct a schedule with the same logon / logout time for all days.
TimeOfDay(8, 0), TimeOfDay(17, 0));
// Then, disable logon and logout on Wednesday.
scheduleWithWednesdayOff.logonTime(DayOfWeek::Wednesday, TimeOfDay::bad());
scheduleWithWednesdayOff.logoutTime(DayOfWeek::Wednesday, TimeOfDay::bad());
}