修复重复组以重复使用相同的标签
FIX repeating groups to reuse same tags
FIX 协议是否允许在消息和重复组中重复使用相同的标签? 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>
您不能 re-use 重复组之外的重复组标签。
将标记声明为重复组标记会对其施加约束,例如它在组中的顺序以及一次出现与后续出现的处理方式不同。 Non-repeating 组标签没有这样的限制。
不,这是不允许的。我建议你从 http://www.quickfixengine.org 获取一个大数据字典,以 XML 格式保存到你的计算机,然后执行如下命令:
grep Price FIX.xml | grep number
这样做会显示所有 Price-related 字段的定义。如果您在 messages/components 中搜索每个字段名称,您将看到每个字段名称都用在不同的地方。总体结果是每个字段在一条消息中只列出一次。
TL;DR
不允许在tag-value编码中。
(但在 FIXML 中是)
一些解释
我最初的误解来自 FIX tag-value 规范中的这个声明:see here, search for "Field presence"
A tag (field) must appear at most once in a message, except when the
tag appears within a repeating group.
但据我了解,这是指消息的 wire 格式,而不是消息的 definition。
而 FIX5.0SP2 规范第 1 卷引用了消息的 定义 并指出:
A tag number (field) should only appear in a message once. If it
appears more than once in the message it should be considered an error
with 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 nesting
will take place resulting in multiple occurrences of the Parties block
within a single FIX message.. Use of NestedParties under these
conditions avoids multiple references to the Parties block within the
same message which is not allowed in FIX tag/value syntax.
顺便说一句,还有组件 NestedParties2
、NestedParties3
、NestedParties4
可以解决这个问题。
来自 FIX 交易社区论坛的信息
线程可以在这里访问,但据我所知,如果您是 FIX TC 成员,您只能访问它:FIX TC forum
FIX专家Hanno Klein给出了以下信息:
The quote from the refactored online spec refers to the wire format of
any instance of a message encoded in tagvalue syntax. It means that
inside the wire format of a single repeating group a tag (field) may
appear more than once.
FIXML 没有这个限制:
The restriction is actually limited to the tagvalue encoding. For
example, the parties component is “Pty” for all instances in FIXML,
the XML syntax/encoding of FIX. This is due to the fact that the XML
syntax has an unambiguous structure with a distinct path to every
occurrence of a component or field. The XML names only need to be
unique within the same element.
Tag-value 是:
For tagvalue, a parser needs to know when a repeating group starts and
ends. The NoXXX field marks the starting point and a field that is not
part of the group marks the ending point. There are no explicit
delimiters 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 in
two distinct repeating groups without causing a parser issue but I do
not see the benefit to allow this exception to the rule. You cannot
allow it for two adjacent levels, e.g. root + nesting level 1 or
nesting 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 the
tag appears within a repeating group.
A tag (field) must appear at most once per repeating group instance.
FIX 协议是否允许在消息和重复组中重复使用相同的标签? 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>
您不能 re-use 重复组之外的重复组标签。
将标记声明为重复组标记会对其施加约束,例如它在组中的顺序以及一次出现与后续出现的处理方式不同。 Non-repeating 组标签没有这样的限制。
不,这是不允许的。我建议你从 http://www.quickfixengine.org 获取一个大数据字典,以 XML 格式保存到你的计算机,然后执行如下命令:
grep Price FIX.xml | grep number
这样做会显示所有 Price-related 字段的定义。如果您在 messages/components 中搜索每个字段名称,您将看到每个字段名称都用在不同的地方。总体结果是每个字段在一条消息中只列出一次。
TL;DR
不允许在tag-value编码中。
(但在 FIXML 中是)
一些解释
我最初的误解来自 FIX tag-value 规范中的这个声明:see here, search for "Field presence"
A tag (field) must appear at most once in a message, except when the tag appears within a repeating group.
但据我了解,这是指消息的 wire 格式,而不是消息的 definition。
而 FIX5.0SP2 规范第 1 卷引用了消息的 定义 并指出:
A tag number (field) should only appear in a message once. If it appears more than once in the message it should be considered an error with 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 nesting will take place resulting in multiple occurrences of the Parties block within a single FIX message.. Use of NestedParties under these conditions avoids multiple references to the Parties block within the same message which is not allowed in FIX tag/value syntax.
顺便说一句,还有组件 NestedParties2
、NestedParties3
、NestedParties4
可以解决这个问题。
来自 FIX 交易社区论坛的信息
线程可以在这里访问,但据我所知,如果您是 FIX TC 成员,您只能访问它:FIX TC forum
FIX专家Hanno Klein给出了以下信息:
The quote from the refactored online spec refers to the wire format of any instance of a message encoded in tagvalue syntax. It means that inside the wire format of a single repeating group a tag (field) may appear more than once.
FIXML 没有这个限制:
The restriction is actually limited to the tagvalue encoding. For example, the parties component is “Pty” for all instances in FIXML, the XML syntax/encoding of FIX. This is due to the fact that the XML syntax has an unambiguous structure with a distinct path to every occurrence of a component or field. The XML names only need to be unique within the same element.
Tag-value 是:
For tagvalue, a parser needs to know when a repeating group starts and ends. The NoXXX field marks the starting point and a field that is not part of the group marks the ending point. There are no explicit delimiters 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 in two distinct repeating groups without causing a parser issue but I do not see the benefit to allow this exception to the rule. You cannot allow it for two adjacent levels, e.g. root + nesting level 1 or nesting 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 the tag appears within a repeating group.
A tag (field) must appear at most once per repeating group instance.