B2BITS FIX Antenna C++  2.27.1
Other Topics

Table of Contents

Statistics

Use FixEngine::singleton()->getStatistics(&status) to get session statistics parameters. For example:

Statistics status;
FixEngine::singleton()->getStatistics(&status);
clog << "Number of active sessions: " << status.m_nActive << endl
<< "Number of reconnecting sessions (as Initiator): " << status.m_nInitiators << endl
<< "Number of sessions, awaiting logon (as Acceptor): " << status.m_nAcceptors << endl
<< "Number of correctly terminated sessions: " << status.m_nCorrectlyTerminated << endl
<< "Number of non-gracefully terminated sessions: " << status.m_nNonGracefullyTerminated << endl;

Log files

File system is used to log messages for FIX Antenna recovery. Log files are created in the directory specified in configuration parameters (the "LogDirectory" property).

Files with the *.conf extension (configuration files) contain basic session information.

Incoming messages are stored in files with the .in extension. Outgoing messages are stored in files with the .out extension.

Files related to the same session have the same base part of the name (the part before a dot)

The engine.log file, storing information about FE operation is also created in the log directory.

Log files are used during automatic session reestablishment. Thus, to ensure a "clean" run of FIX Antenna, it is necessary to remove all the files from the log directory (the "LogDirectory" property).

Encryption

The exchange of sensitive data across public networks may require the usage of data encryption techniques to mask the FIX application-level messages. This chapter describes issues related to data encryption in FIX Antenna C++.

In order to operate in secure mode FIX Antenna C++ requires GNU Privacy Guard command-line utility (GnuPG). It can be downloaded from http://www.gnupg.org. Please follow the OS-specific installation instructions included into GNU Privacy Guard distribution when installing. On finishing the installation, a PATH environment variable must be adjusted to include the directory containing Gnu PG command-line utility (gpg.exe on Windows).

Supported algorithms

Supported FIX protocol encryption methods

The following FIX protocol encryption methods are supported:

Supported PGP public-key algorithms

The following PGP public-key algorithms are supported:

The allowed key size for DSA and ElGamal algorithms is 768 up to 4096 bits. The highest recommended key size is 2048 bits.

Supported DES modes of operation

FIX Antenna C++ operates in DES Cipher Block Chaining Mode (CBC) only. Applying other DES modes at the counterparty's side such as Electronic Codebook Mode (ECB), Cipher Feedback Mode (CFB) leads to premature session termination.

Key management

FIX Antenna C++ library does not have its own keyring storage and uses GnuPG keyring storages instead.

Establishing a secure FIX session requires at least two PGP keys to be present in GnuPG keyring storages. These are:

A secure password is required to access the private key. FIX Antenna C++ looks for this password in the file identified by EncryptionConfigFile configuration property.

Establishing secure session

All session-level details of FIX encryption are encapsulated inside the FIX Engine (FE).

Call the following method to create a secure session:

Session* FixEngine::createSession(Application* apApp, const std::string& aSenderCompID, const std::string& aTargetCompID, FIXVersion aVer) where:

Encryption Configuration File

Below you can see the alphabetically sorted list of all encryption parameters with references to their documentation:

The following parameters can be assigned in the encryption configuration file :

# If "true" the channel binding information will be checked
# the default value is "true"
ChanBindingMustBeChecked = true
# Passwords for PGP private keys
PGP.key.SENDERCOMPID = PASSWORD

Compatible OpenPGP software and SDKs

The following software was tested for compatibility with FIX Antenna C++:

In fact, any software supporting OpenPGP message format (see RFC2440) is compatible with FIX Antenna C++. Please refer to GNU Privacy Guard COMPATIBILITY ISSUES for details.

Error handling

If errors occur, FIX Antenna C++ API throws exceptions, which are the Utils::Exception class objects or objects derived from it. To get an error cause report, use the const char *what() const method.

For example:

try {
// ... - some FIX Antenna C++ API calls
} catch(const Utils::Exception& ex){
// reason:
cout << "EXCEPTION: " << ex.what() << endl;
}

