OnixS C++ FIX Engine 2.79.1.0
Predefined Schedules and Connection Settings

To simplify development, the Session Scheduler provides an ability to define session schedules and connecting settings in configuration files for later referencing in source code.

Once presets are defined in the file, the session scheduler can use them during the instance initialization stage (OnixS::FIX::Scheduling::SessionSchedulerOptions class exposes OnixS::FIX::Scheduling::SessionSchedulerOptions::configurationFile member for these purposes). Afterwards, both schedules and connection settings can be referenced in source code using the string identifiers. Scheduler exposes OnixS::FIX::Scheduling::SessionScheduler::add overload to schedule a session with parameters described in a configuration file.

Example

using namespace OnixS::FIX::Scheduling;

...

SessionSchedulerOptions schedulerOptions;

schedulerOptions.configurationFile("Scheduler.conf");

SessionScheduler scheduler(schedulerOptions);

scheduler.add(sessionWithCurrenex, "Currenex", "Currenex");

Moreover, OnixS::FIX::Scheduling::SessionScheduler exposes OnixS::FIX::Scheduling::SessionScheduler::findSchedule and OnixS::FIX::Scheduling::SessionScheduler::findConnectionSettings members to access real instances of schedules and connection settings described in configuration file. These members come in help when session has to be registered with partially predefined configuration.

Example

The following example demonstrates how a session can be registered with a predefined schedule, but custom connection settings are not described in the configuration file.

using OnixS::FIX::Scheduling;

void registerSessionWithPartlyDefinedConfiguration()
{
    scheduler.add(
        testingEnvironmentSession,
        *scheduler.findSchedule("ICE"),
        InitiatorConnectingSettings("testing-evironment.ice.com", 8000));
}

Configuration File Reference

Description of Scheduler settings has XML-based syntax. The following tags are supported:

Tag

Description

SchedulerSettings

Root element of scheduler's configuration.

Schedules

Contains descriptions of predefined schedules.

Schedule

Describes attributes of particular session schedule.

Connections

Contains descriptions of predefined session connection settings.

Connection

Defines characteristics of particular session connection.

Note:
Up-to-date Scheduler settings configuration schema available on Corporate Website.

Defining Session Connection Time-frames

Session Schedule description consists in definition of following attributes for the <Schedule> element:

Attribute Values

Notes

id Non-empty string.

Unique identifier for the schedule. Value of this attribute is used later in source code to refer to described schedule. Must be unique among all schedules.

firstDay "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" Defines first day of activity week for the session.
lastDay "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" Defines last day of activity week for the session.
logonTime Time value from 0:00 till 23:59 in 24 hours format (with optional seconds resolution). Defines time of logon for session.
logoutTime Time value from 0:00 till 23:59 in 24 hours format (with optional seconds resolution).

Defines time of logout for session.

sessionDuration "day", "week".

Defines whether session continues entire week or activity time frame is limited for single day.

resetSessionNumber "never", "daily", "weekly".

Defines session sequence number reset policy.

Defining Session Connection Settings

Description of connection settings consists of the definition of the following attributes for the <Connection> element:

Attribute Values

Notes

id Non-empty string.

Unique identifier for the settings set. Value of this attribute is used later in source code to refer to described settings. Must be unique among all settings sets.

role "initiator", "acceptor". Specifies whether session must be connected as acceptor or initiator.
host String If session must be logged on in role of initiator, this parameter defines remote host to which session must connect to. Otherwise attribute is ignored.
port Number If session must be logged on in role of initiator, this parameter defines port number to which session must connect to. Otherwise attribute is ignored.
heartbeatInterval Number

If session must be logged on in role of initiator, this parameter defines time interval between two heartbeat messages sent by session on connection idle state.

setResetSeqNumbers "false", "true"

If session must be logged on in role of initiator, this parameter defines whether session must include special flag to logon message to instruct counterparty to reset session sequence numbers once logon procedure succeeded.

