Class Layer1ApiDepthFreezer

All Implemented Interfaces:
AutoCloseable, Layer1ApiAdminListenable, Layer1ApiAdminListener, Layer1ApiAdminProvider, Layer1ApiDataListenable, Layer1ApiDataListener, Layer1ApiDataProvider, Layer1ApiInstrumentListenable, Layer1ApiInstrumentListener, Layer1ApiInstrumentProvider, Layer1ApiListener, Layer1ApiMboDataListenable, Layer1ApiMboDataListener, Layer1ApiProvider, Layer1ApiTradingListenable, Layer1ApiTradingListener, Layer1ApiTradingProvider, LayerApiListenable, Layer1ApiTimeSource

public class Layer1ApiDepthFreezer extends Layer1ApiRelay
  • Constructor Details

  • Method Details

    • onDepth

      public void onDepth(String alias, boolean isBid, int price, int size)
      Description copied from interface: Layer1ApiDataListener
      Depth data update. This is an absolute update, not a delta: the size becomes the total size at that price level. A size of 0 removes the level from the book. Bookmap sends the full initial book as a sequence of these calls after Layer1ApiInstrumentListener.onInstrumentAdded(java.lang.String, velox.api.layer1.data.InstrumentInfo).
      Specified by:
      onDepth in interface Layer1ApiDataListener
      Overrides:
      onDepth in class Layer1ApiUpstreamRelay
      Parameters:
      alias - instrument alias
      isBid - true if it is for bids, false for asks
      price - price where size changed, in ticks
      size - new total size at the level, 0 to remove the level
    • onUserMessage

      public void onUserMessage(Object data)
      Description copied from class: Layer1ApiUpstreamRelay
      Send an upstream event. Allows incorporating arbitrary functionality into protocol.

      This is the extension point of the upstream direction: any layer or the provider may emit an arbitrary object, and it travels towards the GUI through every layer above the origin. The counterpart for the downstream direction is Layer1ApiAdminProvider.sendUserMessage(Object).

      Contract for layers: inspect the message by type, act on the ones you understand and pass every other message on unchanged. Swallowing an unknown message breaks layers above you.

      Messages emitted by Bookmap use classes from velox.api.layer1.messages. Some of them are sent in response to a downstream request and arrive asynchronously, after the corresponding sendUserMessage call has already returned.

      For a SelectAccountMessage arriving after Layer1ApiUpstreamRelay.close(), selected index is set to 0 instead of dropping the message. Thus, provider thread blocked in SelectAccountMessage.get() does not hang forever.

      Specified by:
      onUserMessage in interface Layer1ApiAdminListener
      Overrides:
      onUserMessage in class Layer1ApiUpstreamRelay
      Parameters:
      data - Message content, never null