QuickfixJ必填字段缺失,即使它在那里

时间:2019-01-09 18:35:07

标签: java quickfix fix-protocol quickfixj

即使我确定该字段在那里,也收到“有条件的必填字段丢失”错误消息。

58=Conditionally Required Field Missing, field=55

版本:

QuickFixJ 2.1.0

FIX 4.4

这是我要发送的FIX消息(为清晰起见,已删除模拟值和一些字段)

8=FIX.4.4
9=709
35=R
34=4
49=TARGET
56=ME
11=myClOrdID
131=myQuoteReqID
146=myNoRelatedSym
55=mySymbol          // field missing
167=mySecurityType   // field missing

这是呼叫代码:

String symbol = quoteRequest.getField(new StringField(55)).getValue();

我也尝试过:

String symbol = quoteRequest.getString(55);

这是我的数据字典:

<field number="55" name="Symbol" type="STRING"/>

我意识到符号字段已不再是4.4的QuoteRequest FIX规范的一部分(尽管它是在早期版本中,例如4.0),但是肯定有检索自定义字段的方法吗?我无法控制收到的QuoteRequest消息。

我总是可以自己使用toString()来解析消息,但这有点违背了使用quickfixj的目的。

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

// create group
QuoteRequest.NoRelatedSym group = new QuoteRequest.NoRelatedSym();

// set group, confusing method name I find
message.getGroup(1, group);

// you now have all the getters of fields in that group
Symbol symbol = group.getSymbol();

答案 1 :(得分:0)

标签55位于146个重复组中。参见the docs for reading repeating groups

符号字段仍在FIX44中。您应该花一些时间熟悉所使用的FIX44.xml数据字典文件。

(您可能会发现需要根据交易对手的消息来自定义该文件;实际上,没有人使用基本的FIX44消息定义而没有对其进行至少一点改动。)