This issue is almost identical to this which was not answered properly: Reading Repeating Groups in Custom Messages using Python Quickfix
python 2.7.15 on Windows, q
This may be a much delayed reply. I came across the same issue and was able to resolve it the following way.
Instead of using the field numbers, you can use the quickfix tags which will use the correct tags behind the scenes. I am using a sample tag 'NoAlloc' here but you can use any group you want.
import quickfix as qfix
# how many items are in the group
count = fixmsg.groupCount(qfix.NoAllocs().getTag())
# Getting the fields where 1 is the item in the list you want to retrieve
# from the repeating group. Index starts from 1 (not 0)
field_set = message.getGroupPtr(1, qfix.NoAllocs().getTag())
field_set.getField(qfix.AllocAccount())
NOTE: For custom groups, you will need to define your own fields and groups.
# Sample Field Declaration
class SampleField1(qfix.StringField):
def __init__(self, data=None):
if data is None:
qfix.StringField.__init__(self, 456)
else:
qfix.StringField.__init__(self, 456, data)
# NoSampleGroup Field Declaration
class NoSampleGroup(qfix.IntField):
def __init__(self, data=None):
if data is None:
qfix.StringField.__init__(self, 879)
else:
qfix.StringField.__init__(self, 879, data)
# Sample Group Declaration
class SampleGroup(qfix.Group):
def __init__(self):
order = qfix.IntArray(4)
order[0] = 879 # This is the NoSamppleGroup field
order[1] = 456 # This is the field in the repeating group
order[2] = 0
fix.Group.__init__(self, 879, 456, order)