• 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

Message Fields

An SBE message provides access to message fields via its methods.

To get/set a field value, use the corresponding method of the <xref:OnixS.SimpleBinaryEncoding.IFieldSet> interface.

Setters

The naming convention for setters is SetTypeName(..).

Setting Optional Fields

To set the value of the optional field to null, use the <xref:OnixS.SimpleBinaryEncoding.IFieldSet.SetToNull(System.Int32)> method.

Getters

The naming convention for getters is GetTypeName(..).

Getting Optional Fields

To check if an optional field is present in the message, use the <xref:OnixS.SimpleBinaryEncoding.IFieldSet.Contains(System.Int32)> method.

Field types

There is a need to use the correct field type in getters/setters. But if field type can be implicitly cast to getter type, it is allowed to use such type. For example, it is allowed to call <xref:OnixS.SimpleBinaryEncoding.IFieldSet.GetInteger(System.Int32)> for byte and short fields. For setters, it is an opposite rule: if setter type can be implicitly cast to the field type, it is allowed to use such type. For example, it is allowed to call <xref:OnixS.SimpleBinaryEncoding.IFieldSet.SetByte(System.Int32,System.Byte)> for short and integer fields.

Enumerations Fields

There is an ability to work with user-defined enumerations using <xref:OnixS.SimpleBinaryEncoding.IFieldSet.GetEnum``1(System.Int32)> and <xref:OnixS.SimpleBinaryEncoding.IFieldSet.SetEnum``1(System.Int32,``0)> methods.

Variable-length Fields

Variable-length fields is esposed by <xref:OnixS.SimpleBinaryEncoding.IVariableLengthField> interface. Use <xref:OnixS.SimpleBinaryEncoding.IFieldSet.GetVariableLengthField(System.Int32)> method to obtain variable-length field.

Raw field Value

There is an ability to get/set raw field bytes using <xref:OnixS.SimpleBinaryEncoding.IFieldSet.GetBytes(System.Int32)> and <xref:OnixS.SimpleBinaryEncoding.IFieldSet.SetBytes(System.Int32,System.ReadOnlySpan{System.Byte})> methods.

Example

const int NewOrderSingleTemplateId = 514;

IEncoder encoder = session.CreateEncoder();

IMessage message = encoder.Wrap(NewOrderSingleTemplateId);

const int SideTag = 54;
const int SenderIDTag = 5392;
const int ClOrdIDTag = 11;
const int TimeInForceTag = 59;
const int OrderQtyTag = 38;
const int PriceTag = 44;
const int DisplayQtyTag = 1138;

// Set fields:
message.SetEnum(SideTag, Side.Buy);
message.SetString(SenderIDTag, "GFP");
message.SetString(ClOrdIDTag, "OrderId");
message.SetEnum(TimeInForceTag, TimeInForce.Day);
message.SetUnsignedInteger(OrderQtyTag, 1);
message.SetDecimal(PriceTag, 100);

// Set an optional field to the `null` value:
message.SetToNull(DisplayQtyTag);

// Get required fields:
Side side = message.GetEnum<Side>(SideTag);
string senderId = message.GetString(SenderIDTag);
string clOrdId = message.GetString(ClOrdIDTag);
TimeInForce timeInForce = message.GetEnum<TimeInForce>(TimeInForceTag);
uint orderQty = message.GetUnsignedInteger(OrderQtyTag);

// Get an optional field:
decimal price;
if (message.Contains(PriceTag))
{
    price = message.GetDecimal(PriceTag);
}

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