image/svg+xml
  • OnixS .NET FIX Engine
  • Programming Guide
  • Api Documentation
  • Version 1.16.0
    • Programming Guide
    • FIX Message
Show / Hide Table of Contents
  • Introduction
  • System Requirements
  • Project Dependency Management
  • Getting Started
  • Error Reporting
  • Licensing
  • Engine Initialization and Shutdown
  • Selecting FIX Version
  • FIX Message
    • Manipulating Message Fields
  • FIX Session
    • Establishing FIX Connection
    • Exchanging Messages
    • Message Sequence Numbers
  • Configuring the Engine
    • Loading Engine Settings From Configuration Files
    • Multiple Listen Ports
  • Logging Services
    • Selecting Session Storage
    • Customizing Message Logging
  • Threading Model
  • Thread Safety
  • Repeating Groups
  • Sessions
    • Session States
    • Session Events
    • Accepting FIX Session Without a Prior Creation of Session Object
    • Custom Logon Message
    • Logon Authentication
    • Establishing FIX Connection via Proxy
    • Resetting Message Sequence Numbers
    • Resetting Message Sequence Numbers via ResetSeqNumFlag Field
    • Resending Messages
    • Memory-based Session Storage
    • File-based Session Storage
    • Async File-based Session Storage
    • Pluggable Session Storage
    • Scheduling Session for Automatic Connection
      • Session Schedule
      • Session Connection Settings
      • XML-based Schedules and Connection Settings
    • Failover
    • Message Sending Latency
    • Message Receiving Latency
    • Message Throttling
  • Messaging
    • Manipulating Real Numbers
    • Message Validation
    • Serialized FIX Messages
    • Typed FIX Messages
    • Flat Messages
      • Flat Group Reader
    • Using LINQ
  • FIX Dictionary
    • XML-based Dictionary Description
    • Session-level Dictionary
    • Dictionary Exploration
    • Using QuickFIX Data Dictionary
  • Engine Events
  • TLS/SSL Encryption
    • Using TLS/SSL Encryption
    • Supported Certificates
    • Session-level TLS/SSL Settings
    • Verification of Client SSL Certificates
    • Custom verification of SSL Certificates
    • TLS/SSL Troubleshooting
  • FAST Coding
    • Encoding And Decoding Data Using FAST
    • FAST Template
    • Generating FIX Dictionaries For FAST Coding
    • FAST Exceptions
  • FIXML Converter
  • Reducing Garbage Collection Overhead
  • Best Practices
    • Low Latency Best Practices
    • High Throughput Best Practices
  • Migration Guide
  • Frequently Asked Questions
  • Glossary
  • External Resources
  • Samples
  • Support

FIX Message

A FIX message represents a sequence of fields whose values are associated with unique numbers (tags).

A common way of presenting a FIX message is called the tag-value FIX message format. In this format, all fields are presented as tag=value pairs and are delimited by the special SOH ASCII symbol (it's code is 0x01).

The following image shows the structure of FIX message in the tag-value format:

fixMessageStructure

Message Class

The Engine exposes the Message class to encapsulate all services related to handling FIX messages.

Constructing Blank Message

To create a new FIX Message object, use one of the Message constructors. It initializes a message of the specified type and the FIX protocol version with a few service fields.

For example:

var order = new Message(MsgType.NewOrderSingle, ProtocolVersion.Fix44);
Note

When a Message instance is created with the specified message type, then the corresponding internal data structure is associated with this instance, so you need to create a new message when you want to change the message type.

Parsing Raw (Tag-Value) Format

Several Message.Parse(..) methods are available to construct a Message instance from the raw (tag-value) representation.

For example:

string rawFixString = "8=FIX.4.0\u00019=86\u000135=D\u000149=0\u000156=0\u000134=1\u000152=99990909-17:17:17\u000111=90001008\u000121=1\u000155=IBM\u000154=1\u000138=10\u000140=1\u000159=0\u000110=191\u0001";

var order = Message.Parse(rawFixString);

Converting To Raw (Tag-Value) Format

Several overloads of the ToString() method are available to build a tag-value presentation of a Message instance.

For example:

// Default presentation.
Console.WriteLine(order.ToString());

// Presentation delimited with spaces instead of SOH symbol.
Console.WriteLine(order.ToString(' '));

// More advanced presentation which allows selecting which parts of fields information will be included.
Console.WriteLine(order.ToString(' ', FixStringFormat.TagName | FixStringFormat.TagNumber));

Validating Message

In addition to the presence of a particular field in the message of a specific type, the FIX protocol also defines whether the presence of fields are strictly required in the message, whether they are required under certain conditions, or whether they are optional.

To check for the presence of all required fields use the Validate(MessageValidationFlags) method.

Message Life Cycle

Sometimes there is a need to reuse a Message instance right after it was sent to a session. As soon as the message was sent, the Engine will not use it later, so it can be used again; for example, it could be sent to other sessions.

For example:

public static void Send(Message message, List<Session> sessions)
{
    foreach (var session in sessions)
    {
        session.Send(message);
    }
}
Note

Please note that a Message instance is not thread-safe, so it cannot be used in one thread while it is used in another.

See Also

  • Flat Message
  • FIX Dictionary - a quick and easy to use contemporary dictionary of the FIX Protocol.
  • FIX Parser - the online FIX Parser for the visualisation of FIX messages
  • FIX Analyser - versatile GUI analytical tool for FIX Protocol.
In this article
  • Message Class
  • Constructing Blank Message
  • Parsing Raw (Tag-Value) Format
  • Converting To Raw (Tag-Value) Format
  • Validating Message
  • Message Life Cycle
  • See Also
Back to top Copyright © Onix Solutions.
Generated by DocFX