简体   繁体   English

在QuickFIX / n中删除一个FIX标签,它应该是重复组的成员,但是不是吗?

[英]Remove a FIX tag in QuickFIX/n which should be a member of a repeating group but is not?

I'm developing an adapter to read CME execution reports (35=8) and the CME occasionally sends [constant] tag-337 (ContraTrader) and tag-375 (ContraBroker) values, which are members of repeating group tag-382 (NoContraBrokers) according to the FIX 4.2 spec. 我正在开发一个适配器来读取CME执行报告(35 = 8),并且CME偶尔发送[恒定] tag-337(ContraTrader)和tag-375(ContraBroker)值,它们是重复组tag-382(NoContraBrokers)的成员)根据FIX 4.2规范。

Here is the (unmodified FIX 4.2) group definition for 382 that I'm using. 这是我正在使用的382的(未修改的FIX 4.2)组定义。

  <group name="NoContraBrokers" required="N">
    <field name="ContraBroker" required="N"/>
    <field name="ContraTrader" required="N"/>
    <field name="ContraTradeQty" required="N"/>
    <field name="ContraTradeTime" required="N"/>
  </group>

The problem is that the CME doesn't send a tag-382 value so QF/n has no way of knowing how many groups to expect and throws an exception when it tries to crack the message. 问题在于CME不会发送tag-382值,因此QF / n无法知道期望有多少个组,并且在尝试破解消息时会引发异常。

I've been searching google and reading documentation and I'm perplexed. 我一直在搜索谷歌和阅读文档,我很困惑。 It would be easy to do something like the following but I think it would mess up messaging checksums and such which would result in a malformed FIX message: 进行以下操作很容易,但是我认为这会弄乱消息校验和,从而导致FIX消息格式错误:

public const string SOH = "\u0001";
//my bad code goes here

public void FromApp(Message message, SessionID sessionID)
{
    if (message.ToString().Contains(SOH + "375="))
    {
        int insertionPoint = message.ToString().IndexOf(SOH + "375=");
        string foo = message.ToString().Insert(insertionPoint, SOH + "382=1");
        Message bar = new Message(foo);
        message = bar;
    }
    try
    {
        Crack(message, sessionID);
    }
    catch (QuickFIXException e)
    {
        //Panic on the dance floor!
    }
}

Example message which throws the exception upon Crack(...){} 消息示例在Crack(...){}上引发异常

8=FIX.4.2 | 8 = FIX.4.2 | 9=497 | 9 = 497 | 35=8 | 35 = 8 | 34=3 | 34 = 3 | 43=Y | 43 = Y | 49=SOMEVALUE | 49 = SOMEVALUE | 52=20150326-20:30:24.943 | 52 = 20150326-20:30:24.943 | 56=ANOTHERVALUE | 56 = ANOTHERVALUE | 122=20150326-14:50:47.226 | 122 = 20150326-14:50:47.226 | 1=SOMEACCOUNT | 1 = SOMEACCOUNTCOUNT | 6=0 | 6 = 0 | 11=OrderID12345 | 11 = OrderID12345 | 14=2 | 14 = 2 | 17=70477:M:691285TN0017346 | 17 = 70477:M:691285TN0017346 | 20=0 | 20 = 0 | 31=525 | 31 = 525 | 32=2 | 32 = 2 | 37=70297295250 | 37 = 70297295250 | 38=5 | 38 = 5 | 39=1 | 39 = 1 | 40=2 | 40 = 2 | 41=0 | 41 = 0 | 44=510.25 | 44 = 510.25 | 48=250618 | 48 = 250618 | 54=2 | 54 = 2 | 55=ZW | 55 = ZW | 59=0 | 59 = 0 | 60=20150326-14:50:47.213 | 60 = 20150326-14:50:47.213 | 75=20150326 | 75 = 20150326 | 107=ZWK5 | 107 = ZWK5 | 150=1 | 150 = 1 | 151=3 | 151 = 3 | 167=FUT | 167 = FUT | 337=TRADE | 337 =交易| 375=CME000A | 375 = CME000A | 432=20150326 | 432 = 20150326 | 442=1 | 442 = 1 | 527=702972952502015032617346 | 527 = 702972952502015032617346 | 1028=Y | 1028 = Y | 1057=Y | 1057 = Y | 9717=OrderID438346156 | 9717 = OrderID438346156 | 10=158 | 10 = 158 |

An alternative would be to redefine the execution report structure in the XML file to remove the group definition and insert 337 and 375 as non-required fields but that makes the adapter very specifically for the CME. 一种替代方法是在XML文件中重新定义执行报告结构,以删除组定义,并将337和375插入为非必填字段,但这使适配器非常适合CME。

Is there a less daft way to accomplish this? 有没有那么愚蠢的方法可以做到这一点?

Does CME have documentation for this particular FIX interface? CME是否有针对此特定FIX接口的文档?

It is incredibly common (nearly always, actually) for counterparties to add or remove custom fields to FIX messages. 交易对手在FIX消息中添加或删除自定义字段是非常普遍的(几乎总是如此)。 It's possible that the fields giving you trouble are part of those modifications. 给您带来麻烦的字段可能是这些修改的一部分。

The documentation should show exactly what changes you need to make in your FIX42.xml file so that your engine's expectations match what CME is sending. 该文档应确切显示您需要在FIX42.xml文件中进行哪些更改,以便您的引擎期望与CME发送的内容相匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM