FIX 协议通常允许空字符串值吗?

Is empty string value generally allowed by the FIX protocol?

当我查看 FIX 协议中 String 类型的定义时(例如 here or here), I don't see a minimum length specified. Is it allowed to use empty strings? One online decoder seems to accept an empty string value (see tag 320), an other 抱怨它无效。

FIX 4.4规范声明如下(原文强调):

Each message is constructed of a stream of <tag>=<value> fields with a field delimiter between fields in the stream. Tags are of data type TagNum. All tags must have a value specified. Optional fields without values should simply not be specified in the FIX message. A Reject message is the appropriate response to a tag with no value.

这强烈地向我暗示(但没有明确说明)对字符串使用空值是无效的。不同的 FIX 实现可能以不同的方式处理这种边缘情况,这对我来说并不奇怪。所以,我认为最好的方法是避免对字符串使用空值。

Ciaran 和 Grant 的 answer/comments+1。只是想补充点东西。

  1. 我通常建议在 最新规范 中查找此类内容,因为它们通常 refined/reworded/clarified 以消除不明确或模棱两可的陈述来自旧规格。

  2. 答案就在您 link 问题所在的页面上(强调我的,搜索“Well-formed field”):https://www.fixtrading.org/standards/tagvalue-online/#field-syntax

A well-formed field has the form:

tag=value<SOH>

A field shall be considered malformed if any of the following occurs as a result of encoding:

the tag is empty

the tag delimiter is missing

the value is empty

the value contains an <SOH> character and the datatype of the field is not data or XMLdata

the datatype of the field is data and the field is not immediately preceded by its associated Length field.