I am trying to read from a FIX engine using Python and Quickfix, and have managed to get the engine to recognize custom messages by modifying the data dictionary used (with necessary message groups).
The problem I am now facing is reading repeating groups from the custom messages. The quickfix documentation shows the following:
import quickfix
import quickfix42
noMDEntries = quickfix.NoMDEntries()
message.getField(noMDEntries)
group = quickfix42.MarketDataSnapshotFillRefresh.NoMDEntries()
MDEntryType = quickfix.MDEntryType()
MDEntryPx = quickfix.MDEntryPx()
MDEntrySize = quickfix.MDEntrySize()
orderID = quickfix.OrderID();
message.getGroup(1, group);
group.getField(MDEntryType);
group.getField(MDEntryPx);
group.getField(MDEntrySize);
group.getField(orderID);
...which is fine for FIX messages. When i try and reference my custom message like so:
group = quickfix.CustomMessage.NoMDEntries()
...I get an attribute error.
Any ideas on how to read repeating groups in custom messages?
Edit 1:
i found a hack, but am certain there is a better way of doing this...
for i in range(int(message.getField(NoMDEntries):
group = quickfix.Group(int(message.repeatingField), int(message.delimField))
message.getGroup(i+1, group)
print group.getField(MDEntryPx)
#do something with repeating fields etc
...ideas anyone?