市场数据请求 - FieldNotFound 异常

发布于 2024-11-29 04:00:11 字数 902 浏览 4 评论 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)

我在这里缺少什么?

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.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)

What am i missing here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人事已非 2024-12-06 04:00:11

发现问题:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文