gpt4 book ai didi

quickfix - 修复重复组以重用相同标签

转载 作者:行者123 更新时间:2023-12-02 02:33:34 26 4
gpt4 key购买 nike

FIX 协议(protocol)是否允许在消息和重复组中重复使用相同的标记? IE。我可以有类似的东西

        <message name='Quote' msgtype='S' msgcat='app'>
<field name='Price' required='Y'/><!-- i.e. total price for the whole quote-->
...
<group name='NumLegs' required='Y'>
<field name='Price' required='Y'/><!-- i.e. leg price -->
...
<group name='NumLegDetails' required='Y'>
<field name='Price' required='Y'/><!-- i.e. leg component price -->
...
</group>
...
</group>
</message>

最佳答案

TL;DR

在标记值编码中不允许
(但在 FIXML 中是这样)

一些解释

我最初的误解来自于FIX标记值规范中的这个声明:see here, search for "Field presence"

A tag (field) must appear at most once in a message, except when thetag appears within a repeating group.

但据我所知,这是指消息的有线格式,而不是消息的定义

而 FIX5.0SP2 规范第 1 卷引用了消息的定义并指出:

A tag number (field) should only appear in a message once. If itappears more than once in the message it should be considered an errorwith the specification document.

与此同时,我什至在查看 NestedParties 组件时发现 FIXimate 中提到了它(强调我的):( link to NestedParties component in FIXimate )

The NestedParties component block is identical to the Parties Block.It is used in other component blocks and repeating groups when nestingwill take place resulting in multiple occurrences of the Parties blockwithin a single FIX message.. Use of NestedParties under theseconditions avoids multiple references to the Parties block within thesame message which is not allowed in FIX tag/value syntax.

顺便说一句,还有组件NestedParties2NestedParties3NestedParties4来解决这个问题。

来自FIX交易社区论坛的信息

这里可以访问该线程,但据我所知,只有当您是 FIX TC 成员(member)时才能访问它:FIX TC forum

FIX专家Hanno Klein给出了以下信息:

The quote from the refactored online spec refers to the wire format ofany instance of a message encoded in tagvalue syntax. It means thatinside the wire format of a single repeating group a tag (field) mayappear more than once.

FIXML 没有此限制:

The restriction is actually limited to the tagvalue encoding. Forexample, the parties component is “Pty” for all instances in FIXML,the XML syntax/encoding of FIX. This is due to the fact that the XMLsyntax has an unambiguous structure with a distinct path to everyoccurrence of a component or field. The XML names only need to beunique within the same element.

标签值的作用:

For tagvalue, a parser needs to know when a repeating group starts andends. The NoXXX field marks the starting point and a field that is notpart of the group marks the ending point. There are no explicitdelimiters for repeating groups in tagvalue and components(non-repeating) are not visible in the wire format at all.Technically, you are probably right that a Price tag could exist intwo distinct repeating groups without causing a parser issue but I donot see the benefit to allow this exception to the rule. You cannotallow it for two adjacent levels, e.g. root + nesting level 1 ornesting level x + nesting level y.


原始答案中的这部分仍然适用

另一方面,在定义您自己的重复组时,请使用符号 NoXXX 来表示重复组,因为这是官方建议。 see here, search for "NumInGroup field"

It is recommended that NumInGroup fields be named NoXXX, e.g.NoContraBrokers(382).

但是,按照 44/Price 的示例,您通常会看到 566/LegPrice 用作单个腿的价格,因为两者的使用方式不同。前者是用于执行订单的价格,后者是在定义策略的边时使用的价格。

所以简而言之,在定义消息结构和重复组时,您应该真正考虑该标签的含义对于消息中所有出现的标签 是否都相同,以及使用正文和重复组中的标签完全相同。 清晰度应该是第一位的。


原始答案的不正确(删除线)部分

起初我认为这是不允许的,但主要是因为我从未见过它出现在真实消息中的某个地方。但实际上我找不到不应该允许的理由。 规范只说:see here, search for "Field presence"

A tag (field) must appear at most once in a message, except when thetag appears within a repeating group.

A tag (field) must appear at most once per repeating group instance.

关于quickfix - 修复重复组以重用相同标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64660451/

26 4 0