FAST protocol analysis 2 FIX Fast Tutorial translation [PMap, copy operator]

FIX Fast Tutorial

FIX Fast Tutorial

(Translation Note: This article is a translation and explanation of https://jettekfix.com/education/fix-fast-tutorial/. In addition to the direct translation of the text, I also made my own understanding of each point. Explanation and verification, so you can see that there will be many translation annotations under the translation, and some translation annotations will also have examples. It is recommended to read the previous article before reading this article "FAST protocol analysis 1 through input and output Inverse analysis". Due to the length of the article, I will truncate the chapters according to the actual content)

1. Introduction

FAST (FIX Adapted for Streaming) was developed by the FIX Protocol organization to bring the greater benefits of standardization to market data and deliver optimized performance for the exchange of electronic financial information. Built around a data compression algorithm, it significantly reduces bandwidth requirements and latency between sender and receiver. FAST works particularly well at improving performance during periods of peak message rates. While FAST has grown out of market data, it is applicable and can be used with all FIX messages to offer flexibility in the way that FIX data is formatted for transmission.

FAST uses several techniques to reduce bandwidth. This FAST tutorial covers these techniques briefly on this page and in more detail in later sections.

1、Simplification

FAST (FIX Adapted for Streaming) was developed by the FIX protocol organization to bring greater standardization benefits to market data (I understand it to be trading or market data in securities or futures markets) and to provide better financial electronic information exchange. performance. FAST is built around a data compression algorithm that significantly reduces bandwidth requirements and latency between sender/receiver parties. FAST is particularly effective in increasing the peak message rate (I understand that more data can be transmitted within a limited time). Although FAST has been separated from market data (I understand this to mean that FAST compressed data cannot be read directly, but FIX can), it can be applied to all FIX messages and can format and transmit FIX data in a flexible way.

(Annotation: I understand that FAST is built based on FIX. The reason is that FIX transmits too much redundant information, so FAST performs certain compression. We can compress any FIX message into FAST, or decompress FAST into FIX.)

FAST uses several techniques to reduce bandwidth. This FAST tutorial will briefly introduce these techniques on this page and detail them in later sections.

1.1. FAST Template

FAST Templates define the field layout of messages so the message itself does not describe individual field names or tags. Instead, fields’ identities are inferred from their position within the message as described by the template. This template is shared by both the sender and the receiver (that is, both the encoder and the decoder) and is usually held in an XML file.

Picture 1.1 – “Hello World message transfer”

1.1 FAST mockup

The FAST template defines the field layout of the message (the template file will describe how many fields each message has, the numerical type of each field, and the order of each field), so the transmitted message itself does not describe the name or label of each field. . Instead, the identities of the fields are inferred from their position in the message, as described by the template. This template is shared by the sender and receiver (i.e. encoder and decoder) and is usually stored in an XML file.

(Annotation: The data sender and receiver use "templates" to compress and decompress messages. The template defines the order and meaning of each field, and the sender/receiver can compress and restore data accordingly.)

Figure 1.1 - "hello world message conversion"

1.2. FAST Presence Map (PMap)

The Presence Map (or PMap) is a variable length bit field used to indicate whether or not a particular field is present in a message.

This allows the encoder leave out fields from the message in certain cases, such as:

  • field value is the same as in the previous message (common in fields like trade date, settlement date, etc) or
  • is one greater that last message (common case for sequence number).

The template defines the rules to use when a field is not present in the message.

1.2  FAST Presence Map (PMap)

A presence map (PMap) is a variable-length bit field used to indicate whether a specific field exists in a message.

This allows the encoder to omit certain fields from the message in certain situations, for example:

1) The field value is the same as the previous message (common in fields such as transaction date, settlement date, etc.)

2) The field value is 1 greater than the previous message (common in fields such as sequence numbers)

The template defines the rules to be used when a certain field does not exist in the message.

[Translation Note:

To put it simply, PMap identifies whether a field has a value filled in. If there is no value filled in, a value is automatically assigned based on the definition of the field in the template. Here is an example. Since it is too troublesome to repeat it again, students who need to understand the meaning of the code should read the previous article first.

1)FAST round

Looking back at the rules we summarized in the previous article, after the data is compressed by FAST, if we display it in binary, we will find that the FAST data can be divided into three areas. The first area is PMap, and the second area is template ID. The third area is the numerical part.

2)copy operation mark

The meaning of the Copy operator is that when the FAST data has no assignment to a certain field, the value of the previous FAST data will be used. We create a new simple template with two fields, both using the copy operator

Modify the code to achieve encoding and decoding of 2 pieces of data

The output is as follows:

Parse the original encoding:

It should be noted that in the second paragraph of FAST encoding, the template ID field is omitted, and the second position of PMap is set to 0, indicating that the template ID field has no value (so I think the template ID field has the copy operator by default). Use the previous value.

Then we reduce the assignment operation in the second paragraph and modify the code as follows:

The output of running again is as follows:

You will find that the parsing result of the second paragraph follows the assignment of the first paragraph. Parse the original encoding:

You can see that the template ID field and the second numerical field in PMap are both set to 0.

3)瀻结

In summary, PMap combined with the template content can omit specific fields (repeating, auto-increment, etc.) to reduce the total amount of data and achieve compression.

Guess you like

Origin blog.csdn.net/weixin_40402375/article/details/130509203