简体   繁体   中英

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. However when they are added to the message, they get reordered numerically ascending, ie 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. All header fields used in a message must appear before any of the body fields.

This is absolutely not how FIX protocol is specified to behave. 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).

As such, QuickFIX/n does not support this, because... QF/n implements FIX, and not this stupid non-FIX behavior that your counterparty wants.

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. 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. (Thanks to @ciaran-mchale 's answer for pointing this out.)

"onbehalfcompid" ( tag 115) comes under header of fix message and quoteReqID ( tag 131) and Account (tag 1) comes under body of fix message. and all header tags should appear before the body message tags. and this is applicable to all fix engines/simulator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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