FAQ

  1. Is it possible to create more than one instance of FIX Antenna C++?
  2. Is it possible to create more than one instance of FIX Antenna C++ using the same logging directory?
  3. How to create FIX50, FIX50SP1 or FIX50SP2 session?
  4. May I put session log files to the log directory and expect that FIX Antenna C++ will analyze them when a new session with the same parameters is created?
  5. FIX Antenna C++ was incorrectly terminated. I don't want the session to be restored on next start. What should I do for a clean start?
  6. How can I do the customization (add user-defined fields, messages or change field and message definitions)?
  7. How to fix the "Repeating group fields out of order" error?
  8. How to remove a group from Repeating Groups?
  9. Is it possible to send messages in onLogonEvent handler?
  10. How to extend FIX message with repeating group defined in FIX protocol?
  11. Is it possible to use FixMessage and FixGroup after FixEngine::destroy() call?
  12. What is format of FIX dictionary (fixdict.xml) file?
  13. Is there a way to enable "automatic reconnection" in the case that the FIX-sessions drops? I want to reconnect as soon as the server or the connection is available again.
  14. How can I get message (std::vector<const Engine::TagValue*>) as string or set of fields? I have found only getFields() function, but it doesn't implemented. I am also interesting how can I get any field by tag. For example I am trying to call getField(279) function and then toString() and I have got error message "Not supported: CharFiledValue::toString Tag 279. " How should I convert or get tag values?
  15. How to create multiple sessions with same Sender/Target?
  16. What is Session Qualifier?

Is it possible to create more than one instance of FIX Antenna C++?

Yes, it is possible to create many instances of FIX Antenna C++ as soon as they use different listening ports. However FIX engine is a singleton, which means that only one instance of engine can be created in one application.

Is it possible to create more than one instance of FIX Antenna C++ using the same logging directory?

Yes. However it is recommended to set a different logging file. Otherwise different instances will put logging data to the same file and it will be difficult to distinguish records written by different instances.

How to create FIX50, FIX50SP1 or FIX50SP2 session?

According to FIX specification, sessions based on FIX50 works over FIXT11 session level protocol. So, to create such session, FIXT11_TCP should be passed as the underline protocol to the Engine::CreateSession function. Eg.:

// For session works over FIXT11

May I put session log files to the log directory and expect that FIX Antenna C++ will analyze them when a new session with the same parameters is created?

Yes. FIX Antenna C++ loads all session information on session creation time.

FIX Antenna C++ was incorrectly terminated. I don't want the session to be restored on next start. What should I do for a clean start?

Delete session log files from logs folder by mask:

<sender>-<target>*.*

How can I do the customization (add user-defined fields, messages or change field and message definitions)?

User Defined Fields (the tag numbers 5000 to 9999) are handled like ordinary fields. User-defined FIX messages (e.g. U1, U2) are also handled like ordinary messages. To do the customization, please see the description of the Validation.AdditionalFields configuration property.

How to fix the "Repeating group fields out of order" error?

Example: 8=FIX.4.3 | 9=285 | 35=X | 49=FIXERBRIDGETRD1 | 34=1 | 57=B2BTEST1 | 52=99990909-17:17:17 | 268=4 | 269=2 | 270=9539.500000 | 271=1 | 272=20041208 | 273=13:34:10.000 | 290=1 | 269=4 | 27 0 =9539.500000 | 271=4294967295 | 272=20041208 | 273=13:34:10.000 | 290=1 | 269=Z | 270=9528.000000 | 271=401 | 290=1 | 269=Y | 270=0.000000 | 271=0 | 290=1 | 10=019 | [ERROR] Repeating group fields out of order [RefSeqNum: 1, RefTagID: 269, RefMsgType: X]

Solution: The reason of this problem cannot be detected easily. The required fields of both FIX message itself and (AdditionalFields) group must be filled out with corresponding values and any gap or change in tag order leads to an error (it is true for both standard and custom messages). Therefore, both standard and additional group fields must be checked for validity and then processed again. Extra attention must be paid to the order of fields in the repeating FIX group. For this particular example: tag 290 is placed before tag 269 (wrong tag order).Place the 290 tag and its value after the tag 269 and process the message again to solve the problem.

How to remove a group from Repeating Groups?

