Class MarketDataProcessor

java.lang.Object
com.quantfinlib.marketdata.MarketDataProcessor
All Implemented Interfaces:
AutoCloseable

public final class MarketDataProcessor extends Object implements AutoCloseable
Real-Time Market Data Processing pipeline. Producers publish ticks into a lock-free ring buffer; a dedicated consumer thread dispatches to per-symbol and global listeners, maintains a latest-price cache, and can keep a Portfolio continuously marked to market.
  • Constructor Details

    • MarketDataProcessor

      public MarketDataProcessor(int bufferCapacity)
    • MarketDataProcessor

      public MarketDataProcessor()
  • Method Details

    • start

      public void start()
    • stop

      public void stop()
      Stops the consumer after draining any queued events.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • publish

      public boolean publish(MarketDataEvent event)
      Publishes a tick; single-producer. Returns false if the buffer was full (tick dropped).
    • subscribe

      public void subscribe(String symbol, MarketDataListener listener)
    • subscribeAll

      public void subscribeAll(MarketDataListener listener)
    • monitor

      public void monitor(Portfolio portfolio)
      Keeps the given portfolio's marks synchronized with incoming ticks.
    • latestPrice

      public Double latestPrice(String symbol)
    • processedCount

      public long processedCount()
    • droppedCount

      public long droppedCount()