customLogonMessage String

If session must be logged on in role of initiator, this parameter defines FIX message to be used each time scheduled session tries to logon to counterparty. NOTE: Since <SOH> symbol can't be used in XML-based config, '|' symbol is used as message fields delimiter.

customLogonMessageFieldDelimiter String

Represents delimiter used to separate FIX fields (tag-value pairs) in custom logon message defined by customLogonMessage attribute.

customLogonMessagePath String

If session must be logged on in role of initiator, this parameter defines path to the file in which custom logon message is located. This message will be used each time scheduled session tries to logon to counterparty. Ignored if customLogonMessage attribute is defined.

Note:
It's possible to specify multiple counterparties in session connection settings description. If the Scheduler will fail to connect session to one counterparty it will switch using another one and so on until successfull connection will be established. For this reason session connection settings XML description accepts inner <Counterparty> nodes with host and port attributes. Inner nodes are ignored if master <Connection> node contains host and port attributes.

Example

Below is a typical configuration file for the Sessions Scheduler.

<?xml version="1.0" encoding="utf-8" ?>
<SchedulerSettings
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://onixs.biz/fix/scheduler http://onixs.biz/fix/scheduler/scheduler-settings-1.0.xsd"
  xmlns="http://onixs.biz/fix/scheduler"
  >
  <Schedules>
    <Schedule 
      id="SimpleDaily" 
      firstDay="monday"
      lastDay="friday"
      logonTime="08:00" 
      logoutTime="17:00" 
      sessionDuration="day" 
      resetSessionNumber="weekly"
      />
    <Schedule
      id="SimpleWeekly"
      firstDay="monday"
      lastDay="friday"
      logonTime="08:00"
      logoutTime="17:00"
      sessionDuration="week"
      resetSessionNumber="weekly"
      />
    <Schedule
      id="DailyWithMidnightCross"
      firstDay="monday"
      lastDay="friday"
      logonTime="21:00"
      logoutTime="03:00"
      sessionDuration="day"
      resetSessionNumber="daily"
      />
    <Schedule
      id="WeeklyWithMidnightCross"
      firstDay="monday"
      lastDay="friday"
      logonTime="21:00"
      logoutTime="03:00"
      sessionDuration="week"
      resetSessionNumber="never"
      />
    <Schedule
      id="AllWeek"
      firstDay="sunday"
      lastDay="saturday"
      logonTime="0:00"
      logoutTime="23:59:00"
      sessionDuration="week"
      resetSessionNumber="never"
      />
    <Schedule
      id="DailyWithDailySeqNumberReset"
      firstDay="monday"
      lastDay="friday"
      logonTime="8:00"
      logoutTime="17:00"
      sessionDuration="day"
      resetSessionNumber="daily"
      />
    <Schedule
      id="DailyWithWeeklySeqNumberReset"
      firstDay="monday"
      lastDay="friday"
      logonTime="8:00"
      logoutTime="17:00"
      sessionDuration="day"
      resetSessionNumber="weekly"
      />
  </Schedules>
  <Connections>
    <Connection 
      id="LocalInitiator" 
      role="initiator" 
      host="localhost" 
      port="4500"
      />
    <Connection 
      id="InitiatorToTestingEnvironment" 
      role="initiator" 
      host="testing-evn.privatedomain.com" 
      port="8000"
      setResetSeqNumbers="true"
      />
    <Connection 
      id="MultiTargetInitiator"
      role="initiator"
      setResetSeqNumbers="true"
      heartbeatInterval="45"
      >
      <Counterparty host="primary.domain.com" port="4600"/>
      <Counterparty host="secondary.domain.com" port="4500"/>
    </Connection>
    <!-- Since acceptor has no parameters there's no need in describing more than one acceptor. -->
    <Connection
      id="Acceptor"
      role="acceptor"
      />
  </Connections>
</SchedulerSettings>