如何从MarketDataIncrementalRefresh消息中检索数据?

时间:2011-09-30 05:16:26

标签: vb.net quickfix

如何从MarketDataIncrementalRefresh?

中检索以下值?
  • 符号/仪器
  • 优惠
  • 出价
  • OfferSize
  • BidSize

我熟悉Quote消息处理,例如:

If quote.isSetOfferPx Then Offer = quote.getOfferPx.getValue

MarketDataIncrementalRefresh上尝试了相同的方法,但没有这样的方法,isSetField总是返回false,尽管该字段确实存在。

MarketDataIncrementalRefresh示例消息:

  

8 = FIX.4.29 = 22535 = X34 = 349 = ABC52 = 20110928-12:47:53.31656 = TARGETCOMPID262 = 634528216663837491268 = 2279 = 0269 = 0278 = 155 = AUD / CAD270 = 1.0126515 = AUD271 = 1000000346 = 1279 = 0269 = 1278 = 255 = AUD / CAD270 = 1.0130715 = AUD271 = 1000000346 = 110 = 094

1 个答案:

答案 0 :(得分:2)

问题解决了。为了从MarketDataIncrementalRefresh检索数据,构建Groups。因此,我需要获得每个组并单独检索其数据。

方法是:

Public Overrides Sub onMessage(message As QuickFix42.MarketDataIncrementalRefresh, session As SessionID)

    Try
        If message IsNot Nothing Then
            Dim group As New MarketDataIncrementalRefresh.NoMDEntries()

            For i = 1 To message.getNoMDEntries.getValue

                group = message.getGroup(i, group)

                If group.isSetSymbol Then
                    Dim l_symbol As String = group.getSymbol().getValue

                    If group.getMDEntryType().getValue() = "0"c Then
                        SetBid(l_symbol, group.getMDEntryPx().getValue())
                        If group.isSetMDEntrySize Then
                            SetBidSize(l_symbol, group.getMDEntrySize().getValue)
                        End If
                    End If

                    If group.getMDEntryType().getValue() = "1"c Then
                        SetOffer(l_symbol, group.getMDEntryPx().getValue())
                        If group.isSetMDEntrySize Then
                            SetOfferSize(l_symbol, group.getMDEntrySize().getValue)
                        End If
                    End If
                End If
            Next
        End If
    Catch ex As Exception

    End Try

End Sub