SSE Level 2 Vendor Interface Specification(FAST)-15章-FAST Decoder(FAST解析-第一部分)

来源:互联网 发布:兄弟连linux百度云 编辑:程序博客网 时间:2024/06/06 16:27

15.1 FAST message

The structure of a message purely encoded in STEP looks like this:

 

The structure of a STEP message with message body encoded in FAST looks like this:

 

Within a STEP message, FAST message is stored in the raw data field (96) of which length in byte is
stored in raw data length (95). Vendor supplied system should first read raw data length field from
the STEP message and then extract the FAST message from the raw data field according to the length
specified in the raw data length field.


Each FAST message contains one or multiple market data message. All messages in a FAST message
are of the same category and message type.

>>>每个FAST消息包含一个或多个行情数据信息.在FAST消息内的所有信息具有相同的分类及消息类型.

 

For message that uses FAST operator, the scope of operator is each STEP message.  Thus the
dictionary2 for previous value should be reset after each FAST message.  There is only one global
dictionary in IDC. It will be reset each time after every FAST message.  The first entity of each
market data is presence map which will be discussed later.  Then decoder should process the
remaining market data by the information provided from the presence map and template.

>>>消息使用的是FAST操作符,操作符的范围是每一个STEP消息.因此在每一个FAST消息之后,dictionary 先前的值需要被重置.

>>>在IDC内部,仅有一个全局的dictionary.在每个FAST消息后,每次都将被重置.每一个行情数据的第一个实体是presence map.解析器需

>>>要根据presence map 和 template提供的信息对剩余的行情数据进行处理.

 

 

15.2 Presence Map

The presence map is encoded as bit vector by using stop bit encoding.  If a presence map that ends
with a sequence of all zero, the byte(s) with all zero bits in the end of the presence map will be
truncated.

>>>presence map是通过使用停止位作为位向量进行编码的.如果一个presence map是以一个全0序列来结尾的,那么在

>>>presence map  的末尾的所有0位的字节将被截掉.

15.3 Template

Message template is used for eliminate the tag in the FAST message.  As tag numbers are not sent out
to the receiver, receiver cannot decode the message without the template.  Templates provide the
information to instruct FAST how to encode or decode each entry within a message.  Field data type
Field names, field ids, presence attribute, field operators are provided in the template.  Template is
represented in xml format. The tag number of template id is 999.

>>>消息模板是用于排除(消除)FAST消息中的tag的.因为标签号没有发送给接收器,接收器不能解码不带模板的消息.模板提供的信息用来

>>>指示FAST如何编码或解码消息内部的每个实体.Field data type Field names, field ids, presence attribute, field operators

>>>都在模板内部被提供.模板是用xml格式呈现的.模板ID的标签号是999.

 

The template id of transaction is 1101 which is used for selecting the corresponding template to
decode the FAST message.  The attribute decimalPlaces is an optional field.  If this tag is present,
shifting decimal places is required.  The number of decimal places shifted is the value of the attribute.

>>>transaction的模板ID是1101,它被用于选取对应的模板来解析FAST消息.decimalPlaces属性是一个可选字段.如果出现这个tag

>>>则移动小数位是必需的.移动小数位的个数就是这个属性的值.

 

15.3.1 Data type

>>>数据类型

Here is the data type used or will be used in FAST.

>>>以下是在FAST中现用或者将被使用的数据类型

In each entry, field name and field ID are mandatory attributes while presence is an optional attribute.
The presence attribute represents whether the field is mandatory or optional. The default value for
presence attribute is mandatory. More detail about presence attribute will be discussed later.

>>>在每一个实体中,虽然presence是一个可选属性,但field name和field ID还是强制属性.

>>>presence属性表示字段是强制的还是可选的.它的默认值是强制的.

 

15.3.1.1  String data type

>>>String数据类型
A string data type has an optional charset attribute indicating the character set used in this data type.
There are two supported character sets are ASCII and UTF-8.  The default character set is ASCII. 
The value for UTF-8 is “unicode”.
 

>>>String数据类型有一个可选的charset属性,它用来指示这个数据类型的字符集.有二种字符集被支持,它们是ASCII和UTF-8.默认

