2

I am trying to add a PartyID group to a FIX4.4 message.

I cannot find a "group" for PartyID. So I am adding them sequentially.

NoPartyIDs, PartyRole, PartyIDSource, PartyID

However, whichever way I add them, the fix engine appears to reorder them.

How should I do this, or is there a way to specify order?

    public QuickFix.FIX44.MarketDataRequest QueryMarketDataRequest44(string symbol)
    {
        MDReqID mdReqID = new MDReqID("RqID"+symbol);
        SubscriptionRequestType subType = new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES);
        MarketDepth marketDepth = new MarketDepth(1);

        QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup marketDataEntryGroup = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup();

        QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup();
        symbolGroup.Set(new Symbol(symbol));


        QuickFix.FIX44.MarketDataRequest message = new QuickFix.FIX44.MarketDataRequest(mdReqID, subType, marketDepth);
        message.Set(new MDUpdateType(0));
        message.AddGroup(symbolGroup);

        QuickFix.Fields.NoPartyIDs noPartyIDs = new QuickFix.Fields.NoPartyIDs(1);
        QuickFix.Fields.PartyID partyID = new QuickFix.Fields.PartyID("XXXX");
        QuickFix.Fields.PartyIDSource partyIDSource = new QuickFix.Fields.PartyIDSource('D');
        QuickFix.Fields.PartyRole partyRole = new QuickFix.Fields.PartyRole(35);

        message.SetField(noPartyIDs);
        message.SetField(partyRole);
        message.SetField(partyIDSource);
        message.SetField(partyID);            

        return message;
    }
ManInMoon
  • 6,795
  • 15
  • 70
  • 133

3 Answers3

1

Your code is not adding a group. It is adding 4 individual tags to the message, at the message Body's top level. Per FIX specification, the order of fields in the Body is irrelevant outside of repeating groups. Because of that spec, the QF engine does not record any order of (non-repeating-group) fields. It just puts them in numerical order.

To summarize: your whole approach is wrong and won't work.

I think rupweb's answer will work, though it's a bit of a hack since the Parties group doesn't actually belong to MarketDataRequest according to the DD. For outgoing messages, the engine does not check against the DD, so it'll work.

To do it properly, I'd recommend that you edit your DataDictionary to add the group to the message, and then regenerate the QF/n source with this new DD and then rebuild the engine. This way, your MarketDataRequest class will contain updated fields and accessors for these new fields.

Grant Birchmeier
  • 17,809
  • 11
  • 63
  • 98
1

This worked for me. I used Quote.NoPartyIDsGroup. Odd that there isn't such a group in MarketDataRequest.

QuickFix.Fields.NoPartyIDs noPartyIDs = new QuickFix.Fields.NoPartyIDs(1);
            QuickFix.Fields.PartyID partyID = new QuickFix.Fields.PartyID(lp);
            QuickFix.Fields.PartyIDSource partyIDSource = new QuickFix.Fields.PartyIDSource('D');
            QuickFix.Fields.PartyRole partyRole = new QuickFix.Fields.PartyRole(35);

          QuickFix.FIX44.Quote.NoPartyIDsGroup group = new Quote.NoPartyIDsGroup();

            group.SetField(noPartyIDs);
            group.SetField(partyRole);
            group.SetField(partyIDSource);
            group.SetField(partyID);

            message.AddGroup(group);
ManInMoon
  • 6,795
  • 15
  • 70
  • 133
  • The reason there is no such group in MarketDataRequest is that your custom dictionary is not defining one. Have a look at the nuget package `QuickFix.CustomMessages` which is a great time safer... – Matthias Güntert Jul 24 '19 at 12:00
0

I used something like this:

NoPartyIDs noPartyIDs = new NoPartyIDs();
noPartyIDs.setTag(new PartyID());
noPartyIDs.setTag(new PartyIDSource());
noPartyIDs.setTag(new PartyRole());
m.addGroup(noPartyIDs);

and then in my data dictionary

<component name="Parties">
  <group name="NoPartyIDs" required="N">
    <field name="PartyID" required="N" />
    <field name="PartyIDSource" required="N" />
    <field name="PartyRole" required="N" />
    <group name="NoPartySubIDs" required="N">
      <field name="PartySubID" required="N" />
      <field name="PartySubIDType" required="N" />
    </group>
  </group>
</component>

I believe the order is set in the data dictionary...

rupweb
  • 3,052
  • 1
  • 30
  • 57