Interface Layer1ApiMboDataListener

All Known Subinterfaces:
Layer1ApiAdapter, Layer1ApiListener, Layer1ApiMboDataAdapter, OnlineValueCalculatorAdapter, StrategyUpdateGenerator
All Known Implementing Classes:
Layer1ApiDepthFreezer, Layer1ApiInjectorRelay, Layer1ApiRelay, Layer1ApiStrategiesEchoMessagesLayer, Layer1ApiUpstreamRelay

@DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) public interface Layer1ApiMboDataListener
Listener for MBO (market-by-order) events: individual resting orders in the book rather than aggregated price levels.

Only instruments whose provider reports Layer1ApiProviderSupportedFeatures.mbo produce these events. Prices are in ticks, as in Layer1ApiDataListener. When a provider supplies MBO but no MBP data, Bookmap derives Layer1ApiDataListener.onDepth(java.lang.String, boolean, int, int) updates from these events, so an MBO instrument also receives depth callbacks.

Order ids are opaque strings unique within an instrument. Bookmap keeps a per-instrument book keyed by id. A onMboReplace or onMboCancel for an unknown id, or a onMboSend for an id that is already present, is a protocol violation.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onMboCancel(String alias, String orderId)
    An order left the book, whether canceled or fully executed.
    void
    onMboReplace(String alias, String orderId, int price, int size)
    An existing order changed its price and/or size.
    void
    onMboSend(String alias, String orderId, boolean isBid, int price, int size)
    A new order entered the book.
  • Method Details

    • onMboSend

      void onMboSend(String alias, String orderId, boolean isBid, int price, int size)
      A new order entered the book.
      Parameters:
      alias - instrument alias
      orderId - id of the order, unique within the instrument
      isBid - true for a bid, false for an ask
      price - price in ticks
      size - order size
    • onMboReplace

      void onMboReplace(String alias, String orderId, int price, int size)
      An existing order changed its price and/or size. The side never changes. Bookmap keeps the order's queue position only when the price is unchanged and the size decreased. Any other change moves the order to the back of the queue at the new price.
      Parameters:
      alias - instrument alias
      orderId - id of an order previously reported by onMboSend(String, String, boolean, int, int)
      price - new price in ticks (may equal the old one)
      size - new size (may equal the old one)
    • onMboCancel

      void onMboCancel(String alias, String orderId)
      An order left the book, whether canceled or fully executed. No further events for this id will follow unless it is re-sent.
      Parameters:
      alias - instrument alias
      orderId - id of the removed order