• Version 1.16.0
Show / Hide Table of Contents

Dictionary Exploration

The IMessageInfoDictionary interface exposes services to access information about the content of a specialized FIX dictionary or standard FIX messaging specification. These services allow us to obtain the types of a specific dictionary or standard FIX messages, and to explore the entire message structure, as well as to retrieve names of arbitrary fields by tag numbers.

Accessing Fields Information

To access messages information IMessageInfoDictionary interface has methods to request MessageInfo objects.

The following example demonstrates how fields, which make up a message, can be traversing:

public void TraverseMessages(IMessageInfoDictionary dictionary)
{
    foreach (var msgType in dictionary.MessageTypes)
    {
        var messageInfo = dictionary.GetMessageInfo(msgType);

        Console.WriteLine($"Traversing {messageInfo.Name} (MsgType={messageInfo.Type})...");
        TraverseFields(messageInfo.Fields, 0);
    }
}

void TraverseFields(IEnumerable<FieldInfo> fields, int shift)
{
    string spaces = new string(' ', shift);

    foreach (var field in fields)
    {
        Console.WriteLine($"{spaces}{field.Name}<{field.Tag}> (required={field.IsRequired}) {field.Type?.Name}");

        if (field.Type != null)
        {
            foreach (var value in field.Type.Values.Values)
            {
                Console.WriteLine($" {spaces}{value.Value} ({value.Description})");
            }
        }

        if (field.Group != null)
            TraverseFields(field.Group.Fields, 2 + shift);
    }
}
In this article
Back to top Copyright © Onix Solutions.
Generated by DocFX