0

FieldNotFound尝试订阅外汇交易品种的报价时,我经常遇到异常。尽管我添加了所有必需的标签及其他标签。

(它们是:MDReqID,SubscriptionRequestType,MarketDepth,NoMDEntryTypes,MDEntryType,NoRelatedSym,Symbol。这里指定:http ://www.onixs.biz/tools/fixdictionary/4.2/msgType_V_86.html )

这是我的代码:

Dim l_msg As New QuickFix42.MarketDataRequest(
 New MDReqID(System.Guid.NewGuid.ToString),
 New SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES),
 New MarketDepth(1))

l_msg.setField(New MDUpdateType(1))
l_msg.setField(New AggregatedBook(False))
l_msg.setField(New NoMDEntryTypes(2))
l_msg.setField(New MDEntryType("0"c))    
l_msg.setField(New NoRelatedSym(1))
l_msg.setField(New Symbol("EUR/USD"))

Session.sendToTarget(l_msg, SENDER_COMP_ID.Value, TARGET_COMP_ID.Value)

我在这里想念什么?

4

1 回答 1

0

发现问题:

toApp方法正在使用检查重复项PossDupFlag ,如果不存在,FieldNotFound则抛出异常。

解决方案是使用检查 PossDupFlag 是否存在的条件来包装它,或者在发送之前将此字段添加到消息中:

Public Sub toApp(p_msg As QuickFix.Message, Param1 As QuickFix.SessionID) Implements QuickFix.Application.toApp
        Try
            Dim l_possDupFlag As New QuickFix.PossDupFlag

            If p_msg.isSetField(l_possDupFlag) Then
                p_msg.getHeader().getField(l_possDupFlag)
                If (l_possDupFlag.getValue()) Then
                    Dim donotsendEx As New QuickFix.DoNotSend
                    Throw donotsendEx
                End If
            End If            

        Catch ex As QuickFix.FieldNotFound
            Log.WriteLine("toApp", ex.ToString)
        Catch ex As Exception
            Log.WriteLine("toApp", ex.ToString)
        End Try
    End Sub
于 2011-08-12T20:26:52.397 回答