• Version 1.16.0
Show / Hide Table of Contents

Exchanging Messages

Sending Messages

To send a message to a counterparty use the Send(IMessage) method. This method is asynchronous. As soon as a session is created, it is possible to start sending messages.

If the session is not established, messages are stored in the session storage and will be sent in reply to the Resend Request message when the connection is established with the counterparty and the sequence numbers mismatch is detected (see Resending Messages).

For example:

            const ProtocolVersion version = ProtocolVersion.Fix44;

            var order = new Message(MsgType.NewOrderSingle, version);

            order.Set(Tag.ClOrdID, "Unique identifier for Order as assigned by the buy-side")
                 .Set(Tag.HandlInst, HandlInst.AutoExecPriv)
                 .Set(Tag.Symbol, "Ticker symbol")
                 .Set(Tag.Side, Side.Buy)
                 .Set(Tag.TransactTime, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"))
                 .Set(Tag.OrdType, OrdType.Market);

#if DEBUG
            order.Validate();
#endif

            session.Send(order);

Receiving Messages

To receive incoming application-level messages subscribe to the InboundApplicationMessage event.

For example:

session.InboundApplicationMessage += (object sender, InboundMessageEventArgs e) =>
{
    Console.WriteLine($"Application-level message is received: {e}");
};
In this article
Back to top Copyright © Onix Solutions.
Generated by DocFX