OnixS C++ FIX Engine  4.5.0
API Documentation
Predefined Schedules and Connection Settings

To simplify development, Session Scheduler provides an ability to define session schedules and connecting settings in configuration files for later referencing in the 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 the source code using the string identifiers. Scheduler exposes the 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 the configuration file. These members can help when a session has to be registered with a 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 namespace OnixS::FIX::Scheduling;
scheduler.add(
&testingEnvironmentSession,
*scheduler.findSchedule("ICE"),
InitiatorConnectionSettings("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 a particular session schedule.

Connections

Contains descriptions of predefined session connection settings.

Connection

Defines characteristics of a particular session connection.

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

Defining Session Schedule

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

Attribute Values

Notes

id Non-empty String

It's a unique identifier for the schedule. The value of this attribute is used later in the source code to refer to the described schedule. It must be unique among all schedules.

firstDay Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday Defines the first day of the activity week for session.
lastDay Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday Defines the last day of the activity week for session.
logonTime Time value from 0:00 till 23:59 in 24 hours format (with optional seconds resolution). Defines the time of logon for a session.
logoutTime Time value from 0:00 till 23:59 in 24 hours format (with optional seconds resolution).

Defines the time of logout for a session.

sessionDuration day, week

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

resetSessionNumber never, daily, weekly

Defines session sequence number reset policy.

Defining Session Connection Settings

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

Attribute Values

Notes

id Non-empty String

It's a unique identifier for the settings set. The value of this attribute is used later in the source code to refer to described settings. It must be unique among all settings sets.

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

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

setResetSeqNumbers false, true

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

customLogonMessage String

If a session must be logged on in the role of initiator, this parameter defines FIX message to be used each time the scheduled session tries to logon to a 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 the customLogonMessage attribute.

customLogonMessageFile String

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

Note
It's possible to specify multiple counter parties in session connection settings description. If Scheduler fails to connect session to one counterparty, it will switch, using another one and so on, until a successful connection will be established. For this reason, the 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 Sessions Scheduler.

1 <?xml version="1.0" encoding="utf-8" ?>
2 <SchedulerSettings
3  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4  xsi:schemaLocation="https://ref.onixs.biz/fix/scheduler https://ref.onixs.biz/fix/scheduler/scheduler-settings-1.6.xsd"
5  xmlns="https://ref.onixs.biz/fix/scheduler" >
6 
7  <Schedules>
8 
9  <Schedule
10  id="CME"
11  firstDay="Sunday"
12  logonTime="18:00"
13  lastDay="Friday"
14  logoutTime="16:00"
15  sessionDuration="week"
16  resetSessionNumber="weekly"
17  />
18 
19  <Schedule
20  id="SimpleDaily"
21  firstDay="Monday"
22  lastDay="Friday"
23  logonTime="08:00"
24  logoutTime="17:00"
25  sessionDuration="day"
26  resetSessionNumber="weekly"
27  />
28 
29  <Schedule
30  id="SimpleWeekly"
31  firstDay="Monday"
32  lastDay="Friday"
33  logonTime="08:00"
34  logoutTime="17:00"
35  sessionDuration="week"
36  resetSessionNumber="weekly"
37  />
38 
39  <Schedule
40  id="DailyWithMidnightCross"
41  firstDay="Monday"
42  lastDay="Friday"
43  logonTime="21:00"
44  logoutTime="03:00"
45  sessionDuration="day"
46  resetSessionNumber="daily"
47  />
48 
49  <Schedule
50  id="WeeklyWithMidnightCross"
51  firstDay="Monday"
52  lastDay="Friday"
53  logonTime="21:00"
54  logoutTime="03:00"
55  sessionDuration="week"
56  resetSessionNumber="never"
57  />
58 
59  <Schedule
60  id="AllWeek"
61  firstDay="Sunday"
62  lastDay="Saturday"
63  logonTime="0:00"
64  logoutTime="23:59:00"
65  sessionDuration="week"
66  resetSessionNumber="never"
67  />
68 
69  <Schedule
70  id="DailyWithDailySeqNumberReset"
71  firstDay="Monday"
72  lastDay="Friday"
73  logonTime="8:00"
74  logoutTime="17:00"
75  sessionDuration="day"
76  resetSessionNumber="daily"
77  />
78 
79  <Schedule
80  id="DailyWithWeeklySeqNumberReset"
81  firstDay="Monday"
82  lastDay="Friday"
83  logonTime="8:00"
84  logoutTime="17:00"
85  sessionDuration="day"
86  resetSessionNumber="weekly"
87  />
88 
89  </Schedules>
90 
91  <Connections>
92  <Connection
93  id="LocalInitiator"
94  role="initiator"
95  >
96  <Counterparty host="localhost" port="4500"/>
97  </Connection>
98  <Connection
99  id="InitiatorToTestingEnvironment"
100  role="initiator"
101  setResetSeqNumbers="true"
102  >
103  <Counterparty host="testing-evn.privatedomain.com" port="8000"/>
104  </Connection>
105  <Connection
106  id="MultiTargetInitiator"
107  role="initiator"
108  setResetSeqNumbers="true"
109  heartbeatInterval="45">
110  <Counterparty host="primary.domain.com" port="4600"/>
111  <Counterparty host="secondary.domain.com" port="4500"/>
112  </Connection>
113  <Connection
114  id="InitiatorWithCustomLogonMessage"
115  role="initiator"
116  customLogonMessage="8=FIX.4.2|9=0|35=A|141=Y|5001=TraderId|10=000|"
117  host="localhost">
118  port="4500"
119  </Connection>
120  <Connection
121  id="InitiatorWithCustomLogonMessageAndFieldDelimiter"
122  role="initiator"
123  customLogonMessage="8=FIX.4.2*9=0*35=A*141=Y*10=000*"
124  customLogonMessageFieldDelimiter="*"
125  host="localhost"
126  port="4500">
127  </Connection>
128 
129  <Connection
130  id="Acceptor"
131  role="acceptor"
132  />
133  </Connections>
134 </SchedulerSettings>