Key points for parsing pmap and sequence in the fix/fast Protocol

Source: Internet
Author: User
Key points for parsing pmap and sequence in the fix/fast Protocol

 

Wu Yu

Taiyan Network Studio

 

Due to the upgrade, I sorted out a fix/fast parsing code written by my old brother. What keeps me confused about pmap and sequence solutions (because the code is actually problematic), and I have not found any relevant documents. I downloaded the quickfast installation package, paid for the installation, and found it more complicated. Fortunately, only a little bit is used to understand these two things.

 

Pmap may not exist.

This is a fatal trap. The first data of a normal message is pmap, and the first bit of this pmap is the TID of the message. A normal message must have pmap.

But for sequence, the first data after it is the length of the sequence. The next data may be pmap or formal data. If yes or no, it will be wrong.

Because no relevant documents can be found, you have to check the quick fast code. The quickfast code shows whether pmap is related to the use of pmap based on all the filed in the template. If all fields in this template can be determined without pmap, pmap will not appear. For example:

<Sequence name = "bidpricelevel" presence = "optional">

<Lengthname = "nobidpricelevel" id = "10068" presence = "optional"/>

<Int64name = "bidsize" id = "134"/>

<Int32name = "bidpx" id = "132" decimalplaces = "3"/>

</Sequence>

Because the field operator in sequence is none, this sequence will not have pmap. If yes or no, it should be calculated after the template is loaded.

 

Explicit and implicit sequence length representation.

In the above example, the first field in sequence refers to the number of all sequence, which only needs to be read once. Never regard it as a field in sequence. Another implicit method may be more rational, as shown below:

<Sequence id = "73" presence = "optional" name = "orders">

<Uint32 id = "38" presence = "mandatory" name = "orderqty"/>

</Sequence>

 

The fast template is a self-similar structure.

Self-similarity is another expression of fragment, that is, the whole is very similar to the local image. It is taken out separately. You cannot tell which is the whole and which is the local image. This function is described as recursion. It is called layer by layer, but the same function is called. Quickfast uses dozens of classes for parsing. I have finished using only three classes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.