我正在使用QuickFix和Python绑定,并连接到提供历史数据下载的对手方。为了解析传入的消息,我需要能够读取嵌套重复组。
我在这里找到了一个带有嵌套重复组的数据字典示例:http://quickfix-j.364392.n2.nabble.com/Nested-repeating-group-error-tag-appears-more-than-once-fwd-td7578213.html
我尝试在此示例中为我的DD建模,但我一直收到同样的错误:Conditionally Required Field Missing:3210
。该字段3210恰好是新的(嵌套的)组定义,称为NoChartData
。
我仔细研究了DD并且发现它没有任何问题。同样,我已经三重检查了每个标签的定义,并且还定义了所有标签的可能值。
有什么想法吗?错误是我的错吗?可能是QF错误吗?
编辑:交易对手给我一个预先批准的数据字典样本,但是它没有用(导致同样的错误)。似乎DD没有错。这是QuickFix的C ++版本中的错误吗?
<message name="MarketDataSnapshotFullRefresh" msgtype="W" msgcat="app">
<field name="MDReqID" required="N" />
<field name="Symbol" required="N" />
<field name="SecurityType" required="N" />
<field name="MaturityMonthYear" required="N" />
<field name="MaturityDay" required="N" />
<field name="PutOrCall" required="N" />
<field name="StrikePrice" required="N" />
<field name="OptAttribute" required="N" />
<field name="SecurityID" required="N" />
<field name="SecurityStatus" required="N" />
<field name="SecurityAltID" required="N" />
<field name="SecurityExchange" required="N" />
<field name="SettlType" required="N" />
<field name="TotalVolumeTraded" required="N" />
<field name="Currency" required="N" />
<field name="PriceFeedStatus" required="N" />
<field name="DeliveryTerm" required="N" />
<field name="ExecInst" required="N" />
<field name="ChartType" required="N" />
<field name="TradeDateStart" required="N" />
<field name="TradeDateEnd" required="N" />
<field name="SessionStartTime" required="N" />
<field name="SessionEndTime" required="N" />
<field name="DataFormat" required="N" />
<field name="EncodedTextCRC" required="N"/>
<field name="EncodedTextLen" required="N" />
<field name="EncodedText" required="N" />
<group name="NoMDEntries" required="Y">
<field name="MDEntryType" required="Y" />
<field name="TradeDate" required="N" />
<field name="MDEntryID" required="N" />
<field name="MDEntryPx" required="N" />
<field name="MDEntrySize" required="N" />
<field name="MDEntryTime" required="N" />
<field name="TickDirection" required="N" />
<field name="TradeCondition" required="N" />
<field name="ExecInst" required="N" />
<field name="MDEntryLevel" required="N" />
<field name="ChartType" required="N" />
<field name="MDEntryPositionNo" required="N" />
<field name="SecondaryOrderID" required="N" />
<field name="MDEntryState" required="N" />
<field name="AggressorSide" required="N" />
<field name="MDEntrySizeType" required="N" />
<field name="NumberOfOrders" required="N" />
<field name="ExactNumOrdersIndicator" required="N" />
<field name="TrdType" required="N" />
<field name="TradeVolume" required="N" />
<group name="NoChartData" required="N" >
<field name="Change" required="N" />
<field name="Numerator" required="N" />
<field name="Denominator" required="N" />
<field name="PriceCode" required="N" />
<field name="TickValue" required="N" />
<field name="TradeDateCharts" required="N" />
<field name="MarketModeTime" required="N" />
<field name="MarketMode" required="N" />
<field name="SettlementTime" required="N" />
<field name="Settlement" required="N" />
<field name="HeldSettlementTime" required="N" />
<field name="HeldSettlement" required="N" />
<field name="OpenInterestTime" required="N" />
<field name="OpenInterest" required="N" />
<field name="ClearedVolumeTime" required="N" />
<field name="ClearedVolume" required="N" />
<field name="VWAPTime" required="N" />
<field name="VWAP" required="N" />
<field name="QuoteTime" required="N" />
<field name="BidTicks" required="N" />
<field name="BidRealVolume" required="N" />
<field name="BidImpliedVolume" required="N" />
<field name="OfferTicks" required="N" />
<field name="OfferRealVolume" required="N" />
<field name="OfferImpliedVolume" required="N" />
<field name="TPOStartTime" required="N" />
<field name="TPOTicks" required="N" />
<field name="TPOVolume" required="N" />
<field name="TPOVolumeAtBid" required="N" />
<field name="TPOVolumeAtOffer" required="N" />
<field name="TPOIsOpening" required="N" />
<field name="TPOIsClosing" required="N" />
<field name="TradeTime" required="N" />
<field name="TradedVolume" required="N" />
<field name="TradeTickValue" required="N" />
<field name="TotalTradedVolume" required="N" />
<field name="DueToSpread" required="N" />
<field name="AtBidOrOffer" required="N" />
<field name="BarStartTime" required="N" />
<field name="BarCloseTime" required="N" />
<field name="BarOpenTicks" required="N" />
<field name="BarHighTicks" required="N" />
<field name="BarLowTicks" required="N" />
<field name="BarCloseTicks" required="N" />
<field name="BarVolume" required="N" />
<field name="BarBidVolume" required="N" />
<field name="BarOfferVolume" required="N" />
<field name="BarTradeCount" required="N" />
<field name="BarTradesAtBid" required="N" />
<field name="BarTradesAtOffer" required="N" />
<field name="TickChangeStartTime" required="N" />
<field name="TickChangeCloseTime" required="N" />
<field name="TickChangeVolume" required="N" />
<field name="TickChangeBidVolume" required="N" />
<field name="TickChangeOfferVolume" required="N" />
<field name="TickChangeTradeCount" required="N" />
<field name="TickChangeTradesAtBid" required="N" />
<field name="TickChangeTradesAtOffer" required="N" />
<field name="RFQTime" required="N" />
<field name="BuySell" required="N" />
<field name="Volume" required="N" />
</group>
</group>
</message>
更新 以下是我尝试解析的实际消息的开头:
(8 =FIX.4.2☺9=8233☺35=W☺34=2☺49=CTS☺56=XXXX☺52= 20140929-20:11:48.480☺262= K-0 ☺55=YM☺48= XCME_E YM(Z14)☺207=CME_E☺965=16☺3200=20140903☺3201=20140904☺3202= 15:1 1:48.465☺3203= 15:11:48.465☺3204=3☺3205=2☺ 268 = 2 ☺269=Y☺75=20140904☺ 3210 = 41 ☺ 3212 =6☺ 3211 =20140904☺3212=4☺3216= 20140903-21:43:06.701☺3217=16990☺3212=3☺3213= 20140903- 21:45:09.402☺3214=1☺3212=3☺3213= 20140903-22:00:00.126☺3214=2☺3212=4☺3216= 2014090 3-23:06:29.533☺3217=16990☺3212=5☺3254= 20140903-22:00:00.000☺3255= 20140903-22:30: 34.364☺3256=16990☺3257=16990☺3258=16990☺3259=16990☺3260=2☺3261=0☺3262=2☺3263=2☺3 264 =0☺3265=2☺3212=5☺3254= 20140903-23:00:00.000☺3255= 20140903-23:17:00.207☺3256= 1 6984☺3257=16984☺3258=16984☺3259=16984☺3260=1☺3261=1☺3262=0☺3263=1☺3264=1☺3265=0☺ 3212 =5☺3254= 20140904-00:00:00.000☺3255= 20140904-00:35:19.271☺3256=16986☺3257= 169 86☺3258=16986☺3259=16986☺3260=1☺3261=0☺3262=1☺3263=1☺3264=0☺3265=1☺3212=11☺3225= 20140904-06:09:38.473☺3226=1430☺3212=12☺3222= 20140904-06:09:38.473☺3223=4957☺321 2 =5☺3254= 20140904-01:00:00.000☺3255= 20140904-01:04:44.936☺3256=16984☺3257=16984☺ 3258 =16984☺3259=16984☺3260=3☺3261=0☺3262=3☺3263=2☺3264=0☺3265=2☺3212=5☺3254= 2014 0904-04:00:00.000☺3255= 20140904-04:25:20.988☺3256=16985☺3257=16985☺3258=16985☺32
以下是我用来解析的代码:
if '3210' in tags:
group = fix.Group(3210, 3212)
ncd = int(str(message.getField(FIX['3210']))[5:-1])
(FIX
是标签:值对的字典。)然后我尝试遍历NoChartData
组。
考虑到Grant的回复,似乎我需要改变我的逻辑来处理嵌套组。
答案 0 :(得分:3)
Conditionally Required Field Missing:3210
这不是DD错误;这是您应用中的逻辑错误。
您正在尝试提取不存在的可选字段。您正在调用msg.GetField(3210)
(或其他),但消息(或组)不包含标记3210.QF假设您知道您正在做什么以及该字段应该在那里,因此它继续就像发件人弄错了一样。
但QF乐观; 你可能犯了错误。 (除非发件人真的 应该包含3210。)
用GetField
(或任何正确的函数名称)包裹if(msg.HasField(3210))
来电。不要提取可选字段,除非您知道它们存在或除非您已强制要求发件人发送它们。