2

我对 FAST 消息中的序列有一些问题
例如,我有下一个模板 xml

 <template name="DefaultIncrementalRefreshMessage" id="1">
    <string name="ApplVerID" id="1128">
        <constant value="9"/>
    </string>
    <string name="MessageType" id="35">
        <constant value="X"/>
    </string>
    <string name="SenderCompID" id="49">
        <constant value="MOEX"/>
    </string>
    <uInt32 name="MsgSeqNum" id="34"/>
    <uInt64 name="SendingTime" id="52"/>
    <uInt32 name="LastFragment" id="893" presence="optional"/>
    <sequence name="MDEntries">
        <length name="NoMDEntries" id="268"/>
        <uInt32 name="MDUpdateAction" id="279"/>
        <string name="MDEntryType" id="269"/>
        <uInt64 name="SecurityID" id="48" presence="optional"/>
        <uInt32 name="SecurityIDSource" id="22">
            <constant value="8"/>
        </uInt32>
        <string name="Symbol" id="55" presence="optional"/>
        <string name="SecurityGroup" id="1151" presence="optional"/>
        <uInt32 name="ExchangeTradingSessionID" id="5842" presence="optional"/>
        <uInt32 name="RptSeq" id="83"/>
        <uInt32 name="MarketDepth" id="264" presence="optional"/>
        <uInt32 name="MDPriceLevel" id="1023" presence="optional"/>
        <int64 name="MDEntryID" id="278" presence="optional"/>
        <decimal name="MDEntryPx" id="270" presence="optional"/>
        <int64 name="MDEntrySize" id="271" presence="optional"/>
        <uInt32 name="MDEntryDate" id="272" presence="optional"/>
        <uInt32 name="MDEntryTime" id="273"/>
        <int32 name="NumberOfOrders" id="346" presence="optional"/>
        <string name="MDEntryTradeType" id="20003" presence="optional"/>
        <int32 name="TrdType" id="828" presence="optional"/>
        <decimal name="LastPx" id="31" presence="optional"/>
        <int32 name="MDFlags" id="20017" presence="optional"/>
        <string name="Currency" id="15" presence="optional"/>
        <uInt64 name="Revision" id="20018" presence="optional"/>
        <string name="OrderSide" id="10504" presence="optional"/>
    </sequence>
</template>

起初我得到我们模板的 PMap,下一步我得到模板 id,然后我一个一个地读取字节并且一切正常,但是如果我得到序列“MDEntries”,我的数据将不正确,因为字节序列将被破坏。

我看到下一张带有 FAST Message 结构的图片,并认为我应该读取序列和长度为 'NoMDEntries' 的 PMap,然后一个接一个地读取字节,是否正确?我曾经认为我应该一个一个地读取字节并删除停止位 FAST 消息结构

帮帮我,我如何正确解析“序列”

4

1 回答 1

0

根据 FAST 协议规范,如果序列中没有需要 PMap 位存在的字段(如您的情况),则 PMap 不应出现在流中。要了解字段是否需要 PMap 位存在,您可以使用下表:

             | PMap Bit is required
-----------------------------------
Operator     | Mandatory | Optional
-----------------------------------
None         | no        | no
<constant/>  | no        | yes
<copy/>      | yes       | yes
<default/>   | yes       | yes
<delta/>     | no        | no
<increment/> | yes       | yes
<tail/>      | yes       | yes

您可以参考本文档中的第 10.5 段和附录 3.3.1:http: //ftp.moex.com/pub/FAST/ASTS/docs/FAST%20Specification1_1.pdf

于 2021-07-31T13:35:14.213 回答