Imported from previous forum
[ original email was from Darshan Khedekar - darshan.khedekar.ext@deutsche-boerse.com ]
Hi
I have couple of questions about the exact structure of FAST message and pre-map
(Q1) FAST message structure
I understand that the FAST message structure is as follows
Frame length | pre-map1 | FAST template id1 | Message body1 | pre-map2 | FAST template id2 | Message body2 |…
Now if one plans to encode FIX messages into FAST then every FIX message has a header (FIX version, body length, message type, message sequence number, sending time) and trailer (checksum), as mandatory part of the message.
How is this accommodated as part of a FAST message? Is the header and trailer dropped altogether in FAST? Or should one specify the mandatory fields of the header and trailer as part of the message body layout?
(Q2) Pre-map for static data
I want to specify a pre-map for data that is static for a trading day. All the fields in this message are going to be mandatory, explicit or constant, and independent of any previous fields (hence cannot be copied). This means that there is not a single bit set and I will have 7 consecutive unset bits. The FAST spec. 1.x.05 released 2006-07-11, says that in such a case a “pre-map error” should be reported. Then in this case should the pre-map be dropped altogether? Can I have the following message structure:
Frame length | FAST template id1 | Message body1 | FAST template id2 | Message body2 |…
Are FAST messages without any pre-map allowed?
The spec is wrong here in that it doesn’t explicitly specify that the presence map must be at least seven bits long (and that they are all allowed to be zero). We’ll fix it.
Note that the the first bit of the first presence map of a template is always used for the implicit copy operator of the template identifier. This means that you must always start a template with a presence map even if the contained fields do not have any operators.
/David
(Q2) Pre-map for static data I want to specify a pre-map for data that
is static for a trading day. All the fields in this message are
going to be mandatory, explicit or constant, and independent of any
previous fields (hence cannot be copied). This means that there is
not a single bit set and I will have 7 consecutive unset bits. The
FAST spec. 1.x.05 released 2006-07-11, says that in such a case a
“pre-map error” should be reported. Then in this case should the
pre-map be dropped altogether? Can I have the following message
structure:Frame length | FAST template id1 | Message body1 | FAST template id2 |
Message body2 |…Are FAST messages without any pre-map allowed?
[ original email was from Darshan Khedekar - darshan.khedekar.ext@deutsche-boerse.com ]
Hi David
I donot seem to understand the difference between a sequence and a stream clearly:
“A sequence field instruction specifies that the field in the application type is of sequence type and that the contained group of instructions should be used repeatedly to encode each element. If any instruction of the group needs to allocate a bit in a presence map, each element is represented as a segment in the transfer encoding.”
Does that mean that if I have “copy” operators that require a premap slot the I have to just replace the … by …?
Is this just to be followed as a naming convention to distinguish between the instruction blocks occupying premap slots and those that donot? And I guess if all the instructions are constants/ no operator is used on them but the group in turn as a set of instructions can be optional then we have a … tag and this occupies only one slot in the premap?
Thanks
Darshan
The spec is wrong here in that it doesn’t explicitly specify that the
presence map must be at least seven bits long (and that they are all
allowed to be zero). We’ll fix it.Note that the the first bit of the first presence map of a template is
always used for the implicit copy operator of the template identifier.
This means that you must always start a template with a presence map
even if the contained fields do not have any operators./David
(Q2) Pre-map for static data I want to specify a pre-map for data that
is static for a trading day. All the fields in this message are
going to be mandatory, explicit or constant, and independent of
any previous fields (hence cannot be copied). This means that
there is not a single bit set and I will have 7 consecutive unset
bits. The FAST spec. 1.x.05 released 2006-07-11, says that in
such a case a “pre-map error” should be reported. Then in this
case should the pre-map be dropped altogether? Can I have the
following message structure:Frame length | FAST template id1 | Message body1 | FAST template id2 |
Message body2 |…Are FAST messages without any pre-map allowed?
“A sequence field instruction specifies that the field in the
application type is of sequence type and that the contained group of
instructions should be used repeatedly to encode each element. If any
instruction of the group needs to allocate a bit in a presence map, each
element is represented as a segment in the transfer encoding.”Does that mean that if I have “copy” operators that require a premap
slot the I have to just replace the … by
…?
There is no representation of a stream in the template syntax. Stream is just a term that is used to mean a FAST encoded stream of bytes.
What the paragraph says is that if any of the instructions enclosed in the element use an operator that requires a bit in the presence map, each encoded element of the sequence must start with a presence map. This follows from the definition of a segment in the Transfer Encoding section.
Is this just to be followed as a naming convention to distinguish
between the instruction blocks occupying premap slots and those that
donot?
For the elements of a sequence, yes (see above)
And I guess if all the instructions are constants/ no operator is
used on them but the group in turn as a set of instructions can be
optional then we have a … tag and this occupies only
one slot in the premap?
Not sure what you mean. An optional group can be used to indicate the presence of a whole group of fields using just a single bit in the presence map, but this is not related to the paragraph you quoted.
/David
[ original email was from Darshan Khedekar - darshan.khedekar.ext@deutsche-boerse.com ]
Hi David
If one has a following set of instructions
(1). ordered set if instructions. Not all instructions are mandatory. Many such sets.
(2). These sets also occur in a sequence and sets can be optional.
This leads me to the following template.
......In this way I can have several sets of ordered elements. GRP1, GRP2 etc are ordered but optional.
(Question1) The difference between a group and a sequence is quoted as - one that has ordered set of instructions is a sequence and unordered set of instructions is a group. As I have said above that all my sets are ordered should I change the … to …
(Question2) In the 10.5 Presence Map section I came across the following statement -
“If a field is optional and has no field operator, it is encoded with a nullable representation and the NULL is used to represent absence of a value. It will not occupy any bits in the presence map.”
Which means that if 1_2,1_3,2_2,2_3 above donot carry any values do I need to still put in zeros? Isnt there a way where using pre-map bits I can tell if the value is present or not? for eg
Say, Bit1 - if set tells that GRP1 is present
This bit 1 if set only then,
Bit2 - if set tells that field 1_2 is present
Bit3 - if set tells that field 1_3 is present
else,
Bit2 - says if GRP2 is present and so on…
Thanks for all your replies
Regards
Darshan
“A sequence field instruction specifies that the field in the
application type is of sequence type and that the contained group of
instructions should be used repeatedly to encode each element. If any
instruction of the group needs to allocate a bit in a presence map,
each element is represented as a segment in the transfer encoding.”Does that mean that if I have “copy” operators that require a premap
slot the I have to just replace the … by
…?There is no representation of a stream in the template syntax. Stream is
just a term that is used to mean a FAST encoded stream of bytes.What the paragraph says is that if any of the instructions enclosed in
the element use an operator that requires a bit in the
presence map, each encoded element of the sequence must start with a
presence map. This follows from the definition of a segment in the
Transfer Encoding section.Is this just to be followed as a naming convention to distinguish
between the instruction blocks occupying premap slots and those
that donot?For the elements of a sequence, yes (see above)
And I guess if all the instructions are constants/ no operator is used
on them but the group in turn as a set of instructions can be optional
then we have a … tag and this occupies only one slot
in the premap?Not sure what you mean. An optional group can be used to indicate the
presence of a whole group of fields using just a single bit in the
presence map, but this is not related to the paragraph you quoted./David
(Question1) The difference between a group and a sequence is quoted as -
one that has ordered set of instructions is a sequence and unordered set
of instructions is a group. As I have said above that all my sets are
ordered should I change the … to
…
A sequence is like a repeating group in FIX, or array, or vector of elements in your favorite programming language. A group is similar to a component block in FIX, or struct or class in your favorite language. A sequence consiting of a single element would be very similar to a group, but otherwise they are separate creatures. A sequence for example, has a length preamble indicating the number of elements that follow. Each element in a sequence is encoded according to the instructions enclosed in in the template.
The instructions are ordered both in a group and in a sequence element.
(Question2) In the 10.5 Presence Map section I came across the following
statement - “If a field is optional and has no field operator, it is
encoded with a nullable representation and the NULL is used to represent
absence of a value. It will not occupy any bits in the presence map.”Which means that if 1_2,1_3,2_2,2_3 above donot carry any values do I
need to still put in zeros? Isnt there a way where using pre-map bits I
can tell if the value is present or not? for eg Say, Bit1 - if set tells
that GRP1 is present This bit 1 if set only then, Bit2 - if set tells
that field 1_2 is present Bit3 - if set tells that field 1_3 is present
else, Bit2 - says if GRP2 is present and so on…
No, in this version of FAST, the presence map cannot be used to indicate nullability and you must put a special NULL value on the wire to indicate absence of a field. The NULL value is individually defined for each type, but happens to be encoded as 0x80 in all cases (zero with the stop bit set).
/David