2

I want to produce a market data request with 2 groups, NoMDEntryTypes (267) and NoRelatedSym (146) one after the other, as below:

267=2 269=0 269=1 146=1 55=EUR/USD

but when I send the message somehow quickfixj or my data dictionary swaps around the order of the groups to the following:

146=1 55=EUR/USD 267=2 269=0 269=1 

This happens even if I create a direct string message and validate it through my data dictionary.

What can I do to keep the groups in the order I want ?! THANKS

Grant Birchmeier
  • 17,809
  • 11
  • 63
  • 98
rupweb
  • 3,052
  • 1
  • 30
  • 57
  • 2
    The QuickFIX/J code generation includes an "orderedFields" option to order regular body fields by the data dictionary ordering. I'm not sure if this will order repeating groups but it might be worth trying if you really need to order groups for some reason. http://www.quickfixj.org/quickfixj/usermanual/1.5.3/usage/codegen.html – Frank Smith Aug 17 '15 at 16:40

2 Answers2

5

In FIX, the order of tags in the top-level body does not matter. The various QuickFIX engines' internal representations of Message objects ignore the top-level tag order, because there is no benefit to storing it. When the message is converted to a string, it orders them by numerical tag order. It doesn't change the message in any meaningful way according to FIX.

(Order is preserved inside of repeating groups, because FIX does mandate that the ordering is meaningful inside of groups.)

What can I do to keep the groups in the order I want ?!

For QuickFIX, the answer is: You can't.

If that is a really big problem for your needs (there's no reason it should be), then I guess you'll have to explore other FIX engine options.

Grant Birchmeier
  • 17,809
  • 11
  • 63
  • 98
  • Thx Grant... So why is the ordering swapped at all? – rupweb Aug 14 '15 at 17:06
  • 3
    Because the `Message` class stores the top-level body fields in a `HashMap` (I think) that is keyed by tag. Hashes do not preserve order. It would require extra coding to store the order information, which would not be worthwhile because FIX doesn't care about the order. – Grant Birchmeier Aug 16 '15 at 22:32
1

define class extending GROUP and use your own order for it. just check NoMDEntryTypes.NoRelatedSym

  • Thanks Dev at Transferwise :-) – rupweb Sep 04 '20 at 09:28
  • Per [this question](https://stackoverflow.com/questions/63827638/in-quickfix-what-is-the-relatedsymgroup-order-set-by) I got it to work extending `group` – rupweb Sep 28 '20 at 13:45
  • I don't understand how this could be relevant. The original question is not about reordering tags within groups, but about reordering groups within the top-level body! 146 and 267 are not within a group, so what group could you extend? – Grant Birchmeier Oct 02 '20 at 13:24