Session-level Dialects | Table of Content | Using QuickFIX Dialects |
Dialect Exploration |
The Dialect class exposes services to access information about the content of a specialized FIX dialect or standard FIX messaging specification. These services allow to obtain the types of specific dialect or standard FIX messages, and to explore the entire message structure, as well as to retrieve names of arbitrary fields by tag numbers.
The following members are present for basic field information manipulation:
using FIXForge.NET.FIX; Dialect stdFIX44 = new Dialect(ProtocolVersion.FIX44); int sideTag = FIX44.Tags.Side; string tagName = stdFIX44.TagNameByNumber(sideTag); Console.WriteLine("Field '{0}' (# {1}) has following valid values:", tagName, sideTag); foreach (ValidFieldValue valueInfo in stdFIX44.GetValidFieldValues(sideTag)) Console.WriteLine(String.Format("{0} ({1})", valueInfo.Value, valueInfo.Description));
Imports FIXForge.NET.FIX Dim stdFIX44 As New Dialect(FIXForge.NET.FIX.ProtocolVersion.FIX44) Dim sideTag As Int = FIXForge.NET.FIX.FIX44.Tags.Side Dim tagName As String = stdFIX44.TagNameByNumber(sideTag) Dim valueInfo As ValidFieldValue Console.WriteLine("Field '{0}' (# {1}) has following valid values:", tagName, sideTag) For Each valueInfo In stdFIX44.GetValidFieldValues(sideTag) Console.WriteLine(String.Format("{0} ({1})", valueInfo.Value, valueInfo.Description)) Next valueInfo
To explore message-related information, the following members are exposed by the Dialect class:
The following example demonstrates how fields, which make up a message, can be traversing.
using FIXForge.NET.FIX; void TraverseFields(FieldInfo[] fields, int shift) { String spaces = new String(' ', shift); foreach(FieldInfo field in fields) { Console.WriteLine( "{0}{1} (required={2})", spaces, field.Tag, field.IsRequired); TraverseChildFields(field.ChildFields, 2 + shift); } } public void TraverseMessages(Dialect dialect) { foreach(string msgType in dialect.MessageTypes) { Console.WriteLine( "Traversing {0} (MsgType={1})..", dialect.MessageNameByType(msgType), msgType); TraverseFields(dialect.GetMessageFields(msgType), 0); } }
Imports FIXForge.NET.FIX Sub TraverseFields(ByVal fields() As FieldInfo, ByVal shift As Integer) Dim spaces As New String(" ", shift) Dim field As FieldInfo For Each field In fields Console.WriteLine( _ "{0}{1} (required={2})", _ spaces, field.Tag, field.IsRequired) TraverseFields(field.ChildFields, 2 + shift) Next fInfo End Sub Public Sub TraverseMessages(ByVal fixDialect As Dialect) Dim msgType As String For Each msgType In fixDialect.MessageTypes Console.WriteLine( _ "Traversing {0} (MsgType={1})..", _ dialect.MessageNameByType(msgType), msgType) TraverseFields(dialect.GetMessageFields(msgType), 0) Next msgType End Sub