Are pre-order checks enforced when orders arrive at the same time?

Quick answer

Yes. Every order path takes a per-account lock and runs the rule checks inside the same database transaction that writes the order, counting open positions from the database in that transaction. Two orders arriving at the same instant are therefore processed one after the other, and limits hold, even across server instances.

Detailed answer

Concurrency is where many rule engines quietly fail.

The problem it solves

A naive engine checks a limit, then writes the order. If two orders arrive together, both checks see the same state, both pass, and the account ends up over the limit. For a maximum of 5 positions, a trader with 4 could open 6.

How PropExecutor handles it

  1. The order takes a lock specific to that account.
  2. Open positions are read from the database inside the transaction.
  3. The order gate checks every order-time rule.
  4. The order is written, or refused, in the same transaction.
  5. The lock is released.

Every path is covered

Market orders, placing and modifying pending orders, changing stops, and a resting order triggering all go through the same gate. A new order path cannot be added without it.

Why it matters to firms

Exposure and count limits such as maximum open positions, maximum total lots, hedging bans and orders per day hold exactly as written, so traders cannot exploit timing to exceed them.

PropExecutor team · Updated

All 30 questions in The PropExecutor rule engine · Every category