Attachments |
---|
The QuickFIX/J DataDictionary
contains information about supported FIX messages and fields. This is sometimes called message metadata. QuickFIX/J uses this information for parsing, formatting, and validating messages. However it has other potential uses as well. For example, you could write a simple message formatter that uses DataDictionary
information to print human-friendly representations of FIX messages. In this article we'll develop a message formatter as an example of using QuickFIX/J metadata.
The basic idea is simple, but there are a few complications to consider. Let's say we have a parsed FIX message and want to format it in way that that's easier to read than tag/value pairs. We might start by simply iterating over the fields and printing their values.
...
All the fields are there now, but there are still a few problems. The group count tag is shown twice because it's also a normal top level field. We'll add a few lines of code to avoid printing the group count field as a normal field. We To do this we can ask the data dictionary for the type of a field. In this case, we are checking whether the field is a NumInGroup
type.
...
I hope this gives you some ideas about how to use the metadata API in QuickFIX/J. Please leave a comment if you have questions or suggestions.
Attachments |
---|