简体   繁体   English

QuickFixN:如何在 QuoteRequest 消息上按特定顺序设置字段?

[英]QuickFixN: How to set fields in a specific sequence on a QuoteRequest message?

We have a requirement to send the first 3 fields of the message in the order that they are set, ie QuoteReqID, OnBehalfOfCompID, Account.我们要求按照设置的顺序发送消息的前 3 个字段,即 QuoteReqID、OnBehalfOfCompID、Account。 However when they are added to the message, they get reordered numerically ascending, ie Account, OnBehalfOfCompID, QuoteReqID.但是,当它们被添加到消息中时,它们会按数字升序重新排序,即 Account、OnBehalfOfCompID、QuoteReqID。 With the group, we are able to define the field order but I see no option to do this for the message.使用该组,我们可以定义字段顺序,但我看不到为消息执行此操作的选项。 Does anybody know how we can achieve this?有人知道我们如何实现这一目标吗?

            var message = new QuoteRequest();
            int[] fieldOrder = new[] {Tags.Currency, Tags.Symbol, Tags.SecurityType, Tags.CFICode, Tags.NoLegs, Tags.LegQty, Tags.LegFutSettDate, Tags.LegSecuritySubType};

            message.SetField(new QuoteReqID(stream.QuoteRequestId));
            message.SetField(new OnBehalfOfCompID(_compId));
            message.SetField(new Account(_accountId));
            var group = new Group(Tags.NoRelatedSym, 0, fieldOrder);
            group.SetField(new Currency(stream.Ccy));
            group.SetField(new Symbol(stream.Ccy1 + "/" + stream.Ccy2));
            group.SetField(new SecurityType("FOR"));
            group.SetField(new CFICode("FORWARD"));
            group.SetField(new NoLegs(1));
            group.SetField(new LegQty(stream.Amount));
            group.SetField(new LegFutSettDate(stream.FutSettDate));
            group.SetField(new LegSecuritySubType("TOD"));

            message.AddGroup(group);

            QuickFix.Session.SendToTarget(message, _ratesSession.SessionId);

I am not familiar with QuickFixN, but I know that OnBehalfOfCompID is a field in the header of a message, while both QuoteReqID and Account are fields in the body of a message.我不熟悉 QuickFixN,但我知道OnBehalfOfCompID是消息header中的字段,而QuoteReqIDAccount都是消息正文中的字段。 All header fields used in a message must appear before any of the body fields.消息中使用的所有 header 字段必须出现在任何正文字段之前。

This is absolutely not how FIX protocol is specified to behave.这绝对不是指定 FIX 协议的行为方式。 In the spec, fields in the Body that are not inside a repeating group can be in any order.在规范中,正文中不在重复组内的字段可以按任何顺序排列。 Your counterparty is asking for non-FIX-compliant behavior (and I can see no benefit for it).您的交易对手要求不符合 FIX 的行为(我看不出有什么好处)。

As such, QuickFIX/n does not support this, because... QF/n implements FIX, and not this stupid non-FIX behavior that your counterparty wants.因此,QuickFIX/n 不支持这一点,因为... QF/n 实现了 FIX,而不是您的交易对手想要的这种愚蠢的非 FIX 行为。

I'm sorry to tell you this, but you will have to hack the engine somehow to make this happen.很抱歉告诉你这一点,但你必须以某种方式破解引擎才能实现这一点。

One more caveat: OnBehalfOfCompID is a header field, not a body field.还有一个警告: OnBehalfOfCompID是 header 字段,而不是正文字段。 QF/n should not have a problem with you adding it to an outgoing message's body, but it would likely reject such a message when incoming. QF/n 将它添加到传出消息的正文中应该没有问题,但它可能会在传入时拒绝此类消息。 (Thanks to @ciaran-mchale 's answer for pointing this out.) (感谢@ciaran-mchale 的回答指出了这一点。)

"onbehalfcompid" ( tag 115) comes under header of fix message and quoteReqID ( tag 131) and Account (tag 1) comes under body of fix message. “onbehalfcompid”(标签 115)在修复消息的 header 下,quoteReqID(标签 131)和帐户(标签 1)在修复消息的正文下。 and all header tags should appear before the body message tags.并且所有 header 标签都应该出现在正文消息标签之前。 and this is applicable to all fix engines/simulator.这适用于所有修复引擎/模拟器。

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

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