A match can happen only when prices cross.
Implement crosses.
crosses
bid_price >= ask_price
ask_price <= bid_price
This is the central predicate used by limit orders, post-only orders, and IOC orders.