문제

I'm running QuickFix with the Python API and connecting to a TT FIX Adapter using FIX4.2

I am logging on and sending a market data request for two instruments. That works fine and data from the instruments comes in as expected. I can get all kinds of information from the messages.

However, I am having trouble getting the Symbol (flag 55) field.

    import quickfix as fix

    def fromApp(self, message, sessionID):

        ID = fix.Symbol()
        message.getField(ID)
        print ID

This works for the very first message [the initial Market Data Snapshot (flag 35 = W)] that comes to me. Once I start getting incremental refreshes (flag 35 = X), I can no longer get the Symbol field. Every message that arrives results in a Field Not Found error.

This is confusing me because in the logs, the Symbol field is always present, whether the message type is W or X.

Thinking the Symbol is in the header of refresh messages, I tried get.Field(ID) when 35 = W and get.Header().getField(ID) when 35 = X, however this did not work.

Can somebody help me figure out what is going on here? I would like to be able to explicitly tell my computer what instruments it is looking at.

Thanks

도움이 되었습니까?

해결책

Your question is pretty simple, but you've mixed in some misconceptions as well.

1) Symbol will never be in the header. It is a body field.

2) In X messages, the symbol is in a repeating group. You first have to get a group object with msg.GetGroup(), then get the symbol from that. See this example code, from the repeating groups doc page.

3) In W messages, the symbol is not in a group. That's why it works for you there.

It seems clear you are pretty new to QuickFIX and FIX in general. I think you should take few minutes and skim through the "Working with Messages" section of the docs.

Also, the FIXimate website can be your best friend.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top