OnixS C++ FIX Engine  4.12.0
API Documentation
FAST Decoding Templates

Both OnixS::FIX::FAST::Encoder and OnixS::FIX::FAST::Decoder constructors require the string, that contains the XML-based descriptions of coding rules, called FAST templates.

FAST Template

A FAST template represents an XML-based description of encoding and decoding rules in accordance with the FAST specification.

A template identifier (Template ID) is assigned for each FAST template, which uniquely identifies the encoding/decoding rules.

Note
More than one FAST template can be used to encode the same FIX message type, so the Template ID is supplied as an argument of the OnixS::FIX::FAST::Encoder::Encode method.

FAST Template Example

The following example represents a typical FAST template structure:

1 <?xml version="1.0" encoding="utf-8"?>
2 <templates>
3  <template name="Market Data - Incremental Refresh (X)" id="88">
4  <uInt32 name="BodyLength" id="9"/>
5  <string name="MessageType" id="35">
6  <constant value="X" />
7  </string>
8  <string name="SenderCompID" id="49">
9  <copy/>
10  </string>
11  <string name="TargetCompID" id="56">
12  <copy/>
13  </string>
14  <uInt64 name="MsgSeqNum" id="34">
15  <increment value="1"/>
16  </uInt64>
17  <string name="SendingTime" id="52">
18  <tail/>
19  </string>
20  <string name="PosDupFlag" id="43" presence="optional">
21  <default/>
22  </string>
23  <sequence name="MDEntries">
24  <length name="NoMDEntries" id="268"/>
25  <string name="MDUpdateAction" id="279"/>
26  <string name="Symbol" id="55"/>
27  </sequence>
28  <string name="CheckSum" id="10"/>
29  </template>
30 </templates>

Field Types

Following field types are supported:

Field Example Notes
Signed 32-bit Integer <int32 name="MDEntrySize" id="271" presence="optional"> Min value: -2147483648
Max value: 2147483647
Unsigned 32-bit Integer <uInt32 name="BodyLength" id="9"/> Min value: 0
Max value: 4294967295
Signed 64-bit Integer <int64 name="MinQty" id="110"/> Min value: -9223372036854775808
Max value: 9223372036854775807
Unsigned 64-bit Integer <uInt64 name="MsgSeqNum" id="34"/> Min value: 0
Max value: 18446744073709551615
String <string name="SenderCompID" id="49"/> An optional charset attribute can be used to indicate the character set used in the string ("ascii" or "unicode").
Decimal <decimal name="MDEntryPx" id="270">
<exponent/>
<mantissa/>
</decimal>
Indicates that the field is represented by two parts: an exponent and a mantissa.
Byte Vector <byteVector name="RawData" id ="96" presence="optional"/> Sequence of bytes.
Sequence <sequence name="NoSecurityAltID" id="454" presence="optional">
<string name="SecurityAltID" id="455"/>
</sequence>

Specifies that the contained group of instructions should be used repeatedly to encode each element (e.g. to encode/decode a FIX Repeating Group).

A sequence can have an associated length field, containing an unsigned integer that indicates the number of encoded elements.

The required name attribute identifies the corresponding field in the current FIX message type by the field name.

The optional id attribute identifies the corresponding field in the current FIX message type by the tag number.

The optional presence attribute indicates whether the field is mandatory or optional. If the attribute is not specified, the field is mandatory.

Field Operators

A field, that is not of Sequence type, can have a field operator. The Field Operator specifies an optimization operation for the field.

The following field operators are supported:

Field Operator Example Notes

Constant

<string name="MessageType" id="35">
<constant value="X" />
</string>

Specifies that the value of a field will always be the same initial value.

Is applicable to all field types.

Default

<string name="PosDupFlag" id="43" presence="optional">
<default = "N" />
</string>

Specifies that the value of a field is either present in the FAST stream, or it will be the initial value.

Is applicable to all field types.

Copy

<uInt32 name="MDUpdateAction" id="279">
<copy value="1" />
</uInt32>

If the value is present in the stream, it becomes the new previous value, otherwise, the value of the field is the previous value.

It is applicable to all field types.

Increment

<uInt32 name="RptSeq" id="83">
<increment />
</uInt32>

If the value is present in the stream, it becomes the new previous value, otherwise, the value of the field is the previous value incremented by one.

It is applicable to Integer field types only.

Delta

<int32 name="MDEntrySize" id="271">
<delta />
</int32>

Specifies that a delta value is present in the stream. The field is obtained by combining the delta value with the previous value.

Is applicable to Integer, Decimal, String and Byte Vector field types.

Tail

<string name="SendingTime" id="52">
<tail/>
</string>

Specifies, that a tail value is present in the stream. The value of the field is obtained by combining the tail value with the previous value.

Is applicable to String and Byte Vector fields with constant or increasing value length.

Dictionaries

Field operators may rely on a previous value. The previous values are maintained in named dictionaries. To reset the states of dictionaries (set the state of the previous values to undefined), the OnixS::FIX::FAST::Encoder::reset and OnixS::FIX::FAST::Decoder::reset methods are used.