Class OrderFlyweight

java.lang.Object
com.quantfinlib.sbe.OrderFlyweight

public final class OrderFlyweight extends Object
SBE-style flyweight codec for an order-entry message — the binary counterpart of a FIX NewOrderSingle, at fixed offsets with zero allocation and zero parsing (see TradeFlyweight for the pattern).

Wire layout (little-endian, 44 bytes; 3 bytes padding keep the 64-bit fields naturally aligned):

 offset  0  int32   messageType    = 2
 offset  4  int64   orderId
 offset 12  int32   symbolId
 offset 16  int8    side           (0 = BUY, 1 = SELL)
 offset 17  int8[3] padding
 offset 20  int64   quantity
 offset 28  double  price          (NaN = market order)
 offset 36  int64   timestampNanos
 
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      Message type discriminator at offset 0.
      See Also:
    • BLOCK_LENGTH

      public static final int BLOCK_LENGTH
      Total encoded size in bytes.
      See Also:
  • Constructor Details

    • OrderFlyweight

      public OrderFlyweight()
  • Method Details

    • wrap

      public OrderFlyweight wrap(ByteBuffer buffer, int offset)
    • encode

      public OrderFlyweight encode(long orderId, int symbolId, Side side, long quantity, double price, long timestampNanos)
      Encodes a full order message at the wrap position (writes the type header).
    • orderId

      public long orderId()
    • symbolId

      public int symbolId()
    • side

      public Side side()
    • quantity

      public long quantity()
    • price

      public double price()
    • timestampNanos

      public long timestampNanos()