• Programming Guide
  • Api Documentation
  • OnixS CME iLink3 Handler for .NET Core, version 1.4.2
Show / Hide Table of Contents
  • Introduction
  • System Requirements
  • Getting Started
    • Error Reporting
    • Licensing
    • SBE Message
      • Tag-based Messaging
      • Message Fields
      • Repeating Groups
    • iLink 3 Session
      • Universally Unique Identifier
      • Establishing iLink3 Connection
      • Exchanging Messages
      • Message Sequence Numbers
  • Configuring the Handler
    • Configuration File Examples (XML or JSON)
  • Logging
  • Session Storage
    • File-Based Session Storage
    • Memory-based Session Storage
    • Asynchronous File-Based Session Storage
    • Pluggable Session Storage
  • Advanced Programming
    • Thread Safety
    • Session Initialization and Binding
    • Session States
    • Listening to Session Events
    • Handling NotApplied Messages
    • Handling Business Reject Messages
    • Automated Downloading of GTC and GTD Orders
    • Reconnection
    • Fault Tolerance
    • Understanding Send Latency
    • Strongly Typed Messages
  • Best Practices
    • Low Latency Best Practices
  • Glossary
  • Support

Exchanging Messages

Sending Messages

To send a message to a counterparty, use the <xref:OnixS.Cme.ILink3.Session.Send(OnixS.SimpleBinaryEncoding.IMessage)> method. The Handler sets all session-level fields automatically (e.g., SeqNum, SendingTimeEpoch).

Note

The session should be fully established before sending application-level messages.

Receiving Messages

To receive messages, subscribe to corresponding events of the Session class:

  • InboundApplicationMessage
  • InboundSessionMessage

Example

SessionSettings settings = new SessionSettings();

settings.LicenseStore = "../../../../../license";

settings.TradingSystemVersion = "1.1.0";
settings.TradingSystemName = "Trading System";
settings.TradingSystemVendor = "OnixS";

settings.SessionId = ConfigurationManager.AppSettings["SessionId"];
settings.FirmId = ConfigurationManager.AppSettings["FirmId"];
settings.AccessKey = ConfigurationManager.AppSettings["AccessKey"];
settings.SecretKey = ConfigurationManager.AppSettings["SecretKey"];

using (Session session = new Session(settings, marketSegmentId))
{
    session.InboundApplicationMessage += (sender, args) =>
    {
        Console.WriteLine("Received: " + args.Message);
    };
    session.InboundSessionMessage += (sender, args) =>
    {
        Console.WriteLine("Received: " + args.Message);
    };

    IEncoder encoder = session.CreateEncoder();

    const int NewOrderSingleTemplateId = 514;
    IMessage message = encoder.Wrap(NewOrderSingleTemplateId);

    message.SetUnsignedLong(Tag.PartyDetailsListReqID, partyDetailsListReqID);
    message.SetByte(Tag.Side, (byte)Side.Buy);
    message.SetString(Tag.SenderID, "GFP");
    message.SetString(Tag.ClOrdID, "OrderId");
    message.SetUnsignedLong(Tag.OrderRequestID, 1u);
    message.SetString(Tag.Location, "UK");
    message.SetChar(Tag.OrdType, (char)OrderType.Limit);
    message.SetByte(Tag.TimeInForce, (byte)TimeInForce.Day);
    message.SetInteger(Tag.SecurityID, securityId);
    message.SetUnsignedInteger(Tag.OrderQty, 1);
    message.SetDecimal(Tag.Price, price);
    message.SetByte(Tag.ManualOrderIndicator, (byte)ManualOrdInd.Automated);
    message.SetChar(Tag.ExecutionMode, (char)ExecMode.Aggressive);
    message.SetByte(Tag.ExecInst, (byte)ExecInst.AON);

}
In This Article
Back to top Copyright © Onix Solutions.
Generated by DocFX