Background
Sometimes, there are chances that your system requires to perform some conformance test/certificate test/connectivity tests with new counterparties no matter as an initiator (i.e. buy-side) / or as an acceptor (i.e. sell-side).
Among all the test cases, there are usually at least one or two cases related to the connection recovery handling regarding your FIX engine. Some of these connectivity test cases should be asking you to test by disconnecting abruptly, and the others should be requiring to disconnect gracefully.
It should be easy to simulate the cases for "disconnect abruptly", as you could simply use "kill -9 <process_id>" on Linux system, or using "CTRL+C" on the command-line terminal of Windows system. However, regarding "disconnect gracefully", do you need to implement the logout logic (i.e. disconnect gracefully) explicitly?
If you are using QuickFIX/J (which is one of the most famous open source Java implementation of the popular C++ QuickFIX engine), there is a good news to you! The simulation could easily be done by just some configuration as described below.
Configuration
In the quickfix.cfg (or most of the samples found on Internet is: QFJ.cfg):
| StartTime=00:00:00 #EndTime=23:59:00 EndTime=10:25:00 |
Unexpected Result
However, the result is unexpectedly as below logs (i.e. the end time is actually on Saturday):
| 10:23:54.645 [main] INFO quickfix.SessionSchedule - [FIXT.1.1:DEMO-CLIENT01->FIX01] weekly, MON 00:00:00-UTC - SAT 10:25:00-UTC 10:23:54.664 [main] INFO quickfixj.event - FIXT.1.1:DEMO-CLIENT01->FIX01: Session FIXT.1.1:DEMO-CLIENT01->FIX01 schedule is weekly, MON 00:00:00-UTC - SAT 10:25:00-UTC 10:23:54.665 [main] INFO quickfixj.event - FIXT.1.1:DEMO-CLIENT01->FIX01: Created session: FIXT.1.1:DEMO-CLIENT01->FIX01 |
What do the above logs mean in details? Why would be like this?
The logs mean the session is a week-long session instead of daily session which implies the following:
- The logout message will not be sent out automatically until the session end time (i.e. 10:25:00, Sat)
- If no other extra setting and the established session could last until the end, then the sequence number will not be restarted from 1 until the next session start (i.e. 00:00:00 of next Monday)
Failure Reason
After an investigation, it is because there are 2 parameters in the configuration file as below are affecting the result:
| StartDay=mon EndDay=sat |
After further studying the configuration on the QuickFIX's configuration guidelines, the configuration details is:
| ID | Description | Valid Values | Default |
|---|---|---|---|
| Session | |||
| BeginString | Version of FIX this session should use | FIXT.1.1 FIX.4.4 FIX.4.3 FIX.4.2 FIX.4.1 FIX.4.0 | |
| SenderCompID | Your ID as associated with this FIX session | case-sensitive alpha-numeric string | |
| TargetCompID | Counter parties ID as associated with this FIX session | case-sensitive alpha-numeric string | |
| SessionQualifier | Additional qualifier to disambiguate otherwise identical sessions | case-sensitive alpha-numeric string | |
| DefaultApplVerID | Required only for FIXT 1.1 (and newer). Ignored for earlier transport versions. Specifies the default application version ID for the session. This can either be the ApplVerID enum (see the ApplVerID field) or the BeginString for the default version. | FIX.5.0SP2 FIX.5.0SP1 FIX.5.0 FIX.4.4 FIX.4.3 FIX.4.2 FIX.4.1 FIX.4.0 9 8 7 6 5 4 3 2 | |
| ConnectionType | Defines if session will act as an acceptor or an initiator | initiator acceptor | |
| StartTime | Time of day that this FIX session becomes activated | time in the format of HH:MM:SS, time is represented in UTC | |
| EndTime | Time of day that this FIX session becomes deactivated | time in the format of HH:MM:SS, time is represented in UTC | |
| StartDay | For week long sessions, the starting day of week for the session. Use in combination with StartTime. | Day of week in English using any abbreviation (i.e. mo, mon, mond, monda, monday are all valid) | |
| EndDay | For week long sessions, the ending day of week for the session. Use in combination with EndTime. | Day of week in English using any abbreviation (i.e. mo, mon, mond, monda, monday are all valid) | |
Refined Configuration
From the above definition, we can understand that if the "StartDay" and "EndDay" parameters have been enabled, the "StartTime" and the "EndTime" will be used together along with the "StartDay" and "EndDay" respectively.
Expected Result
So, what we need to do is to disable the "StartDay" and "EndDay" (can simply comment them or remove them from the configuration file). After that, the session would now be recognized by QuickFix/J as "daily session" instead of a "week long session":
| 11:10:01.935 [main] INFO quickfix.SessionSchedule - [FIXT.1.1:DEMO-CLIENT01->FIX01] daily, 00:00:00-UTC - 11:12:00-UTC 11:10:01.945 [main] INFO quickfixj.event - FIXT.1.1:DEMO-CLIENT01->FIX01: Session FIXT.1.1:DEMO-CLIENT01->FIX01 schedule is daily, 00:00:00-UTC - 11:12:00-UTC 11:10:01.946 [main] INFO quickfixj.event - FIXT.1.1:DEMO-CLIENT01->FIX01: Created session: FIXT.1.1:DEMO-CLIENT01->FIX01 |
Here you go! Is it useful to your testing?
沒有留言:
張貼留言