Search code examples
c#.net-coreclient-serverfix-protocolquickfixn

FIXT.1.1 5.0 SP2 Unable to Send/Recv with certain tags included


i'm working on FIX, both client and server. The FIX messages seems fine when i send standard NewOrderSingle and I get an ExecutionReport.

However, when the server tries to send an ExecutionReport with the following tags, it either gets rejected/not sent, or was sent but client didnt properly receive it. Here are the troublesome tags.....

exReport.SetField(new ApplVerID(ApplVerID.FIX50SP2));       // Tag 1128

When client received this tag, it will send a REJECT to server with.... Tag specified out of required order

exReport.SetField(new MDEntryID(oid));                      // Tag 278

When client received this tag, it will send a REJECT to server with.... Tag not defined for this message type

exReport.SetField(new OrderBook(1));                        // Tag 30001

When client received this tag, it will send a REJECT to server with.... Invalid tag number [Please note for this case I added a NEW tag and already defined in cs files]

Under FieldTags.cs

public const int OrderBook = 30001;

Under Fields.cs

public sealed class OrderBook : IntField
{
    public const int TAG = 30001;

    public OrderBook()
        : base(Tags.OrderBook) { }
    public OrderBook(int val)
        : base(Tags.OrderBook, val) { }
}

I have no idea how to make these tags work, please someone help me.


Solution

  • Disclaimer: I have not used QuickFixN, so what I say is based on my knowledge of the FIX protocol rather than the product you are using.

    The fields within a FIX message have some minimal ordering requirements imposed on them. In particular, all the header fields should be appear before any body fields, and any trailer fields should appear last in a message. The ApplVerID field is defined as belonging in the header, so a "Tag specified out of required order" error suggests that the field had been intermingled with body fields rather than appear with other header fields.

    I assume your FIX applications make use of a FIX data dictionary, which is an XML file that defines fields, and whether those fields appear in the header or trailer, or the body of specific messages. If you examine your FIX data dictionary, you should be able to confirm that ApplVerID belongs in the header fields. You will probably also be able to verify that the "Tag not defined for this message type" error for the MDEntryID field is because the FIX dictionary definition for the message does not contain that field.

    The "Invalid tag number" error message arises because you should have defined the new field in the FIX data dictionaries used by both the server and client applications, rather than write a C# class for the new field. (I am assuming the FIX product provides a compiler that will generate C# classes from a FIX data dictionary.)