市场数据请求代码格式

时间:2015-10-29 04:43:43

标签: fix-protocol

    var noMDETGroup1 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
    noMDETGroup1.MDEntryType = new MDEntryType('0');
    var noMDETGroup2 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
    noMDETGroup2.MDEntryType = new MDEntryType('1');
    var noMDETGroup3 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
    noMDETGroup3.MDEntryType = new MDEntryType('2');
    var noMDETGroup4 = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
    noMDETGroup4.MDEntryType = new MDEntryType('4');

    msg.AddGroup(noMDETGroup1);
    msg.AddGroup(noMDETGroup2);
    msg.AddGroup(noMDETGroup3);
    msg.AddGroup(noMDETGroup4);
}

有没有更简单的方法来重复组? Quick Fix / n网站给了我这个想法:http://quickfixn.org/tutorial/repeating-groups.html

1 个答案:

答案 0 :(得分:0)

嗯,这是一种方式:

char[] mdEntryTypes = {'0', '1', '2', '4'};
foreach (char c in mdEntryTypes)
{
    var group = new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();
    group.MDEntryType = new MDEntryType(c);
    msg.AddGroup(group);
}