Trading.MatchingEngine (trading v0.1.0)
Order matching engine that handles order execution with price-time priority.
Summary
Functions
Adds a new symbol to the matching engine.
Cancels an order.
Gets market data for a symbol.
Gets the order book for a symbol.
Creates a new matching engine.
Registers a callback for events.
Submits an order to the matching engine.
Types
@type t() :: %Trading.MatchingEngine{ callbacks: map(), order_books: %{required(String.t()) => Trading.OrderBook.t()}, trade_id_counter: integer(), trades: [trade()] }
Functions
Adds a new symbol to the matching engine.
Cancels an order.
Gets market data for a symbol.
@spec get_order_book(t(), String.t()) :: {:ok, Trading.OrderBook.t()} | {:error, String.t()}
Gets the order book for a symbol.
@spec new() :: t()
Creates a new matching engine.
Registers a callback for events.
@spec submit_order(t(), Trading.Order.t()) :: {:ok, t(), [trade()]} | {:error, String.t()}
Submits an order to the matching engine.