开发者

Market Data Request - FieldNotFound Exception

I'm constantly getting FieldNotFound exception when trying to subscribe to quotes of a Forex symbol. Although i added all the required tags and beyond.

(Which are: MDReqID,SubscriptionRequestType,MarketDepth,NoMDEntryTypes,MDEntryType,NoRelatedSym,Symbol. As specified here: http://www.onixs.biz/tools/fixdictionary/4.2/msgType_V_86.html)

Here is my code:

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

l_msg.setFi开发者_如何学运维eld(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)

What am i missing here?


Found the issue:

The toApp method is checking for duplicates using the PossDupFlag And if it doesn't exist, FieldNotFound exception is being thrown.

The solution is either to wrap it with a condition that checks if PossDupFlag exists, or adding this field to the message before send:

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