Python Quickfix - reading custom repeating groups

2019-08-15 09:01发布

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, quickfix 1.15.1, FIX 4.2

I have a custom data dictionary from my trading platform provider which has custom fields and groups in the execution report. The full XML is available here: http://library.tradingtechnologies.com/tt-fix/System_Overview.html . In particular the group is defined as such:

        <group name='NoSecurityAltID' required='N'>
            <field name='SecurityAltID' required='N' />
            <field name='SecurityAltIDSource' required='N' />

I have specified the custom data dictionary and set UseDataDictionary=Y as specified elsewhere although I think this is the default anyway.

group= quickfix42.ExecutionReport.NoSecurityAltID()

returns an attribute error.

The strange thing is that NoContraBrokers is available as an attribute but that is not one of the groups in the custom dictionary but is in the standard 4.2 dictionary. I therefore thought that there was some error and that it was not parsing the custom dictionary but I have verified that it is.

I am new to quickfix (and python) so may have made an elementary error. But this has held me up for a long time now so would really appreciate some direction.

Update:

So I can only access standard FIX 4.2 groups by this method. I have now created a group:

group = quickfix.Group(454, 455)

where 454=NoSecurityAltID and 455=SecurityAltID.

Now I am struggling to read the string for the particular SecurityAltIDSource I want. This is the overview of the group:

Group overview

I want to read the 'Alias' and 'Name' but can only access the TagNumber for SecurityAltIDSource by

message.getGroup(1, group)
group.getField(456)

How can I access the strings for the fields I want?

Thanks

Update 2:

It was a simple error (although not a quick one to work out). I was able to access the field I wanted by:

group.getField(455)

I am concerned that using the field integers my not be as robust as another method. Is there a better way of doing this (short of recompiling the engine which would be beyond me)?

0条回答
登录 后发表回答