About this question

Self-Trade Prevention Engine

Medium · architecture & logic · Quant Developer interview question · c++, order-book, algorithms, finance

Self-Trade Prevention (STP) is a crucial risk management control in algorithmic trading designed to prevent an entity from executing trades against its own resting orders. By enforcing specific behaviors when self-matches occur, exchanges and trading firms ensure compliance with wash-trading regulations and avoid unnecessary transaction costs. Task Implement a matching engine that processes a stream of orders and enforces the "Cancel Aggressor" STP strategy within a Price-Time priority Limit Or