Class MatchEngine
java.lang.Object
eds.model.MatchEngine
- All Implemented Interfaces:
IMatchEngine
Matching engine responsible for executing incoming orders against the
current
OrderBook.
The engine follows standard price-time priority rules:
- Incoming orders are matched against the best available price.
- Execution price is always the price of the resting order.
- If an order cannot be fully matched, remaining behavior depends on the order type.
Post-matching behavior:
- Remaining
Order.Type.LIMITorders are added to the order book. - Remaining
Order.Type.MARKETorders are cancelled immediately.
-
Nested Class Summary
Nested classes/interfaces inherited from interface IMatchEngine
IMatchEngine.MatchResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionProcesses an incoming order and attempts to match it against the order book.
-
Constructor Details
-
MatchEngine
public MatchEngine()
-
-
Method Details
-
match
Processes an incoming order and attempts to match it against the order book.If matching counterpart orders exist, trades are generated until the order is filled or no further matches are possible.
- Specified by:
matchin interfaceIMatchEngine- Parameters:
incoming- the order entering the marketbook- the order book containing resting orderscurrentTime- the simulation timestamp of the event- Returns:
- a list of
Tradeobjects representing executed trades
-