This section describes a dictionary-independent mode of FAST encoder and decoders.
Following notes are belonged to FAST decoder (OnixS::FIX::FAST::Decoder class), but all the same considerations are applicable to FAST Encoder (OnixS::FIX::FAST::Encoder) and Event-Based FAST Decoder (OnixS::FIX::FAST::EventBasedDecoder).
Normally initialization of FAST decoder needs to prepare two XML files: the FAST template itself and FIX dictionary. The first one describes the rules, which are applied to binary data, and the second one describes the allowed structures of messages. Each message consists of fields and each field has literal ("name") and numeric ("id" or "tag") attributes attached. These attributes are defined in the mentioned XMLs:
Here is an important point: each name has to be mapped to the unique number and vice versa. That's why it is possible to retrieve the name by the numeric id and numeric id by the name.
The dictionary-independent mode is an approach where only a single XML document has to be used, that is the FAST template itself. The FIX dictionary becomes generated on the base of the FAST template content and particular FIX protocol version, which is used as a "base dictionary". Since standard FIX protocol descriptions are incorporated within the FIX Engine, this approach significantly simplifies the usage of the FAST decoder. Also, a generated dictionary usually works slightly faster than the separately defined one. A user should prepare just a proper FAST template (see Preparing FAST-template to use within dictionary-independent mode) and have to specify the correct version of the base FIX protocol (FIX 4.4, FIX 5.0 SP1, etc.). It is possible to omit the choice of the FIX protocol, but note, that FIX 4.0 will be used by default, that in turn could affect on compatibility between FIX-messages, retrieved from decoder, and FIX-messages, provided by a particular provider. The base dictionary defines how the resulted FIX message will be exposed in string representation, and which representations could be successfully parsed. In particular, this affects the value of tag 8: "8=FIX4.4" for FIX 4.4, "8=FIXT.1.1" for FIX 5.0 and above, etc. That's why the base protocol has to be chosen carefully.
Identifier of the generated FIX dictionary will be created within one of two ways:
The generated dictionary is accessible after the creation of appropriate FAST tool using
fixDictionary() method. It is possible to retrieve the identifier of the dictionary and use it to subsequent initialization of OnixS::FIX::Dictionary instances.
These approaches are illustrated in the next section.
Following snippets illustrates the usage of the OnixS::FIX::FAST::Decoder class but all the same considerations are applicable to OnixS::FIX::FAST::Encoder and OnixS::FIX::FAST::EventBasedDecoder. Instructions of the Engine initializations are omitted also.
Create the decoder in the simplest way, using FIX 4.0 as a base dictionary:
Create the decoder using a particular FIX version (FIX 5.0) as a base dictionary:
Create the decoder, using a particular FIX version (FIX 5.0) as a base dictionary, and providing custom dictionary name:
Accessing the generated dictionary and recreating it in a separate context:
The FAST template should satisfy the following requirements:
|<template id="100" name="Msg1">|
<int32 name="Price" id="5200"><copy/></int32>
<int32 name="Amount" id="5201"/>
<template id="105" name="Msg2">
<decimal name="Price" id="5200"><default/></decimal>
<int32 name="Amount" id="5201"><delta/></int32>
|<!– Template with simple fields –>|
<template id="100" name="Msg1">
<int32 name="NoProducts" id="5300"><copy/></int32>
<string name="Products" id="5301"><copy/></string>
<!– Template with sequence –>
<template id="105" name="Msg2">
<sequence name="Products" id="5301">
<length name="NoProducts" id="5300">