Use the FIXGroup.remove(int tag) method, where tag is a Repeating Group Leading Tag. Setting the corresponding tag to zero is prohibited by FAC++ (Parser Exception is thrown).

Is it possible to send messages in onLogonEvent handler?

When session-acceptor receives a Logon message, the onLogonEvent is fired. Sending messages in this event handler causes session none graceful termination. The reason is that the FIX protocol requires the first message to be Logon. It is prohibited to send messages in onLogonEvent handler.

How to extend FIX message with repeating group defined in FIX protocol?

The AdditionalFields mechanism requires repeating the group specification fully. It is not enough to add a repeating group leading tag to add this group to the FIX message - all tags of this group have to be enumerated as well. For example the correct extension of the BF message is: Validation.AdditionalFields = FIX44:BF:386(336,625?)

Is it possible to use FixMessage and FixGroup after FixEngine::destroy() call?

It is prohibited to continue using FIXMessage and FixGroup objects after engine::destroy() call, you may only destroy them.

What is format of FIX dictionary (fixdict.xml) file?

Format of the FIX dictionary file (a.k.a fixdict.xml) is defined by set of XSD files:

Format of the conditionally required expression is similar to Pascal syntax. Example:

T$1414 > 0 and existtags(T$1415) or T$1415 in ('A', 'B')

Set of available functions/operators:

Sample of XML protocol file: Creating protocol customization

Is there a way to enable "automatic reconnection" in the case that the FIX-sessions drops? I want to reconnect as soon as the server or the connection is available again.

You can set reconnect count to -1. This will force FIX Antenna to reconnect infinitely. To interrupt reconnection call Session:: disconnectNonGracefully method.

How can I get message (std::vector<const Engine::TagValue*>) as string or set of fields? I have found only getFields() function, but it doesn't implemented. I am also interesting how can I get any field by tag. For example I am trying to call getField(279) function and then toString() and I have got error message "Not supported: CharFiledValue::toString Tag 279. " How should I convert or get tag values?

There is currently no method to convert TagValue to string. Only FIXMessage can be represented as string.

When you are receiving "Not supported: CharFiledValue::toString" you should change your code to call FIXMessage::getAsChar. In general you should check type of the field in the FIX dictionary file and use appropriate getter method. Almost all FIX types and C++ types have same names. Exception is FIX::float. In C++ it is Engine::Decimal.

How to create multiple sessions with same Sender/Target?

In version 2.10.15.5 of FIX Antenna and newer, you can first create Engine::SessionId structure by passing Sender, Target and unique Session Qualifier to its constructor. Then call one of overloaded methods createSession() which accepts Engine::SessionId structure as one of arguments. See section Session identifier of the documentation for more details

What is Session Qualifier?

Session Qualifier is an extra identifier, which together with SenderCompID and TargetCompID uniquely identify session. In particular, this allow user creating several sessions with the same Sender/Target pair. See section Session identifier of the documentation for more details

Troubleshooting

  1. I get "ERROR: Error: License is not valid - components will be stopped! Please contact us at sales@btobits.com for further assistance. " error message right after start.
  2. FIX Antenna cannot create listen port on start
  3. Exception "Session could not be created - application fix protocol 'FIX50' is not available!" when creating FIX50 based session

I get "ERROR: Error: License is not valid - components will be stopped! Please contact us at sales@btobits.com for further assistance. " error message right after start.

This error means that you have some problem with license file. Possible cases:

  1. License is expired
  2. License is invalid
  3. License cannot be found

Make sure that your engine.license file is located according to the value of 'LicenseFile' property. Try to set the full path to engine.license in the 'LicenseFile' property. Send your logs and license file to sales.nosp@m.@bto.nosp@m.bits..nosp@m.com.

FIX Antenna cannot create listen port on start

Make sure that this port is not in use by some other application. Try

netstat -a

to get a list of used ports.

Exception "Session could not be created - application fix protocol 'FIX50' is not available!" when creating FIX50 based session

Make sure that correct value on underlineProtocol passed to Engine::createSession function. FIX50 based session use FIXT11 session level protocol, instead of FIX. For additional information see How to create FIX50, FIX50SP1 or FIX50SP2 session? and FIX Session