Interface IMatchEngine

All Known Implementing Classes:
MatchEngine

public interface IMatchEngine
Stateless domain service for order matching.

The matching engine accepts an incoming Order, attempts to match it against the current OrderBook, and produces zero or more Trade executions.

The implementation may modify the provided order book during the matching process and update the state of the involved orders.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Stores both results of one matching step: the trades that were created and the orders that became completed.
  • Method Summary

    Modifier and Type
    Method
    Description
    match(Order incoming, OrderBook book, double currentTime)
    Attempts to match an incoming order against the order book.
  • Method Details

    • match

      IMatchEngine.MatchResult match(Order incoming, OrderBook book, double currentTime)
      Attempts to match an incoming order against the order book.

      If compatible counterpart orders exist, one or more trades may be generated. The method returns all executions produced during the matching operation.

      Parameters:
      incoming - the incoming order to be matched
      book - the active order book used for matching
      currentTime - the simulation timestamp at which matching occurs
      Returns:
      trades and fully completed resting orders from the match