>>>的字符集是ASCII.UTF-8的值为"unicode".

 

15.3.1.2  Integer data type

>>>Integer数据类型
An integer data type is used for storing 32-bit integer data. 

>>>它用于存储32位有符号整型数.
 
15.3.1.3  Long data type

>>>Long数据类型
A long data type is used for storing 64-bit integer data.

>>>它用于存储64位有符号长整型数.

 

15.3.1.4  Repeating group data type

>>>Repeating group 数据类型
A repeating group data type is used for a group of repeating instructions.  The first child of sequence
must be a length tag which is for storing the number of repeating group. The length field is signed
integer in IDC.

>>>Repeating group 数据类型用于一组重复指令.序列的第一个子项必须是一个用于存储Repeating group个数的长度标签.

>>>在IDC中,这个长度字段是有符号整型.

 

15.3.2 Field encoding operator

>>>字段编码操作符
Here is the field encoding operator used or will be used in FAST.
 

>>>以下是在FAST中现用或将被使用的字段编码操作符:

 

*The constant operator field which is optional will occupy a single bit. The bit will be set to on if the
input value is equal to the constant value which is defined in the template.  It will be set to off if the
input value is absent and no value will be set in the stream for constant operator. 

>>>constant操作符是可选的并且占据1bit.如果这个输入值等于在模板中定义的常量值,那么这个bit将被置成on.

>>>如果这个输入值是不存在的,那么这个bit将被置成off,并且在数据流中也将没有值被设置用于这个constant操作符.
 
Presence map is a sequence of bits representing the presence of fields inside a FAST message.  A field
does not occupy a bit when it is without operator or it is a mandatory constant field. 

>>>Presence map是一个位序列,用来表示在FAST消息内部字段是否存在.

>>>当一个字段不带操作符或者它是一个强制的常量字段,那么它不占据任何bit.

15.3.3 Repeating group

In UA1102, there are two repeating groups.  If one or more repeating groups are present, the first
encoded field is the number of level of the repeating group.  After the number of the repeating group
is the presence map of first level if the allocated slot for the repeating group is larger than one.  In
UA1102, those two fields in the repeating group are mandatory and without operator. Thus, no
presence map slot is allocated.  Consequently, there is no presence map for the entities of repeating
group. If presence map slots is allocated, each repeating group contains presence map on their own. 

>>>在UA1102内部,有二个Repeating group.如果存在一个或多个Repeating group,则第一个编码字段就是这个

>>>repeating group的level的个数.如果已经为多于一个repeating group分配了槽位,那么在repeating group个数的后面

>>>就是第一个level的presence map.

>>>在UA1102内部,repeating group 里有二个字段是强制的并且不带操作符,所以没有presence map 位被分配.

>>>因此这里没有用于repeating group 实体的presence map.

>>>如果presence map 位是有分配的,那么每一个repeating group 都有包含他们自己的presence map.

 

Here is an example of UA1102 with repeating group:

>>>一个带有repeating group的UA1102例子:

 

Another example of UA1102 without repeating group:

>>>一个不带有repeating group的UA1102例子:

 

 

To decode a FAST message, firstly, the presence map is extracted from the message first.  Then, the
non-repeating field before the repeating group 1 should be processed.  If repeating group 1 is present,
the number of repeating entities should be read and each entity should then be processed based on it’s
own presence map. After processed repeating group 1, repeating group 2 should be processed in the
same way and finally, the non-repeating fields after the repeating group 2 should be  processed.

>>>解析一个FAST消息,第一步,首先从消息中提取presence map;然后,应该先处理在重复组 1 之前的非重复字段.

>>>如果重复组 1存在,则读取重复实体的个数,并且每个实体根据它自己的presence map逐一处理.

>>>在处理完重复组 1之后,重复组 2使用同样的方法进行处理,直到结束,

>>>在重复组 2之后,非重复字段应该被处理.

 

 

 SSE Level 2 Vendor Interface Specification(FAST)-15章-FAST Decoder(FAST解析-第一部分)---完

 

 

 

 

原创粉丝点击