我从我的服务提供商那里得到了这个示例响应。他们定义了已经定义的标记(我已经从FIXimate中检查过)。
8=FIXT.1.19=108135=IB49=NSECM56=MTBM34=1924=1115=21828=61826=Nifty CPSE1815=2294.51816=2310.151817=2286.551818=2276.751819=2294.21820=1967852601488651821=262231822=257851823=0.771824=2799.551825=2139.51827=-1826=Nifty GrowSect 151815=7037.751816=7070.351817=7023.651818=6990.61819=7042.91820=7768216282514231821=782041822=750561823=0.751824=7354.551825=5942.151827= 1826=Nifty50 Value 201815=5444.71816=5465.61817=5417.41818=5413.61819=5425.91820=1.90667550936387E+151821=1348851822=1341791823=0.231824=5563.81825=4171.651827=-1826=Nifty Mid Liq 151815=4133.551816=4206.551817=4133.551818=4107.21819=4205.41820=1573956262705091821=428041822=442911823=2.391824=4677.051825=3770.551827=-1826=Nifty Pvt Bank1815=15385.21816=15415.51817=15339.751818=15248.81819=15377.71820=9015155094048031821=589741822=592681823=0.851824=16152.151825=13298.31827=+1826=NIFTY MIDCAP 1001815=19184.851816=19326.31817=19184.851818=19046.551819=19314.251820=7127426889917151821=1858871822=1884631823=1.411824=21840.851825=17700.91827=-10=174
问题是我无法读取重复组。我创建自定义组为

 noIndexRecords = int(message.getField(1828))
 if noIndexRecords > 0:
    group = fix.Group(1828, 1826, )
    message.getGroup(num=1, group=group)

但这显示了一个FieldNotFound错误。我已将规范文件FIX50SP2.xml更改为:
添加的字段:
<field number='1815' name="OpenIndex" type="PRICE"/>
<field number='1816' name="HighIndex" type="PRICE"/>
<field number='1817' name="LowIndex" type="PRICE"/>
<field number='1818' name="CloseIndex" type="PRICE"/>
<field number='1819' name="IndexValue" type="PRICE"/>
<field number='1820' name="MarketCapitalization" type="DOUBLE"/>
<field number='1821' name="NoOfDownMoves" type="INT"/>
<field number='1822' name="NoOfUpMoves" type="INT"/>
<field number='1823' name="PercentageChange" type="DECIMAL"/>
<field number='1824' name="YearlyHigh" type="PRICE"/>
<field number='1825' name="YearlyLow" type="PRICE"/>
<field number='1826' name="IndexName" type="STRING"/>
<field number='1827' name="NetChangeIndicator" type="CHAR"/>
<field number='1828' name="NumberOfRecords" type="INT"/>
<field number='8288' name='NoIndexRecords' type='NUMINGROUP'/>

已添加邮件类别:
<message name='IndexBroadcast' msgtype="IB" msgcat="app">
            <field name="NumberOfRecords" required="N"/>
            <component name="NoIndexRecord" required="N"/>

组件定义为:
<component name="NoIndexRecord">
    <group name='NoIndexRecords' required='N'>
        <field name='IndexName' required='Y'/>
        <field name='SecurityID' required='N'/>
        <field name='OpenIndex' required='N'/>
        <field name='HighIndex' required='N'/>
        <field name='LowIndex' required='N'/>
        <field name='CloseIndex' required='N'/>
        <field name='IndexValue' required='N'/>
        <field name='MarketCapitalization' required='N'/>
        <field name='NoOfDownMoves' required='N'/>
        <field name='NoOfUpMoves' required='N'/>
        <field name='PercentageChange' required='N'/>
        <field name='YearlyHigh' required='N'/>
        <field name='YearlyLow' required='N'/>
        <field name='NetChangeIndicator' required='N'/>
    </group>
</component>

我经历了不同的讨论和论坛,却找不到解决办法。一个类似的问题是unanswered
如有任何帮助,我们将不胜感激。谢谢

最佳答案

我已更改规范文件FIX50SP2.xml
我想您指的是spec/FIX50SP2.xml的文件QuickFIX C++ Fix Engine Library。要想成功,我想你需要recompile the quickfix-engine。除非您正在派生QuickFix引擎项目,否则这可能不是您想要的。
尝试定义字段like this

import quickfix

class MarketCapitalizationField(quickfix.DoubleField):
    number = 1820

    def __init__(self, data=None)
        args = (self.number,) if data is None else (self.number, data)
        super(MarketCapitalizationField, self).__init__(*args)

class IndexNameField(quickfix.StringField):
    number = 1826

    def __init__(self, data=None)
        args = (self.number,) if data is None else (self.number, data)
        super(IndexNameField, self).__init__(*args)

class NumberOfRecordsField(quickfix.IntField):
    number = 1828

    def __init__(self, data=None)
        args = (self.number,) if data is None else (self.number, data)
        super(NumberOfRecordsField, self).__init__(*args)

…然后像这样读你的信息:
noIndexRecords = int(message.getField(NumberOfRecords.number))
for idx in range(1, noIndexRecords+1):
    message.getGroup(i, group)
    group.getField(MarketCapitalizationField.number)
    group.getField(IndexNameField.number)

07-24 20:58